Routing Loop Generated When Routes Are Imported Between BGP and IS-IS Processes
As dynamic routing protocols, BGP and IS-IS are widely used on live networks. Mutual route import between BGP and IS-IS processes is often involved in networking solutions. If no correct routing policies are configured on the devices where routes are mutually imported between BGP and IS-IS processes to control the route advertisement direction, a Layer 3 routing loop may occur, compromising services.
Analysis of a Routing Loop Generated When Routes Are Imported Between BGP and IS-IS Processes
Applicable Products and Versions
Product Series |
Products |
Versions |
---|---|---|
All |
All |
Product versions based on VRPv5 and VRPv8 platforms |
Overview of Mutual Route Import Between BGP and IS-IS Processes
As dynamic routing protocols, BGP and IS-IS are widely used on live networks. Mutual route import between BGP and IS-IS processes is often involved in networking solutions. If no correct routing policies are configured on the devices where routes are mutually imported between BGP and IS-IS processes to control the route advertisement direction, a Layer 3 routing loop may occur, compromising services.
Typical Networking
On the network shown in Figure 1-1, DeviceA, DeviceB, DeviceE, and DeviceF belong to AS 65500, in which BGP runs; IS-IS runs on DeviceB, DeviceC, DeviceD, and DeviceE to calculate routes. DeviceB is configured to import BGP routes to the IS-IS routing table, whereas DeviceE is configured to import IS-IS routes to the BGP routing table. If no correct routing policies are configured on the devices where routes are imported between BGP and IS-IS processes, a routing loop may occur. For details about routing loop generation, see Detailed Introduction to Routing Loop Generation.
Fundamentals of Routing Loop Generation
Data Preparation
To complete the configurations in the preceding networking scenario, you need the following data.
Device Name |
Router ID |
AS Number/Process ID |
Interface Name |
---|---|---|---|
DeviceA |
1.1.1.1 |
BGP 65500 |
GE 0/1/0 Loopback 0 |
DeviceB (Device on which routes are imported between BGP and IS-IS processes) |
2.2.2.2 |
BGP 65500 |
GE 0/1/0 GE 0/3/0 Loopback 0 |
- |
IS-IS 1 |
GE 0/2/0 |
|
DeviceC |
- |
IS-IS 1 |
GE 0/1/0 GE 0/2/0 |
DeviceD |
- |
IS-IS 1 |
GE 0/1/0 GE 0/2/0 |
DeviceE (Device on which routes are imported between BGP and IS-IS processes) |
- |
IS-IS 1 |
GE 0/1/0 |
5.5.5.5 |
BGP 65500 |
GE 0/2/0 Loopback 0 |
Detailed Introduction to Routing Loop Generation
For details about the configuration data of each device, see Data Preparation and Improper MED Setting for Mutual Route Import. As shown in Figure 1-1, take DeviceA advertising a route 10.10.10.10/32 as an example. A continuous routing loop is formed through the following process:
Phase 1:
DeviceA is configured to import the static route 10.10.10.10/32 using the import-route static command in the BGP view and then advertises the route to DeviceB. An export policy is configured on DeviceA to set the MED value to 50 for the BGP route to be advertised. DeviceA's routes may be from other devices and have route costs. To simplify configuration and illustration, this example uses a static route and applies a routing policy to set the MED value. After receiving the BGP route 10.10.10.10/32 from DeviceA, Device B advertises the route to DeviceE. In addition, IS-IS 1 on DeviceB imports the BGP route, and then DeviceB advertises the route to DeviceC. In IS-IS 1, the route 10.10.10.10/32 is transmitted through the following devices in sequence: DeviceC -> DeviceD -> DeviceE.
Phase 2:
DeviceE receives the BGP route 10.10.10.10/32 from DeviceB, and also imports the IS-IS route sent by DeviceD into the BGP routing table. As the imported IS-IS route has a higher preference than the BGP route, DeviceE preferentially selects the route imported from the IS-IS process and advertises this route to DeviceB through BGP.
Phase 3:
DeviceB receives the BGP routes 10.10.10.10/32 from DeviceA and DeviceE. BGP compares the route attributes. As the MED value of the BGP route from DeviceE is 30, smaller than the MED value (50) of the BGP route from DeviceA, BGP preferentially selects the BGP route 10.10.10.10/32 from DeviceE.
Phase 4:
After the selected BGP route 10.10.10.10/32 on DeviceB is updated, IS-IS on DeviceB is triggered to import the BGP route, and then DeviceB advertises the route to DeviceC. In IS-IS 1, the route 10.10.10.10/32 is transmitted through the following devices in sequence: DeviceC -> DeviceD -> DeviceE. Then, DeviceE imports the IS-IS route to its BGP routing table and advertises the route back to DeviceB.
As a result, a continuous routing loop is formed.
Check the selected BGP route 10.10.10.10/32 on DeviceB. The following command output shows that the route from DeviceE is preferentially selected.
[~DeviceB] display bgp routing-table 10.10.10.10 BGP local router ID : 2.2.2.2 Local AS number : 65500 Paths: 2 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 10.10.10.10/32: From: 5.5.5.5 (5.5.5.5) Route Duration: 0d00h20m28s Relay IP Nexthop: 10.1.5.1 Relay IP Out-Interface: GigabitEthernet0/3/0 Original nexthop: 5.5.5.5 Qos information : 0x0 AS-path Nil, origin incomplete, MED 30, localpref 100, pref-val 0, valid, internal, best, select, pre 255, IGP cost 1 Advertised to such 1 peers: 1.1.1.1 BGP routing table entry information of 10.10.10.10/32: From: 1.1.1.1 (1.1.1.1) Route Duration: 0d00h05m31s Relay IP Nexthop: 10.1.1.1 Relay IP Out-Interface: GigabitEthernet0/1/0 Original nexthop: 1.1.1.1 Qos information : 0x0 AS-path Nil, origin incomplete, MED 50, localpref 100, pref-val 0, valid, internal, pre 255, IGP cost 1, not preferred for MED Not advertised to any peer yet |
Examples of Incorrect Configuration Causing Routing Loops
Improper MED Setting for Mutual Route Import
Device Name |
Configuration |
Problem |
---|---|---|
DeviceA |
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ip route-static 10.10.10.10 255.255.255.255 NULL0
#
route-policy cost permit node 10
apply cost 50
#
bgp 65500
router-id 1.1.1.1
peer 2.2.2.2 as-number 65500
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
import-route static
peer 2.2.2.2 enable
peer 2.2.2.2 route-policy cost export
#
ospf 10
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.1.0 0.0.0.255
#
ip route-static 10.10.10.10 255.255.255.255 NULL0
#
return
|
An export policy is applied on DeviceA to set the MED value to 50 for the BGP route to be advertised to DeviceB. DeviceB receives the BGP routes 10.10.10.10/32 from DeviceA and DeviceE. BGP compares the route attributes. As the MED value of the BGP route from DeviceE is 30, smaller than the MED value (50) of the BGP route from DeviceA, BGP preferentially selects the BGP route from DeviceE. |
DeviceB |
# interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.2.1 255.255.255.0 isis enable 1 # interface GigabitEthernet0/3/0 undo shutdown ip address 10.1.5.2 255.255.255.0 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # isis 1 is-level level-2 cost-style wide network-entity 10.0000.0000.0001.00 import-route bgp permit-ibgp # bgp 65500 router-id 2.2.2.2 peer 1.1.1.1 as-number 65500 peer 1.1.1.1 connect-interface LoopBack0 peer 5.5.5.5 as-number 65500 peer 5.5.5.5 connect-interface LoopBack0 # ipv4-family unicast undo synchronization peer 1.1.1.1 enable peer 5.5.5.5 enable peer 5.5.5.5 reflect-client # ospf 10 area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 10.1.1.0 0.0.0.255 network 10.1.5.0 0.0.0.255 # return |
|
DeviceE |
# interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.4.2 255.255.255.0 isis enable 1 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.5.1 255.255.255.0 # interface LoopBack0 ip address 5.5.5.5 255.255.255.255 # isis 1 is-level level-2 cost-style wide network-entity 10.0000.0000.0004.00 # bgp 65500 router-id 5.5.5.5 peer 2.2.2.2 as-number 65500 peer 2.2.2.2 connect-interface LoopBack0 # ipv4-family unicast undo synchronization import-route isis 1 peer 2.2.2.2 enable # ospf 10 area 0.0.0.0 network 5.5.5.5 0.0.0.0 network 10.1.5.0 0.0.0.255 # return |
- |
Examples of Recommended Configuration to Prevent Routing Loops
Setting a Proper Local_Pref Value for Loop Prevention
Configuration roadmap:
Apply an import policy on DeviceB to increase the Local_Pref value of the BGP route received from DeviceA to 110. As the default Local_Pref value of the BGP route received from DeviceE is 100, this configuration ensures that DeviceB always preferentially selects the one from DeviceA.
The following example uses BGP on DeviceA to import the route 10.10.10.10/32. The key configurations are as follows.
Device Name |
Configuration |
---|---|
DeviceA |
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
route-policy cost permit node 10
apply cost 50
#
bgp 65500
router-id 1.1.1.1
peer 2.2.2.2 as-number 65500
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
import-route static
peer 2.2.2.2 enable
peer 2.2.2.2 route-policy cost export
#
ospf 10
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.1.0 0.0.0.255
#
ip route-static 10.10.10.10 255.255.255.255 NULL0
#
return
|
DeviceB |
# interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.2.1 255.255.255.0 isis enable 1 # interface GigabitEthernet0/3/0 undo shutdown ip address 10.1.5.2 255.255.255.0 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # route-policy localPre permit node 10 apply local-preference 110 # isis 1 is-level level-2 cost-style wide network-entity 10.0000.0000.0001.00 import-route bgp permit-ibgp # bgp 65500 router-id 2.2.2.2 peer 1.1.1.1 as-number 65500 peer 1.1.1.1 connect-interface LoopBack0 peer 5.5.5.5 as-number 65500 peer 5.5.5.5 connect-interface LoopBack0 # ipv4-family unicast undo synchronization peer 1.1.1.1 enable peer 1.1.1.1 route-policy localPre import peer 5.5.5.5 enable peer 5.5.5.5 reflect-client # ospf 10 area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 10.1.1.0 0.0.0.255 network 10.1.5.0 0.0.0.255 # return |
DeviceE |
# interface GigabitEthernet0/1/0 undo shutdown ip address 10.1.4.2 255.255.255.0 isis enable 1 # interface GigabitEthernet0/2/0 undo shutdown ip address 10.1.5.1 255.255.255.0 # interface LoopBack0 ip address 5.5.5.5 255.255.255.255 # isis 1 is-level level-2 cost-style wide network-entity 10.0000.0000.0004.00 # bgp 65500 router-id 5.5.5.5 peer 2.2.2.2 as-number 65500 peer 2.2.2.2 connect-interface LoopBack0 # ipv4-family unicast undo synchronization import-route isis 1 peer 2.2.2.2 enable # ospf 10 area 0.0.0.0 network 5.5.5.5 0.0.0.0 network 10.1.5.0 0.0.0.255 # return |
The IP address configuration on the interfaces does not affect routing loop generation.
Check the route 10.10.10.10/32 on each device. Figure 1-2 shows the route advertisement direction on each device.
Device Name |
Routing Table Output |
---|---|
DeviceA |
[~DeviceA] display ip routing-table 10.10.10.10 Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Summary Count : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.10.10.10/32 Static 60 0 DB 0.0.0.0 NULL0 |
DeviceB |
[~DeviceB] display bgp routing-table 10.10.10.10
BGP local router ID : 2.2.2.2
Local AS number : 65500
Paths: 1 available, 1 best, 1 select, 0 best-external, 0 add-path
BGP routing table entry information of 10.10.10.10/32:
From: 1.1.1.1 (1.1.1.1)
Route Duration: 0d00h14m41s
Relay IP Nexthop: 10.1.1.1
Relay IP Out-Interface: GigabitEthernet0/1/0
Original nexthop: 1.1.1.1
Qos information : 0x0
AS-path Nil, origin incomplete, MED 50, localpref 110, pref-val 0, valid, internal, best, select, pre 255, IGP cost 1
Advertised to such 1 peers:
5.5.5.5
[~DeviceB] display ip routing-table 10.10.10.10
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.10.10/32 IBGP 255 50 RD 1.1.1.1 GigabitEthernet0/1/0
|
DeviceC |
[~DeviceC] display ip routing-table 10.10.10.10
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.10.10/32 ISIS-L2 15 10 D 10.1.2.1 GigabitEthernet0/1/0
|
DeviceD |
[~DeviceD] display ip routing-table 10.10.10.10
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.10.10/32 ISIS-L2 15 20 D 10.1.3.1 GigabitEthernet0/1/0
|
DeviceE |
[~DeviceE] display bgp routing-table 10.10.10.10 BGP local router ID : 5.5.5.5 Local AS number : 65500 Paths: 2 available, 1 best, 1 select, 0 best-external, 0 add-path BGP routing table entry information of 10.10.10.10/32: From: 2.2.2.2 (2.2.2.2) Route Duration: 0d00h17m41s Relay IP Nexthop: 10.1.5.2 Relay IP Out-Interface: GigabitEthernet0/2/0 Original nexthop: 1.1.1.1 Qos information : 0x0 AS-path Nil, origin incomplete, MED 50, localpref 110, pref-val 0, valid, internal, best, select, pre 255, IGP cost 2 Originator: 1.1.1.1 Cluster list: 2.2.2.2 Not advertised to any peer yet BGP routing table entry information of 10.10.10.10/32: Imported route. From: 0.0.0.0 (0.0.0.0) Route Duration: 0d01h18m30s Direct Out-interface: GigabitEthernet0/1/0 Original nexthop: 10.1.4.1 Qos information : 0x0 AS-path Nil, origin incomplete, MED 30, pref-val 0, valid, local, pre 15, not preferred for Local_Pref Not advertised to any peer yet [~DeviceE] display ip routing-table 10.10.10.10
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.10.10/32 ISIS-L2 15 30 D 10.1.4.1 GigabitEthernet0/1/0
|
Setting a Proper IP Prefix List for Loop Prevention
Configuration roadmap:
Apply a routing policy based on an IP prefix list on DeviceE to filter out the routes with the route originator being DeviceA when BGP on DeviceE imports routes from the IS-IS process. This recommendation is based on the following fact: The BGP route that DeviceB receives from DeviceA is imported to the IS-IS process, and then DeviceE imports this IS-IS route to the BGP process so that BGP on DeviceE advertises the BGP route to DeviceB.
The following example uses BGP on DeviceA to import the route 10.10.10.10/32. The key configurations are as follows.
Device Name |
Configuration |
---|---|
DeviceA |
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 10.1.1.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
route-policy cost permit node 10
apply cost 50
#
bgp 65500
peer 2.2.2.2 as-number 65500
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
import-route static
peer 2.2.2.2 enable
peer 2.2.2.2 route-policy cost export
#
ospf 10
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.1.1.0 0.0.0.255
#
ip route-static 10.10.10.10 255.255.255.255 NULL0
#
return
|
DeviceB |
# interface GigabitEthernet 0/1/0 undo shutdown ip address 10.1.1.2 255.255.255.0 # interface GigabitEthernet 0/2/0 undo shutdown ip address 10.1.2.1 255.255.255.0 isis enable 1 # interface GigabitEthernet 0/3/0 undo shutdown ip address 10.1.5.2 255.255.255.0 # interface LoopBack0 ip address 2.2.2.2 255.255.255.255 # isis 1 is-level level-2 cost-style wide network-entity 10.0000.0000.0001.00 import-route bgp permit-ibgp # bgp 65500 peer 1.1.1.1 as-number 65500 peer 1.1.1.1 connect-interface LoopBack0 peer 5.5.5.5 as-number 65500 peer 5.5.5.5 connect-interface LoopBack0 # ipv4-family unicast undo synchronization peer 1.1.1.1 enable peer 5.5.5.5 enable peer 5.5.5.5 reflect-client # ospf 10 area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 10.1.1.0 0.0.0.255 network 10.1.5.0 0.0.0.255 # return |
DeviceE |
# interface GigabitEthernet 0/1/0 undo shutdown ip address 10.1.4.2 255.255.255.0 isis enable 1 # interface GigabitEthernet 0/2/0 undo shutdown ip address 10.1.5.1 255.255.255.0 # interface LoopBack0 ip address 5.5.5.5 255.255.255.255 # ip ip-prefix no_need_send index 10 permit 10.10.10.10 32 # route-policy no_need_send deny node 10 if-match ip-prefix no_need_send # route-policy no_need_send permit node 20 # isis 1 is-level level-2 cost-style wide network-entity 10.0000.0000.0004.00 # bgp 65500 peer 2.2.2.2 as-number 65500 peer 2.2.2.2 connect-interface LoopBack0 # ipv4-family unicast undo synchronization import-route isis 1 route-policy no_need_send peer 2.2.2.2 enable # ospf 10 area 0.0.0.0 network 5.5.5.5 0.0.0.0 network 10.1.5.0 0.0.0.255 # return |
Verify the configuration.
Device Name |
Routing Table Output |
---|---|
DeviceA |
[~DeviceA] display ip routing-table 10.10.10.10 Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route ------------------------------------------------------------------------------ Routing Table : _public_ Summary Count : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.10.10.10/32 Static 60 0 DB 0.0.0.0 NULL0 |
DeviceB |
[~DeviceB] display bgp routing-table 10.10.10.10
BGP local router ID : 2.2.2.2
Local AS number : 65500
Paths: 1 available, 1 best, 1 select, 0 best-external, 0 add-path
BGP routing table entry information of 10.10.10.10/32:
From: 1.1.1.1 (1.1.1.1)
Route Duration: 0d00h00m09s
Relay IP Nexthop: 10.1.1.1
Relay IP Out-Interface: GigabitEthernet0/1/0
Original nexthop: 1.1.1.1
Qos information : 0x0
AS-path Nil, origin incomplete, MED 50, localpref 100, pref-val 0, valid, internal, best, select, pre 255, IGP cost 1
Advertised to such 1 peers:
5.5.5.5
[~DeviceB] display ip routing-table 10.10.10.10
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.10.10/32 IBGP 255 50 RD 1.1.1.1 GigabitEthernet0/1/0
|
DeviceC |
[~DeviceC] display ip routing-table 10.10.10.10
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.10.10/32 ISIS-L2 15 10 D 10.1.2.1 GigabitEthernet0/1/0
|
DeviceD |
[~DeviceD] display ip routing-table 10.10.10.10
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.10.10/32 ISIS-L2 15 20 D 10.1.3.1 GigabitEthernet0/1/0
|
DeviceE |
[~DeviceE] display bgp routing-table 10.10.10.10
BGP local router ID : 5.5.5.5
Local AS number : 65500
Paths: 1 available, 1 best, 1 select, 0 best-external, 0 add-path
BGP routing table entry information of 10.10.10.10/32:
From: 2.2.2.2 (2.2.2.2)
Route Duration: 0d00h04m25s
Relay IP Nexthop: 10.1.5.2
Relay IP Out-Interface: GigabitEthernet0/1/0
Original nexthop: 1.1.1.1
Qos information : 0x0
AS-path Nil, origin incomplete, MED 50, localpref 100, pref-val 0, valid, internal, best, select, pre 255, IGP cost 2
Originator: 1.1.1.1
Cluster list: 2.2.2.2
Not advertised to any peer yet
[~DeviceE] display ip routing-table 10.10.10.10
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : _public_
Summary Count : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.10.10.10/32 ISIS-L2 15 30 D 10.1.4.1 GigabitEthernet0/1/0
|
Summary and Suggestion
The preceding example describes only one scenario, in which a routing loop occurs when routes are mutually imported between BGP and IS-IS processes. This issue may also occur in other networking scenarios, which are not described in this document. The preceding configuration recommendation may need to be adjusted based on actual configurations on the live network. Ensure to configure correct routing policies on the devices that perform mutual route import and control the route advertisement direction properly to prevent routing loops.