实验目的:
1、掌握DHCP基本配置实现地址自动分配。
2、理解DHCP的实现原理。
实验拓扑:
实验步骤:
1、依据图中拓扑,在SW1上架设DHCP服务,为不同VLAN的主机动态提供IP信息,配置如下:
SW1(config)#ip dhcp pool VLAN10 SW1(dhcp-config)#network 192.168.10.0 255.255.255.0 SW1(dhcp-config)#default-router 192.168.10.254 SW1(dhcp-config)#dns-server 8.8.8.8 114.114.114.114 SW1(dhcp-config)#lease 7 SW1(dhcp-config)#exit SW1(config)#ip dhcp pool VLAN20 SW1(dhcp-config)#network 192.168.20.0 255.255.255.0 SW1(dhcp-config)#default-router 192.168.20.254 SW1(dhcp-config)#dns-server 8.8.8.8 114.114.114.114 SW1(dhcp-config)#lease 7 SW1(dhcp-config)#exit
2、在DHCP Client将IP设置为动态学习方式,如下:
PC1(config)#int f0/0 PC1(config-if)#ip address dhcp PC1(config-if)#exit PC2(config)#int f0/0 PC2(config-if)#ip address dhcp PC2(config-if)#exit
3、检测DHCP分配情况,如下:
①在DHCP Client上,查看地址是否学到
PC1#show ip int brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.10.1 YES DHCP up up PC2#show ip int brief Interface IP-Address OK? Method Status Protocol FastEthernet0/0 192.168.20.1 YES DHCP up up
从上面可以看出,PC的地址已经学到,并且地址学习方式从手工方式变成DHCP方式。
②在DHCP Server上,查看DHCP地址池分配情况
R1#show ip dhcp pool Pool VLAN10 : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 254 Leased addresses : 1 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased addresses 192.168.10.2 192.168.10.1 - 192.168.10.254 1 Pool VLAN20 : Utilization mark (high/low) : 100 / 0 Subnet size (first/next) : 0 / 0 Total addresses : 254 Leased addresses : 1 Pending event : none 1 subnet is currently in the pool : Current index IP address range Leased addresses 192.168.20.2 192.168.20.1 - 192.168.20.254 1
查看DHCP地址分配,以及主机情况,如下:
R1#show ip dhcp binding Bindings from all pools not associated with VRF: IP address Client-ID/ Lease expiration Type Hardware address/ User name 192.168.10.1 0063.6973.636f.2d63. Mar 08 2002 12:37 AM Automatic 6330.352e.3330.3963. 2e30.3030.302d.4661. 302f.30 192.168.20.1 0063.6973.636f.2d63. Mar 08 2002 12:38 AM Automatic 6330.362e.3330.3963. 2e30.3030.302d.4661. 302f.30
从上面结果可以看到,通过部署DHCP技术,可以使主机更方便接入网络。尤其是移动互联网时代,DHCP技术越发彰显其重要性,各种终端如PC、手机、平板需要更方便的连入网络,所以除了常规的企业网络,在现在的公共WIFI场所如公交、地铁、咖啡馆等,DHCP技术的应用也是非常广泛。此实验完成。
- 还没有人评论,欢迎说说您的想法!