STP故障01-STP端口问题

如上图所示,模拟某云小部分场景: 1、 图中上面红框表示Internet(用CE1的loopback1模拟),下面红框表示客户设备(用CE1交换机loopback2模拟); 2、 在CE1交换机中存在两个VRF(test1及test2),test1用于对接Internet及将流量引入防火墙,test2用于对接客户设备及防火墙控制后的流量(即trust区域流量); 3、 防火墙使用GE1/0/1建立HRP关系,使用三层子接口(GE1/0/0.10、GE1/0/0.20)对接交换机,具体ip地址如图中所示(所有网段均采用一个C段);

配置信息如下:

1、 防火墙配置: sysname FW01

hrp enable hrp interface GigabitEthernet1/0/1 remote 1.1.1.3 hrp standby config enable

interface GigabitEthernet1/0/0.10 vlan-type dot1q 10 description To_CE1_test1 ip address 10.10.1.2 255.255.255.0 vrrp vrid 1 virtual-ip 10.10.1.1 active service-manage ping permit service-manage ssh permit

interface GigabitEthernet1/0/0.20 vlan-type dot1q 20 description To_CE1_test2 ip address 10.11.1.2 255.255.255.0 vrrp vrid 1 virtual-ip 10.11.1.1 active service-manage ping permit service-manage ssh permit

interface GigabitEthernet1/0/1 undo shutdown ip address 1.1.1.2 255.255.255.0 vrrp vrid 1 virtual-ip 1.1.1.1 active service-manage ping permit service-manage ssh permit

firewall zone trust set priority 85 add interface GigabitEthernet1/0/0.20

firewall zone untrust set priority 5 add interface GigabitEthernet1/0/0.10

firewall zone name hrp id 4 set priority 95 add interface GigabitEthernet1/0/1

security-policy default action permit

ip route-static 10.9.1.0 255.255.255.0 10.10.1.4 description CE1_VRF-test1 ip route-static 10.12.1.0 255.255.255.0 10.11.1.4 description CE1_VRF-test2 防火墙FW-02与FW-01配置类似

2、 交换机配置: sysname CE1

vlan batch 10 20

ip ***-instance test1 ipv4-family route-distinguisher 10:1

ip ***-instance test2 ipv4-family route-distinguisher 20:1

interface Vlanif10 description To_FW_untrust ip binding ***-instance test1 ip address 10.10.1.4 255.255.255.0

interface Vlanif20 description To_FW_trust ip binding ***-instance test2 ip address 10.11.1.4 255.255.255.0

interface GE1/0/0 undo shutdown port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 10 20

interface GE1/0/1 undo shutdown port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 10 20

interface LoopBack1 description Internet ip binding ***-instance test1 ip address 10.9.1.1 255.255.255.0

interface LoopBack2 description client ip binding ***-instance test2 ip address 10.12.1.1 255.255.255.0

ip route-static ***-instance test1 10.12.1.0 255.255.255.0 10.10.1.1 description FW-untrust ip route-static ***-instance test2 10.9.1.0 255.255.255.0 10.11.1.1 description FW-trunst

现在我们来做个场景模拟,Internet访问客户侧业务 或者 客户侧访问Internet业务,在客户正在访问的情况下,刚好我们要操作防火墙,会导致防火墙主备切换,那是否会对客户产生影响?如果有,影响有多大?

1、带着这个问题,选择Internet侧长ping客户侧设备,然后我们切换防火墙,看是否会掉包;

2、我们可以发现掉了两个包,我们只断了防火墙连接交换机的端口,HRP互连端口并没有关闭,那为什么会掉包,难道是因为会话没有同步?

3、可以发现,还是掉了两个包,这明显不是防火墙会话原因;数据转发一定离不开ARP及MAC表,我们可以观察下防火墙上的ARP表项,看是否是防火墙ARP表问题;

通过查看ARP表发现,防火墙连接交换机端口UP后,是经过了1~2秒才学到了交换机10.10.1.4的ARP信息,所以掉包应该是这个原因导致。

延伸: 在上面第1步测试中,用真机CE设备测试,应该是掉5个包;这是为什么呢? 在CE交换机中,针对STP是有优化的,具体优化如下: 端口使能生成树协议后,会默认启动边缘端口的自动探测功能,当端口在(2 x Hello Timer +1)秒时间内收不到BPDU报文,自动将端口设置为边缘端口;如果在接口视图下配置了stp edged-port enable 或 stp edged-port disable、或者在系统视图下配置stp edged-port default,边缘端口自动探测功能就不生效了。

我们可以看CE1交换机的GE1/0/0端口信息:

可以看到,CE1交换机的GE1/0/0端口显示边缘端口以开启,但实际上我们在端口下并未配置边缘端口,这就是CE交换机边缘端口的自动探测功能导致的,在经过5S后,GE1/0/0端口还未收到BPDU报文,就认为对端可能是PC,可以将该端口设置为边缘端口,避免了STP/mstp端口的慢收敛。