华为的MSTP+VRRP配置.

发布时间 2023-06-15 08:38:08作者: 雨夜清风

 

AR1

 1 undo terminal monitor
 2 system-view
 3 sysname AR1
 4 interface GigabitEthernet0/0/0
 5 ip address 192.168.0.2 255.255.255.252
 6 quit
 7 interface GigabitEthernet0/0/1
 8 ip address 192.168.0.6 255.255.255.252
 9 quit
10 interface loopback 0
11 ip address 1.1.1.1 255.255.255.255
12 quit
13 ip route-static 172.16.0.0 24 192.168.0.1
14 ip route-static 172.16.1.0 24 192.168.0.5
15 ip route-static 0.0.0.0 0 192.168.0.5

Lsw1

 1 undo terminal monitor
 2 system-view
 3 sysname LSW1
 4 vlan batch 11 21 22 2 3
 5 interface vlanif 11
 6 ip address 192.168.1.3 28              //管理网络
 7 vrrp vrid 1 virtual-ip 192.168.1.1
 8 quit
 9 interface vlanif 21
10 ip address 172.16.0.3 24
11 vrrp vrid 2 virtual-ip 172.16.0.1
12 vrrp vrid 2 priority 80
13 quit
14 interface vlanif 22
15 ip address 172.16.1.3 24
16 vrrp vrid 3 virtual-ip 172.16.1.1
17 vrrp vrid 3 priority 200
18 vrrp vrid 3 track  interface ethernet0/0/5 reduced 150
19 quit
20 interface ethernet 0/0/1
21 port link-type trunk
22 port trunk allow-pass vlan 11 21
23 quit
24 interface ethernet 0/0/2
25 port link-type trunk
26 port trunk allow-pass vlan 11 22
27 quit
28 interface ethernet0/0/3
29 port link-type trunk
30 port trunk allow-pass vlan 11 21 22
31 quit
32 stp enable
33 stp mode mstp
34 stp region-configuration
35 region-name 001
36 instance 1 vlan 11
37 instance 2 vlan 21
38 instance 3 vlan 22
39 active region-configuration
40 quit
41 stp instance 1 root secondary
42 stp instance 2 root secondary
43 stp instance 3 root primary
44 interface vlanif 2
45 ip address 192.168.0.5 30 
46 quit
47 interface ethernet 0/0/5
48 port link-type access
49 port default vlan 2
50 quit
51 interface vlanif 3
52 ip address 192.168.0.10 30
53 quit
54 interface ethernet0/0/4
55 port link-type access
56 port default vlan 3
57 quit
58 ip route-static 1.1.1.1 32 192.168.0.6
59 ip route-static 0.0.0.0 0 192.168.0.9
60 display vrrp brief

LSW2

 1 undo terminal monitor
 2 system-view
 3 sysname LSW2
 4 vlan batch 11 21 22 2 3
 5 interface vlanif 11
 6 ip address 192.168.1.2 28
 7 vrrp vrid 1 virtual-ip 192.168.1.1
 8 vrrp vrid 1 priority 200
 9 vrrp vrid 1 track interface ethernet 0/0/5 reduced 150
10 quit
11 interface vlanif 21
12 ip address 172.16.0.2 24
13 vrrp vrid 2 virtual-ip 172.16.0.1
14 vrrp vrid 2 priority 200
15 vrrp vrid 2 track interface ethernet 0/0/5 reduced 150
16 quit
17 interface vlanif 22
18 ip address 172.16.1.2 24
19 vrrp vrid 3 virtual-ip 172.16.1.1
20 vrrp vrid 3 priority 80
21 quit
22 interface ethernet 0/0/1
23 port link-type trunk
24 port trunk allow-pass vlan 11 21
25 quit
26 interface ethernet 0/0/2
27 port link-type trunk
28 port trunk allow-pass vlan 11 22
29 quit
30 interface ethernet 0/0/3
31 port link-type trunk
32 port trunk allow-pass vlan 11 21 22
33 quit
34 stp enable
35 stp mode mstp
36 stp region-configuration
37 region-name 001
38 instance 1 vlan 11
39 instance 2 vlan 21
40 instance 3 vlan 22
41 active region-configuration
42 quit
43 stp instance 1 root primary
44 stp instance 2 root primary
45 stp instance 3 root secondary
46 interface vlanif 2
47 ip address 192.168.0.1 30
48 interface ethernet 0/0/5
49 port link-type access
50 port default vlan 2
51   quit
52 interface vlanif 3
53 ip address 192.168.0.9 30
54   quit
55 interface ethernet0/0/4
56 port link-type access
57 port default vlan 3
58 quit
59 ip route-static 1.1.1.1 32 192.168.0.2
60 ip route-static 0.0.0.0 0 192.168.0.10
61  dis vrrp bri

 

LSW3
 1 undo terminal monitor
 2 system-view
 3 sysname LSW3
 4 vlan batch 11 22
 5 interface vlanif11
 6 ip address 192.168.1.5 28 //管理网络
 7 quit
 8 interface ethernet 0/0/3
 9 port link-type access
10 port default vlan 22
11 quit
12 interface ethernet 0/0/1
13 port link-type trunk
14 port trunk allow-pass vlan 11 22
15 quit
16 interface ethernet 0/0/2
17 port link-type trunk
18 port trunk allow-pass vlan 11 22
19 quit
LSW4
 1 undo terminal monitor
 2 system-view
 3 sysname LSW4
 4 vlan batch 11 21
 5 interface vlanif 11
 6 ip address  192.168.1.4 28
 7 quit
 8 interface ethernet0/0/3
 9 port link-type access
10 port default vlan 21
11 quit
12 interface ethernet 0/0/1
13 port link-type trunk
14 port trunk allow-pass vlan 11 21
15 quit
16 interface ethernet0/0/2
17 port link-type trunk
18 port trunk allow-pass vlan 11 21
19 quit
20 vlan 11
21 description Guanli              //管理网络
22 quit