实验拓扑:
使得左边DHCP客户端直接获取ip地址,右边的客户端通过中继后再获取ip地址;
相关配置:
DHCP服务器:
20网段:
DHCP_Server(config)#ip dhcp pool net_to_20
DHCP_Server(dhcp-config)#network 20.1.1.0 /24
DHCP_Server(dhcp-config)#default-router 20.1.1.1
DHCP_Server(dhcp-config)#dns-server 8.8.8.8
DHCP_Server(dhcp-config)#domain-name yf.com
30网段:
DHCP_Server(config)#ip dhcp pool net_to_30
DHCP_Server(dhcp-config)#default-router 30.1.1.2
DHCP_Server(dhcp-config)#dns-server 7.7.7.7
DHCP_Server(dhcp-config)#network 30.1.1.0 /24
DHCP_Server(dhcp-config)#domain-name hui.com
DHCP_Server(config)#ip dhcp excluded-address 20.1.1.1
DHCP_Server(config)#ip dhcp excluded-address 30.1.1.2
测试:
DHCP_Client(config)#inter f0/0
DHCP_Client(config-if)#ip address dhcp
DHCP_Client(config-if)#no shutdown
*Mar 1 00:20:48.591: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 20.1.1.2, mask 255.255.255.0, hostname DHCP_Client
DHCP中继测试:
DHCP_Server(config)#ip route 30.1.1.0 255.255.255.0 10.1.1.2
DHCP_Relay(config)#interface f0/1
DHCP_Relay(config-if)#ip helper-address 10.1.1.1
DHCP_Client2(config)#interface f0/0
DHCP_Client2(config-if)#no shutdown
DHCP_Client2(config-if)#ip add dhcp
*Mar 1 00:26:26.027: %DHCP-6-ADDRESS_ASSIGN: Interface FastEthernet0/0 assigned DHCP address 30.1.1.1, mask 255.255.255.0, hostname DHCP_Client2