【网络】【操作系统】DHCP服务介绍及架设

  • 1.DHCP介绍

工作过程

序号 DHCP客户端 DHCP服务器(192.168.1.10)
1

发现阶段:DHCP Discover

广播请求IP地址:

源IP:0.0.0.0

目的IP:255.255.255.255

 
2  

提供阶段:DHCP Offer,广播

源IP:192.168.1.10

目的IP:255.255.255.255

提供IP:192.168.1.188

3

选择阶段:选择第一个Offer信息,广播方式发送

DHCP Request

源IP:0.0.0.0

目的IP:255.255.255.255

租期:21600秒

 
4  

确认阶段:DHCP ACK,广播

源IP:192.168.1.10

目的IP:255.255.255.255

提供IP:192.168.1.188

5

续租,发送DHCP Request,单播

源IP:192.168.1.188

目的IP:192.168.1.10

 
6  

确认阶段:DHCP ACK,表明租约时间100%,单播

源IP:192.168.1.10

目的IP:192.168.1.188

     

 

  • 2.安装DHCP服务

(1)安装DHCP服务:yum -y install dhcp

(2)查看安装结果:rpm -qa | grep dhcp

[root@mail ~]# rpm -qa | grep dhcp
dhcp-libs-4.2.5-68.el7.centos.1.x86_64
dhcp-4.2.5-68.el7.centos.1.x86_64
dhcp-common-4.2.5-68.el7.centos.1.x86_64
(3)修改dhcpd.confi

/etc/dhcp/dhcpd.conf   //默认没有配置,配置示例在路径:/usr/share/doc/dhcp*/dhcpd.conf.example

ddns-update-style none;    //全局配置参数,dns服务更新类型为不更新
ignore client-updates;        //全局配置参数

# A slightly different configuration for an internal subnet.
subnet 10.100.0.0 netmask 255.255.255.0 {              
  range 10.100.0.100 10.100.0.200;
  option domain-name-servers 10.100.0.15;
  option domain-name "scitc.com";
  option routers 10.100.0.1;
  option broadcast-address 10.100.0.255;
  default-lease-time 600;
  max-lease-time 7200;
}

(4)重启DHCP服务并设置开机启动

重启DHCP服务:systemctl start dhcpd

设置DHCP开机启动:systemctl start dhcpd

 

 

你可能感兴趣的:(操作系统)