华三交换机路由器如何配置dhcp中继(dhcp relay)
具体环境如上图,内网有专门的dhcp服务器(此处用华三路由器代替)连接到核心交换机,核心交换机做dhcp中继,给下面用户分配ip。
一,dhcp服务端配置。
配置路由器接口地址
[R_DHCP]interface GigabitEthernet 02
[R_DHCP-GigabitEthernet0/2]ip address 192.168.0.1 24
使能dhcp
[R_DHCP]dhcp enable
配置dhcp地址池
[R_DHCP]dhcp server ip-pool vlan10
[R_DHCP-dhcp-pool-vlan10]network 192.168.10.0 mask 255.255.255.0 //配置dhcp网段
[R_DHCP-dhcp-pool-vlan10]gateway-list 192.168.10.1 //配置网关地址
[R_DHCP-dhcp-pool-vlan10]dns-list 192.168.10.1 //配置dns服务器地址
[R_DHCP-dhcp-pool-vlan10]expired day 0 hour 10 //配置租期
[R_DHCP-dhcp-pool-vlan10]forbidden-ip 192.168.10.1 //配置排除地址
配置dhcp服务器到内网192.168.10.0/24的静态路由,保证网络互通
[R_DHCP]ip route-static 192.168.10.0 24 192.168.0.2
二,配置交换机
配置交换机上联路由器接口和地址
[SW1]vlan 100
[SW1]interface vlan 100
[SW1-Vlan-interface100]ip add 192.168.0.2 24
[SW1-Vlan-interface100]quit
[SW1]interface GigabitEthernet 1/0/2
[SW1-GigabitEthernet1/0/2]port link-type access
[SW1-GigabitEthernet1/0/2]port access vlan 100
配置交换机下联内网的接口和地址
[SW1]vlan 10
[SW1-vlan10]interface GigabitEthernet 1/0/1
[SW1-GigabitEthernet1/0/1]port link-type access
[SW1-GigabitEthernet1/0/1]port access vlan 10
[SW1-GigabitEthernet1/0/1]qu
[SW1]interface vlan 10
[SW1-Vlan-interface10]ip address 192.168.10.1 24
[SW1-Vlan-interface10]dhcp select relay //设置接口工作在dhcp中继模式,(缺省接口工作在dhcp服务器模式下)
[SW1-Vlan-interface10]dhcp relay server-address 192.168.0.1 //设置接口中继的dhcp服务器的地址
使能dhcp
[SW1]dhcp enable
添加缺省静态路由,保证和dhcp服务器网络互通
[SW1]ip route-static 0.0.0.0 192.168.0.1
三,在dhcp服务器的路由器上查看dhcp分配情况
display dhcp server ip-in-use
使用命令查看dhcp服务器的统计信息。display dhcp server statistics
在中继交换机上查看中继统计信息,display dhcp relay statistics
……