Friday, February 19, 2016

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

  • 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 192.168.0.0/16 out
  • Send outgoing traffic destined for anywhere other than the local network through the pipe
  • ipfw add 1000 pipe 1 ip from 192.168.1.226 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 192.168.1.226 to any

No comments:

Post a Comment