Add a DHCP server to OpenVoucher

Add a DHCP server to OpenVoucher

In a productive environment, you usually want to use DHCP for addressing your clients. The best way to do so is to install a DHCP server on OpenVoucher. This guide will tell you how to do this.

The DHCP service is not a part of OpenVoucher itself – but can be run on the same machine. An update, configuration change, reinstall or uninstall of OpenVoucher will never have any impact on the DHCP server we will now configure.

Note: You can also install the virtual appliance – it has a pre-installed DHCP server.

As in all documents, I assume you have OpenVoucher running on a recent Debian machine. If you use another OS, this guide might not work.

First, install a DHCP server on your machine using this command:

apt-get install dhcp3-server

When installing, an error message saying that the server couldn’t be started might be displayed. That’s because the configuration is incomplete. You can ignore this as this point.

Now edit the file /etc/dhcp/dhcpd.conf

Change your domain name and DNS servers in the config file to either external DNS servers or your internal name servers:

option domain-name "openvoucher.internal";
option domain-name-servers 8.8.8.8, 8.8.4.4;

Then scroll down a little bit, to the subnet declarations. Add a subnet for your guest network like this:

subnet 10.0.0.0 netmask 255.255.255.0 {
        range 10.0.0.100 10.0.0.199;
        option routers 10.0.0.1;
}

If you need more clients, you can modify the range. For a large environment, you could use a bigger subnet – keep in mind that this enlarges your broadcast domain! Another way could be to use multiple subnets and multiple OpenVoucher servers – they can use the same database.

When this is completed, we have to bind the server to our guest interface since this is the only net where we want the DHCP server to assign IP addresses. Open the file /etc/default/isc-dhcp-server

Define your guest interface like this:

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"

Now (re)start the DHCP server with the following command:

/etc/init.d/isc-dhcp-server restart

When running this command, you might get an error message saying the server couldn’t be stopped. That’s because it wasn’t running before. Don’t panic – if it starts now everything is fine.

Leave a Reply

Your email address will not be published. Required fields are marked *