jump to navigation

Quick guide how to Setup a linux dhcp server (Centos 5.2) July 3, 2009

Posted by daakeung in Uncategorized.
Tags: , ,
2 comments

Quick guide to setup a linux DHCP server on a 10.0.0.0/24 network, you can modify this to work with your own design.

[root@dhcp ~]# yum install dhcp

[root@dhcp ~]cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp: overwrite `/etc/dhcpd.conf’? y
[root@dhcp ~]vi /etc/dhcpd.conf

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

subnet 10.0.0.0 netmask 255.255.255.0 {

# — default gateway
option routers                  10.0.0.1;
option subnet-mask              255.255.255.0;

#option nis-domain               “akeung.com”;
option domain-name              “akeung.com”;
option domain-name-servers      10.0.0.25;

option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
# — Selects point-to-point node (default is hybrid). Don’t change this unless
# — you understand Netbios very well
#       option netbios-node-type 2;

range dynamic-bootp 10.0.0.2 10.0.0.254;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
#        host ns {
#                next-server marvin.redhat.com;
#                hardware ethernet 12:34:56:78:AB:CD;
#                fixed-address 207.175.42.254;
#        }
}

Then esc, press

:wq

To start the service :

service dhcpd start

To enable it at bootup :

chkconfig dhcpd on

You can locate the leases at :

/var/lib/dhcpd/dhcpd.leases

Also, if a reservation is needed. Simply add the following to /etc/dhcpd.conf

host daakeung {
option host-name “daakeung.akeung.com”;
hardware ethernet 00:00:00:00:00:00;      #<—-Replace with Client’s MAC address
fixed-address 10.0.0.7;
}