MDI DHCP Server Implementation
MDI DHCP Server Implementation:
OS Version RHEL 6.1 (x86_64)
ROOT Password : ghL@#W01GS
To access DHCP server logged in on MDI mail server with public IP (credential is on login sheet):
tetra@tetra004:~$ ssh root@14.141.218.163 root@14.141.218.163's password: "Type password"
Then access DHCP server from mail server:
[root@mailserver ~]# ssh root@192.168.1.10 root@192.168.1.10's password: "Type password"
Set the hostname
[root@mdidhcpserver dhcp]# vim /etc/sysconfig/network
NETWORKING=yes HOSTNAME=mdidhcpserver
Set IP address
[root@mdidhcpserver dhcp]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0 HWADDR=ec:b1:d7:3c:10:07 NM_CONTROLLED=no ONBOOT=yes IPADDR=192.168.1.10 NETMASK=255.255.0.0 GATEWAY=192.168.12.25 TYPE=Ethernet BOOTPROTO=none IPV6INIT=no USERCTL=no
Restart network service:
[root@mdidhcpserver dhcp]# /etc/init.d/network restart [root@mdidhcpserver dhcp]# chkconfig network on [root@mdidhcpserver dhcp]# service NetworkManager stop [root@mdidhcpserver dhcp]# chkconfig NetworkManager off
Flush the firewall rules:
[root@mdidhcpserver dhcp]# iptables -F [root@mdidhcpserver dhcp]# service iptables stop [root@mdidhcpserver dhcp]# chkconfig iptables off
Disable the selinux:
[root@mdidhcpserver dhcp]# setenforce 0
Disable selinux from file:
[root@mdidhcpserver dhcp]# vim /etc/sysconfig/selinux
#This file controls the state of SELinux on the system. #SELINUX= can take one of these three values: #enforcing - SELinux security policy is enforced. #permissive - SELinux prints warnings instead of enforcing. #disabled - No SELinux policy is loaded. SELINUX=disabled #SELINUXTYPE= can take one of these two values: #targeted - Targeted processes are protected, #mls - Multi Level Security protection. SELINUXTYPE=targeted
Install DHCP package
rpm -ivh dhcp-4.1.1-19.P1.el6.x86_64.rpm
Configuring DHCP Server
Edit configuration file and make below entries
[root@mdidhcpserver dhcp]# vim /etc/dhcp/dhcpd.conf
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
log-facility local5;
authoritative;
subnet 192.168.0.0 netmask 255.255.0.0 {
range 192.168.13.1 192.168.24.254;
option domain-name-servers 192.168.10.83, 192.168.12.25;
option domain-name "mdi.ac.in";
option routers 192.168.12.25;
option broadcast-address 192.168.15.255;
default-lease-time 864000;
max-lease-time 1728000;
}
host DESKTOP-NH2KCIO { hardware ethernet B6:86:87:B2:FD:EC ; fixed-address 192.168.17.228;}
host DESKTOP-NH3KCIO { hardware ethernet B0:5A:DA:D6:9C:7D ; fixed-address 192.168.13.202;}
host DESKTOP-NH1KCIO {hardware ethernet 44:8a:5b:72:53:b2 ; fixed-address 192.168.12.215;}
host Tarun_mobile {hardware ethernet 98:0c:a5:18:bc:bd ;}
deny unknown-clients;
# Unknown clients get this pool.
subnet 169.254.0.0 netmask 255.255.0.0 {
option domain-name-servers ns1.example.com, ns2.example.com;
max-lease-time 300;
range 169.254.0.1 169.254.255.254;
allow unknown-clients;
}
include "/mac_address/NMP28_MAC_Responses.txt";
include "/mac_address/PGPM_2014.txt";
include "/mac_address/PGPM_2015.txt";
include "/mac_address/PGPIM_2014.txt";
include "/mac_address/PGPIM_2015.txt";
include "/mac_address/sap_2016.txt";
include "/mac_address/fpm_2015.txt";
include "/mac_address/Vendor.txt";
include "/mac_address/PGHR_2015.txt";
include "/mac_address/PGHR_2014.txt";
include "/mac_address/Faculty_Staff_Hostel_LH_LAB.txt";
include "/mac_address/PTPGPM.txt";
Assign the network interface:
[root@mdidhcpserver ~]# vim /etc/sysconfig/dhcpd
Make below entry:
DHCPDARGS=eth0
After configuration Restart DHCP Service
[root@mdidhcpserver ~]# /etc/init.d/dhcpd restart [root@mdidhcpserver ~]# chkconfig dhcpd on
Disable dhcpd6 service
[root@mdidhcpserver dhcp]# /etc/init.d/dhcpd6 stop [root@mdidhcpserver dhcp]# chkconfig dhcpd6 off
Enabling log
[root@mdidhcpserver ~]# vim /etc/rsyslog.conf
Make below entry in rsyslog.conf file
# Save DHCP log local5.* /var/log/dhcpd.log
Restart rsyslog service
[root@mdidhcpserver ~]# /etc/init.d/rsyslog status rsyslogd (pid 1349) is running... [root@mdidhcpserver ~]# /etc/init.d/rsyslog restart
Bind new MAC address.
[root@mdidhcpserver ~]# cd /mac_address [root@mdidhcpserver mac_address]# ls -l total 200 -rw-r--r-- 1 root root 42211 Mar 16 14:06 Faculty_Staff_Hostel_LH_LAB.txt -rw-r--r-- 1 root root 3236 Mar 16 12:24 fpm_2015.txt -rw-r--r-- 1 root root 17422 Mar 16 11:40 NMP28_MAC_Responses.txt -rw-r--r-- 1 root root 6483 Mar 9 14:27 PGHR_2014.txt -rw-r--r-- 1 root root 9809 Mar 9 14:21 PGHR_2015.txt -rw-r--r-- 1 root root 867 Mar 9 11:08 PGPIM_2014.txt -rw-r--r-- 1 root root 1501 Mar 9 11:02 PGPIM_2015.txt -rw-r--r-- 1 root root 32881 Mar 8 15:56 PGPM_2014.txt -rw-r--r-- 1 root root 50847 Mar 16 13:45 PGPM_2015.txt -rw-r--r-- 1 root root 4616 Mar 16 13:22 PTPGPM.txt -rw-r--r-- 1 root root 534 Mar 9 13:44 sap_2016.txt -rw-r--r-- 1 root root 122 Mar 12 17:31 Vendor.txt
For example if client requested to add MAC address in Faculty and Staff department then open below file and make entry as given formate.
[root@mdidhcpserver mac_address]# vim Faculty_Staff_Hostel_LH_LAB.txt
host 110_Kamal_Kishore-1 {hardware ethernet 00:16:E6:F6:E8:B1 ;}
host 111_Satya_Prakash-1 {hardware ethernet 00:16:E6:F6:BC:B7 ;}
host 111_Satya_Prakash-2 {hardware ethernet 14:f6:5a:ff:68:19 ;}
host 114_Ashok_Mishra-1 {hardware ethernet 00:16:E6:F6:BC:6E ;}
host 115_Tika_Bahadur-1 {hardware ethernet 00:01:6c:9d:33:d0 ;}
host 115_Tika_Bahadur-2 {hardware ethernet 78:45:C4:C3:DD:7C ;}
host 115_Tika_Bahadur-3 {hardware ethernet 9C:2A:70:C5:F2:F5 ;}
host 132_Charanjeet-4 {hardware ethernet 5C:F8:A1:97:11:D1 ;}
host 132_Charanjeet-5 {hardware ethernet 08:bd:45:66:03:3e ;}
host 135_Des_Raj-1 {hardware ethernet 8C:DC:D4:46:AF:9E ;}
host 136_Ashish_Kumar_Bose-1 {hardware ethernet 00:16:E6:21:4D:32 ;}
host 142_Lekh_Bahadur-1 {hardware ethernet 00:01:6C:9C:B1:12 ;}
host 143_R_P_Paswan-1 {hardware ethernet 00:01:6C:9C:A4:A1 ;}
Note: Duplicate entry will not be accepted you will get error while restarting dhcpd service.
Save file and restart dhcpd service:
[root@mdidhcpserver ~]# /etc/init.d/dhcpd restart