Internal BGP (Border Gateway Protocol) explained

But lets say if i am manually configuring router id in BGP which is not present in any physical or loopback Ip will label be generated for it and will that cause an issue ?
thanks for reply lagapides

Hello Anoop

In BGP, the router ID acts only as a unique identifier, and not as an actual routable IP address. It has no routing functionality, even if it can be defined as an active loopback or interface IPv4 address. You can manually configure it as any IPv4 address as long as it is unique in the BGP routing domain.

When it comes to LDP, the router ID for BGP is not something that LDP will ever see in order for it to create a label for it. So the BGP router ID plays no part in the labels created by LDP.

However, just a note here that LDP, unlike the router ID for BGP or OSPF, needs its own router ID to be routable, thus it should be reachable from the network and should be advertised in the routing protocol being used. More info on this can be found at this lesson:

I hope this has been helpful!

Laz

1 Like

Hello All,

I am testing the ibgp full mesh with 4 routers, R1 to R2, R3, R4 serial links connected to each other i.e peering directly connected interfaces. iBGP peer is up on all R1, R2, R3, R4. I have advertised loopback network say 1. 2. 3 4 networks by ibgp network command, I can ping the directly connected interface on all routers, but I can’t see the loopbacks advertised throughout the AS 20., even though I have a full mesh? Am I Missing Anything?

Hello Vivek

Remember that in order to correctly configure iBGP within an AS, you must first ensure that you have successful routing between all routers within that AS using an IGP or using static routing. Make sure that the loopbacks on all of your routers are reachable from all other loopbacks in the network. Also, keep in mind that iBGP requires that you create BGP peers not only between directly connected routers but between ALL routers. So in your topology, each iBGP router should have three peerings.

One of the things that I found confusing when learning about BGP is the fact that you need an IGP to make BGP work. But why? Isn’t BGP a routing protocol itself? We must remember the role of BGP. BGP is not responsible for the routing found within an AS. BGP is responsible for advertising the prefixes within the AS to external ASes. iBGP shares them within the AS, and eBGP takes those collected prefixes and shares them with other ASes.

So iBGP is not responsible for ensuring that you have connectivity between your loopbacks. You must ensure that this is achieved using an IGP or static routing before you employ BGP.

I hope this has been helpful!

Laz

R1(config-router)#network 1.1.1.0 mask 255.255.255.0

What is the use of this configuration in bgp on R1 router.

Hello Rahul

This command is used to advertise the 1.1.1.0/24 network using BGP. More about how to advertise networks in BGP, including the network command, can be found in the following lesson:

I hope this has been helpful!

Laz

Hi René thanks for your wisdom. I’ve included two more Routers. I’m succeded in pinging from R1 to 7.7.7.7 and from R7 to 1.1.1.1 but from any router of AS-2 i can’t reach any of loopback(R1/R7).

R1#sh running-config | section bgp
router bgp 1
 bgp log-neighbor-changes
 network 1.1.1.0 mask 255.255.255.0
 neighbor 192.168.12.2 remote-as 2

router ospf 1
 network 2.2.2.0 0.0.0.255 area 0
 network 192.168.23.0 0.0.0.255 area 0
!
router bgp 2
 bgp log-neighbor-changes
 network 192.168.12.0
 neighbor 3.3.3.3 remote-as 2
 neighbor 3.3.3.3 update-source Loopback0
 neighbor 3.3.3.3 next-hop-self
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 4.4.4.4 next-hop-self
 neighbor 5.5.5.5 remote-as 2
 neighbor 5.5.5.5 update-source Loopback0
 neighbor 5.5.5.5 next-hop-self
 neighbor 6.6.6.6 remote-as 2
 neighbor 6.6.6.6 update-source Loopback0
 neighbor 6.6.6.6 next-hop-self
 neighbor 192.168.12.1 remote-as 1

!
router ospf 1
 network 3.3.3.0 0.0.0.255 area 0
 network 192.168.23.0 0.0.0.255 area 0
 network 192.168.34.0 0.0.0.255 area 0
!
router bgp 2
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 2
 neighbor 2.2.2.2 update-source Loopback0
 neighbor 4.4.4.4 remote-as 2
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 5.5.5.5 remote-as 2
 neighbor 5.5.5.5 update-source Loopback0
 neighbor 6.6.6.6 remote-as 2
 neighbor 6.6.6.6 update-source Loopback0

AS2 Running ospf, and Full mesh BGP. Only R2/R6 have configured next-hop-self to the rest…The

Can you help me to find the gap?

Thanks so much in advanced

Thanks lazoras !
It got cleared after reading your full content.
Could you please explain ZTP in one of your session.

Hello Fran

Actually, this is expected behavior. If you take a look at the routing table of R1 (or R7), you will find that the IP addresses of R3, R4, and R5 are not found within the routing table. So when you ping 1.1.1.1 from R4, for example, the ping will reach R1, but R1 will not know how to find the 192.168.34.0/24 network to reply to, so the ping fails.

In order for these pings to be successful, R1 and R7 must have the IP addresses of the routers in AS2 in its own routing table. As stated in the lesson:

If you also want to ping R1 from any of the other routers then you need to make sure R1 knows where to send the return traffic.

In a production network, you don’t really need all routers to be able to ping all other routers. In this particular case, AS2 is acting as a transit network to interconnect AS1 and AS3. In the real world, AS2 would be an ISP. Customers don’t need connectivity to internal routers of the ISP. The goal is to interconnect those two networks, so connectivity to other routers within AS2 is not necessary.

I hope this has been helpful!

Laz

Hello Rahul

Glad to hear that your question was answered!

Now as for ZTP, are you talking about zero-touch provisioning? It’s somewhat unrelated to BGP, but here’s a quick summary.

ZTP is a concept that is used to enable network devices to be installed without any requirement for initial configuration. Such devices should connect to the network and get their instructions “over the wire” from a centralized management system. Cisco DNA as well as SD-Access and SD-WAN are attempts to automate initial installation (with onboarding processes etc) but these are not truly zero touch, although they approach it compared to older platforms.

I hope I have addressed your questions, but if not, please let me know so that I can respond more fully to your queries.

I hope this has been helpful!

Laz

Got it! Thanks so much :slight_smile:

1 Like

Hello Rene.
So for “normal” enterprises you will not have to configure or deal with iBGP, right?
I mean why an enterprise would need / want to be a transit AS.

If the above is correct, I need to deal with iBGP if I want to be a Transit AS, like for intstance an ISP.

Please clarify this.
Thanks in advance.

Hello Alexis

Whether you will be dealing with iBGP or not does not depend upon the type of enterprise that you are working with. iBGP is an integral part of BGP and will always be used within an AS. eBGP is used between ASes. Both are necessary for the proper operation of BGP.

I understand how you may have come to this conclusion since AS1 and AS3 in the lesson each have a single router. However, it is often the case that enterprises will have several devices within their AS, which means that they will employ iBGP within their networks.

As an enterprise, you are correct that you would not want to become a transit network for third-party traffic. This is especially true if you have connections to two or more ISPs. In such an arrangement, it may be possible for one ISP to route traffic via your enterprise equipment to reach the other ISP, a scenario you want to avoid. To ensure that this does not happen, you should prevent such transit traffic, as described in the following lesson:

I hope this has been helpful!

Laz

Hi,
Love your lessons. One query on Next-hop-Self.
Why are we not using it on R3? .
We are using Next-hop-self in R2 and R4 with 3.3.3.3 as the neighbor. Don’t we have to use it in R3 with 2.2.2.2 and 4.4.4.4 as neighbors?

For example , dont we need the below cmd?

R3 (config-router) # neighbor 2.2.2.2 next-hop-self
R3 (config-router) # neighbor 4.4.4.4 next-hop-self

Karthik

Hello Karthick

The next-hop-self command is always used by an eBGP router when advertising a route it learned from its eBGP neighbor to its iBGP peers.

In this case:

  • R2 which is an eBGP neighbor with R1
  • is advertising a route it learned from R1 (eBGP neighbor)
  • with its iBGP peers, that is, R3 and R4

Why does it do this? Because if it does not, the next-hop IP will remain 192.168.12.1, which is the IP address of R1. Because R1 is in a different AS, none of the iBGP routers in AS2 know this next-hop address. It is not found in any of their routing tables. The next-hop must thus be replaced with the IP address of the eBGP router connecting to that AS which is R2.

So the next-hop-self command will only be used by routers that find themselves on the border of the AS. R3 is not at the border.

Why? Well, think about this. R2 is saying to the rest of the routers in AS2, that in order to reach 1.1.1.1, the next hop is me. This makes sense because 1.1.1.1 is in the AS directly connected to R2’s eBGP peering. When R3 receives this information, it has no reason to make itself the next hop for 1.1.1.1, because everyone in the AS can already reach R2 as the next hop.

I hope this has been helpful!

Laz

Thanks a lot for very clear explanation. Appreciate it.

Regards,
Karthik S

1 Like

Hi,
I’m not very clear why iBGP AD is higher than eBGP, what’s the benefit ?

In below network topology, how can we force R2 to learn 3.3.3.3 via iBGP over eBGP, it makes sense to learn the network via iBGP, right ?

L0 - 3.3.3.0/24 — R1 – (iBGP) – R2 -------eBGP -------- R3 — (OSPF) — R4 (L0 - 3.3.3.0/24)

Thanks

Hello Kenny

Actually, iBGP AD is 200 and eBGP AD is 20, which means that a route learned via eBGP will take precedence over the same route being learned via iBGP. This is the case in order to prevent loops.

If a BGP router learns the same route from an eBGP neighbor AND an iBGP neighbor, it will always prefer eBGP based on the default AD. Why? Because if a route is advertised via eBGP, then it can never have originated within the local AS, therefore it considered the route learned via iBGP (from the local AS) as incorrect, or at least as less reliable. This is because of BGP’s loop prevention mechanism which eliminates any routes that contain its own AS.

For example, if route 1.1.1.1/24 within AS1 is advertised to other ASes, any eBGP router that receives an advertisement containing this destination will remove it because it contains AS1 (its own AS) as part of the path. Therefore, because of this mechanism, it is considered impossible for an eBGP router to receive an eBGP advertisement about a route that is found within its own AS. Therefore, any routes advertised via eBGP are considered by default outside of the local AS. So if the same route is advertised via iBGP, it considers that less reliable than the eBGP route.

Now in your specific scenario, the problem is not the AD of BGP routes, but the fact that 3.3.3.0/24 is not unique. This is a fundamentally flawed network implementation that should never be configured. If you did have such a case, and you wanted R2 to learn the network via iBGP and not via eBGP, then you could simply change the AD, but the fundamental problem of network operation would still remain, again not because of the way that BGP behaves, but because of duplicate IP addresses.

I hope this has been helpful!

Laz

Question:

What is the purpose of router-id command in BGP?

Hello David

Like in other routing protocols, the Router ID is used to uniquely identify a router within the BGP topology. The router ID of a BGP router is contained within the OPEN message when a BGP is established. If BGP does not have a router ID, it cannot establish any peering sessions. If there are duplicate router IDs within a single AS, routing problems can occur.

You can find out more info at this Cisco documentation:

I hope this has been helpful!

Laz