Next Previous Contents

4. DHCP-Relay

4.1 Installation

Download the source archive from http://www.strongsec.com/freeswan/dhcprelay/ then unpack, configure, compile and install it:


bash# tar -xvzf dhcprelay-X.Y.tar.gz
bash# cd dhcprelay-X.Y
bash# ./configure
bash# make
bash# make install

In case of troubles, the relay can be compiled in debugging mode by using the --enable-debug argument:
bash# ./configure --enable-debug
bash# make
bash# make install

The DHCP-Relay can be started, stopped, restarted and observed using the /etc/init.d/dhcprelay startup script as shown in the following example:
bash# /etc/init.d/dhcprelay start
Starting dhcprelay                      done
bash# /etc/init.d/dhcprelay status
Checking for service dhcprelay:         running
bash# /etc/init.d/dhcprelay stop
Shutting down dhcprelay                 done

To make the relay starting automatically on start-up, insert the service with the insserv or chkconfigtool:
bash# cd /etc/init.d/
bash# insserv dhcprelay

Be aware of the fact that FreeS/WAN must already be running when you start the relay and thus if you restart the FreeS/WAN service, the DHCP-Relay must be restarted, too!

4.2 Configuration

The DHCP-Server configuration file (/usr/local/etc/dhcprelay.conf) contains four items:

It follows an example for one ipsec device and a known DHCP-Server, according to the overview scenario.
# DHCP-Relay configuration file

# Logfile
LOGFILE="/var/log/dhcprelay.log"

# IPSec devices (comma separated list including NO spaces)
DEVICES="ipsec0"

# The device over which the DHCP-Server can be reached
SERVERDEVICE="eth1"

# Hostname or IP Address of the DHCP-Server
DHCPSERVER="192.168.0.10"

4.3 Running the DHCP-Server and the DHCP-Relay on the same Host

Since release 0.3.1 of the DHCP-Relay this can easily be done by binding both, the relay and the server to the loopback device. Therefore, set


SERVERDEVICE="lo"

in the DHCP-Relay configuration file and add lo to the list of target devices when starting the DHCP-Server. For example:
bash# dhcpd lo eth1

Further, the DHCP-Server must be able to reply to request comming over the lo device, which are not out of the dedicated subnet (127.0.0.0/8). For the ISC DHCP-Server the subnet setting must therefore be set to any:
...
subnet 0.0.0.0 netmask 0.0.0.0 {
...
}

See Section 5.2 for a complete configuration file.


Next Previous Contents