华为交换机配置vrrp、mstp综合实验

;


1.PC1的网关ip位于汇聚交换机A,PC2的网关IP位于汇聚交换机B,默认均为vlan 1;

2.核心交换机A 与核心交换机B 采用VRRP实现高可用,双机互联端口采用二层聚合;

3.核心交换机A 指定为Vlan 194 和 vlan 192 的根桥(bridge root),核心交换机B指定为vlan195 和vlan193的根桥(bridge root);

汇聚层交换机A:

#生成树的模式选为mstp

stp mode mstp

#进入生成树的配置模式

stp region-configuration

region-name yongfu

#创建实例1,将vlan192、194划到实例1中

instance 1 vlan 192 194 

#创建实例1,将vlan193、195划到实例2中

instance 2 vlan 193 195

#激活配置

active region-configuration

interface Vlanif1

#接入层交换机的网关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

#配置环回接口的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

#宣告直连网络

  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的网关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,手动设置route-id

ospf 1 router-id 2.2.2.2

area 0

#宣告直连网段

  network 10.14.192.0 0.0.0.127

  network 10.13.193.152 0.0.0.7

核心交换机lsw1:

#创建vlan192-195

vlan batch 192 to 195

#指定该交换机为实例1的根网桥(即为vlan 192、194的根桥)

stp instance 1 root primary

#指定该交换机为实例2的根网桥(即为vlan 193、195的备根桥)

stp instance 2 root secondary

#配置mstp生成树协议

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协议,vrid为192,虚拟网关地址为10.13.192.155

vrrp vrid 192 virtual-ip 10.13.192.155

#默认优先级是100,现将优先级设置为120,为主网关设备

vrrp vrid 192 priority 120

interface Vlanif193

ip address 10.13.193.153 255.255.255.248

#不配置优先级,默认为100,作为备用网关

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

#将接口划分为对应的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

#宣告直连网段

  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相似)

#创建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,设置主、备网关

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

你可能感兴趣的:(华为交换机配置vrrp、mstp综合实验)