Step by Step for multipule interface dhcp server installation on ubuntu 12.04


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

 More details click
                            author by-rbgeek.wordpress

0 comments:

Post a Comment