Howto Openbsd-Queuing v4.0.0
Howto Openbsd-Queuing v4.0.0
queuing
Abstract
Example for the conguration of an OpenBSD 5.5 based IPv4 net-
work router with bandwidth management. The given example addresses
a small home network with four users supporting multiple devices (e.g.,
notebooks, mobiles, tablets or desktops) per user. The Internet connec-
tion is implemented based on PPPoE dial-up line (e.g., ADSL).
Introduction
Disclaimer
The only one responsible for what you are doing is yourself. Simply following
this how-to will not exclude you from this responsibility. In other words: do not
blame me, if things go wrong.
Objective
This is not a beginners guide to OpenBSD, PF, networking, the Internet, or
computers in common. It addresses IT professionals.
Versions
New versions of this paper might be found on www.benjaminheckmann.de/
howto/.
1 OpenBSD Installation
Hardware Preparation
As minimal setup for a router you will need:
• Two Network Cards (one for the connection to the Internet, the other for
your local area network)
1
• One Hard Disk Drive with at least 5 GB capacity (recommended, to be
able to update your installation)
• CD-ROM drive
• The other stu (like a processor, memory, etc.; for further details see
www.openbsd.org/faq/faq1.html#Platforms)
Download the les install55.iso, src.tar.gz, and sys.tar.gz. Create a bootable
CD using the install55.iso le. For more details see www.openbsd.org/faq/
faq4.html#MkCD-ROM.
2
20. DUIDs: yes
21. Use whole disk: whole
22. Use (A)uto layout
23. Location of sets: cd
24. Which one: cd0
25. Pathname: 5.5/amd64
26. Select sets:
• bsd
• bsd.rd
• base55.tgz
• etc55.tgz
• comp55.tgz
• man55.tgz
• -game55.tgz
• -xbase55.tgz
• -xetc55.tgz
• -xshare55.tgz
• -xfont55.tgz
• -xserv55.tgz
• done
3
Conguration of Basic OS Services
To enable routing, activate IP forwarding in the kernel. Also, congure the
routing of GRE packages for VPNs using PPTP.
vi /etc/sysctl.conf
<...>
net.inet.gre.allow=1
net.inet.ip.forwarding=1
<...>
Congure the start of the rewall, nameserver, timeserver and ftp proxy.
vi /etc/rc.conf.local
named_ags=""
ntpd_ags=""
dhcpd_ags=""
ftpproxy_ags=""
sendmail_ags=NO
inetd=NO
check_quotas=NO
Deactivate sendmail's cronjob.
crontab -e
<...>
#*/30 * * * * /usr/sbin/sendmail <...>
<...>
The automatic startup of the relevant services is now congured. The next step
is the conguration of the specic service behavior.
vi /var/named/named.boot
vi /etc/resolv.conf
vi /etc/ntpd.conf
servers pool.ntp.org
4
rdate -ncv pool.ntp.org
In former how-tos the conguration of a DHCP server was detailed. This how-to
obtains this feature.
For the conguration of the PPPoE dial-up, the according authentication
data must be known.
vi /etc/hostname.pppoe0
vi /etc/hostname.<dev1>
up
##
## Interfaces
##
if_ext="pppoe0"
if_int="<dev0>"
##
## Bandwidth
##
# Total upstream
5
bnd_up_max="160Kb"
# NAS, Router, etc. := 1/6
bnd_up_default="26Kb"
# User One := 1/4
bnd_up_usr1="40Kb"
# User Two := 1/4
bnd_up_usr2="40Kb"
# User Three := 1/6
bnd_up_usr3="27Kb"
# User Four := 1/6
bnd_up_usr4="27Kb"
# Total downstream
bnd_dn_max="864Kb"
# NAS, Router, etc. := 1/6
bnd_dn_default="144Kb"
# User One := 1/4
bnd_dn_usr1="216Kb"
# User Two := 1/4
bnd_dn_usr2="216Kb"
# User Three := 1/6
bnd_dn_usr3="144Kb"
# User Four := 1/6
bnd_dn_usr4="144Kb"
##
## Privileged clients
##
# User One
table <usr1_direct> { 192.168.2.21, 192.168.2.41, 192.168.2.50
}
# User Two
table <usr2_direct> { 192.168.2.22, 192.168.2.42 }
# User Three
table <usr3_direct> { 192.168.2.12, 192.168.2.32 }
# User Four
table <usr4_direct> { 192.168.2.11, 192.168.2.31 }
##
## Privileged networks
##
6
##
## Default behavior
##
##
## Upstream queues
##
# Parent queue
queue up_parent on $if_ext bandwidth $bnd_up_max
# NAS, Router, etc.
queue up_default parent up_parent bandwidth $bnd_up_default
default
# User One
queue up_usr1 parent up_parent bandwidth $bnd_up_usr1
# User Two
queue up_usr2 parent up_parent bandwidth $bnd_up_usr2
# User Three
queue up_usr3 parent up_parent bandwidth $bnd_up_usr3
# User Four
queue up_usr4 parent up_parent bandwidth $bnd_up_usr4
##
## Downstream queues
##
# Parent queue
queue dn_parent on $if_int bandwidth $bnd_dn_max
# NAS, Router, etc.
queue dn_default parent dn_parent bandwidth $bnd_dn_default
default
# User One
queue dn_usr1 parent dn_parent bandwidth $bnd_dn_usr1
# User Two
queue dn_usr2 parent dn_parent bandwidth $bnd_dn_usr2
# User Three
queue dn_usr3 parent dn_parent bandwidth $bnd_dn_usr3
7
# User Four
queue dn_usr4 parent dn_parent bandwidth $bnd_dn_usr4
##
## NAT
##
##
## Normalize trac
##
##
## Default lter
##
##
## External interface ltering
##
8
##
## Internal interface ltering
##
##
## FTP proxy anchor
##
anchor "ftp-proxy/*"
##
## Deny spoong
##
#!/bin/csh
cd /usr/src
9
setenv CVS_CLIENT_PORT -1
setenv CVSROOT [email protected]:/cvs
cvs -d$CVSROOT up -rOPENBSD_5_5 -Pd
vi update-02_kernel.sh
#!/bin/csh
cd /usr/src/sys/arch/amd64/conf
/usr/sbin/cong GENERIC
cd /usr/src/sys/arch/amd64/compile/GENERIC
make clean && make depend && make
cd /usr/src/sys/arch/amd64/compile/GENERIC
make install
vi update-03_binaries.sh
#!/bin/csh
rm -rf /usr/obj/*
cd /usr/src
make obj
cd /usr/src/etc && env DESTDIR=/ make distrib-
dirs
cd /usr/src
make build
• systat queues
• pfctl -vvs rules
The rst two commands enable the monitoring of the queue usage. The last
command may help to sort out, why queuing might not work in your ruleset.
pftop does not seem to be able to work with the new queuing at the moment.
10