是其没出现问题的情况下vlan10走左边,vlan20走右边,实现分流。
一旦任何一方出现问题,都可以自动更换线路。
目标:
1、LsW1作为 vlan 10的主网关和根桥,LSW2作为 vlan 20的主网关和根桥AR1、AR
2、实现双出口双链路上连,可互为备份
3、v1an 10用户正常情况使用左迈线路访问互联网,vlan 20用户正常情况使用右边线路访间互联网
1、配置链路聚合
(1)创建聚合口: int Eth-Trunk 1
(2)将接口捆绑:trunkport g0/0/2 to g0/0/3(trunkport GigabitEthernet 0/0/2 to 0/0/3要这么写才可中间要有空格)
(3)查看结果:dis int Eth-Trunk 1
表示配置正确,同时另外一台交换机也做相同的配置。
2、配置生成树放环(STP)
(1)配置基础的vlan trunk
(1.1)在jieru交换机上,创建vlan: vlan batch 10 20
(1.2)把左接口划分到vlan 10:int g0/0/1
port link-type access
port de vlan 10
(1.3)把有接口划分到vlan 20:int g0/0/2
port link-type access
port de vlan 20
(1.4)把上接口配置为trunk模式:为了支持多个vlan往上走
int g0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
int g0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
(1.5)为了实现主备高可靠性同时实现网关冗余
要在core-1交换机中创建vlan 10 20:vlan batch 10 20
需要在其接口g0/0/1配置:int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
同时要将int Eth-Trunk 1接口配置,因为它也要走vlan10 20
int Eth-Trunk 1
port link-type trunk
port trunk allow-pass vlan 10 20
然后,再去右边的core-2做相同的配置
要在core-2交换机中创建vlan 10 20:vlan batch 10 20
需要在其接口g0/0/1配置:int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
同时要将int Eth-Trunk 1接口配置,因为它也要走vlan10 20
int Eth-Trunk 1
port link-type trunk
port trunk allow-pass vlan 10 20
(2) 配置mstp域:多生成树,用于阻塞不同的接口,不同vlan走不同线路。
首先进入多生成树的配置:stp region-configuration
(2.1)配置mstp域名:region-name a
(2.2)配置mstp的修订号:region-level 1
(2.3)创建两个生成树实例,分别针对valn10和vlan20:instance 10 vlan 10
instance 20 vlan 20
华为需要激活:active region-configuration
这个操作需要三台交换机的配置完全相同
可以通过dis this去粘贴到另外两台从
#
....
#包括“#”
(3)配置各实例的优先级
左边核心作为vlan10也就是实例10的根桥
core-1
stp instance 10 priority 4096 (主根)
stp instance 20 priority 8192(备根)
右边核心作为valn 20也就是实例20的根桥
core-1
stp instance 20 priority 4096 (主根)
stp instance 10 priority 8192(备根)
在jieru交换机中可以查看:dis stp instance 10 brief
阻塞了4号口
dis stp instance 20 brief
3、VRRP:虚拟路由冗余协议。两台或者多态设备充当网关。
在vlan10中
左核心,配上ip 192.168.10.253,配上vrrp的地址10.254,优先级高(充当pc1的主网关)
右核心,配上ip 192.168.10.252,配上vrrp的地址10.254,优先级保持默认100
pc1把网关配置成 192.168.10.254
先在左核心core-1:int vlan 10
ip add 192.168.10.253 24
vrrp vrid 10 (vrid组号10两边保持一致) virtual-ip 192.168.10.254(虚拟网关)
vrrp vrid 10 priority 110(成为主设备)
在core-2:int vlan 10
ip add 192.168.10.252 24
vrrp vrid 10 virtual-ip 192.168.10.254
使用pc1去ping192.168.10.254,能通说明成功
查看主备网关在core-1上:dis vrrp brief
在core-2上:dis vrrp brief
同样在vlan20中
在core-2:int vlan 20
ip add 192.168.20.252 24
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 110
在core-1 :int vlan 20
ip add 192.168.20.253 24
vrrp vrid 20 virtual-ip 192.168.20.254
4、配置ospf和静态浮动路由
(1)配各个设配的互连ip
现在core-1:
在许多真机中支持在物理接口配置IP,但是虚拟的不行,因此需要有互连vlan
vlan11
vlan111
int vlan 11
ip add 172.16.1.1 24
int g0/0/4
port link-type access
port de vlan 11
同理
int vlan 111
ip add 172.16.11.1 24
int g0/0/5
port link-type access
port de vlan 111
同理配置core-2
vlan 22
vlan 222
int vlan 22
ip add 172.16.2.1 24
int g0/0/5
port link-type access
port de vlan 22
int vlan 222
ip add 172.16.22.1 24
int g0/0/4
port link-type access
port de vlan 222
配置路由器左边的地址,ck-1(出口):
int g0/0/0
ip add 172.16.1.2 24
ping 172.16.1.1(ping一下对面)
int g0/0/1
ip add 172.16.22.2 24
ping 172.16.22.1
配置右边路由器,ck-2:
int g0/0/0
ip add 172.16.11.2 24
ping 172.16.11.1
int g0/0/1
ip add 172.16.2.2 24
ping 172.16.2.1
(2)开启ospf,并且宣告各个接口
在core-1:ospf
area 0(区域0)
net 0.0.0.0 0.0.0.0(把所有的网络都宣告在区域零,实际工作中不行,这是简化版的)
在core-2:ospf
area 0(区域0)
net 0.0.0.0 0.0.0.0
在ck-1:ospf
area 0(区域0)
net 0.0.0.0 0.0.0.0
在ck-2:ospf
area 0(区域0)
net 0.0.0.0 0.0.0.0
ck-1:dis ospf peer brief(查看ospf是否建立邻居)
ck-1:ospf
silent-interface g0/0/2(没必要建立g0/0/2的邻居,可以减轻工作量)
ck-2:dis ospf peer brief(查看ospf是否建立邻居)
ospf
silent-interface g0/0/2(没必要建立g0/0/2的邻居,可以减轻工作量)
core-1 :dis ospf peer brief
ospf
silent-interface vlanif 10
silent-interface vlanif 20(没必要)
(3)引入默认路由
在ck-1:int g0/0/2
ip add 100.100.100.1 29
int g1/0/0
ip add 200.200.200.2 29
ip route-static 0.0.0.0 0 100.100.100.6(主选)
ip route-static 0.0.0.0 0 200.200.200.6 preference 61(备选,数字越大,优先级越低)
dis ip routing-table 6.6.6.6
在ck-2:int g0/0/2
ip add 200.200.200.1 29
int g1/0/0
ip add 100.100.100.2 29
ip route-static 0.0.0.0 0 200.200.200.6(主选)
ip route-static 0.0.0.0 0 100.100.100.6 preference 61(备选,数字越大,优先级越低)
dis ip routing-table 6.6.6.6
在ck-1:ospf(在ospf中引入默认路由)
default-route-advertise type 1
dis ip routing-table 6.6.6.6
在ck-2:ospf
default-route-advertise type 1
(4)路由优先级控制
core-1:int g0/0/5
dis this
int vlan 111
ospf cost 2(开销值改大)
dis ip routing-table 6.6.6.6
core-2:int g0/0/4
dis this
int vlan 222
ospf cost 2(开销值改大)
ck-1:dis ip routing-table 192.168.10.1 (查看回程路由是否也都走左边)
还是一个随机的走法
core-2:int vlan 10
ospf cost 2
ck-1:dis ip routing-table 192.168.10.1
core-1: int vlan 20
ospf cost 2
5、多出口nat
在出口路由器设置acl
ck-1:acl 2000
rule permit source any
int g0/0/2
nat outbound 2000
int g2/0/0
nat outbound 2000
ck-2:acl 2000
rule permit source any
int g0/0/2
nat outbound 2000
int g2/0/0
nat outbound 2000
用pc1去ping 6.6.6.6(注意配置AR3的接口地址,PC3的地址,及网关)
并且跟踪是否从左边走:tracert 6.6.6.6
用pc1去ping 6.6.6.6
并且跟踪是否从右边走:tracert 6.6.6.6
6、主备切换测试
(1)在jieru交换机:int g0/0/3
shutdown
再去ping 6.6.6.6看是否正常,可能需要等待一段时间
(2)关闭core-1的所有接口
(3)测试宽带线路 关闭ck-1 g0/0/2
出现了路由迭代
是因为在配置的时候使用了ospf全宣告net 0.0.0.0 0.0.0.0,把宽带也宣告了
修改ck-2:ospf
are 0
undo net 0.0.0.0 255.255.255.255
dis this
network 172.16.0.0 0.0.255.255
进入ck-1做同样的操作
ospf
ar 0
dis this
undo net 0.0.0.0 255.255.255.255
network 172.16.0.0 0.0.255.255
ck-1:dis ip routing-table 6.6.6.6
(4)拔掉电信宽带
现象是PC1ping不通了,因此没有BFD,它可以检测运营商出现问题自动切换
在ck-1:bfd(打开BFD的功能)
q
bfd 1 bind peer-ip 100.100.100.6 interface g0/0/2 one-arm-echo (单臂回声)
discriminator local 1
commit
ip route-static 0.0.0.0 0 100.100.100.6 track bfd 1