DHCP中继器
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DHCP中继器相关的知识,希望对你有一定的参考价值。
首先配置SWA,RTA,RTB的基础配置保证各个网段互通。
SWA配置:
[SWA]vlan 10
[SWA-vlan10]quit
[SWA]vlan 20
[SWA-vlan20]quit
[SWA]interface Vlan-interface 10
[SWA-Vlan-interface10]ip address 192.168.10.254 24
[SWA-Vlan-interface10]quit
[SWA]interface Vlan-interface 20
[SWA-Vlan-interface20]ip address 192.168.20.254 24
[SWA-Vlan-interface20]quit
[SWA]interface GigabitEthernet 1/0/2
[SWA-GigabitEthernet1/0/2]port link-type access
[SWA-GigabitEthernet1/0/2]port access vlan 10
[SWA-GigabitEthernet1/0/2]quit
[SWA]interface GigabitEthernet 1/0/3
[SWA-GigabitEthernet1/0/3]port link-type access
[SWA-GigabitEthernet1/0/3]port access vlan 20
[SWA-GigabitEthernet1/0/3]quit
[SWA]ip route-static 0.0.0.0 0.0.0.0 192.168.1.1
RTA配置:
[RTA]interface GigabitEthernet 0/0
[RTA-GigabitEthernet0/0]ip address 192.168.1.1 24
[RTA-GigabitEthernet0/0]quit
[RTA]interface GigabitEthernet 0/1
[RTA-GigabitEthernet0/1]ip address 192.168.2.1 24
[RTA-GigabitEthernet0/1]quit
[RTA]ip route-static 192.168.10.0 24 192.168.1.2
[RTA]ip route-static 192.168.20.0 24 192.168.1.2
RTB配置:
[RTB]interface GigabitEthernet 0/0
[RTB-GigabitEthernet0/0]ip address 192.168.2.2 24
[RTB-GigabitEthernet0/0]quit
[RTB]ip route-static 192.168.1.0 24 192.168.2.1
[RTB]ip route-static 192.168.10.0 24 192.168.2.1
[RTB]ip route-static 192.168.20.0 24 192.168.2.1
SWA配置dhcp中继:
[SWA]dhcp enable
[SWA]interface Vlan-interface 10
[SWA-Vlan-interface10]dhcp select relay //配置dhcp类型为中继
[SWA-Vlan-interface10]dhcp relay server-address 192.168.1.1 //指定中继的最终dhcp地址
[SWA-Vlan-interface10]quit
配置RTA地址池和dhcp服务:
[RTA]dhcp enable
[RTA]dhcp server ip-pool vlan10 //配置一个地址池
[RTA-dhcp-pool-vlan10]network 192.168.10.0 24
[RTA-dhcp-pool-vlan10]gateway-list 192.168.10.254
[RTA-dhcp-pool-vlan10]dns-list 202.96.134.133 114.114.114.114
[RTA-dhcp-pool-vlan10]expired day 0 hour 4
[RTA-dhcp-pool-vlan10]quit
[RTA-GigabitEthernet0/0]dhcp select server //最好添加这一步
测试如图:
H3C交换机DHCP中继配置
H3C交换机DHCP中继配置
H3C交换机DHCP中继配置
其实SWA的vlan10去找dhcp分配地址是使用vlan10的192.168.10.254这个地址代理获取地址,所以交换机会根192.168.10.254这个地址来分配192.168.10.0/24段的地址给设备。由此,可以理解路由器根据地址池配置的网关信息来准确分配地址。
配置vlan20的中继最终dhcp服务器是RTB
[SWA]interface Vlan-interface 20
[SWA-Vlan-interface20]dhcp select relay
[SWA-Vlan-interface20]dhcp relay server-address 192.168.2.2
[SWA-Vlan-interface20]quit
配置RTB:
[RTB]dhcp enable
[RTB]dhcp server ip-pool vlan20
[RTB-dhcp-pool-vlan20]network 192.168.20.0 24
[RTB-dhcp-pool-vlan20]gateway-list 192.168.20.254
[RTB-dhcp-pool-vlan20]dns-list 8.8.8.8
[RTB-dhcp-pool-vlan20]expired day 0 hour 4
[RTB-dhcp-pool-vlan20]quit
[RTB]interface GigabitEthernet 0/0
[RTB-GigabitEthernet0/0]dhcp select server //最好添加这一步
[RTB-GigabitEthernet0/0]quit
H3C交换机DHCP中继配置
以上是关于DHCP中继器的主要内容,如果未能解决你的问题,请参考以下文章