DHCP server:
function:provide dynamic IP for each host in the LAN
mode of communication:
Client: Use 255.255.255.255 broadcast the same DHCP client to send DCHP discover package.
DHCP: After the packet data is received, a DHCP offer packet is sent back with DHCP to the client's ip,mask,network, gateway, etc., including the lease date.
Client: After receiving the message, send a DHCP request package for confirmation.
DHCP: After receiving the message, confirm again.
To install DHCP:
yum search dhcpd;
yum install dhcpd;
Check to see the files installed:
RPM-QL dhcpd
Edit/etc/dhcp/dhcpd.conf File
7 option Domain-name "localhost";设置本机的域名
8 option Domain-name-servers 192.168.29.0, 192.168.29.100;设置DNS服务器IP
9
ten default-lease-time;默认租约时间
One by one max-lease-time 7200;最大租约时间,以秒为单位
log-facility local7;
Subnet 192.168.29.0 netmask 255.255.255.0 {
}
+subnet NETWOEK NETMASK 子网掩码
Subnet 192.168.29.0 netmask 255.255.255.0 {
range 192.168.29.100 192.168.29.150;分配ip范围
option routers 192.168.29.2;网关
-- }
"host assigns IP to fixed host"
Redhatserver Host {host “字符创”
Hardware Ethernet 00:0c:29:4b:1b:6a; "Assign a host's Mac"
fixed-address 192.168.29.250;ip
option routers 192.168.29.3;网关
option Domain-name "you just";域名
option Domain-name-servers 114.114.114.114,8.8.8.8;DNS服务器地址
+ + }
where the configuration file takes effect from local to global.
Default-lease-time;
Max-lease-time 7200; can also be set up specifically for a host
Client:
Configuring the/etc/sysconfig/network-script/ifcfg-eth0 file
Bootproto=dhcp one of the
if the virtual machine is configured as a DHCP server, the appeal settings are the same, but:650) this.width=650; "src=" http://img.blog.csdn.net/20161201181256873 "alt=" here write a picture describing "title=" "style=" border:none; Color:rgb (51,51,51); font-family: ' Microsoft Yahei '; Font-size:14px;white-space:normal;background-color:rgb ( 255,255,255); "/>
and OK,
The client wants to set up the diagram as above.
The server starts the DHCP service:
Service DHCPD Start
or/ETC/RC.D/INIT.D/DHCPD start
client can get dynamic IP with normal power on
This article is from the "Lnsanellinux" blog, make sure to keep this source http://lnsane784.blog.51cto.com/1226518/1932801
LINUX-DHCP Server Setup