How to enable ALTQ on igb driver FreeBSD

22 Mar

Views: 2528

Enable ALTQ on igb driverALTQ also known as alternative queuing, its a framework to manage queue on network interfaces. My FreeBSD box requires this function to enable and do QoS things such as limiting network bandwidth per customers based on their IP address or limiting the network bandwidth based on protocols.

I used HP DL 160 with intel I350 dual port network adapter (igb0 & igb1), running on FreeBSD 10.2-RELEASE-p14 amd64.  After configuring and enabling ALTQ on that interfaces, I try to load pf.conf and get the following error:

pfctl: igb0: driver does not support altq

In fact, the igb driver doesn’t support ALTQ and we need to patch some files to make it works. To enable ALTQ support on igb interfaces, please do the following steps:

1. Please visit the url below:

https://forums.freebsd.org/threads/48283/

As mentioned on that thread, we need to patch the igb driver using the patch on 3rd post or we can do it manually:

1. Edit /usr/src/sys/conf/options and add the following parameter to line 409:

$ sudo vim /usr/src/sys/conf/options
IGB_LEGACY_TX     opt_igb.h

2. Then edit if_igb.c and add the parameter below to line 34:

#include "opt_igb.h"

3. Edit if_igb.h and add the parameter below to line 37:

#include "opt_igb.h"

4. Enter into /usr/src/sys/architecture/conf, then copy GENERIC file to new file and add the ALTQ parameters decribed here or see below:

$ cd /usr/src/sys/amd64/conf/
$ sudo cp /usr/src/sys/amd64/conf/GENERIC /usr/src/sys/amd64/conf/KERNELCONF0316
$ sudo vim /usr/src/sys/amd64/conf/KERNELCONF0316

# Change ident to identify your kernel
ident KERNELCONF0316
#add the following into the file
# pf support
device mem
device pf
device pflog
device pfsync

# altq support
options ALTQ
options ALTQ_CBQ # Class Bases Queuing (CBQ)
options ALTQ_RED # Random Early Detection (RED)
options ALTQ_RIO # RED In/Out
options ALTQ_HFSC # Hierarchical Packet Scheduler (HFSC)
options ALTQ_PRIQ # Priority Queuing (PRIQ)
options ALTQ_NOPCC # Required for SMP build
# other optimizations

4. Enter to /usr/src, then compile, install the kernel and then reboot:

$ cd /usr/src
$ sudo make buildkernel KERNCONF=KERNELCONF0316
$ sudo make installkernel KERNCONF=KERNELCONF0316
$ sudo reboot

Verify new kernel installation use the following command:

sysctl kern.conftxt | grep ident
ident ROUTER200316

Done!, please test with your ALTQ rules on pf.conf

One Reply to “How to enable ALTQ on igb driver FreeBSD”

  1. Pingback: How-To: Enable ALTQ on igb driver on FreeBSD - FreeBSDNews.com

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.