DHCP Server with multiple subnet


In my previous post i have explained how to install and configure DHCP server on CentOS. Here we are going to configure the dhcp server with different/multiple subnet network.

Before making the changes in dhcp.conf file, take the backup for safer side.

[root@server.local ~]#cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf_bak20140708

The DHCP daemon listens on all network interfaces unless otherwise specified. The following /etc/sysconfig/dhcpd example specifies that the DHCP daemon listens on the eth0 and eth1 interfaces:

DHCPDARGS="eth0 eth1";

If a system has three network interfaces cards — eth0, eth1, and eth2 — and it is only desired that the DHCP daemon listens on eth0, then only specify eth0 in /etc/sysconfig/dhcpd:

DHCPDARGS="eth0";

For example, we have two network interfaces, eth0 listens to 192.168.1.0/24 network and eth1 listens to 192.168.2.0/24 network. Then the dhcp server configuraiton should be as below settings.

option domain-name "example.com";
option domain-name-servers 192.168.1.100, 192.168.1.200
default-lease-time 600;
max-lease-time 7200;

subnet 192.168.1.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
range 192.168.1.1 192.168.1.254;
}

subnet 192.168.2.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option routers 192.168.2.1;
range 192.168.2.1 192.168.2.254;
}

Leave a comment

Leave a comment