Setting UP DHCP SERVER In Linux


DHCP, or Dynamic Host Configuration Protocol, allows an administrator to configure network settings for all clients on a central server.

The DHCP clients request an IP address and other network settings from the DHCP server on the network. The DHCP server in turn leases the client an IP address within a given range or leases the client an IP address based on the MAC address of the client’s network interface card (NIC). The information includes its IP address, along with the network’s name server, gateway, and proxy addresses, including the netmask.

Nothing has to be configured manually on the local system, except to specify the DHCP server it should get its network configuration from. If an IP address is assigned according to the MAC address of the client’s NIC, the same IP address can be leased to the client every time the client requests one. DHCP makes network administration easier and less prone to error.

Configure dhcp server

dhcp rpm is required to configure dhcp server. check it if not found then install

[root@manish~]# rpm -qa | grep dhcp

dhcp-3.0.5-7-el5

Now check dhcpd service in system service it should be on

[root@manish ~]# chkconfig –list | grep dhcp*

dhcpd       0:off   1:off   2:off   3:on   4:on   5:on   6:off

#setup

Select System service from list

[*]dhcpd

To assign IP to dhcp server

DHCP server have a static a ip address. First configure the ip address 192.168.0.254 with netmask of 255.255.255.0 on server.

Main configuration file of dhcp server is dhcpd.conf. This file located on /etc directory. If this file is not present there or you have corrupted this file, then copy new file first, if ask for overwrite press y

[root@manish ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

cp: overwrite  ‘/etc/dhcpd.conf’ ? y

now open /etc/dhcpd.conf and modify it so that it looks like

# Sample configuration file for ISC dhcpd

# option definitions common to all supported networks…
#option domain-name “example.org”;
subnet 172.18.0.0  netmask 255.255.255.0 {
range 172.18.0.36 172.18.0.45;
# option routers 172.18.0.1;
# option domain-name-servers 192.200.1.14;
allow bootp;
allow booting;
default-lease-time 600;
max-lease-time 7200;
}
group My server group{
next-server 172.18.0.6;
filename “pxelinux.0”;
host manish {
fixed-address   172.18.0.15;

option routers 172.18.0.1;

option domain-name-servers 172.18.0.20;

hardware ethernet   D4:3D:7E:1A:6E:6B;
}
}

now create a blank file use to store the allocated ip address information

[root@manish~]# touch /var/lib/dhcpd/dhcpd.leases

Now restart dhcpd service and on it with chkconfig commands

[root@manish~]# service dhcpd restart

Linux Client configuration

Client configuration is very easy and straightforward. All you need to do is set ip address to dynamic in the properties of lan card. In linux

#setup select network configuration from menu list

Select lan card and enter on ok

Select USE DHCP and enter on ok

Now click on quit and quit to come back on root prompt

Now restart the network service to obtain ip from dhcp server

 

About Alex Hunt

Hi All I am Manish Kumar Jha aka Alex Hunt. I am currently working in VMware Software India Pvt Ltd as Operations System Engineer (vCloud Air Operations). I have around 5 Years of IT experience and have exposure on VMware vSphere, vCloud Director, RHEL and modern data center technologies like Cisco UCS and Cisco Nexus 1000v and NSX. If you find any post informational to you please press like and share it across social media and leave your comments if you want to discuss further on any post. Disclaimer: All the information on this website is published in good faith and for general information purpose only. I don’t make any warranties about the completeness, reliability and accuracy of this information. Any action you take upon the information you find on this blog is strictly at your own risk. The Views and opinions published on this blog are my own and not the opinions of my employer or any of the vendors of the product discussed.
This entry was posted in Server Configuration. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s