Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/logver.com/wp-includes/post-template.php on line 284

Warning: count(): Parameter must be an array or an object that implements Countable in /www/wwwroot/logver.com/wp-includes/post-template.php on line 284

H3C交换机DHCP中继配置

这里介绍H3C设备DHCP中继配置,华为交换机也是类似。 如图,SWA是核心交换机,只做DHCP中继,为了方便更好理解dhcp中继原理,这里测试RTA给交换机vlan10分配地址,RTB给交换机vlan20分配地址。

首先配置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 a ccess
[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 //最好添加这一步
其实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

资料来至互联网

人已赞赏
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧