Multiple Interface DHCP Server on Ubuntu 12.04LTS

Scenario:

Ubuntu dhcp server with 3 network cards (eth0,eth1,eth2), eth0 is connected to upstream server, in order to get the internet access, eth1 is connected to the 10.10.10.0/24 subnet and serve as dhcp server  while eth2 serve for 172.16.10.0/24 subnet.

Before configuring the dhcp server on Ubuntu, we shall check the ip address setting on our Ubuntu server:

sudo nano /etc/network/interfaces

Ubuntu as DHCP Server:

To install dhcp server, enter the following command at a terminal prompt:

sudo apt-get install isc-dhcp-server

We have more than one network card(s) in our Ubuntu server, so we need  to select the network card(s) on which our server will be listen for dhcp request. (By default, it listens on eth0 but we want to change it to eth1 and eth2).

We can change this by editing  /etc/default/isc-dhcp-server file:

sudo nano /etc/default/isc-dhcp-server

Change “eth0” to the interface(s) on which we want that our server will listen for dhcp request (In this case, it’s eth1 and eth2):

It’s always a good practice to make a backup copy of /etc/dhcp/dhcpd.conf file:

sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bak 

Now we will change the default configuration by editing /etc/dhcp/dhcpd.conf, I normally delete everything inside the file and manually add the configuration that suits my needs :-)

sudo nano /etc/dhcp/dhcpd.conf

Here is my dhcpd.conf file, you need to change it according to your needs:

ddns-update-style none;
authoritative;
log-facility local7;

subnet 10.10.10.0 netmask 255.255.255.0 {
 option routers 10.10.10.1;
 option subnet-mask 255.255.255.0;
 option broadcast-address 10.10.10.255;
 option domain-name-servers 10.10.10.1;
 option domain-name "eth1.lan";
 default-lease-time 600;
 max-lease-time 7200;
 range 10.10.10.10 10.10.10.100;
}

subnet 172.16.10.0 netmask 255.255.255.0 {
 option routers 172.16.10.1;
 option subnet-mask 255.255.255.0;
 option broadcast-address 172.16.10.255;
 option domain-name-servers 172.16.10.1;
 option domain-name "eth2.lan";
 default-lease-time 600;
 max-lease-time 7200;
 range 172.16.10.10 172.16.10.100;
}

Restart dhcp service using the following command:

sudo service isc-dhcp-server restart 

Confirm the IP Address on Windows 7 that connect to eth1:

Confirm the IP Address on Windows XP that connect to eth2:

To Check the DHCP Leases on Ubuntu Server:
sudo tail /var/lib/dhcp/dhcpd.leases

 

Hope this will help you!

 

Please Remember me in your prayers!


5 responses to “Multiple Interface DHCP Server on Ubuntu 12.04LTS

  1. Hassnat Ahmad December 27, 2012 at 12:51 am

    Thanks Arbab Bahi. i realy enjoyed your tutorial. main apko slute karta hoon.

  2. Otmane Tafiani February 5, 2013 at 11:38 pm

    Hello Friend I have a study DHCP
    How can solutions Ubuntu 12.04 lts
    server /client

  3. Jose June 18, 2013 at 5:47 pm

    how to configure Sun ray server and windows connector on ubuntu

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: