-
Plug an Ethernet cable into your computer. You'll need this for Internet connectivity while your Wi-Fi card is used to create a network.
-
Enable Internet Sharing in System Preferences.
-
Get your phone connected to the network you just created and make sure you can browse the web.
-
Ensure dummynet'd packets are still routed through the normal rules so masquerading works:
eleos@Nebula ~$ sudo sysctl -w net.inet.ip.fw.one_pass=0 net.inet.ip.fw.one_pass: 0 -> 0 -
Configure the low-quality pipe:
eleos@Nebula ~$ sudo ipfw pipe 1 config bw 14KB/s eleos@Nebula ~$ sudo ipfw pipe 1 config plr 0.01 -
Route packets into the pipe, but only for traffic over your AirPort interface:
eleos@Nebula ~$ sudo ipfw add 10 pipe 1 ip from any to any via en1 00010 pipe 1 ip from any to any via en1
Last active
October 12, 2015 11:08
-
-
Save pnc/4018033 to your computer and use it in GitHub Desktop.
Randomize link quality
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| srand(5) | |
| while true do | |
| plr = (rand * 100).round / 100.0 | |
| if plr > 0.8 | |
| plr = 1.0 | |
| end | |
| bw = rand(20) | |
| plr_command = "sudo ipfw pipe 1 config plr #{plr}" | |
| bw_command = "sudo ipfw pipe 1 config bw #{bw}KB/s" | |
| puts plr_command | |
| `#{plr_command}` | |
| puts bw_command | |
| `#{bw_command}` | |
| length = rand(45) | |
| puts "sleep #{length}" | |
| sleep length | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment