Sunday, June 9, 2013

DHCP Configuration - Server CentOS - Client XP

ifcfg-eth0 file configuration
        In Linux server the IP address is statically assigned which will be 192.168.13.0/24. Here server will be capable to ping the client machine and that has to be same from the client machine which will be also able to ping the server machine which is running on CentOS. For that DHCP Server will be installed in the Linux server to assign the static IP address to their client machine.

DHCP Cofiguration – Dynadmic Host Configuration Protocol

DHCP is used to manage IP address centrally. It also protects the IP address centrally. It automatically assigns the IP address to the guest OS. Not only the IP address but it also assigns gateway, DNS server, Net BIOS and network information. DHCP assigns IP address statically as well as dynamically. Here we will assign a static IP address so that we can manage our IP address centrally.


There are some key points which need to be set before the installation of DHCP server.

Disable your Selinux.

Stop your IP tables and IP 6tables service.
Below 2 figures shows the IP address and other network information for eth0 and eth1. These files are lying in /etc/sysconfig/network-scripts/ folder/ you can go to that folder and give these commands to edit these files.


# nano ifcfg-eth0

ifcfg-eth0 file configuration

ifcfg-eth1 file configuration

# nano ifcfg-eth1
 
To install DHCP we will give following command.

# yum install dhcp

Once installation process gets completed we need to edit the dhcpd.conf file which is lying in the etc folder. We can edit it using any editor such as VI, vim or nano. We are using here nano.

Here is the explanation of all options which are going to be used for the configuration in our dhcpd.conf configuration file.
dhcpd.conf File



Option subnet mask | domain-name | domain-servers
It specifies the relevant subnet mask domain name and the name servers.
Range
Range decides the limit range of client machines which are allowed to interact with the host machine.
Maximum lease time

For how much time a client can hold IP which is given by server.
  


# nano  dhcpd.conf


Save above configuration by pressing Ctrl+x then it will ask you to save or not click on Y for yes and hit enter to come on command line window back.

To start  DHCP  server we will give following command.

# service  dhcpd start


Self-Critical Evaluation

By doing this service  DHCP d should start correctly but here we were getting error message due to file permission of any  DHCP  package's file. Below figure shows the error message.
dhcp service init error.

This is a simple permission error which is solved by following command.

# chown  dhcpd:dhcpd /var/run/dhcpd.pid
 
dhcpd error solved.


Configure Windows XP as Per Our DHCP Client

Keep your CentOS open and start other windows XP VM machine. After it gets opened, open command prompt and give these two commands.

C:\  ipconfig /release



It will release all the IP address that current system is having. After that give another command to ask our host as to give IP address to our client machine.

C:\  ipconfig /renew


Our host OS will assign  IP address to our client XP machine by  DHCP  server. We can also check the Local Area Network Connection Status to cross verify that this new address is assigned by  DHCP  server.


As we can see that DHCP server is assigning IP address to our client XP. Thus whole practical is carried away.

No comments:

Post a Comment