Loading

华为VRRP+BFD配置

!!这个笔记有点儿乱,能看懂就好,看不懂在看看其他博主的把。。。
 
网络拓扑图:

 

·--我们先把基本的网络配置先配置完成才能完成VRRP的配置:
SW1:
vlan batch 10 20
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
  SW4:
vlan batch 10 20
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
SW3:
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/1
port link-type access
port default vlan 30
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
interface Vlanif30
ip address 13.1.1.3 255.255.255.0
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 192.168.10.253 0.0.0.0
network 192.168.20.253 0.0.0.0
network 13.1.1.3 0.0.0.0
SW2:
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet0/0/1
port link-type access
port default vlan 30
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
interface Vlanif30
ip address 12.1.1.2 255.255.255.0
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 192.168.10.252 0.0.0.0
network 192.168.20.252 0.0.0.0
network 12.1.1.2 0.0.0.0
R1:
interface GigabitEthernet0/0/1
ip address 13.1.1.1 255.255.255.0
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
interface LoopBack0
ip address 8.8.8.8 255.255.255.255
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 8.8.8.8 0.0.0.0
network 12.1.1.1 0.0.0.0
network 13.1.1.1 0.0.0.0
  --前面基本配置请配置完毕,上面我把命令已经放上面了,可以自己刷,如果想要自己敲就最好不要刷,自己敲的记忆才能更加深刻!
  --接下来我们需要先配置一个MSTP,华为默认就是MSTP,我们需要给VLAN 10 和 VLAN 20分别分配一个实例,我不知道MSTP好像就是一个实例一棵树,如果是RSTP哪些就一个VLAN一棵树,这里用MSTP的原因就是如果以后要扩展会比较方便罢了!
SW1:
stp region-configuration  //进入配置模式中
region-name RR //域名为RR,这个倒是无所谓,配不配都可以,配了就要一样!
instance 10 vlan 10  //指定VLAN 10的实例为10
instance 20 vlan 20  //指定VLAN 20的实例为20
active region-configuration  //激活实例配置,如果不激活就没有用!
 
SW2:
stp region-configuration
region-name RR
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
stp instance 10 root primary //设置实例10的优先级为主根
stp instance 20 root secondary  //设置实例20的优先级为次根
SW3:
stp region-configuration
region-name RR
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 RR
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
  --上面配置完MSTP实例后还配置了优先级,这里要强调的是如果是cisco就最好不要用这种设置优先级的方式,因为这种方式并不是让优先级设置为0,而是在32768的基础上减4096,次根桥也是一样,在32768的基础上加4096,如果这样设置的话就会出现其他优先级高得交换机接进来就会出现拓扑重新计算收敛!我们华为倒是无所谓,这样设置主根是0,次根是4096,默认就这样,不过无论哪个模拟器,都建议修改优先级而不是设置主根得方式!我们这里只是为了方便偷懒
  --我们需要看MSPT的效果图:
SW1:
SW4:
  --上面所有的配置可以算基本配置了,接下来就是配置VRRP和BFD了
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虚拟IP地址!
vrrp vrid 10 track interface GigabitEthernet 0/0/1 reduced 50  //配置跟踪上游接口,down掉后优先级将削减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 的邻居的会话,指定目的和源IP,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 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
  --上面就是BFD的建立和调用过程了,你们可以自己试试现在讲R1的g0/0/0口down掉看看会发生什么把!我这里就不放效果图了,结果肯定是SW2的VLAN 10由活动路由器变成了被封路由器,由SW3的VLAN 10成为活动路由器!PC1之后就会走SW3了去8.8.8.8或12.1.1.2了!
  --其实不仅由BFD协议还有一个nqa的协议也可以做到,他不需要两端都建立邻居,只需要SW2自己建立邻居就可以监听R1的链路情况!我们这里就只讲BFD,NQA以后看看什么时候讲把,BFD还有一个好处就是OSPF也可以调用他!比如说2个路由器之间建立邻居关系,中间夹着一个交换机,如果交换机的某个接口down掉了,两个路由器需要等40s后邻居才能够失效,而如果两个路由器之间是纯直连的那么她两某个接口dow掉邻居就会立刻失效,这个是OSPF一个机制!而我们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
 
 
 --这样接入层的配置的优化已经整完了,这里我们就真的结束了。。。其实还有TC保护、根保护一堆乱七八糟的的东西,这里就不配置了,本来就是只像配置VRRP和BFD的,我有点憨憨了。。。
 --另外测试这方面你们自己可以去测试,测试总应该会把。。
 --算了写个测试结果:
  1、当SW1-2之间的链路down掉后,将走SW3,或者走SW4在到SW3
  2、当SW1-3之间的链路down掉后,将走SW4在到SW3
  3、当SW1-4之间的链路down掉后那就母的办法了!
  4、当SW2-3上游g0/0/1口down后优先级将削减50
  5、当R1和SW2-3的本地接口down掉后SW2-3也将削减50
 --其实还不止这些链路,还有其他的,要看他down掉哪一根线了,这个拓扑图很经典的,其实还可以配置更多的东西和优化。。。
 
 
 
 
 
 
 
 
 
posted @ 2020-11-01 10:27  忽如一夜春风来~  阅读(2565)  评论(0编辑  收藏  举报