Limit bandwidth or upload on a Jail Plugin (my attempt)

By Zack - February 19, 2016

  • Unfortunately.. it still doesn't work :[

  • Enable dummynet and ipfw the FreeBSD traffic shaping module:
    • edit /boot/loader.conf and add 
    • ipfw_load="YES" 
    • dummynet_load="YES"
    • run kldload dummynet to load the modules or just restart the server.
  • Set up a pipe that restricts traffic 
    • ipfw pipe 1 config bw 20Mbit/s
    • ipfw queue 1 config pipe 1 mask dst-ip 0xffffffff
  • Adjust ip block as necessary to not throttle your own LAN 
    • ipfw add 100 queue 1 tcp from me 32400 to not out
  • Send outgoing traffic destined for anywhere other than the local network through the pipe
  • ipfw add 1000 pipe 1 ip from to any
  • Default allow all
    • ipfw add 65000 pass all from any to any
  •  systat -ifstat 1   is used to monitor bandwidth
  • You can see your pipes with ipfw pipe show (just as you see the regular rules with ipfw show.
  • ipfw pipe flush   This command will destroy all the pipes generated.

ipfw add 1 allow tcp from any to me 22 keep-state ipfw pipe 1 config bw 20Mbit/s ipfw add 1000 pipe 1 ip from to any

  • Share:

You Might Also Like