服务器端口号 67 客户端端口号 68 实验过程: 第一步:R1的DHCP R1(config)#service dhcp R1(config)#no ip dhcp conflict logging //关闭DHCP冲突记录功能 R1(config)#ip DHCP pool libo
//配置一个DHCP地址池,名称为libo R1(DHCP-config)#network 192.168.0.0 /24 //配置DHCP分配192.168.0.0/24这个网段的ip地址 R1(DHCP-config)#default-router 192.168.0.1 //配置默认网关地址 R1(DHCP-config)#dns-server 61.134.1.4 //配置DNS服务器地址61.134.1.4 R1(DHCP-config)#domain-namewww.woyaoxiuxi.com`` //配置域名为: R1(DHCP-config)#lease infinite //设置地址租期无限 R1(DHCP-config)#exit R1(config)#ip DHCP excluded-address 192.168.0.1 //配置DHCP不要分发192.168.0.1这个ip地址 R1(config)#end 第二步:配置R2和R3上的接口 2(config)#int f0/0 R2(config-if)#ip add dhcp R2(config-if)#no sh *Nov 26 21:04:54.943: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.0.2, mask 255.255.255.0, hostname R2 //R2的f0/0接口获得一个192.158.0.2的ip地址 R3(config)#int f0/0 R3(config-if)#ip add dhcp R3(config-if)#no sh *Nov 26 21:05:12.191: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 192.168.0.3, mask 255.255.255.0, hostname R3 //R3的f0/0接口获得一个192.168.0.3的地址 第三步:在R1上查看DHCP池的情况 R1#sh ip dhcp pool libo

Pool libo : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 254 Leased addresses : 2 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased addresses 192.168.0.4 192.168.0.1 - 192.168.0.254 2 //当前未被租用的, 地块范围 ,租用数 R1#sh ip dhcp binding Bindings from all pools not associated with VRF: IP address Client-ID/ Lease expiration Type Hardware address/ User name 192.168.0.2 0063.6973.636f.2d63. Infinite Automatic 6139.322e.3035.6563. 2e30.3030.302d.4661. 302f.30 192.168.0.3 0063.6973.636f.2d63. Infinite Automatic 6139.332e.3037.3830. 2e30.3030.302d.4661. 302f.30 第四步:show 一下,ping一下 R2#sh ip in b Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.0.2 YES DHCP up up
Serial2/0 unassigned YES unset administratively down down
Serial2/1 unassigned YES unset administratively down down

R2#ping 192.168.0.1

Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds: .!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 8/28/60 ms