A project case explains the BGP routing notification principle in detail (with topology configuration)

Posted by bdee1 on Thu, 17 Feb 2022 10:00:46 +0100

preface

I wrote an article earlier 32 figures explain BGP routing protocol in detail: basic concept of BGP, BGP peer, BGP message type, BGP state machine, etc.

Today, I will tell you in detail about the four principles of BGP notification routing;

  • BGP only publishes optimal and effective routes;
  • Routes obtained from EBGP will be published to all peers (IBGP and EBGP)
  • The route learned from IBGP will not be sent to other IBGP peers. This principle is called "IBGP horizontal segmentation".
  • If the route learned from IBGP is to be sent to EBGP peers, it depends on learning this route from other IGP protocols. This rule is called BGP synchronization principle.

Project case

1. Experimental topology

The requirements are as follows:

(1) Routers R1, R5 and R6 run ospf protocol and publish loopback2 address in R1 ospf; Routers R1 and R5 belong to BGP AS 100, establish EBGP neighbors with R2, and pass R1 loopback2 to R2, R4 and R3 through BGP;

(2) R2 and R4 belong to BGP AS 200 and establish IBGP neighbors; R3 belongs to BGP AS 300 and establishes EBGP neighbors with R2;

(3) R3, R7 and R8 are all IBGP peers, and R8 publishes loopback addresses.

2. Experimental configuration

R6 configuration:

#
interface LoopBack0
 ip address 6.6.6.6 255.255.255.255
#
interface LoopBack2
 ip address 10.10.10.10 255.255.255.255
#
interface GigabitEthernet0/0/0
 ip address 10.1.16.2 255.255.255.252
#
interface GigabitEthernet0/0/1
 ip address 10.1.56.2 255.255.255.252
#
ospf 1
 area 0.0.0.0
  network 10.1.16.0 0.0.0.3
  network 10.1.56.0 0.0.0.3
  network 10.10.10.10 0.0.0.0
#

R1 configuration:

#
interface GigabitEthernet0/0/0
 ip address 10.1.12.1 255.255.255.252
#
interface GigabitEthernet0/0/1
 ip address 10.1.15.1 255.255.255.252
#
interface GigabitEthernet0/0/2
 ip address 10.1.16.1 255.255.255.252
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255
#
bgp 100
 peer 10.1.12.2 as-number 200
 #
 ipv4-family unicast
  undo synchronization
  network 1.1.1.1 255.255.255.255
  network 10.10.10.10 255.255.255.255
  peer 10.1.12.2 enable
#
ospf 1
 area 0.0.0.0
  network 10.1.16.0 0.0.0.3
#

R5 configuration:

#
interface GigabitEthernet0/0/0
 ip address 10.1.25.2 255.255.255.252
#
interface GigabitEthernet0/0/1
 ip address 10.1.15.2 255.255.255.252
#
interface GigabitEthernet0/0/2
 ip address 10.1.56.1 255.255.255.252
#
interface LoopBack0
 ip address 5.5.5.5 255.255.255.255
#
bgp 100
 peer 10.1.25.1 as-number 200
 #
 ipv4-family unicast
  undo synchronization
  network 5.5.5.5 255.255.255.255
  network 10.10.10.10 255.255.255.255
  peer 10.1.25.1 enable
#
ospf 1
 area 0.0.0.0
  network 10.1.56.0 0.0.0.3
#

R2 configuration:

#
interface GigabitEthernet0/0/0
 ip address 10.1.12.2 255.255.255.252
#
interface GigabitEthernet0/0/1
 ip address 10.1.23.1 255.255.255.252
#
interface GigabitEthernet0/0/2
 ip address 10.1.24.1 255.255.255.252
#
interface GigabitEthernet0/0/3
 ip address 10.1.25.1 255.255.255.252
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255
#
bgp 200
 peer 10.1.12.1 as-number 100
 peer 10.1.23.2 as-number 300
 peer 10.1.24.2 as-number 200
 peer 10.1.25.2 as-number 100
 #
 ipv4-family unicast
  undo synchronization
  network 2.2.2.2 255.255.255.255
  peer 10.1.12.1 enable
  peer 10.1.23.2 enable
  peer 10.1.24.2 enable
  peer 10.1.24.2 next-hop-local
  peer 10.1.25.2 enable
#

R4 configuration:

#
interface GigabitEthernet0/0/0
 ip address 10.1.24.2 255.255.255.252
#
interface LoopBack0
 ip address 4.4.4.4 255.255.255.255
#
bgp 200
 peer 10.1.24.1 as-number 200
 #
 ipv4-family unicast
  undo synchronization
  peer 10.1.24.1 enable
#

R3 configuration:

#
interface GigabitEthernet0/0/0
 ip address 10.1.23.2 255.255.255.252
#
interface GigabitEthernet0/0/1
 ip address 10.1.37.1 255.255.255.252
#
interface GigabitEthernet0/0/2
 ip address 10.1.38.1 255.255.255.252
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255
#
bgp 300
 peer 10.1.23.1 as-number 200
 peer 10.1.37.2 as-number 300
 peer 10.1.38.2 as-number 300
 #
 ipv4-family unicast
  undo synchronization
  network 3.3.3.3 255.255.255.255
  peer 10.1.23.1 enable
  peer 10.1.37.2 enable
  peer 10.1.37.2 next-hop-local
  peer 10.1.38.2 enable
  peer 10.1.38.2 next-hop-local
#

R7 configuration:

#
interface GigabitEthernet0/0/0
 ip address 10.1.37.2 255.255.255.252
#
interface GigabitEthernet0/0/1
 ip address 10.1.78.1 255.255.255.252
#
interface LoopBack0
 ip address 7.7.7.7 255.255.255.255
#
bgp 300
 peer 10.1.37.1 as-number 300
 peer 10.1.78.2 as-number 300
 #
 ipv4-family unicast
  undo synchronization
  peer 10.1.37.1 enable
  peer 10.1.78.2 enable
#

R8 configuration:

#
interface GigabitEthernet0/0/0
 ip address 10.1.38.2 255.255.255.252
#
interface GigabitEthernet0/0/1
 ip address 10.1.78.2 255.255.255.252
#
interface LoopBack0
 ip address 8.8.8.8 255.255.255.255
#
interface LoopBack99
 ip address 88.88.88.88 255.255.255.255
#
bgp 300
 peer 10.1.38.1 as-number 300
 peer 10.1.78.1 as-number 300
 #
 ipv4-family unicast
  undo synchronization
  network 88.88.88.88 255.255.255.255
  peer 10.1.38.1 enable
  peer 10.1.78.1 enable
#

3. BGP notification principles

(1) BGP only publishes optimal and effective routes;

In the above case, R2 can learn the route of 10.10.10.10/32 through R1 and R5.

As shown in the above figure, the route from R1 to BGP is optimal and effective; Therefore, R2 will only publish the route received from R1 when publishing the route to the peer.

Only the optimal and effective routes will be added to the routing table. As shown in the figure below:

Why is learning from R1 optimal? As shown in the figure below, because the router id size is not preferred;

(2) Routes obtained from EBGP will be published to all peers (IBGP and EBGP).

In the above case, R2 can learn the route of 10.10.10.10/32 through R1 and R5. It will be published to both IBGP peer R4 and IBGP peer R3.

We query the routes on R3 and R4 (as shown in the figure below).

(3) The route learned from IBGP will not be sent to other IBGP. This principle is called "IBGP horizontal segmentation".

In the above case, R3, R7 and R8 are IBGP peers. The loopback99 address 88.88.88/32 published by R8 will be sent to IBGP peers R7 and R8, but R7 will no longer be sent to R8, otherwise it will cause a loop.

(4) If the route learned from IBGP is to be sent to EBGP peers, it depends on learning this route from other IGP protocols. This rule is called BGP synchronization principle.

In the above case, R3, R7 and R8 are IBGP peers. The loopback99 address 88.88.88/32 published by R8 will be sent to IBGP peers R7 and R8, and R8 will be sent to EBGP peer R2. You should also learn this route depending on the IGP routing table.

---END---