Configuration of DHCP in Linux
DHCP Server Configuration
In DHCP
server the IP addresses are automatically assigned to the clients and these IP
addresses are known as Dynamic IP addresses
Service Profile
Package:dhcp
Server Daemon:dhcpd
Client
Daemon:dhclient
Configuration
File:/etc/dhcpd.conf
Port:67,68
Set
the system ip statically
IP:
192.168.0.254
NetMask: 255.255.255.0
Gateway: 192.168.0.254
[root@server~]# service network restart
[root@server~]# chkconfig network on
NetMask: 255.255.255.0
Gateway: 192.168.0.254
[root@server~]# service network restart
[root@server~]# chkconfig network on
[root@server~]# yum install dhcp* -y
[root@server~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf. Sample /etc/dhcpd.conf
[root@server~]# /etc/dhcpd.conf
subnet 192.168.0.0 netmask 255.255.255.0 { #Network ID
option routers 192.168.0.254; #Gateway or router IP
option subnet-mask 255.255.255.0;
option nis-domain "HIT.com"; #NIS Domain
option domain-name "HIT.com"; #DNS Domain
option domain-name-servers 182.2168.0.1; #DNS IP
[root@server~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf. Sample /etc/dhcpd.conf
[root@server~]# /etc/dhcpd.conf
subnet 192.168.0.0 netmask 255.255.255.0 { #Network ID
option routers 192.168.0.254; #Gateway or router IP
option subnet-mask 255.255.255.0;
option nis-domain "HIT.com"; #NIS Domain
option domain-name "HIT.com"; #DNS Domain
option domain-name-servers 182.2168.0.1; #DNS IP
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
option ntp-servers 172.24.0.254;
# option netbios-name-servers 192.168.1.1;
option netbios-name-servers 172.24.0.254; range dynamic-bootp 192.168.0.1 192.168.0.50;
default-lease-time 21600;
# option ntp-servers 192.168.1.1;
option ntp-servers 172.24.0.254;
# option netbios-name-servers 192.168.1.1;
option netbios-name-servers 172.24.0.254; range dynamic-bootp 192.168.0.1 192.168.0.50;
default-lease-time 21600;
max-lease-time
43200;
# we want the
nameserver to appear at a fixed address
host ns {
hardware ethernet aa:ab:56:78:AB:CD; #MAC Address
hardware ethernet aa:ab:56:78:AB:CD; #MAC Address
fixed-address
192.168.0.30;
}
host nfs { #reservation of IP
option host-name server1.HIT.com;
hardware ethernet aa:ab:56:78:AB:CD; #MAC Address
fixed-address 192.24.0.15;
}
}
host nfs { #reservation of IP
option host-name server1.HIT.com;
hardware ethernet aa:ab:56:78:AB:CD; #MAC Address
fixed-address 192.24.0.15;
}
}
:wq
[root@server~]# service dhcpd restart
[root@server~]# chkconfig dhcpd on
Client Side configuration
Method1
To get
IP from DHCP use netconfig command
[root@client~]#netconfig
Select
[*]Use dynamic IP configuration(BOOTP/DHCP)
[root@client~]#service network restart
[root@client~]#ifconfig
Method2
[root@client~]#dhclient -r #
-r for release
[root@client~]#dhclient
[root@client~]#ifconfig
Note:Remove the HOSTNAME entry from
/etc/sysconfig/network file in order to get the ip from DHCP server otherwise
this name will overridden whcich is coming from DHCP server
[root@client~]# vi /etc/sysconfig/network
NETWORKING=yes
:wq!
Leave Your Comment Below If You Like This Post
0 comments: