TEL:
华为交换机 HCDP实验 BFD基础配置(静态路由备份)
| 发布时间: 2019-06-10 21:16:19 | 1542 次浏览

一、实验拓扑实验拓扑比较容易理解,一主一备两条广域网链路,连接两台PC


二、基础实验配置R1的基础配置

#
interface Vlanif1
ip address 192.168.10.1 255.255.255.0
#
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
ip address 102.1.1.1 255.255.255.0 
#
ip route-static 192.168.20.0 255.255.255.0 102.1.1.2
ip route-static 192.168.20.0 255.255.255.0 12.1.1.2 preference 100
#



R2的基础配置
#
interface Vlanif1
ip address 192.168.20.1 255.255.255.0 
#
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0 
#
interface GigabitEthernet0/0/1
ip address 102.1.1.2 255.255.255.0 
#
ip route-static 192.168.10.0 255.255.255.0 102.1.1.1
ip route-static 192.168.10.0 255.255.255.0 12.1.1.1 preference 100

#
三、测试现况(未使能BFD)移除HUB2和HUB3之间的链路,发现在PC间的通信中断,因为静态路由不能进行收敛
PC>ping 192.168.20.20

Ping 192.168.20.20: 32 data bytes, Press Ctrl_C to break

Request timeout!

Request timeout!

Request timeout!

Request timeout!

Request timeout!

--- 192.168.20.20 ping statistics ---

  5 packet(s) transmitted

  0 packet(s) received

  100.00% packet loss


四、 配置BFD功能实现静态路由的备份功能


这里BFD有两种方式:手工方式 或 自动方式,配置时二选一即可

如果是手工方式,R1配置如下


bfd

bfd manual001 bind peer-ip 102.1.1.2 source-ip 102.1.1.1

discriminator local 100

discriminator remote 200

min-tx-interval 500

min-rx-interval 500

commit

如果是手工方式,R2配置如下

bfd 

bfd manual001 bind peer-ip 102.1.1.1 source-ip 102.1.1.2

discriminator local 200

discriminator remote 100

min-tx-interval 500

min-rx-interval 500

commit

查看BFD会话的命令
[AR2]dis bfd session all 

--------------------------------------------------------------------------------

Local Remote     PeerIpAddr      State     Type        InterfaceName            

--------------------------------------------------------------------------------

200   100        102.1.1.1       Up        S_IP_PEER         -                  

--------------------------------------------------------------------------------

     Total UP/DOWN Session Number : 1/0



(和手工二选一)如果是自动方式配置BFD,R1配置如下
bfd 

bfd testauto bind peer-ip 102.1.1.2 source-ip 102.1.1.1 auto

min-tx-interval 500

min-rx-interval 500

commit



(和手工二选一)如果是自动方式配置BFD,R2配置如下
bfd

bfd testauto bind peer-ip 102.1.1.1 source-ip 102.1.1.2 auto

min-tx-interval 500

min-rx-interval 500

commit



检查的命令如下
[AR2]dis bfd session dynamic 

--------------------------------------------------------------------------------

Local Remote     PeerIpAddr      State     Type        InterfaceName            

--------------------------------------------------------------------------------

8193  8192       102.1.1.1       Up        S_AUTO_PEER       -                  

--------------------------------------------------------------------------------

     Total UP/DOWN Session Number : 1/0




五、配置路由调用BFDR1的配置
[AR1]ip route-static 192.168.20.0 24 102.1.1.2 track bfd-session manual001

R2的配置
[AR2]ip route-static 192.168.10.0 24 102.1.1.1 track bfd-session manual001


六、测试网络备份能力在PC上发起PING包并且同时中断HUB2和HUB3之间的连线,观察PING的情况如下(只有一个丢包)
PC>ping 192.168.20.20 -c 20Ping 192.168.20.20: 32 data bytes, Press Ctrl_C to break

From 192.168.20.20: bytes=32 seq=1 ttl=126 time=31 ms

From 192.168.20.20: bytes=32 seq=2 ttl=126 time=16 ms

From 192.168.20.20: bytes=32 seq=3 ttl=126 time=15 ms

From 192.168.20.20: bytes=32 seq=4 ttl=126 time=15 ms

From 192.168.20.20: bytes=32 seq=5 ttl=126 time=15 ms

From 192.168.20.20: bytes=32 seq=6 ttl=126 time=15 ms

Request timeout!

From 192.168.20.20: bytes=32 seq=8 ttl=126 time=31 ms

From 192.168.20.20: bytes=32 seq=9 ttl=126 time=16 ms

From 192.168.20.20: bytes=32 seq=10 ttl=126 time=16 ms

观察静态路由表发现主链路因BFD失效变成了inactive
[AR1]dis ip routing-table protocol static 

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Public routing table : Static

         Destinations : 1        Routes : 2        Configured Routes : 2

Static routing table status : <Active>

         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

   192.168.20.0/24  Static  100  0          RD   12.1.1.2        GigabitEthernet0

/0/0

Static routing table status : <Inactive>

         Destinations : 1        Routes : 1

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

   192.168.20.0/24  Static  60   0          R    102.1.1.2       GigabitEthernet0

/0/1

[AR1]