Skip to content

Instantly share code, notes, and snippets.

@vanics
Forked from mefellows/tools.md
Created November 23, 2019 21:17
Show Gist options
  • Save vanics/feb98b7584cf9a2d710e72feaebb9fa2 to your computer and use it in GitHub Desktop.
Save vanics/feb98b7584cf9a2d710e72feaebb9fa2 to your computer and use it in GitHub Desktop.
Networking Tools - Cheat Sheet

*nix Networking Tools Cheat Sheet

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)

iptables (Linux)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment