拓扑
需求
1)所有部门中都使用了网关冗余技术,为了增强网关稳定性和冗余性
-配置VRRP
-SW5是VLAN10和VLAN20的Master ,是VLAN30的Backup
-SW6是VLAN10和VLAN20的Backup,是VLAN30的Master
2)交换机之间存在很多冗余链路,必须防止环路的发生,并且能够提高链路的利用率,要求每个部门的主机访问其他主机时,使用的都是最优的转发路径
-配置MSTP
-SW5是VLAN10和VLAN20的主根 ,是VLAN30的备根
-SW6是VLAN10和VLAN20的备根 ,是VLAN30的主根
3)VLAN30的主机通过SW6与DHCP服务器通信,获取IP地址,所以SW6也是DHCP中继
配置步骤
第一步:SW6基础配置
-创建vlan10/vlan20/vlan30/vlan50
-配置vlanif虚接口地址:192.168.xx.252
-与SW1/SW2/SW3互联的接口配置trunk,允许所有vlan通过
第二步:配置VRRP
-在SW5中将g0/0/6 口配置trunk 模式,允许所有vlan通过
-在vlanif虚接口下配置VRRP
-让SW5成为vlan10/vlan20的Master,vlan30的Backup
-让SW6成为vlan30的Master,vlan10/vlan20的Backup
第三步:配置MSTP
-在所有的交换机中配置MSTP
-让SW5成为vlan10/vlan20的主根,vlan30的备根
-让SW6成为vlan30的主根、vlan10/vlan20的备根
第四步:配置SW6-DHCP中继
-在系统视图下,开启dhcp 功能
-在每个vlanif虚接口下开启dhcp中继,并配置DHCP服务器IP:192.168.50.1
配置命令
第一步:SW6基础配置
SW6配置:
[Huawei]sys SW6
[SW6]port-group group-member g0/0/1 to g0/0/3 g0/0/6
[SW6-port-group]port link-type trunk
[SW6-port-group]port trunk allow-pass vlan all
[SW6-port-group]quit
[SW6]vlan batch 10 20 30 50
[SW6]int vlanif 10
[SW6-Vlanif10]ip address 192.168.10.252 24
[SW6-Vlanif10]int vlanif20
[SW6-Vlanif20]ip address 192.168.20.252 24
[SW6-Vlanif20]int vlanif30
[SW6-Vlanif30]ip address 192.168.30.252 24
第二步:配置VRRP
SW5配置:
[SW5]int g0/0/6
[SW5-GigabitEthernet0/0/6]port link-type trunk
[SW5-GigabitEthernet0/0/6]port trunk allow-pass vlan all
[SW5-GigabitEthernet0/0/6]quit
[SW5]int vlanif 10
[SW5-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[SW5-Vlanif10]vrrp vrid 10 priority 130
[SW5-Vlanif10]int vlanif 20
[SW5-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[SW5-Vlanif20]vrrp vrid 20 priority 130
[SW5-Vlanif20]int vlanif 30
[SW5-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
SW6配置:
[SW6]int vlanif 10
[SW6-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[SW6-Vlanif10]int vlanif 20
[SW6-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[SW6-Vlanif20]int vlanif 30
[SW6-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[SW6-Vlanif30]vrrp vrid 30 priority 130
第三步:配置MSTP
SW1配置:
[SW1]stp region-configuration
[SW1-mst-region] region-name ntd
[SW1-mst-region] instance 10 vlan 10
[SW1-mst-region] instance 20 vlan 20
[SW1-mst-region] instance 30 vlan 30
[SW1-mst-region] active region-configuration
[SW1-mst-region] quit
[SW1]int g0/0/3
[SW1-G0/0/3]port link-type trunk
[SW1-G0/0/3]port trunk allow-pass vlan all
SW2配置:
[SW2]stp region-configuration
[SW2-mst-region] region-name ntd
[SW2-mst-region] instance 10 vlan 10
[SW2-mst-region] instance 20 vlan 20
[SW2-mst-region] instance 30 vlan 30
[SW2-mst-region] active region-configuration
[SW2-mst-region] quit
[SW2]int g0/0/3
[SW2-G0/0/3]port link-type trunk
[SW2-G0/0/3]port trunk allow-pass vlan all
SW3配置:
[SW3]stp region-configuration
[SW3-mst-region] region-name ntd
[SW3-mst-region] instance 10 vlan 10
[SW3-mst-region] instance 20 vlan 20
[SW3-mst-region] instance 30 vlan 30
[SW3-mst-region] active region-configuration
[SW3-mst-region] quit
[SW3]int g0/0/3
[SW3-G0/0/3]port link-type trunk
[SW3-G0/0/3]port trunk allow-pass vlan all
SW5配置:
[SW5]stp region-configuration
[SW5-mst-region]region-name ntd
[SW5-mst-region]instance 10 vlan 10
[SW5-mst-region]instance 20 vlan 20
[SW5-mst-region]instance 30 vlan 30
[SW5-mst-region]active region-configuration
[SW5]stp instance 10 priority 4096
[SW5]stp instance 20 priority 4096
[SW5]stp instance 30 priority 8192
SW6配置:
[SW6]stp region-configuration
[SW6-mst-region] region-name ntd
[SW6-mst-region] instance 10 vlan 10
[SW6-mst-region] instance 20 vlan 20
[SW6-mst-region] instance 30 vlan 30
[SW6-mst-region] active region-configuration
[SW6]stp instance 10 priority 8192
[SW6]stp instance 20 priority 8192
[SW6]stp instance 30 priority 4096
第四步:配置SW6-DHCP中继
SW6配置:
[SW6]int vlanif 50
[SW6-Vlanif50]ip address 192.168.50.252 24
[SW6-Vlanif50]quit
[SW6]dhcp enable
[SW6]int vlanif 10
[SW6-Vlanif10]dhcp select relay
[SW6-Vlanif10]dhcp relay server-ip 192.168.50.1
[SW6-Vlanif10]int vlanif 20
[SW6-Vlanif20]dhcp select relay
[SW6-Vlanif20]dhcp relay server-ip 192.168.50.1
[SW6-Vlanif20]int vlanif30
[SW6-Vlanif30]dhcp select relay
[SW6-Vlanif30]dhcp relay server-ip 192.168.50.1
备注:sw1/sw2/sw3的g0/0/3口也做成trunk接口
备注:实现vlan50的最优转发路径:
1)vlan50的流量默认走实例0 -instance 0
2) 所以我们把SW5设置位instance 0 的主根, 把SW6设置位instance 0 的备根
就可以实现SW6 到DHCP服务器的数据转发路径是通过g0/0/6转发,实现最优转发路径
3)配置命令:
SW5:
stp instance 0 priority 4096
SW6:
stp instance 0 priority 8192
第五步:验证与测试:
vlan10/vlan20的PC 通过SW5-中继和DHCP,获取IP地址
vlan30的PC 通过SW6-中继和DHCP,获取IP地址
所有的PC都互联互通
验证命令:
<SW5>display stp instance 10
<SW5>display stp instance 20
<SW5>display stp instance 30
<SW5>display stp instance 0
<SW5>display vrrp brief
<SW6>display stp instance 10
<SW6>display stp instance 20
<SW6>display stp instance 30
<SW6>display stp instance 0
<SW6>display vrrp brief