今天下班的时候接到一个运维电话,客户说主交换机上行链路断掉之后网络不通,然后进行了一小段时间的自愿加班进行了分析解决,因为公司规定下班一个半小时加班算自愿加班,不算加班费,意思就是下班抓紧时间回家不要逗留,哈哈~下面看问题
拓扑结构
我将现网中的问题部分拓扑简化出来如下图:
图片.png
设备中的主要配置配置如下:
#路由器R1的配置
#接口
interface GigabitEthernet0/0/0
ip address 21.40.1.1 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 21.41.1.1 255.255.255.252
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#路由
ip route-static 172.16.16.0 255.255.255.0 21.40.1.2
ip route-static 172.16.16.0 255.255.255.0 21.41.1.2 preference 100
#交换机SW2配置
#接口
interface Vlanif100
ip address 172.16.16.252 255.255.255.0
vrrp vrid 10 virtual-ip 172.16.16.254
vrrp vrid 10 priority 120
#
interface Vlanif801
ip address 21.43.1.1 255.255.255.252
#
interface Vlanif802
ip address 21.40.1.2 255.255.255.252
#
interface GigabitEthernet0/0/1
shutdown
port link-type access
port default vlan 802
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 100
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 801
#路由
ip route-static 1.1.1.1 255.255.255.255 21.40.1.1
ip route-static 1.1.1.1 255.255.255.255 21.43.1.2 preference 100
#交换机SW3的配置
#接口
interface Vlanif100
ip address 172.16.16.253 255.255.255.0
vrrp vrid 10 virtual-ip 172.16.16.254
#
interface Vlanif801
ip address 21.43.1.2 255.255.255.252
#
interface Vlanif802
ip address 21.41.1.2 255.255.255.252
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 100
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 802
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 801
#
#路由
ip route-static 1.1.1.1 255.255.255.255 21.41.1.1
首先这种三角形的三层构架的是标准的三层构架但是这看似美好的东西之中潜在很多问题,我们一一进行分析
-
首先两台汇聚交换机之间采用Acess口连接,如果汇聚下联到接入交换机的某条线路down掉或者被STP阻断,均会导致VRRP无法协商,如果右侧SW3的下联线路down掉或者被STP阻断之后并不影响,但是如果做左侧SW2的下联线路down掉之后业务便会不通,因为R1回复的数据包是回到SW2上,而下行到接入的链路断了,SW2和SW3又是Access接口连接,无法透传vlan,并没有真正的实现链路的冗余
图片.png
-
如果stp阻断两台汇聚交换机之间的连线则会导致两台汇聚交换机之间无法通信,左侧交换机SW2上行链路断掉以后,如果没有配置track机制则SW2中vrrp依然保持Master,也就是说PC上来的数据到达SW2之后会尝试从恒联也就是SW3上行,但是也被STP阻断了,所以业务依然不能保持正常,冗余也没有实现
VRRP阻断汇聚之间链路.png
下班操作的时候还真没有考虑这么多,当时一看两台汇聚之间用的Access口连接的就觉得不大对劲儿,但是我进行的修改是在SW2中添加了track机制,即当SW2的上行链路断掉以后降低SW2中vrrp的优先级,这样可以将vrrp的master切换到SW3上,无论上行数据还是下行都走备用线路,虽然问题解决了,但感觉还是有问题,SW2和SW3之间的恒连线似乎没啥用,下面看下三层网络中VRRP和STP的配置方式
三层网络中VRRP+STP的配置方法
vrrp配合stp对数据进行分流,这是前几天刚刚学习的东西,今天正好派上用场了,下面看下拓扑和配置:
汇聚接入.png
只截取了拓扑的一部分,不过也能说明问题了,下面是主要配置
#------------------------------------SW3的主要配置------------------------------------
vlan batch 101 to 102 301 1002 1006 1010
#
stp instance 0 root primary
stp instance 1 root primary #将实例1设置为根
stp instance 2 root secondary #将实例2设置为次根
#
stp region-configuration
region-name YHJR
instance 1 vlan 101 301 #将业务1和管理vlan加入实例1
instance 2 vlan 102 #将业务2加入实例2
active region-configuration
interface Vlanif101
description Yewu1
ip address 172.16.1.252 255.255.255.0
vrrp vrid 12 virtual-ip 172.16.1.254
vrrp vrid 12 priority 200
#
interface Vlanif102
description Yewu2
ip address 172.16.2.252 255.255.255.0
vrrp vrid 13 virtual-ip 172.16.2.254
#
interface Vlanif301
description JieruGuanli
ip address 172.16.18.252 255.255.255.0
vrrp vrid 11 virtual-ip 172.16.18.254
vrrp vrid 11 priority 200
#
interface Vlanif1002
ip address 10.10.0.6 255.255.255.252
#
interface Vlanif1006
ip address 10.10.0.22 255.255.255.252
#
interface Vlanif1010
ip address 10.10.0.37 255.255.255.252
#
interface Eth-Trunk1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 101 to 102 301 1010
mode lacp-static
#
interface GigabitEthernet0/0/1
eth-trunk 1
#
interface GigabitEthernet0/0/2
eth-trunk 1
#
interface GigabitEthernet0/0/3
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 1002
#
interface GigabitEthernet0/0/4
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 1006
#
interface GigabitEthernet0/0/5
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 101 to 102 301
#
interface GigabitEthernet0/0/6
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 101 to 102 301
#------------------------------SW4的主要配置---------------------------------
stp instance 0 root secondary
stp instance 1 root secondary #这里的配置和SW3正好相反从而实现分流,
stp instance 2 root primary #vlan 101 301通过SW3上行,vlan102通过SW4上行
#
stp region-configuration
region-name YHJR
instance 1 vlan 101 301
instance 2 vlan 102
active region-configuration
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif101
description Yewu1
ip address 172.16.1.253 255.255.255.0
vrrp vrid 12 virtual-ip 172.16.1.254
#
interface Vlanif102
description Yewu2
ip address 172.16.2.253 255.255.255.0
vrrp vrid 13 virtual-ip 172.16.2.254
vrrp vrid 13 priority 200
#
interface Vlanif301
description JieruGuanli
ip address 172.16.18.253 255.255.255.0
vrrp vrid 11 virtual-ip 172.16.18.254
#
interface Vlanif1003
ip address 10.10.0.10 255.255.255.252
#
interface Vlanif1007
ip address 10.10.0.26 255.255.255.252
#
interface Vlanif1010
ip address 10.10.0.38 255.255.255.252
#
interface MEth0/0/1
#
interface Eth-Trunk1
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 101 to 102 301 1010
mode lacp-static
#
interface GigabitEthernet0/0/1
eth-trunk 1
#
interface GigabitEthernet0/0/2
eth-trunk 1
#
interface GigabitEthernet0/0/3
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 1007
#
interface GigabitEthernet0/0/4
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 1003
#
interface GigabitEthernet0/0/5
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 101 to 102 301
#
interface GigabitEthernet0/0/6
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 101 to 102 301
#--------------------------------接入中stp的配置--------------------------------
stp region-configuration
region-name YHJR
instance 1 vlan 101 301
instance 2 vlan 102
active region-configuration
接入交换机中的配置中只附了stp的配置,其余配置比较简单不在贴附,上述配置即可实现stp和vrrp配合使用分流,并且两台汇聚之间的链路不会被stp阻断,instance 1中的vlan通过SW3上行instance 2中的vlan通过SW4上行,我们看下接入交换机SW5中stp的状态
接入交换机stp状态.png
很多知识需要深层次学习研究,不然用起来的时候会显得很吃力,用不好也会显得鸡肋,还是静下心来学习,总结,提高,本人也是入门选手,文章有写的不对,或者不太理解咱们可以讨论。
网友评论