Wednesday, March 12, 2008

DHCP Server on Linux

My environment: RH FC8, x86_64

Before get started, make sure you have the dhcp package installed:

dhcp-3.0.6-12.fc8

The main configuration file is in /etc/dhcpd.conf, here is mine:

ddns-update-style interim;
ignore client-updates;

subnet 192.168.2.0 netmask 255.255.255.0 {

option routers 192.168.2.254;
option subnet-mask 255.255.255.0;

option domain-name "pandaeatsbamboo.com";
option domain-name-servers 192.168.2.60;

next-server 192.168.2.50; #My CUCM address

range dynamic-bootp 192.168.2.101 192.168.2.200; #The dhcp pool range
default-lease-time 21600;
max-lease-time 43200;

host test-server {
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 12.34.56.78; # Fixed allocation based on MAC address
}


}


Restart your DHCP daemon:
/etc/init.d/dhcpd restart

Check the leases by viewing the lease file at /var/lib/dhcpd/dhcpd.leases, here is the sample file:

lease 192.168.2.197 {
starts 2 2008/03/11 08:00:21;
ends 2 2008/03/11 14:00:21;
tstp 2 2008/03/11 14:00:21;
binding state free;
hardware ethernet 00:19:d2:d0:10:01;
uid "\001\000\031\322\320\020\001";
}
lease 192.168.2.196 {
starts 2 2008/03/11 12:34:28;
ends 2 2008/03/11 18:34:28;
binding state active;
next binding state free;
hardware ethernet 00:02:78:90:e6:c5;
uid "\001\000\002x\220\346\305";
}




No comments: