;
1.PC1的網(wǎng)關(guān)ip位于匯聚交換機A犀盟,PC2的網(wǎng)關(guān)IP位于匯聚交換機B,默認均為vlan 1蝇狼;
2.核心交換機A 與核心交換機B 采用VRRP實現(xiàn)高可用阅畴,雙機互聯(lián)端口采用二層聚合;
3.核心交換機A 指定為Vlan 194 和 vlan 192 的根橋(bridge root)迅耘,核心交換機B指定為vlan195 和vlan193的根橋(bridge root);
匯聚層交換機A:
#生成樹的模式選為mstp
stp mode mstp
#進入生成樹的配置模式
stp region-configuration
region-name yongfu
#創(chuàng)建實例1贱枣,將vlan192、194劃到實例1中
instance 1 vlan 192 194?
#創(chuàng)建實例1颤专,將vlan193纽哥、195劃到實例2中
instance 2 vlan 193 195
#激活配置
active region-configuration
interface Vlanif1
#接入層交換機的網(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
匯聚層交換機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,手動設(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
核心交換機lsw1:
#創(chuàng)建vlan192-195
vlan batch 192 to 195
#指定該交換機為實例1的根網(wǎng)橋(即為vlan 192栖秕、194的根橋)
stp instance 1 root primary
#指定該交換機為實例2的根網(wǎng)橋(即為vlan 193春塌、195的備根橋)
stp instance 2 root secondary
#配置mstp生成樹協(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
#默認優(yōu)先級是100只壳,現(xiàn)將優(yōu)先級設(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)先級暑塑,默認為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
#將接口劃分為對應(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捆綁成一個聚合口
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事格,進程號為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
核心交換機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
#配置個接口的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
交換機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,進程號為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
交換機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