edit kernel config
# cd /usr/src/sys/amd64/conf
# cp GENERIC GENERIC.netmap
# vi GENERIC.netmap
device netmap # add device of netmap
compile and install
# cd /usr/src
# make -j 30 buildkernel KERNCONF=GENERIC.netmap
# make installkernel KERNCONF=GENERIC.netmap
reboot
# reboot
confirm
# ls /dev/netmap
/dev/netmap
install git
# pkg install git-2.3.5
clone cell incubator form GitHUB
$ git clone https://github.com/SF-TAP/sf-incubator.git
build
$ cd sf-incubator/src
$ make
Before running, disable offload engine of NICs. The shell script included by the repository automatically disable offload engine of all NICs.
$ sudo ./misc/ifcap_disable.sh
Here, suppose that we have a following FreeBSD box, which has two 10 GbE (ix0 and ix1) and four 1 GbE (igb0, igb1, igb2 and igb3) interfaces. -r is a prefix of "RIGHT", and -t is a prefix of "TAP".
We can use qb-separator for traffic separating as follows. qb-separator must be executed with root privilege.
# ./qb-separator -r ix0 -t igb0,igb1,igb2,igb3
Here, qb-separator captures traffic from ix0, then separates and forwards it to igb[0-3]. Note that it separates traffic by using the hash values of IP addresses and port numbers of captured packets.
We can also use qb-tap for traffic mirroring as follows. qb-tap also must be executed with root privilege.
# ./qb-tap -r ix0 -t igb0,igb1,igb2,igb3
Here, qb-tap forwards all captured traffic from ix0 to igb[0-3].
We can use qb-separator or qb-tap as a simple software L2 bridge as follows.
# ./qb-separator -r ix0 -l ix1
-l is a prefix of "LEFT".
We use qb-separator as a L2 bridge and traffic separator as follows.
# ./qb-separator -r ix0 -l ix1 -t igb0,igb1,igb2,igb3
Here, qb-separator separates all traffic from ix0 and ix1 and forwards it to igb[0-3].
Similarly, qb-tap can work as a L2 bridge and traffic mirroring box as follows.
# ./qb-tap -r ix0 -l ix1 -t igb0,igb1,igb2,igb3
Here, all traffic caputured from ix0 and ix1 is forwarded to igb[0-3].