Skip to main content

DHCP Server Installation and Configuration in RHEL 7.0

DHCP server : Dynamic host configuration protocol is a Client/Server protocol which will automatically provide IP address to the requested client. Not only IP address along with IP it will also provide subnet mask, default gateway and DNS IP address.
Every device on a TCP/IP-based network must have a unique unicast IP address to access the network and its resources. Without DHCP, IP addresses for new computers or computers that are moved from one subnet to another must be configured manually; IP addresses for computers that are removed from the network must be manually reclaimed.
With DHCP, this entire process is automated and managed centrally. The DHCP server maintains a pool of IP addresses and leases an address to any DHCP-enabled client when it starts up on the network. Because the IP addresses are dynamic (leased) rather than static (permanently assigned), addresses no longer in use are automatically returned to the pool for reallocation.
Server will provide a automatic IP address using DORA process which means, D=Discovery, O=Offer, R-REquest and A=Ackowledgement see detailed explanation about each one.
Discovery
The client broadcasts messages on the network subnet using the destination address 255.255.255.255 or the specific subnet broadcast address. A DHCP client may also request its last-known IP address. If the client remains connected to the same network, the server may grant the request. Otherwise, it depends whether the server is set up as authoritative or not.
Offer
DHCP server receives a DHCPDISCOVER message from a client, which is an IP address lease request, the server reserves an IP address for the client and makes a lease offer by sending a DHCPOFFER message to the client. This message contains the client’s MAC address, the IP address that the server is offering, the subnet mask, the lease duration, and the IP address of the DHCP server making the offer.
Request
In response to the DHCP offer, the client replies with a DHCP request, broadcast to the server, requesting the offered address. A client can receive DHCP offers from multiple servers, but it will accept only one DHCP offer. Based on required server identification option in the request and broadcast messaging, servers are informed whose offer the client has accepted. When other DHCP servers receive this message, they withdraw any offers that they might have made to the client and return the offered address to the pool of available addresses.
Acknowledgement
When the DHCP server receives the DHCPREQUEST message from the client, the configuration process enters its final phase. The acknowledgement phase involves sending a DHCPACK packet to the client. This packet includes the lease duration and any other configuration information that the client might have requested. At this point, the IP configuration process is completed.
while providing the permanent IP address to the DHCP client it will collect its MAC address. Provided IP address will not changed until DHCP server lease time expires.

DHCP Server Profile

Packages : dhcp*
Service : dhcpd.service
Config file : /etc/dhcp/dhcpd.conf
Port Number: 67
Installing DHCP server required packages using yum
[root@mail ~]# yum install dhcp*
[root@mail ~]# systemctl enable dhcpd.service
[root@mail ~]# systemctl start dhcpd.service
Job for dhcpd.service failed. See 'systemctl status dhcpd.service' and 'journalctl -xn' for details.
you may receive above error some times don’t worry after we set and DHCP server configuration restart service will work normally
[root@mail ~]# firewall-cmd --permanent --add-service=dhcp
success
[root@mail ~]# firewall-cmd --reload
success
Copy the sample configuration file to main configuration file. Default DHCP server configuration will not contain anything (empty)
[root@mail ~]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf 
cp: overwrite ‘/etc/dhcp/dhcpd.conf’? y
Now edit the config file /etc/dhcp/dhcpd.conf
[root@mail ~]# vim /etc/dhcp/dhcpd.conf
Default Line number 48
# A slightly different configuration for an internal subnet.
subnet 192.168.4.0 netmask 255.255.255.0 {
 range 192.168.4.10 192.168.4.254;
 option domain-name-servers ns1.internal.example.org;
 option domain-name "arkit.co.in";
 option routers 192.168.4.2;
 option broadcast-address 192.168.4.255;
 default-lease-time 600;
 max-lease-time 7200;
}
As shown in above we have to change subnet IP netmask IP add your domain name, routers IP (default gateway) broadcast IP address.
After that restart the dhcpd service
[root@mail ~]# systemctl restart dhcpd.service 
[root@mail ~]# systemctl status dhcpd.service 
dhcpd.service - DHCPv4 Server Daemon
 Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; disabled)
 Active: active (running) since Thu 2016-03-24 23:39:19 IST; 5s ago
dhcp server configuration verification we can verify the config file using below command, will tell you where is the configuration went wrong
[root@mail ~]# dhcpd configtest
that’s for server side.
Go to client and test whether your getting same series IP address.

Comments

Popular posts from this blog

Troubleshooting Tomcat using Catalina log

Troubleshooting Tomcat using Catalina log We can get the  catalina  logs in  $CATALINA_HOME/logs Here we'll have a  catalina.out We can see some huge info in that log file. If we want to what exactly happens since the start of tomcat then we need to log that into a new file. By default we have log rotation enabled on this logs. For now let us stop tomcat and nullify the catalina.out file and then start tomcat to have some new info in the catalina.out # service tomcat stop # cd $CATALINA_HOME/logs # :> catalina.out (or) cat /dev/null > catalina.out # ll catalina.out -rw-r----- 1 root root 0 Feb 18 16:19 catalina.out # service tomcat start # ll catalina.out -rw-r----- 1 root root 17341 Feb 18 16:21 catalina.out We can see the log being written after the start of tomcat. Now we can notice the instance giving some information about the starting of tomcat, about the configuration for the startup, path of the servlet instance for which the log is re...

Managing tomcat application

Tomcat is a servlet application which is ready to use after download. There is no need of installing this application. We can directly start or stop it from the bin directory.  So in such case we should go to the bin directory in the CATALINA_HOME or else we need to use the startup script along with its absolute path. And the same is needed to shut it down. We can use the below script to manage the tomcat application and we neither need to go to the CATALINA_HOME nor to use the absolute path. All we need to do is to change the permissions to make it executable and copy that to /sbin and /etc/init.d/ directories. If we copy this into /etc/init.d/ then also we need to mention the absolute path but we can easily memorize it as we know all the startup scripts exists there. But if we copy that into /sbin then there is absolutely no need of mentioning the path of the file. We can use this like below: # tomcat start|stop|restart|status #!/bin/bash # Author : Arjun S...

IPC (Incident, Problem & Change) Management with OTRS

IPC (Incident, Problem & Change) Management with OTRS 1.  Install OTRS 5 on CentOS 7 Download https://www.otrs.com/download-open-source-help-desk-software-otrs-free/ # rpm -i otrs-5.0.22-01.noarch.rpm Open  following link in browser to run the installer.  Replace  “otrs.itgratis.com” with your server IP/Hostname http:// otrs.itgratis.com /otrs/installer.pl Follow the instruction on the screen. You will find below screen for Database. Select  MySQL and click Next Here you need to Install MySQL-Community-Server before you click on Next. You can install Database on the same server or a separate server. Download https://dev.mysql.com/downloads/repo/yum/ Add MySQL Yum Repository # rpm -Uvh mysql57-community-release-el7-11.noarch.rpm Verifying MySQL Repo # yum repolist Install & Start MySQL Server #yum install mysql-community-server #systemctl start mysqld.service Find unamename & Password # grep 'temporary password...