华为VRRP+BFD配置

-我们先把基本的网络配置先配置完成才能完成华为VRRP+BFD配置的配置
交换机接口及VLAN的配置
 SW1
sys
sys sw1
un info en
vlan 10
int g0/0/2
port link-type acc
port de vlan 10
int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10
int g0/0/3
port link-type trunk
port trunk allow-pass vlan 10
 SW2
sys
sys sw2
un info en
vlan batch 10 20 30
int g0/0/1
port link-type acc
port de vlan 30
int g0/0/2
port link-type trunk
port trunk allow-pass vlan 10
int g0/0/3
port link-type trunk
port trunk allow-pass vlan 20
int g0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20 30
 SW3
sys
sys sw3
un info en
vlan batch 10 20 30
int g0/0/1
port link-type acc
port de vlan 30
int g0/0/2
port link-type trunk
port trunk allow-pass vlan 20
int g0/0/3
port link-type trunk
port trunk allow-pass vlan 10
int g0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20 30
 SW4
sys
sys sw1
un info en
vlan 20
int g0/0/2
port link-type acc
port de vlan 20
int g0/0/1
port link-type trunk
port trunk allow-pass vlan 20
int g0/0/3
port link-type trunk
port trunk allow-pass vlan 20
路由器IP及三层交换机vlanif 的配置
R1
sys
sys r1
un info en
int g0/0/0
ip add 12.1.1.1 24
int g0/0/1
ip add 13.1.1.1 24
q
int LoopBack 0
ip add 8.8.8.8 32
q
sw2
int vlanif 10
ip add 192.168.10.252 24
int vlanif 20
ip add 192.168.20.252 24
int vlanif 30
ip add 12.1.1.2 24
sw3
int vlanif 10
ip add 192.168.10.253 24
int vlanif 20
ip add 192.168.20.253 24
int vlanif 30
ip add 13.1.1.3 24
ospf 配置
R1
ospf 1 router-id 1.1.1.1
area 0
network 8.8.8.8 0.0.0.0
network 12.1.1.0 0.0.0.255
network 13.1.1.0 0.0.0.255
q
q
sw2
ospf 1 router-id 2.2.2.2
area 0
network 192.168.10.0 0.0.0.255
network 192.168.20.0 0.0.0.255
network 12.1.1.0 0.0.0.255
q
q
sw3
ospf 1 router-id 3.3.3.3
area 0
network 192.168.10.0 0.0.0.255
network 192.168.20.0 0.0.0.255
network 13.1.1.0 0.0.0.255
q
q
接下来我们需要先配置一个MSTP,华为默认就是MSTP,我们需要给VLAN 10 和 VLAN 20分别分配一个实例
 --接下来我们需要先配置一个MSTP,华为默认就是MSTP,我们需要给VLAN 10 和 VLAN 20分别分配一个实例,我不知道MSTP好像就是一个实例一棵树,如果是RSTP哪些就一个VLAN一棵树,这里用MSTP的原因就是如果以后要扩展会比较方便罢了!
SW1:
stp region-configuration  //进入配置模式中
region-name QIU //域名为QIU,这个倒是无所谓,配不配都可以,配了就要一样!
instance 10 vlan 10  //指定VLAN 10的实例为10
instance 20 vlan 20  //指定VLAN 20的实例为20
active region-configuration  //激活实例配置,如果不激活就没有用!
SW2:设置实例10的优先级为主根  ,设置实例20的优先级为次根
stp region-configuration
region-name QIU
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
q
stp instance 10 root primary 
stp instance 20 root secondary  
SW3:
stp region-configuration
region-name QIU
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
quit
stp instance 10 root secondary
stp instance 20 root primary
SW4:
stp region-configuration
region-name QIU
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
  --上面配置完MSTP实例后还配置了优先级,这里要强调的是如果是cisco就最好不要用这种设置优先级的方式,因为这种方式并不是让优先级设置为0,而是在32768的基础上减4096,次根桥也是一样,在32768的基础上加4096,如果这样设置的话就会出现其他优先级高得交换机接进来就会出现拓扑重新计算收敛!
  --我们需要看MSPT的效果图:
display stp brief
上面所有的配置可以算基本配置了,接下来就是//配置vrrp虚拟IP地址(没有子网掩码)和BFD配置跟踪上游接口,down掉后优先级将削减50
SW2:
interface Vlanif10
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 110
interface Vlanif20
vrrp vrid 20 virtual-ip 192.168.20.254  
vrrp vrid 10 track interface GigabitEthernet 0/0/1 reduced 50  
SW3:
interface Vlanif10
vrrp vrid 10 virtual-ip 192.168.10.254
interface Vlanif20
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 10 priority 110
vrrp vrid 20 track interface GigabitEthernet 0/0/1 reduced 50
--上面我们的VRRP就已经配置完成,比如说SW1和SW2之间的链路挂掉了可以走SW1-SW3,SW1-3挂掉了可以走SW1-4,那如果SW4挂掉了那就没辙了!这些都是内部的冗余,那如果是SW2上游接口挂掉了呢?我们也配置了跟踪,那如果是R1的接口down了那,那VRRP就真没辙了,所以就需要用到BFD!BFD的作用就是两端建立邻居,并互相监听对方是否存活!可以调用到VRRP中!
SW2
bfd    //需要先打开bfd
quit
bfd 10 bind peer-ip 12.1.1.1 source-ip 12.1.1.2 auto    //创建一个bfd为10 的邻居的会话,指定目 12.1.1.1 的和源IP 12.1.1.2,auto是随机生成编号的意思
interface Vlanif 10
vrrp vrid 10 track bfd-session session-name 10 reduced 50    //调用为10的BFD,down掉的话将削减50优先级
SW3:
bfd
quit
bfd 20 bind peer-ip 13.1.1.1 source-ip 13.1.1.3 auto
interface Vlanif 20
vrrp vrid 20 track bfd-session session-name 20 reduced 50
R1:
bfd
quit
bfd 10 bind peer-ip 12.1.1.2 source-ip 12.1.1.1 auto    //R1也需要和SW2-3之间建立BFD邻居
quit
bfd 20 bind peer-ip 13.1.1.3 source-ip 13.1.1.1 auto
q
  --上面就是BFD的建立和调用过程了
整个VRRP和BFD就已经部署完成了,针对内部网络的MSTP收敛太慢?简单进行优化一下
SW1:
stp bpdu-protection  //开启BPDU保护
interface GigabitEthernet 0/0/2
stp edged-port enable  //开启边缘端口
port-security enable  //开启端口安全
port-security protect-action shutdown  //违规触发动作为shutdown
port-security max-mac-num 5      //设置接口最大MAC学习数量
port-security mac-address sticky    //设置安全类型为黏贴
port-security aging-time 1440      //设置MAC表老化时间为1天
SW4:
stp bpdu-protection
interface GigabitEthernet 0/0/2
stp edged-port enable
port-security enable
port-security protect-action shutdown
port-security max-mac-num 5
port-security mac-address sticky
port-security aging-time 1440
 
 --这样接入层的配置的优化已经整完了
常用查看命令:
display stp brief
dis bfd session all
[SW3]display stp region-configuration 查看MST的相关参数
其他补充*****************
边缘端口
作用原理:当边缘端口配置了BPDU保护以后,边缘端口在收到BPDU以后,该接口会进入err-down,端口角色变成DP,端口状态变成discarding
恢复:
1、手动,在接口视图下undo shutdown
2、自动,[Huawei]error-down auto-recovery cause bpdu-protection interval 30//由于BPDU保护所致的err-down状态会在30s后自动恢复up
命令:
1、[Huawei]stp edged-port default 全局开启边缘端口
2、[Huawei-GigabitEthernet0/0/2]stp edged-port enable 接口开启边缘端口
3、[Huawei]stp bpdu-protection 全局开启BPDU保护功能,只针对边缘端口有效
根保护
作用对象:所有的普通端口,
作用原理:如果一个接口没有开启边缘端口,那么这个接口就无法使用BPDU保护来防止STP攻击;根保护功能可以强制一个接口永远是指定端口,防止周围的交换机成为根桥。当一个接口开启根保护以后,一旦收到了更优的BPDU,那么接口角色不变,接口状态变为discarding。
注意:根保护只能给DP角色配置,不能给RP角色配置
恢复:当接口不在收到更优的BPDU之后,将会进入到正常的STP收敛过程,理论上经过2个转发时延恢复转发状态
命令:[Huawei-GigabitEthernet0/0/2]stp root-protection //根保护只能在接口视图下配置
环路保护
现象:在已经形成环路的交换网络中,由于网络延时或者单向故障,导致一个根端口无法收到上游发来的BPDU,那么接口将老化后变为DP角色,并且变成转发状态
作用:为了防止这种环路,对根端口开启环路保护后,在无法收到上游的BPDU后,该端口会变成DP角色,并且保持discarding状态
环路保护可以在RP和AP端口开启
恢复:当接口收到上游BPDU后,会立刻恢复正常的STP收敛结果
命令:[SW8-GigabitEthernet0/0/1]stp loop-protection 在接口下开启环路保护
4、TC-BPDU保护
现象:运行STP的交换机,在默认收到TC-BPDU后,会删除MAC地址表和ARP表项
作用:防止TC-BPDU共攻击
命令:[HUAWEI-GigabitEthernet0/0/1] stp tc-restriction enable 接口下开启TC-BPDU保护功能
[HUAWEI] stp tc-protection interval 10 开启TC-BPDU保护,在10秒钟以内对TC的操作频率
[HUAWEI] stp tc-protection threshold 5 操作频率为5次
以上3条命令含义:在全局下定义了处理TC-BPDU的频次为每10秒钟处理5次,然后再在接口下开启该功能,意味着这个接口在收到TC-BPDU后,只能每10秒处理5个

 仅供个人学习使用,禁止其他用途,因用户自身造成一切问题与本站无关,版权归原作者所有,本站不承担技术及版权问题,如有侵犯您的权益请联系我删除

  • 4
    点赞
  • 44
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值