实验拓扑(VLAN --- MSTP ---VRRP )
VLAN 101
VLAN 102
SW1:IP 101 :101.1.1.253 /24
IP 102 :102.1.1.253 /24
SW2:IP 101 :101.1.1.254 /24
IP 102 :102.1.1.254 /24
1,配置VLAN,配置MSTP。
配置:
SW1:
#
vlan 1
#
vlan 101 to 102
#
……
#
stp region-configuration
region-name h3c
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
………………
#
interface NULL0
#
interface Vlan-interface101
ip address 101.1.1.253 255.255.255.0
#
interface Vlan-interface102
ip address 102.1.1.253 255.255.255.0
#
interface Ethernet0/4/0
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 101 to 102
#
………………
#
interface Ethernet0/4/2
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 101 to 102
#
………………
#
stp instance 1 root primary
stp instance 2 root secondary
stp enable
#
SW2:
#
vlan 1
#
vlan 101 to 102
#
…………
#
stp region-configuration
region-name h3c
instance 1 vlan 101
instance 2 vlan 102
active region-configuration
#
………………
#
interface NULL0
#
interface Vlan-interface101
ip address 101.1.1.254 255.255.255.0
#
interface Vlan-interface102
ip address 102.1.1.254 255.255.255.0
#
interface Ethernet0/4/0
port link-mode bridge
#
interface Ethernet0/4/1
port link-mode bridge
port link-type trunk
port trunk permit vlan 1 101 to 102
#
interface Ethernet0/4/2
port link-mode bridge
port link-type trunk
port trunk permit vlan all
#
………………
#
stp instance 1 root secondary
stp instance 2 root primary
stp enable
#
以上在两台交换上配置完MSTP后,互联的端口e0/4/2会把相应的VLAN 给discarding了。所以如果不配置SW3的端口的话,SW1和SW2是不能互通的。而SW3上端口配置了trunk后,两台的流量就通过SW3互通了。
查看端口STP情况 :
[SW1]display stp interface e0/4/2
----[MSTI 1][Port3(Ethernet0/4/2)][FORWARDING]----
Port Role :Designated Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=200
Desg. Bridge/Port :0.000f-e200-0100 / 128.3
Rapid transition :true
Num of Vlans Mapped :1
Port Times :RemHops 20
----[MSTI 2][Port3(Ethernet0/4/2)][DISCARDING]----
Port Role :Alternate Port
Port Priority :128
Port Cost(Legacy) :Config=auto / Active=200
Desg. Bridge/Port :0.000f-e200-0200 / 128.3
Num of Vlans Mapped :1
Port Times :RemHops 20
SW2的情况相反。
VRRP配置:
SW1:
[SW1]int vlan 101
[SW1-Vlan-interface101]vrrp vrid 101 virtual-ip 101.1.1.1
[SW1-Vlan-interface101]vrrp vrid 101 preempt-mode
[SW1-Vlan-interface101]vrrp vrid 101 priority 101 //默认为100
[SW1-Vlan-interface101]int vlan 102
[SW1-Vlan-interface102]vrrp vrid 102 virtual-ip 102.1.1.1
SW2的配置相似,但VALN 101 ,VLAN 102相反的。
查看VRRP:
[SW2]dis vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 101 Backup 100 1 None 101.1.1.1
Vlan102 102 Master 102 1 None 102.1.1.1
[SW1]dis vrrp
IPv4 Standby Information:
Run Mode : Standard
Run Method : Virtual MAC
Total number of virtual routers : 2
Interface VRID State Run Adver Auth Virtual
Pri Timer Type IP
---------------------------------------------------------------------
Vlan101 101 Master 101 1 None 101.1.1.1
Vlan102 102 Backup 100 1 None 102.1.1.1