Setting up dhcrelay on OpenBSD

Posted by Tres Sat, 11 Nov 2006 06:26:00 GMT

We’ve got upwards of 30 vlans that we relay DHCP requests for. On FreeBSD, you just add your interfaces to a list in rc.conf and go. It makes things easy to maintain.

Out of the box OpenBSD has no analog to the shorthand method FreeBSD has, but it’s really easy to set up this functionality.

First we needed to create a bpf device for all the vlan interfaces that we were relaying across. To make bpf devices 10-30, use the following script:

#!/bin/sh
start=10
end=30

cd /dev
current=$start
while [ $current -le $end ]
do 
./MAKEDEV bpf${current} 
current=`expr $current + 1`
done


Then we set up /etc/rc.conf.local with the following:


dhcrelay_interfaces="vlan2 vlan3 vlan4 vlan5 vlan6 vlan7 vlan8 vlan9 vlan10 vlan11"

dhcrelay_servers="server1.blas.phemo.us server2.blas.phemo.us server3.blas.phemo.us"

Finally, we set up rc.local like this:

. /etc/rc.conf.local
if [ -n "${dhcrelay_interfaces}" ]
then
        for i in $dhcrelay_interfaces
        do
                echo -n " dhcrelay $i:"; /usr/sbin/dhcrelay -i $i $dhcrelay_servers
        done
fi

Now maintaining all those relay interfaces is as easy as it is in FreeBSD.

Posted in , ,  | Tags ,  | no comments

Comments

Comments are disabled