华为交换机VRRP 综合配置示例

时间:2021-12-29 07:30:59
组网需求:

楼层1和楼层2分别通过两条线路做冗余接入交换机(本示例只考虑vrrp,暂不考虑其他方面)。当其中一段链路故障时,能通过另外一条链路传输。

配置信息:

<lsw9>dis cu

#

sysname lsw9

#

vlan batch  

#

stp mode stp

#

interface Ethernet0//

 port link-type access

 port default vlan 

#

interface Ethernet0//

 port link-type access

 port default vlan 

#

interface GigabitEthernet0//

 port link-type trunk

 port trunk allow-pass vlan  

#

interface GigabitEthernet0//

 port link-type trunk

 port trunk allow-pass vlan  

 stp instance  cost 

#

return

<lsw9>

--------------------------

<lsw11>dis cu

#

sysname lsw11

#

vlan batch 

#

stp mode stp

#

interface Ethernet0//

 port link-type access

 port default vlan 

#

interface Ethernet0//

 port link-type access

 port default vlan 

#

interface GigabitEthernet0//

 port link-type trunk

 port trunk allow-pass vlan 

 stp instance  cost 

#

interface GigabitEthernet0//

 port link-type trunk

 port trunk allow-pass vlan 

#

return

<lsw11>

-------------------------

<lsw7>dis cu

#

sysname lsw7

#

vlan batch    

#

stp mode stp

#

interface Vlanif1

#

interface Vlanif10

 description to  L

 ip address 10.155.10.254 255.255.255.0

 vrrp vrid  virtual-ip 10.155.10.252

 vrrp vrid  priority 

 vrrp vrid  preempt-mode timer delay 

#

interface Vlanif20

 ip address 10.155.20.254 255.255.255.0

 vrrp vrid  virtual-ip 10.155.20.252

 vrrp vrid  priority 

 vrrp vrid  preempt-mode timer delay 

#

interface Vlanif30

 description to  L

 ip address 10.156.40.254 255.255.255.0

 ip address 10.156.30.254 255.255.255.0 sub

 vrrp vrid  virtual-ip 10.156.30.252

 vrrp vrid  virtual-ip 10.156.40.252

 vrrp vrid  priority 

 vrrp vrid  preempt-mode timer delay 

#

interface Vlanif100

 ip address 10.10.10.1 255.255.255.0

#

interface MEth0//

#

interface GigabitEthernet0//

 port link-type access

 port default vlan 

#

interface GigabitEthernet0//

 port link-type trunk

 port trunk pvid vlan 

 port trunk allow-pass vlan  to 

#

interface GigabitEthernet0//

 port link-type trunk

 port trunk allow-pass vlan 

#

ospf 

 area 0.0.0.0

  network 10.10.10.0 0.0.0.255

  network 10.155.0.0 0.0.255.255

  network 10.156.0.0 0.0.255.255

#

return

--------------------------------------

<lsw8>dis cu

#

sysname lsw8

#

vlan batch    

#

stp mode stp

#

interface Vlanif1

#

interface Vlanif10

 description to  L

 ip address 10.155.10.253 255.255.255.0

 vrrp vrid  virtual-ip 10.155.10.252

#

interface Vlanif20

 description to  L

 ip address 10.155.20.253 255.255.255.0

 vrrp vrid  virtual-ip 10.155.20.252

#

interface Vlanif30

 description to  L

 ip address 10.156.30.253 255.255.255.0

 ip address 10.156.40.253 255.255.255.0 sub

 vrrp vrid  virtual-ip 10.156.30.252

 vrrp vrid  priority 

 vrrp vrid  preempt-mode timer delay 

 vrrp vrid  virtual-ip 10.156.40.252

#

interface Vlanif200

 ip address 10.10.20.1 255.255.255.0

#

interface MEth0//

#

interface GigabitEthernet0//

#

interface GigabitEthernet0//

 port link-type trunk

 port trunk allow-pass vlan  

#

interface GigabitEthernet0//

 port hybrid pvid vlan 

 port hybrid tagged vlan  to 

#

interface GigabitEthernet0//

 port link-type trunk

 port trunk allow-pass vlan 

#

ospf 

 area 0.0.0.0

  network 10.155.0.0 0.0.255.255

  network 10.156.0.0 0.0.255.255

  network 10.10.20.0 0.0.0.255

#

return

<lsw8>

-----------------

<Huawei>dis cu

#

sysname Huawei

#

stp instance  root primary

stp enable

#

interface GigabitEthernet0//

 ip address 10.10.10.254 255.255.255.0

 stp enable

#

interface GigabitEthernet0//

 ip address 10.10.20.254 255.255.255.0

 stp enable

#

interface GigabitEthernet0//

 ip address 61.128.128.6 255.255.255.0

#

return

<Huawei>