Building the Network You Need with OpenBSD's PF: BSDCan, Ottawa May 6th, 2009
Prev |  | Next

# ALTQ - allocation by percentage

example swiped from unix.se:

    altq on $ext_if cbq bandwidth 640Kb queue { def, ftp, udp, \
        http, ssh, icmp }
        queue def bandwidth 18% cbq(default borrow red)
        queue ftp bandwidth 10% cbq(borrow red)
        queue udp bandwidth 30% cbq(borrow red)
        queue http bandwidth 20% cbq(borrow red)
        queue ssh bandwidth 20% cbq(borrow red) { ssh_interactive, \
              ssh_bulk }
              queue ssh_interactive priority 7 bandwidth 20%
              queue ssh_bulk priority 0 bandwidth 80%
        queue icmp bandwidth 2% cbq

    pass log quick on $ext_if proto tcp from any to any port ssh \
        flags S/SA keep state queue (ssh_bulk, ssh_interactive)
    pass in quick on $ext_if proto tcp from any to any port ftp \
        flags S/SA keep state queue ftp
    pass in quick on $ext_if proto tcp from any to any port www \
        flags S/SA keep state queue http
    pass out on $ext_if proto udp all keep state queue udp
    pass out on $ext_if proto icmp all keep state queue icmp