Here is a tutorial about building a FreeBSD router with traffic shaping using OpenBSD’s PF and ALTQ HFSC discipline.

Step 1. Compile Kernel with support for PF and ALTQ
————————————————————————-

cd /usr/src/sys/i386/conf/
cp GENERIC ROUTER

edit ROUTER file and add the following lines at the end of file:

# —————— add the following lines to ROUTER file ——————
# pf support
device mem
device pf
device pflog
device pfsync

# altq support
options ALTQ
options ALTQ_CBQ
options ALTQ_RED
options ALTQ_RIO
options ALTQ_HFSC
options ALTQ_PRIQ

# other optimizations
options HZ=1000
options DEVICE_POLLING
# ———————————- eof ———————————————-

Next, compile kernel with configurations from ROUTER file

cd /usr/src
make -j4 buildkernel KERNCONF=ROUTER
make installkernel KERNCONF=ROUTER

Reboot the machine and you have support in kernel for PF and ALTQ

Step 2 Create pf.conf file for your firewall and traffic shaper Read the rest of this entry »