试验拓扑图:
clip_p_w_picpath006
       在这个实验中我们用R2充当远端DHCP服务器。区别于本地DHCP配置,在R0的F0/0接口上使用ip helper-address address命令来只想DHCP服务器R2。
       在实验之前一定要关掉虚拟机网络管理中将自带的DHCP关掉啊。
       具体配置如下:
1路由器R0上的配置:.
R0#sh run
Building configuration...
Current configuration:
!
!
interface FastEthernet0/0
ip address 172.16.1.254 255.255.255.0
ip helper-address 172.16.3.2
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 172.16.2.1 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 172.16.0.0
no auto-summary
!
2.路由器R1上的配置:
R1#sh run
Building configuration...
Current configuration:
!
hostname R1
!
interface FastEthernet0/0
ip address 172.16.2.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 172.16.3.1 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 172.16.0.0
no auto-summary
!
3.路由器R2上的配置:
R2#sh run
Building configuration...
Current configuration:
!
hostname R2
!
memory-size iomem 15  //15%的内存大小用于iomem
ip subnet-zero    //可以使用全0网段IP
!
ip dhcp pool tiger506 //配置DHCP地址池
network 172.16.1.0 255.255.255.0
default-router 172.16.1.254
dns-server 200.1.1.1
!
interface FastEthernet0/0
ip address 172.16.3.2 255.255.255.0
duplex auto
speed auto
!
router rip
version 2
network 172.16.0.0
no auto-summary
!
        路由器上已经配置好了,在主机网卡上我们选择“自动获取IP地址”:
clip_p_w_picpath007
       现在在“运行”中敲击cmd,进入后我们用ipconfig/all命令来查看ip配置信息;
用ipconfig/release来释放当前地址,用ipconfig/renew来获取新地址。
clip_p_w_picpath009
        大家看到主机已经获取了IP地址,留意一下它的MAC地址,下面的命令会让我们在远端的DHCP服务器上看到它。
在R2上运行命令 sh ip dhcp binding
clip_p_w_picpath011
        观察下在主机上运行ipconfig/release和ipconfig/renew时R2上的变化:
主机上运行ipconfig/release时,R2的debug ip dhcp event的反映
clip_p_w_picpath013
主机上运行ipconfig/renew时,R2的debug ip dhcp event的反映
clip_p_w_picpath015
        再给大家推荐几个R2上使用的DEBUG命令:
debug ip dhcp server linkage
debug ip dhcp server packet
       在R0上大家可以观察有哪些UDP包过来:
debug ip udp