1. 实验目的
- 熟悉DHCP中继的应用场景
- 掌握DHCP中继的配置方法
2. 实验拓扑
DHCP中继配置实验拓扑如图所示:
3. 实验步骤
- IP地址的配置
AR1的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
Info: Information center is disabled.
[Huawei]sysname AR1
AR2的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
[Huawei]sysname AR2
[AR2]interface g0/0/1
[AR2-GigabitEthernet0/0/1]ip address 192.168.1.2 24
[AR2-GigabitEthernet0/0/1]quit
[AR2]interface g0/0/0
[AR2-GigabitEthernet0/0/0]ip address 23.1.1.2 24
[AR2-GigabitEthernet0/0/0]quit
AR3的配置
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]undo info-center enable
[Huawei]sysname AR3
[AR3]interface g0/0/1
[AR3-GigabitEthernet0/0/1]ip address 23.1.1.3 24
[AR3-GigabitEthernet0/0/1]quit
[AR3]ip route-static 192.168.1.0 24 23.1.1.2
- DHCP的配置
AR1的配置
[AR1]dhcp enable //开启DHCP服务
[AR1]interface g0/0/0 //进入到接口g0/0/0
[AR1-GigabitEthernet0/0/0]ip address dhcp-alloc //地址通过DHCP分配
[AR1-GigabitEthernet0/0/0]quit
AR2的配置
[AR2]dhcp enable //开启DHCP服务
[AR2]dhcp server group joinlabs //创建DHCP服务器组名字叫joinlabs
[AR2-dhcp-server-group-joinlabs]dhcp-server 23.1.1.3 //DHCP服务器成员
[AR2-dhcp-server-group-joinlabs]quit
[AR2]interface g0/0/1
[AR2-GigabitEthernet0/0/1]dhcp select relay //在接口下开启DHCP中继功能
[AR2-GigabitEthernet0/0/1]dhcp relay server-select joinlabs
[AR2-GigabitEthernet0/0/1]quit
AR3的配置
[AR3]dhcp enable
[AR3]ip pool joinlabs
[AR3-ip-pool-joinlabs]network 192.168.1.0 mask 24
[AR3-ip-pool-joinlabs]gateway-list 192.168.1.2
[AR3-ip-pool-joinlabs]quit
[AR3]interface g0/0/1
[AR3-GigabitEthernet0/0/1]dhcp select global
[AR3-GigabitEthernet0/0/1]quit
4. 实验调试
- 在AR1上查看接口IP地址
<AR1>display ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 2
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.1.254/24 up up
GigabitEthernet0/0/1 unassigned down down
通过以上输出可以看到,AR1的g0/0/0接口获得一个192.168.1.254的地址
- 让AR1重新获取IP地址,然后在AR2的g0/0/0抓包分析:
第一个包:Discover
Discover的包文结构如图所示:
第二个包:Offer
Offer的包文结构如图所示:
第三个包:Request
Request的包文结构如图所示:
第四个包:ACK
ACK的包文结构如图所示:
更多实验拓扑资料可领取(部分示意)
关注+点赞后,私信找我领取!