Thursday 1 March 2012

Configuring DHCP server on Redhat 6 with Static and Dynamic IP

## Configuring DHCP server on Redhat 6

Before we begin, I assume that you have FQDN and Static IP for server machine. In this case, they are example.com and 192.168.0.254 respectively. Now, lets start with configuring our own DHCP server.



Step # 1: Install DHCP.

[root@server named]# yum install dhcp*

Step # 2: Configure DHCP.

[root@server ]# vi /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#
ddns-update-style none;
option domain-name "example.com";            --> Domain name for DHCP server
option domain-name-servers 192.168.0.254;  --> IP address of DHCP server
default-lease-time 21600;
max-lease-time 43200;

subnet 192.168.0.0 netmask 255.255.255.0
{
        option routers 192.168.0.4;                  --> Defining Gateway
        option subnet-mask 255.255.255.0;
        range 192.168.0.10 192.168.0.200;       --> IP Addresses Pool [Dynamic]
}

host test
{
hardware ethernet 00:12:3F:7F:2E:65;        --> this provides Static IP address to the client machine
fixed-address 192.168.0.14;                              with given Hardware Address (MAC) [Static]
}
[root@server ]#

Step # 3: Start DHCP.

[root@server ]# /etc/init.d/dhcpd start
Starting dhcpd:                                            [  OK  ]
[root@server ]#

That's it, you have now configured your own DHCP server. You can now go to your client machine and enter gateway whichever you have mentioned in DHCP configuration (in above case "192.168.0.4") and reload network service.

No comments:

Post a Comment