Re-compile your kernel for enabling the ALTQ options.
Check your maximum bandwidth, not only from your physical device capability,
dmesg | grep ^vioif dmesg | grep ^xennet
but also regarding your network path against some remote network (e.g. public). And in case there is a modem in between.
export PKG_PATH=ftp://ftp.ee.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/8.0/All/ #export PKG_PATH=ftp://ftp.fr.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/8.0/All/ export PASSIVE_FTP=yes ftp -a $PKG_PATH bye pkg_add -v iperf3 pkg_info | grep iperf3
sysctl -w net.inet.ip.forwarding=1 sysctl -w net.inet6.ip6.forwarding=1 sysctl -w net.inet.tcp.ecn.enable=1 cat >> /etc/sysctl.conf <<-EOF net.inet.ip.forwarding=1 net.inet6.ip6.forwarding=1 net.inet.tcp.ecn.enable=1 EOF
Start with a very low overall bandwidth just for testing. Here PRIQ for simplicity. ICMP and UDP priority, from 0
to 15
, the latter being the highest priority. Choose your protocol number carefully.
vi /etc/altq.conf #new file interface xennet0 bandwidth xxxK priq class priq xennet0 classicmp NULL priority 14 class priq xennet0 classudp NULL priority 13 class priq xennet0 classlow NULL priority 0 default filter xennet0 classicmp 0 0 0 0 1 filter xennet0 classudp 0 0 0 0 0 17 interface xennet1 bandwidth xxxK priq class priq xennet1 classicmp NULL priority 14 class priq xennet1 classudp NULL priority 13 class priq xennet1 classlow NULL priority 0 default filter xennet1 classicmp 0 0 0 0 1 filter xennet1 classudp 0 0 0 0 17
Now if you tag the packets from another router or yourself, using a conditioner, eventually get rid of the protocol number (write 0
instead) and add the tos
keyword and value to further classify your network stream. Beware about ToS vs DiffServ.
ICMP -- 1 TCP -- 6 UDP -- 17 tos -- 0x10 tos -- 0x60 tos -- 0x
The manual says that class name must be unique per interface, this means we can use same name for differents interfaces.
echo altqd=yes >> /etc/rc.conf /etc/rc.d/altqd start
TCP first,
iperf3 --time 0 -c x.x.x.x
meanwhile UDP,
iperf3 --time 0 -u -c x.x.x.x -p 5202
then ICMP,
ping -f x.x.x.x
You might need to change the UDP bandwidth manually, see the iperf3
manual. Also notice there are two more columns with the UDP output of iperf3
.
altqstat -i xennet0 altqstat -i xennet1
man altq.conf
tcpdump -i NETIF host ENDPOINT -vvv
man iperf3 / tos
, netperf, aria2man ping / flood