DHCP中继代理原理和配置

4.1 问题
1)配置DHCP中继,让客户端从DHCP服务器获取地址

2)客户机可以ping通R1

[DHCP]int g0/0/0
[DHCP-GigabitEthernet0/0/0]ip add 192.168.2.2 24 /设定接口ip
[DHCP-GigabitEthernet0/0/0]q
[DHCP]dhcp enable /启用DHCP
Info: The operation may take a few seconds. Please wait for a moment.done.
[DHCP]ip pool p1 /设置IP地址池P1
Info: It's successful to create an IP address pool.
[DHCP-ip-pool-p1]network 192.168.1.0 mask 24 /设置网段
[DHCP-ip-pool-p1]gateway-list 192.168.1.1 /设置网关地址
[DHCP-ip-pool-p1]dns-list 8.8.8.8 /设置dns
[DHCP-ip-pool-p1]q
[DHCP]int g0/0/0
[DHCP-GigabitEthernet0/0/0]dhcp select global /接口开启全局模式
[DHCP]ip route-static 192.168.1.0 24 192.168.2.1 /设置静态路由

[DHCPZJ]int g0/0/0
[DHCPZJ-GigabitEthernet0/0/0]ip add 192.168.1.1 24
[DHCPZJ-GigabitEthernet0/0/0]int g0/0/1
[DHCPZJ-GigabitEthernet0/0/1]ip add 192.168.2.1 24 /设置IP地址
[DHCPZJ-GigabitEthernet0/0/1]q
[DHCPZJ]dhcp enable /开启dhcp
Info: The operation may take a few seconds. Please wait for a moment.done.
[DHCPZJ]int g0/0/0
[DHCPZJ-GigabitEthernet0/0/0]dhcp select relay /网关地址接口开启中继模式
[DHCPZJ-GigabitEthernet0/0/0]dhcp relay server-ip 192.168.2.2 /指定服务器ip地址
[DHCPZJ-GigabitEthernet0/0/0]q

DHCP中继代理原理和配置_第1张图片

增加一个网段DHCP

[DHCP]int g0/0/1
[DHCP-GigabitEthernet0/0/1]ip add 192.168.3.1 24
[DHCP-GigabitEthernet0/0/1]q
[DHCP]ip pool p3
Info: It's successful to create an IP address pool.
[DHCP-ip-pool-p3]network 192.168.3.0 mask 24
[DHCP-ip-pool-p3]gateway-list 192.168.3.1
[DHCP-ip-pool-p3]lease day 3
[DHCP-ip-pool-p3]dns-list 3.3.3.3
[DHCP-ip-pool-p3]q
[DHCP]int g0/0/1
[DHCP-GigabitEthernet0/0/1]dhcp select global

DHCP中继代理原理和配置_第2张图片