64.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

动态主机设置协议DHCP是一个局域网的网络协议,英文全称为Dynamic Host Configuration Protocol,其使用UDP协议工作,且主要有两个用途:用于内部网或网络服务供应商自动分配IP地址;给用户们用于内部网管理员作为对所有计算机作中央管理的手段。

服务架构

服务架构如下,左侧为客户端,右侧为服务端,中间为地址获取的全部流程:

64-1.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

服务流程

  1. 地址请求:客户端连接网络后,如果其未设置网络地址,则会广播一条请求信息,所有设备都会收到该条信息,非DHCP服务设备则会丢弃该条信息;

  2. 地址提供:DHCP服务端收到请求信息之后,会在地址池内查找一个未被使用的IP地址,并将其发给请求端;

  3. 地址选择:如果网内存在多个DHCP服务端,请求端会收到多条地址信息,它会选择最先收到那条地址,并广播一条选择的信息,声明已经使用了哪个服务端提供的哪一条地址;

  4. 地址确认:服务端收到请求端的选择信息后,先判断是否选择自己的,然后会将余下信息(包含掩码、网关等等)发送给请求端。

服务设置

Server2019默认不会安装DHCP,需要自行安装。点击仪表板上的添加角色和功能:

64-2.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

在添加角色和功能向导页面中点击下一步:

64-3.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

我们可以将服务安装在本机,也可以安装在远程服务器上,这里选择基于角色或基于功能的安装,然后点下一步:

64-4.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

选从服务器池中选择服务器,目前服务器池只有当前的服务器,然后点下一步:

64-5.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

在列表中选择角色,勾选DHCP服务器:

64-6.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

勾选后会弹出添加功能确认界面,它会安装除了服务之外的相关工具和组件:

64-7.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

弹出错误提示,需要给服务设置静态IP地址。毕竟要给别人分配地址,自己要先具备。我们可以现在设置,也可以安装好服务之后设置,然后点击继续:

64-8.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

经过上面的操作后,会发现DHCP服务器角色已经被勾选,然后点下一步:

64-9.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

接下来是功能选择,无需勾选任何,点下一步:

64-10.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

显示注意事项,无需理会,直接点下一步:

64-11.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

接下来是角色添加确认界面,点击安装即可:

64-12.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

稍等一会安装成功,点击关闭:

64-13.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

添加好角色后,又回到了初始界面,发现右上角弹出了警告信息需要处理:

64-14.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

无需任何修改,直接提交:

64-15.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

接下来会显示完成界面,点击关闭:

64-16.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

警告信息处理好后,点击下面的DHCP即可进入角色:

64-17.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

接下来我们开始配置DHCP,在右上角的工具处,选DHCP:

64-18.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

双击DHCP的内容下面的服务器,即可展开地址配置:

64-19.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

双击其中的IPv4,打开后会发现空空如也,我们需要添加一个IP作用域,作用域就是IP的地址池:

64-20.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

点击右侧更多操作:

64-21.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

点新建作用域:

64-22.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

在向导页面中点下一步:

64-23.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

接下来给作用域起一个名称,我们这里以dusays.com为例:

64-24.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

设置作用域分配的地址范围,依次输入IP起始地址与结束地址,余下的信息会自动生成:

64-25.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

接下来设置IP排除地址,排除地址是指不会被分配出去的范围,输入起始、结束之后点击添加:

64-26.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

添加后的效果:

64-27.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

设置租用时间,默认8天,无需调整:

64-28.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

DHCP除了分配地址外,还能分配默认网关、DNS等,如果稍后设置,则点击否。这里我们继续设置,选是即可:

64-29.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

设置默认网关,我们这里就填写192.168.1.1,然后点击添加:

64-30.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

添加后的效果:

64-31.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

设置域名称和DNS服务器界面根据实际情况填写,这里就不做修改了,直接点下一步:

64-32.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

WINS服务器界面不用修改,直接点下一步:

64-33.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

DHCP作用域是否立即激活,选是即可:

64-34.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

最后显示确认完成界面:

64-35.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10

客户测试

客户端测试图,大家可以看到DHCP服务器地址是192.168.1.1,获取的IP地址是192.168.1.100,因为2-99被排除:

64-36.jpg?x-oss-process=image/auto-orient,1/quality,q_90/watermark,image_bG9nby5wbmc_eC1vc3MtcHJvY2Vzcz1pbWFnZS9yZXNpemUsUF8yMA,g_center,t_50,x_10,y_10


 评论