Configuring MAC binding in DHCP Server

configuring MAC binding in DHCP server means permanently assigning static Internet protocol (IP) to the DHCP client using client MAC address.

We don’t want to give automatic IP address to servers, which are service providers. As a example if a NFS or Samba Server IP got changed automatically after a reboot are Network restart then all client who are acessing NFS and Samba shares can’t be accessible using old IP address each and every time we have to intimate to the employees if server IP address changed.  Not only about accessing the NFS and Samba shares some of the shares maybe used for hosting of application. Hot coded links in HTML/PHP intranets all things get effected due an single IP address change.

Our goal is to set static IP address to DHCP client (server) using DHCP server configuration, which is called as configuring MAC binding

first step is to configure DHCP server, please refer below link

DHCP server installation and configuration Step by Step Guide

Configuring MAC binding

after configuring the DHCP server restart the service and verify status

[root@mail ~]# systemctl restart dhcpd.service 
[root@mail ~]# systemctl status dhcpd.service

collect client machine MAC address simple trick, ping to all the clients which you want configure MAC binding then run # arp -a command

[root@mail ~]# ping 192.168.4.12
PING 192.168.4.12 (192.168.4.12) 56(84) bytes of data.
64 bytes from 192.168.4.12: icmp_seq=1 ttl=64 time=0.290 ms
^C
--- 192.168.4.12 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.290/0.323/0.356/0.033 ms
[root@mail ~]# arp -a
? (192.168.4.2) at 00:50e:56:ee:4e:e2 [ether] on eno16777736

Edit the configuration and change as required

[root@mail ~]# vim /etc/dhcp/dhcpd.conf

host nfsserver {
 hardware ethernet 00:50e:56:ee:4e:e2;
 fixed-address 192.168.4.12;
}

as shown above we have to add host short name MAC address and host IP address.

If you want to configure MAC binding for 50 servers then copy the same line and paste below 50 times and change there MAC address, hostname and IP address accordingly.

test configuration file before restarting DHCP server

[root@mail ~]# dhcpd configtest
Internet Systems Consortium DHCP Server 4.2.5
Copyright 2004-2013 Internet Systems Consortium.
All rights reserved.

restart DHCP service

[root@mail ~]# systemctl restart dhcpd.service 
[root@mail ~]# systemctl status dhcpd.service

That’s it restart network services in client and verify specified IP address it will get. If you restart 100 times also you will get same IP address from DHCP lease.

Please provide your valuable comments

Related Articles

DHCP Server Installation and configuration RHEL 7

PXE Boot Server Installation RHEL 7

Linux Lab at Home

Linux Video Tutorial

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

Your email address will not be published. Required fields are marked *