Jump to content

MDI DHCP Server Implementation

From TetraWiki
Revision as of 08:16, 16 March 2016 by Brijesh (talk | contribs)


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-NH1KCIO {
#  hardware ethernet 44:8a:5b:72:53:b2;
#  fixed-address 192.168.12.215;
#}
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