華為交換機(jī)配置vrrp、mstp綜合實(shí)驗(yàn)

;


1.PC1的網(wǎng)關(guān)ip位于匯聚交換機(jī)A,PC2的網(wǎng)關(guān)IP位于匯聚交換機(jī)B,默認(rèn)均為vlan 1;

2.核心交換機(jī)A 與核心交換機(jī)B 采用VRRP實(shí)現(xiàn)高可用,雙機(jī)互聯(lián)端口采用二層聚合;

3.核心交換機(jī)A 指定為Vlan 194 和 vlan 192 的根橋(bridge root),核心交換機(jī)B指定為vlan195 和vlan193的根橋(bridge root);

匯聚層交換機(jī)A:

#生成樹(shù)的模式選為mstp

stp mode mstp

#進(jìn)入生成樹(shù)的配置模式

stp region-configuration

region-name yongfu

#創(chuàng)建實(shí)例1,將vlan192、194劃到實(shí)例1中

instance 1 vlan 192 194?

#創(chuàng)建實(shí)例1,將vlan193、195劃到實(shí)例2中

instance 2 vlan 193 195

#激活配置

active region-configuration

interface Vlanif1

#接入層交換機(jī)的網(wǎng)關(guān)ip

ip address 10.12.192.254 255.255.255.128

interface Vlanif192

ip address 10.13.192.156 255.255.255.248

interface Ethernet0/0/1

port link-type trunk

port trunk allow-pass vlan 2 to 4094

interface Ethernet0/0/2

port link-type trunk

port trunk allow-pass vlan 2 to 4094

#配置環(huán)回接口的IP地址

interface LoopBack0

ip address 1.1.1.1 255.255.255.0

#配置route-id 1.1.1.1

ospf 1 router-id 1.1.1.1

area 0

#宣告直連網(wǎng)絡(luò)

? network 10.13.192.0 0.0.0.255

? network 10.12.192.128 0.0.0.127

匯聚層交換機(jī)B:

vlan batch 193

stp mode mstp

stp region-configuration

region-name yongfu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

interface Vlanif1

#pc2的網(wǎng)關(guān)ip

ip address 10.14.192.126 255.255.255.128

interface Vlanif193

ip address 10.13.193.156 255.255.255.248

interface Ethernet0/0/1

port link-type trunk

port trunk allow-pass vlan 193

interface Ethernet0/0/2

port link-type trunk

port trunk allow-pass vlan 193

#配置ospf,手動(dòng)設(shè)置route-id

ospf 1 router-id 2.2.2.2

area 0

#宣告直連網(wǎng)段

? network 10.14.192.0 0.0.0.127

? network 10.13.193.152 0.0.0.7

核心交換機(jī)lsw1:

#創(chuàng)建vlan192-195

vlan batch 192 to 195

#指定該交換機(jī)為實(shí)例1的根網(wǎng)橋(即為vlan 192、194的根橋)

stp instance 1 root primary

#指定該交換機(jī)為實(shí)例2的根網(wǎng)橋(即為vlan 193、195的備根橋)

stp instance 2 root secondary

#配置mstp生成樹(shù)協(xié)議

stp mode mstp

stp region-configuration

region-name yongfu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

interface Vlanif192

ip address 10.13.192.153 255.255.255.248

#配置vrrp協(xié)議,vrid為192,虛擬網(wǎng)關(guān)地址為10.13.192.155

vrrp vrid 192 virtual-ip 10.13.192.155

#默認(rèn)優(yōu)先級(jí)是100,現(xiàn)將優(yōu)先級(jí)設(shè)置為120,為主網(wǎng)關(guān)設(shè)備

vrrp vrid 192 priority 120

interface Vlanif193

ip address 10.13.193.153 255.255.255.248

#不配置優(yōu)先級(jí),默認(rèn)為100,作為備用網(wǎng)關(guān)

vrrp vrid 193 virtual-ip 10.13.193.155

interface Vlanif194

ip address 10.13.194.1 255.255.255.248

vrrp vrid 194 virtual-ip 10.13.194.3

vrrp vrid 194 priority 120

interface Vlanif195

ip address 10.13.195.1 255.255.255.248

vrrp vrid 195 virtual-ip 10.13.195.3

#配置聚合口

interface Eth-Trunk1

port link-type trunk

#放通所有vlan

port trunk allow-pass vlan 2 to 4094

#將接口劃分為對(duì)應(yīng)的vlan

interface GigabitEthernet0/0/1

port link-type trunk

port trunk allow-pass vlan 192

interface GigabitEthernet0/0/2

port link-type trunk

port trunk allow-pass vlan 193

#將GigabitEthernet0/0/3、GigabitEthernet0/0/4捆綁成一個(gè)聚合口

interface GigabitEthernet0/0/3

eth-trunk 1

interface GigabitEthernet0/0/4

eth-trunk 1


interface GigabitEthernet0/0/5

port link-type trunk

port trunk allow-pass vlan 2 to 4094


interface GigabitEthernet0/0/6

port link-type trunk

port trunk allow-pass vlan 2 to 4094

#配置ospf,進(jìn)程號(hào)為1,route-id為3.3.3.3

ospf 1 router-id 3.3.3.3

area 0.0.0.0

#宣告直連網(wǎng)段

? network 10.13.192.152 0.0.0.7

? network 10.13.193.152 0.0.0.7

? network 10.13.194.0 0.0.0.7

? network 10.13.195.0 0.0.0.7

ip route-static 19.130.107.0 255.255.255.192 10.13.194.5

核心交換機(jī)lsw2:(配置與lsw1相似)

#創(chuàng)建vlan192-195

vlan batch 192 to 195

stp mode mstp

stp instance 2 root primary

stp instance 1 root secondary

stp region-configuration

region-name yongfu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

#配置個(gè)接口的ip地址,配置vrrp,設(shè)置主、備網(wǎng)關(guān)

interface Vlanif192

ip address 10.13.192.154 255.255.255.248

vrrp vrid 192 virtual-ip 10.13.192.155

interface Vlanif193

ip address 10.13.193.154 255.255.255.248

vrrp vrid 193 virtual-ip 10.13.193.155

vrrp vrid 193 priority 120

interface Vlanif194

ip address 10.13.194.2 255.255.255.248

vrrp vrid 194 virtual-ip 10.13.194.3

interface Vlanif195

ip address 10.13.195.2 255.255.255.248

vrrp vrid 195 virtual-ip 10.13.195.3

vrrp vrid 195 priority 120

interface Eth-Trunk1

port link-type trunk

port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/1

port link-type trunk

port trunk allow-pass vlan 192

interface GigabitEthernet0/0/2

port link-type trunk

port trunk allow-pass vlan 193

interface GigabitEthernet0/0/3

eth-trunk 1

interface GigabitEthernet0/0/4

eth-trunk 1

interface GigabitEthernet0/0/5

port link-type trunk

port trunk allow-pass vlan 2 to 4094

interface GigabitEthernet0/0/6

port link-type trunk

port trunk allow-pass vlan 2 to 4094

交換機(jī)lsw14:

vlan batch 194

stp mode mstp?

stp region-configuration

region-name yongfu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

interface Vlanif1

ip address 10.13.192.133 255.255.255.252

interface Vlanif194

ip address 10.13.194.5 255.255.255.248

interface Ethernet0/0/1

port link-type trunk

port trunk allow-pass vlan 194

interface Ethernet0/0/2

port link-type trunk

port trunk allow-pass vlan 194

#配置ospf,進(jìn)程號(hào)為1,route-id 5.5.5.5

ospf 1 router-id 5.5.5.5

area 0.0.0.0

? network 10.13.194.0 0.0.0.7

? network 10.13.192.132 0.0.0.3

ip route-static 19.130.107.0 255.255.255.0 10.13.192.134

交換機(jī)lsw15:

vlan batch 195

stp mode mstp

stp region-configuration

region-name yongu

instance 1 vlan 192 194

instance 2 vlan 193 195

active region-configuration

interface Vlanif1

ip address 10.13.192.149 255.255.255.252

interface Vlanif195

ip address 10.13.195.5 255.255.255.248

interface Ethernet0/0/1

port link-type trunk

port trunk allow-pass vlan 195

interface Ethernet0/0/2

port link-type trunk

port trunk allow-pass vlan 195

ospf 1 router-id 6.6.6.6

area 0.0.0.0

? network 10.13.192.148 0.0.0.3

? network 10.13.195.0 0.0.0.7

ip route-static 61.142.211.0 255.255.255.0 10.13.192.150

出口路由器R1:

interface Ethernet0/0/0

ip address 10.13.192.134 255.255.255.252

interface Ethernet0/0/1

ip address 19.130.107.1 255.255.255.0

ospf 1 router-id 7.7.7.7

area 0.0.0.0

? network 10.13.192.132 0.0.0.3

? network 19.130.107.0 0.0.0.255

ip route-static 0.0.0.0 0.0.0.0 10.13.192.133

出口路由器R2:


interface Ethernet0/0/0

ip address 10.13.192.150 255.255.255.252

interface Ethernet0/0/1

interface GigabitEthernet0/0/0

ip address 61.142.211.122 255.255.255.0

nat static global 61.142.211.123 inside 10.12.194.1 netmask 255.255.255.255

nat static enable

ospf 1 router-id 8.8.8.8

area 0.0.0.0

? network 10.13.192.148 0.0.0.3

? network 61.142.211.0 0.0.0.255

ip route-static 0.0.0.0 0.0.0.0 10.13.192.149

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。