<2017-10-26 Thu>

Here some dummynet usages on Mac.

Configure Bandwidth

  1. Create pipe with bandwidth, redirect packets to the pipe

    sudo dnctl pipe 1 config bw 1Kbit/s
    echo "dummynet out proto tcp from any to wordpress.org pipe 1" |sudo pfctl -f -
    
  2. Enable if not

    sudo pfctl -e
    
  3. do download and watch the speed

    wget -O /dev/null wordpress.org/latest.zip #=>
    ... 3.02KB/s ...
    
  4. Adjust the bandwitch on fly and watch the speed

    sudo dnctl pipe 1 config bw 10Kbit/s #=>
    ... 61.0KB/s ...
    
  5. Reset and disable

    sudo pfctl -f /etc/pf.conf
    sudo pfctl -d