DHCP Server on Centos

DHCP – Dynamic Host Configuration Protocol

For any administrator it is mandatory to have service like dhcp for seamless network operation, even though your network is of only few computers.

It helps your centrally manage dns servers & ip pool.

Many admins avoids using dhcp as ip keeps on changing if computer is out of network for a day or two. In that case you can have ip assigned for MAC address or have longer lease for ip address. By default max lease time is12 hrs. You can increase default & max lease time. This will enable dhcp server to retain ip for specific host even if it is out of network.

Configuring dhcp service.
Install dhcp service

yum install dhcp

copy sample config & make suitable changes for your network.

cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

Below is the configuration I used for dhcp service. (I changed only ip address / network for my LAN)

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

subnet 192.168.222.0 netmask 255.255.255.0 {

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

option nis-domain               “linuxreaders.com”;
option domain-name              “linuxreaders.com”;
option domain-name-servers      192.168.222.1;

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 192.168.222.128 192.168.222.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;
}
}

Start dhcp service.

service dhcpd start

Now you can switch your client computers on dhcp.

For more details on dhcp, you can refer to following link.

For reference

Related posts:

  1. Squid Proxy
  2. NTP Server on CentOS
  3. OCSNG Server Setup on CentOS
  4. SSH / SCP key authentication

Subscribe to LinuxReaders

rss twitter mail google buzz facbook stumble digg

3 Comments

  1. sajani says:

    I have done all the above settings but when i try to start dhcp service, a failure notice is given. Can some one help me out pls

  2. pl share error log & dhcpd.conf

  3. [...] to your existing or new /etc/dhcpd.conf. Note: xxx.xxx.xxx.xxx is the IP address of your PXE serverHow to configure dhcp server on centosallow booting; allow bootp; option option-128 code 128 = string; option option-129 code 129 = text; [...]

Leave a Reply