DHCP:动态主机设置协议(Dynamic Host Configuration Protocol)是一个局域网的网络协议,使用
UDP协议 工作,主要有两个用途:用于内部网或网络服务供应商自动分配IP地址;给用户用于内部网管
理员作为对所有计算 机作中央管理的手段。
DHCP实验
DHCP配置
拓扑
路由器配置
================R1 配置dhcp服务端==============R1#conf tR1(config)#int e0/0R1(config-if)#ip add 192.168.1.1 255.255.255.0R1(config-if)#no shR1(config-if)#ip dhcp pool cisco # 创建一个地址池R1(dhcp-config)#network 192.168.1.0 /24 # 在地址池中放一个网段R1(dhcp-config)#default-router 192.168.1.1 # 设置默认网关R1(dhcp-config)#dns-server 114.114.114.114 114.114.115.115 # 设置主备DNSR1(dhcp-config)#lease 1 # 租约时间改为1天R1(dhcp-config)#exitR1(config)#ip dhcp excluded-address 192.168.1.1 # 设置排除地址================R2 R3 配置dhcp客户端==============R3#conf tEnter configuration commands, one per line. End with CNTL/Z.R3(config)#int e0/0R3(config-if)#ip add dhcpR3(config-if)#no shR2#conf tEnter configuration commands, one per line. End with CNTL/Z.R2(config)#int e0/0R2(config-if)#ip add dhcpR2(config-if)#no sh
检查IP分配情况
R1#sh ip dhcp bindingBindings from all pools not associated with VRF:IP address Client-ID/ Lease expiration TypeHardware address/User name192.168.1.2 0063.6973.636f.2d61. Feb 02 2021 04:01 PM Automatic6162.622e.6363.3030.2e32.3030.302d.4574.302f.30192.168.1.3 0063.6973.636f.2d61. Feb 02 2021 04:01 PM Automatic6162.622e.6363.3030.2e33.3030.302d.4574.302f.30
DHCP工作过程
