Table of contents
Experiment 6-2 BFD and OSPF linkage configuration experiment
Step 1. IP addressing and basic configuration
Experiment 6-2 BFD and OSPF linkage configuration experiment
Experimental objectives
Master the quick configuration of BFD in OSPF environment
Topology
Scenes
The two routers R1 and R2 are connected to each other through S1, and their respective interfaces are running in OSPF area 0. Since the interfaces are not directly connected, if one of the interfaces is down, the other will not immediately notice it. It needs to wait four times the hello time to delete the neighbor. During this time, data forwarding will be in an abnormal state. In this scenario, BFD can be used to speed up OSPF convergence.
Learning tasks
Step 1. IP addressing and basic configuration
Configure IP address information for all routers.
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 10.0.12.1 24
[R1-GigabitEthernet0/0/1]quit
[R1]interface loopback 0
[R1-LoopBack0]ip address 10.0.1.1 32
[R1-LoopBack0]quit
After configuring the address, check it immediately on each router.
[R1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(E): E-Trunk down
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 9
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 9
Interface IP Address/Mask Physical Protocol
Cellular0/0/0 unassigned down down
Cellular0/0/1 unassigned down down
GigabitEthernet0/0/0 unassigned *down down
GigabitEthernet0/0/1 10.0.12.1/24 up up
GigabitEthernet0/0/2 unassigned *down down
GigabitEthernet0/0/3 unassigned *down down
LoopBack0 10.0.1.1/32 up up(s)
NULL0 unassigned up up(s)
Serial1/0/0 unassigned *down down
Serial2/0/0 unassigned *down down
Serial3/0/0 unassigned *down down
Serial4/0/0 unassigned *down down
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]ip address 10.0.12.2 24
[R2-GigabitEthernet0/0/1]quit
[R2]interface loopback 0
[R2-LoopBack0]ip address 10.0.2.2 32
[R2-LoopBack0]quit
[R2]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
(E): E-Trunk down
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 10
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 10
Interface IP Address/Mask Physical Protocol
Cellular0/0/0 unassigned down down
Cellular0/0/1 unassigned down down
Ethernet4/0/0 unassigned *down down
Ethernet4/0/1 unassigned *down down
GigabitEthernet0/0/0 unassigned *down down
GigabitEthernet0/0/1 10.0.12.2/24 up up
GigabitEthernet0/0/2 unassigned *down down
GigabitEthernet0/0/3 unassigned *down down
LoopBack0 10.0.2.2/32 up up(s)
NULL0 unassigned up up(s)
Serial1/0/0 unassigned *down down
Serial2/0/0 unassigned *down down
Serial3/0/0 unassigned *down down
Check connectivity from R1 to R2:
[R1]ping 10.0.12.2
PING 10.0.12.2: 56 data bytes, press CTRL_C to break
Request time out
Reply from 10.0.12.2: bytes=56 Sequence=2 ttl=255 time=1 ms
Reply from 10.0.12.2: bytes=56 Sequence=3 ttl=255 time=1 ms
Reply from 10.0.12.2: bytes=56 Sequence=4 ttl=255 time=1 ms
Reply from 10.0.12.2: bytes=56 Sequence=5 ttl=255 time=1 ms
--- 10.0.12.2 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 1/1/1 ms
Step 2. OSPF configuration
According to the topology, interfaces of routers R1 and R2, including loopback interface 0, are assigned to OSPF area 0:
[R1]ospf 1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 10.0.1.1 0.0.0.0
[R1-ospf-1-area-0.0.0.0]quit
[R1-ospf-1]quit
[R2]ospf 1
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 10.0.12.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 10.0.2.2 0.0.0.0
[R2-ospf-1-area-0.0.0.0]quit
[R2-ospf-1]quit
Check OSPF interface status and neighbor status:
[R1]display ospf interface
OSPF Process 1 with Router ID 10.0.12.1
Interfaces
Area: 0.0.0.0 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
10.0.12.1 Broadcast BDR 1 1 10.0.12.2 10.0.12.1
10.0.1.1 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
[R2]display ospf interface
OSPF Process 1 with Router ID 10.0.12.2
Interfaces
Area: 0.0.0.0 (MPLS TE not enabled)
IP Address Type State Cost Pri DR BDR
10.0.12.2 Broadcast DR 1 1 10.0.12.2 10.0.12.1
10.0.2.2 P2P P-2-P 0 1 0.0.0.0 0.0.0.0
Check OSPF neighbor status:
[R1]display ospf peer brief
OSPF Process 1 with Router ID 10.0.12.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 10.0.12.2 Full
----------------------------------------------------------------------------
Total Peer(s): 1
[R2]display ospf peer brief
OSPF Process 1 with Router ID 10.0.12.2
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 10.0.12.1 Full
----------------------------------------------------------------------------
Total Peer(s): 1
The neighbor is already in the Full state, and the OSPF configuration is complete.
Step 3. Configure BFD session
You need to enable BFD globally in the system, and enable linkage BFD in the OSPF view.
[R1]bfd
[R1-bfd]quit
[R1]ospf 1
[R1-ospf-1]bfd all-interfaces enable
[R1-ospf-1]quit
[R2]bfd
[R2-bfd]quit
[R2]ospf 1
[R2-ospf-1]bfd all-interfaces enable
[R2-ospf-1]quit
Check the BFD session status after both ends are configured:
[R1]display bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
8192 8192 10.0.12.2 Up D_IP_IF GigabitEthernet0/0/1
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
[R2]display bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
8192 8192 10.0.12.1 Up D_IP_IF GigabitEthernet0/0/1
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
[R1]display ospf bfd session all
OSPF Process 1 with Router ID 10.0.12.1
Area 0.0.0.0 interface 10.0.12.1(GigabitEthernet0/0/1)'s BFD Sessions
NeighborId:10.0.12.2 AreaId:0.0.0.0 Interface:GigabitEthernet0/0/1
BFDState:up rx :1000 tx :1000
Multiplier:3 BFD Local Dis:8192 LocalIpAdd:10.0.12.1
RemoteIpAdd:10.0.12.2 Diagnostic Info:No diagnostic information
To test the BFD effect, shut down the R2 interface:
[R2]interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1]shutdown
If the debug function is enabled on R1, if you observe the debug log on R1, the following content will appear:
<R1>debug ospf bfd
Sep 23 2016 03:39:25+00:00 R1 %%01BFD/4/STACHG_TODWN(l)[23]:BFD session changed to Down. (SlotNumber=0, Discriminator=8192, Diagnostic=DetectDown, Applications=OSPF, ProcessPST=False, BindInterfaceName=GigabitEthernet0/0/1, InterfacePhysicalState=Up, InterfaceProtocolState=Up)
<R1>
Sep 23 2016 03:39:25+00:00 R1 %%01OSPF/3/NBR_CHG_DOWN(l)[24]:Neighbor event:neighbor state changed to Down. (ProcessId=1, NeighborAddress=10.0.12.2, NeighborEvent=KillNbr, NeighborPreviousState=Full, NeighborCurrentState=Down)
<R1>
Sep 23 2016 03:39:25+00:00 R1 %%01OSPF/3/NBR_DOWN_REASON(l)[25]:Neighbor state leaves full or changed to Down. (ProcessId=1, NeighborRouterId=10.0.12.2, NeighborAreaId=0, NeighborInterface=GigabitEthernet0/0/1,NeighborDownImmediate reason=Neighbor Down Due to Kill Neighbor, NeighborDownPrimeReason=BFD Session Down, NeighborChangeTime=2016-09-23 03:39:25)
There are other related logs, which are omitted here, and the focus is on the third log above.
Re-enable the interface:
[R2-GigabitEthernet0/0/1]undo shutdown
Check the BFD session and OSPF neighbor relationship again:
[R1]display bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
8193 8193 10.0.12.2 Up D_IP_IF GigabitEthernet0/0/1
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
[R1]display ospf bfd session all
OSPF Process 1 with Router ID 10.0.12.1
Area 0.0.0.0 interface 10.0.12.1(GigabitEthernet0/0/1)'s BFD Sessions
NeighborId:10.0.12.2 AreaId:0.0.0.0 Interface:GigabitEthernet0/0/1
BFDState:up rx :1000 tx :1000
Multiplier:3 BFD Local Dis:8193 LocalIpAdd:10.0.12.1
RemoteIpAdd:10.0.12.2 Diagnostic Info:No diagnostic information
[R2]display bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
8193 8193 10.0.12.1 Up D_IP_IF GigabitEthernet0/0/1
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
[R2]display ospf bfd session all
OSPF Process 1 with Router ID 10.0.12.2
Area 0.0.0.0 interface 10.0.12.2(GigabitEthernet0/0/1)'s BFD Sessions
NeighborId:10.0.12.1 AreaId:0.0.0.0 Interface:GigabitEthernet0/0/1
BFDState:up rx :1000 tx :1000
Multiplier:3 BFD Local Dis:8193 LocalIpAdd:10.0.12.2
RemoteIpAdd:10.0.12.1 Diagnostic Info:No diagnostic information
BFD is re-established.
Configuration file reference
<R1>display current-configuration
[V200R007C00SPC600]
#
sysname R1
#
bfd
#
interface GigabitEthernet0/0/1
ip address 10.0.12.1 255.255.255.0
#
interface LoopBack0
ip address 10.0.1.1 255.255.255.255
#
ospf 1
bfd all-interfaces enable
area 0.0.0.0
network 10.0.1.1 0.0.0.0
network 10.0.12.0 0.0.0.255
#
return
<R2>display current-configuration
[V200R007C00SPC600]
#
sysname R2
#
bfd
#
interface GigabitEthernet0/0/1
ip address 10.0.12.2 255.255.255.0
#
interface LoopBack0
ip address 10.0.2.2 255.255.255.255
#
ospf 1
bfd all-interfaces enable
area 0.0.0.0
network 10.0.2.2 0.0.0.0
network 10.0.12.0 0.0.0.255
#
return