-
-
Save vanics/feb98b7584cf9a2d710e72feaebb9fa2 to your computer and use it in GitHub Desktop.
Revisions
-
mefellows revised this gist
Aug 26, 2015 . 1 changed file with 29 additions and 14 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,6 @@ # *nix Networking Tools Cheat Sheet ##<a name="perf"></a> Network Performance ### <a name="iperf"></a> iperf (all) @@ -35,6 +22,13 @@ You should get a throughput in (GMk)bits/sec ###<a name="pfctl"></a> pfctl + dnctl (MacOSX Yosemite+) #### List Rules ``` sudo dnctl list sudo pfctl -sa -v -v ``` ####<a name="shape"></a> Shape traffic ``` (cat /etc/pf.conf && echo "dummynet-anchor \"mop\"" && echo "anchor \"mop\"") | sudo pfctl -f - @@ -58,8 +52,29 @@ iperf -c localhost -t 5 ####<a name="delay"></a> Delay Delays packet transmission by 20ms: ``` sudo dnctl pipe 1 config delay 20 ``` ####<a name="packet"></a> Simulate Packet Loss Drop 35% of packets on the pipe: ``` sudo dnctl pipe 1 config plr 0.35 ``` #### No error ``` sudo dnctl pipe 1 config plr .35 sudo dnctl pipe 1 config noerror ``` Don't report the error back to the sender - simulate loss at a remote router ####<a name="undo"></a> Undo To undo whatever mess you've created back to the default... -
mefellows revised this gist
Aug 26, 2015 . 1 changed file with 47 additions and 29 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,45 @@ # *nix Networking Tools Cheat Sheet <!-- MarkdownTOC --> - Network Performance - iperf (all) - a name="firewall"> Packet and Firewall filtering - a name="pfctl"> pfctl + dnctl (MacOSX Yosemite+) - a name="ipfw"> ipfw (FreeBSD/OpenBSD) - a name="iptables"> iptables (Linux) - a name="links"> Links <!-- /MarkdownTOC --> ## <a name="perf"></a> Network Performance ### <a name="iperf"></a> iperf (all) Setup the server: ``` iperf -s ``` Run the client against the server for 7 seconds: ``` iperf -c localhost -t 7 ``` You should get a throughput in (GMk)bits/sec ##<a name="firewall"></a> Packet and Firewall filtering ###<a name="pfctl"></a> pfctl + dnctl (MacOSX Yosemite+) ####<a name="shape"></a> Shape traffic ``` (cat /etc/pf.conf && echo "dummynet-anchor \"mop\"" && echo "anchor \"mop\"") | sudo pfctl -f - echo "dummynet in quick proto tcp from any to any port 5001 pipe 1" | sudo pfctl -a mop -f - sudo dnctl pipe 1 config bw 1Mbit/s ``` Observe traffic is now shaped to 100Mbit/s: @@ -23,41 +48,34 @@ Observe traffic is now shaped to 100Mbit/s: iperf -s -D # Run as Daemon (-D) iperf -c localhost -t 5 ``` > ------------------------------------------------------------ > Client connecting to localhost, TCP port 5001 > TCP window size: 144 KByte (default) > ------------------------------------------------------------ > [ 5] local 127.0.0.1 port 59573 connected with 127.0.0.1 port 5001 > [ ID] Interval Transfer Bandwidth > [ 5] 0.0- 5.0 sec 60.5 MBytes 101 Mbits/sec ####<a name="delay"></a> Delay ####<a name="packet"></a> Simulate Packet Loss ####<a name="undo"></a> Undo To undo whatever mess you've created back to the default... ``` sudo dnctl -q flush sudo pfctl -f /etc/pf.conf ``` ###<a name="ipfw"></a> ipfw (FreeBSD/OpenBSD) ###<a name="iptables"></a> iptables (Linux) ##<a name="links"></a> Links * https://gist.github.com/tracphil/4353170 * -
mefellows revised this gist
Aug 26, 2015 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -23,11 +23,12 @@ Observe traffic is now shaped to 100Mbit/s: iperf -s -D # Run as Daemon (-D) iperf -c localhost -t 5 ``` > ------------------------------------------------------------ > Client connecting to localhost, TCP port 5001 > TCP window size: 144 KByte (default) > ------------------------------------------------------------ > [ 5] local 127.0.0.1 port 59573 connected with 127.0.0.1 port 5001 > [ ID] Interval Transfer Bandwidth > [ 5] 0.0- 5.0 sec 60.5 MBytes 101 Mbits/sec -
mefellows revised this gist
Aug 26, 2015 . 1 changed file with 50 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,34 @@ ## Packet and Firewall filtering ### pfctl + dnctl (MacOSX Yosemite+) ``` (cat /etc/pf.conf && echo "dummynet-anchor \"mop\"" && echo "anchor \"mop\"") | sudo pfctl -f - echo "dummynet in quick proto tcp from any to any port 5001 pipe 1" | sudo pfctl -a mop -f - sudo dnctl pipe 1 config bw 1Mbit/s ``` To undo... ``` sudo dnctl -q flush sudo pfctl -f /etc/pf.conf ``` Observe traffic is now shaped to 100Mbit/s: ``` iperf -s -D # Run as Daemon (-D) iperf -c localhost -t 5 ``` > ------------------------------------------------------------ > Client connecting to localhost, TCP port 5001 > TCP window size: 144 KByte (default) > ------------------------------------------------------------ > [ 5] local 127.0.0.1 port 59573 connected with 127.0.0.1 port 5001 > [ ID] Interval Transfer Bandwidth > [ 5] 0.0- 5.0 sec 60.5 MBytes 101 Mbits/sec ### ipfw (FreeBSD/OpenBSD) @@ -11,3 +38,25 @@ ## Network Performance ### iperf (all) I perf Setup the server: ``` iperf -s ``` Run the client against the server for 7 seconds: ``` iperf -c localhost -t 7 ``` You should get a throughput in (GMk)bits/sec ## Links * https://gist.github.com/tracphil/4353170 * -
mefellows created this gist
Aug 26, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ # *nix Networking Tools Cheat Sheet ## Packet and Firewall filtering ### pfctl (MacOSX Yosemite+) ### ipfw (FreeBSD/OpenBSD) ### iptables (Linux) ## Network Performance ### iperf (all)