BFD+VRRP+MSTP+DHCP综合实验

似梦清欢
• 阅读 79

BFD+VRRP+MSTP+DHCP综合实验

网关设备链路聚合和VLAN放行:
[SW1]int Eth-Trunk 12
[SW1-Eth-Trunk12]mode lacp-static
[SW1-Eth-Trunk12]trunkport gi 0/0/3 0/0/4
[SW1]vlan batch 10 20 30 40 
[SW2]int Eth-Trunk 12
[SW2-Eth-Trunk12]mode lacp-static
[SW2-Eth-Trunk12]trunkport gi 0/0/3 0/0/4
[SW2]vlan batch 10 20 30 40 


交换机终端接口VLAN配置:
[SW3-GigabitEthernet0/0/3]port link-type access     
[SW3-GigabitEthernet0/0/3]port default vlan 10    
[SW3-GigabitEthernet0/0/4]port link-type access     
[SW3-GigabitEthernet0/0/4]port default vlan 20
[SW4-GigabitEthernet0/0/3]port link-type access     
[SW4-GigabitEthernet0/0/3]port default vlan 30    
[SW4-GigabitEthernet0/0/4]port link-type access     
[SW4-GigabitEthernet0/0/4]port default vlan 40


交换机上联接口VLAN配置:
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]undo port trunk allow-pass vlan 1
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 30 40
[SW1-GigabitEthernet0/0/2]port link-type trunk
[SW1-GigabitEthernet0/0/2]undo port trunk allow-pass vlan 1
[SW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20 30 40
[SW1-Eth-Trunk12]port link-type trunk
[SW1-Eth-Trunk12]undo port trunk allow-pass vlan 1
[SW1-Eth-Trunk12]port trunk allow-pass vlan 10 20 30 40
其他交换机的互联接口都做相同配置


MSTP域配置:
[SW1]stp region-configuration      
[SW1-mst-region]region-name Huawei
[SW1-mst-region]revision-level 12
[SW1-mst-region]instance 10 vlan 10 30        实例映射VLAN 
[SW1-mst-region]instance 20 vlan 20 40        实例映射VLAN               
[SW1-mst-region]active region-configuration         激活域配置
所有交换价都在同一个域中,域配置相同

使用根桥优先级选举根桥和备根桥
[SW1]stp instance 10 root primary       指定实例10中SW1为最优先设备(根桥)
[SW1]stp instance 20 root secondary     指定实例20中SW1为第二优先设备(备根桥)
[SW2]stp instance 20 root primary       指定实例20中SW2为最优先设备(根桥) 
[SW2]stp instance 10 root secondary     指定实例10中SW2为第二优先设备(备根桥)    

四台交换机的MSTP端口: BFD+VRRP+MSTP+DHCP综合实验

BFD+VRRP+MSTP+DHCP综合实验

BFD+VRRP+MSTP+DHCP综合实验

BFD+VRRP+MSTP+DHCP综合实验

SW1、SW2做VRRP:
[SW1]int Vlanif 10    
[SW1-Vlanif10]ip address 192.168.1.100 24    
[SW1]int Vlanif 20    
[SW1-Vlanif20]ip address 192.168.2.100 24    
[SW1]int Vlanif 30    
[SW1-Vlanif30]ip address 192.168.3.100 24    
[SW1]int Vlanif 40
[SW1-Vlanif40]ip address 192.168.4.100 24

[SW2]int Vlanif 10
[SW2-Vlanif10]ip address 192.168.1.200 24    
[SW2]int Vlanif 20    
[SW2-Vlanif20]ip address 192.168.2.200 24    
[SW2]int Vlanif 30    
[SW2-Vlanif30]ip address 192.168.3.200 24    
[SW2]int Vlanif 40
[SW2-Vlanif40]ip address 192.168.4.200 24


为和MSTP保持一致,在vlanif10、vlanif30中,SW1做VRRP的master,在vlanif20、vlanif40中,SW2做VRRP的master:
[SW1-Vlanif10]vrrp vrid 10 virtual-ip 192.168.1.254    vrid 10组内的所有VRRP设备虚拟IP相同
[SW1-Vlanif10]vrrp vrid 10 priority 120      vlanif 10中更改优先级将SW1设置为VRRP master设备
[SW2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.1.254

[SW1-Vlanif20]vrrp vrid 20 virtual-ip 192.168.2.254    vrid 20组内的所有VRRP设备虚拟IP相同
[SW2-Vlanif20]vrrp vrid 20 virtual-ip 192.168.2.254
[SW2-Vlanif20]vrrp vrid 20 priority 120      vlanif 10中更改优先级将SW1设置为VRRP master设备

[SW1-Vlanif30]vrrp vrid 30 virtual-ip 192.168.3.254 
[SW1-Vlanif30]vrrp vrid 30 priority 120      vlanif 30中更改优先级将SW1设置为VRRP master设备
[SW2-Vlanif30]vrrp vrid 30 virtual-ip 192.168.3.254

[SW1-Vlanif40]vrrp vrid 40 virtual-ip 192.168.4.254
[SW2-Vlanif40]vrrp vrid 40 virtual-ip 192.168.4.254
[SW2-Vlanif40]vrrp vrid 40 priority 120      vlanif 40中更改优先级将SW2设置为VRRP master设备

SW1和SW2的VRRP配置效果: BFD+VRRP+MSTP+DHCP综合实验

BFD+VRRP+MSTP+DHCP综合实验

终端地址使用DHCP配置:(只对PC1做DHCP配置)
[SW1]ip pool vlan10     SW1上配置地址池vlan10
[SW1-ip-pool-vlan10]gateway-list 192.168.1.254     虚拟地址网关
[SW1-ip-pool-vlan10]network 192.168.1.0 mask 24
[SW1-ip-pool-vlan10]excluded-ip-address 192.168.1.100     排除已使用的虚拟接口地址
[SW1-ip-pool-vlan10]excluded-ip-address 192.168.1.200     排除已使用的虚拟接口地址
[SW1-ip-pool-vlan10]excluded-ip-address 192.168.1.151 192.168.1.253    排除一段IP
Error:Some of addresses not be excluded are not idle,or not in the pool.
上述报错提示已经有IP在排除的列表中,不需要再次排除(即192.168.1.200),但dis th查看命令仍可以生效
[SW2]ip pool vlan10
[SW2-ip-pool-vlan10]gateway-list 192.168.1.254
[SW2-ip-pool-vlan10]network 192.168.1.0 mask 24
[SW2-ip-pool-vlan10]excluded-ip-address 192.168.1.100
[SW2-ip-pool-vlan10]excluded-ip-address 192.168.1.200
[SW2-ip-pool-vlan10]excluded-ip-address 192.168.1.0 192.168.1.150
上述配置后,SW1和SW2互为DHCP主备服务器,下发IP时不会发生IP冲突,但是可用网络数减少

启用DHCP功能:
[SW1]dhcp enable    
[SW1]int Vlanif 10
[SW1-Vlanif10]dhcp select global 
[SW2]dhcp enable     
[SW2]int Vlanif 10
[SW2-Vlanif10]dhcp select global 

BFD+VRRP+MSTP+DHCP综合实验 ::: warning 如果SW1和SW3的链路断开,SW3从SW2处获取IP信息。由于SW1并未失效,SW1仍为VRRP master设备,SW2为VRRP的backup设备,SW2会将DHCP请求发给SW1,由SW1下发DHCP信息后,经过SW2转发给SW3并下发到终端PC1。 :::

BFD快速收敛配置:(只对VLAN10做快速收敛配置)
[AR1-GigabitEthernet0/0/0]ip ad 10.1.11.254 24
[SW1]vlan 1000       新建和AR1连接的VLAN
[SW1-GigabitEthernet0/0/5]port link-type access     
[SW1-GigabitEthernet0/0/5]port default vlan 1000
[SW1-Vlanif1000]ip ad 10.1.11.1 24
[SW2]vlan 2000         新建和AR1连接的VLAN
[SW2-GigabitEthernet0/0/5]port link-type access     
[SW2-GigabitEthernet0/0/5]port default vlan 2000
[SW2-Vlanif2000]ip ad 10.1.22.2 24

[AR1]ip route-static 192.168.1.0 24 10.1.11.1
[AR2]ip route-static 192.168.1.0 24 10.1.22.2
[SW1]ip route-static 100.1.1.1 32 10.1.11.254
[SW2]ip route-static 100.1.1.1 32 10.1.22.254
检测VRRP主设备的上行链路
VRRP主设备SW1做动态BFD检测:
[SW1]bfd
[SW1]bfd AR1 bind peer-ip 10.1.11.254 source-ip 10.1.11.1 auto    BFD会话名为检测对象AR1
[SW1-bfd-session-ar1]min-tx-interval 200
[SW1-bfd-session-ar1]min-rx-interval 200
[SW1-bfd-session-ar1]detect-multiplier 4      即800ms后可以检测到链路故障
AR1做同样的配置(双向会话):
[AR1]bfd SW1 bind peer-ip 10.1.11.1 source-ip 10.1.11.254 auto
[AR1-bfd-session-ar1]min-tx-interval 200
[AR1-bfd-session-ar1]min-rx-interval 200
[AR1-bfd-session-ar1]detect-multiplier 4

BFD会话AR1建立成功: BFD+VRRP+MSTP+DHCP综合实验 如果BFD会话AR1状态由UP变为DOWN,表示SW1的上行链路失效,BFD会降低SW1优先级,使得自己变为备设备,另一台备设备变为主设备。

[SW1]int Vlanif 10       vlanif10中,SW1为主设备
[SW1-Vlanif10]vrrp vrid 10 track bfd-session session-name AR1 reduced 30
在vrid 10组中,检测BFD会话AR1,如果会话AR1状态DOWN,优先级降低30,(变为备设备)

BFD+VRRP+MSTP+DHCP综合实验 断开AR1——SW1链路,SW2立刻变为主设备: BFD+VRRP+MSTP+DHCP综合实验 恢复AR1——SW1链路后,需要等待30s MSTP生成树收敛时间,优先级高的SW1会重新变为主设备,SW2变为备设备。(VRRP也需要等待收敛)

检测VRRP下行链路失效
[SW2]bfd    
[SW2]bfd SW1 bind peer-ip 192.168.1.100 source-ip 192.168.1.200 auto    BFD会话名为检测对象SW1,检测使用vlanif 10的地址
[SW2-bfd-session-sw1]min-tx-interval 200
[SW2-bfd-session-sw1]min-rx-interval 200
[SW2-bfd-session-sw1]detect-multiplier 4
SW1做同样的配置(双向会话):
[SW1]bfd SW2 bind peer-ip 192.168.1.200 source-ip 192.168.1.100 auto 
[SW1-bfd-session-sw1]min-tx-interval 200
[SW1-bfd-session-sw1]min-rx-interval 200
[SW1-bfd-session-sw1]detect-multiplier 4

[SW2]int Vlanif 10       vlanif10中,SW2为备设备
[SW2-Vlanif10]vrrp vrid 10 track bfd-session session-name SW1 increased 30
在vrid 10组中,检测BFD会话SW1,如果会话SW1状态DOWN,优先级提高30,(变为主设备)

::: warning 优先级降低一定是在原本优先级较高的设备(主设备)上做。 优先级提高一定是在原本优先级较低的设备(备设备)上做。 ::: 备设备SW2 VRRP状态: BFD+VRRP+MSTP+DHCP综合实验 如上,BFD会话SW1正常UP时,运行优先级和配置优先级相同。 将SW1的vlanif10 shutdown: BFD+VRRP+MSTP+DHCP综合实验 如上,BFD会话SW1 DOWN时,运行优先级比配置优先级提高30。


如上配置后,PC1连续访问路由器环回口100.1.1.1时,断掉AR1——SW1的链路,恢复AR1——SW1的链路,均不会出现丢包(或出现极少量丢包)现象。

点赞
收藏
评论区
推荐文章

暂无数据

似梦清欢
似梦清欢
Lv1
学海无涯
文章
17
粉丝
17
获赞
1