Internal BGP (Border Gateway Protocol) explained

Hello Vinod

If there is no next hop, we can’t install the prefix from BGP into the routing table. So in order to fix this, we can either change the next hop IP address with the next-hop-self command or we can advertise the network in question using a routing protocol, either an IGP or via BGP so that the network will be in the routing table and the prefix will be installed in the routing table from BGP.

I hope this has been helpful!

Laz

1 Like

Why does eBGP have a lower admin distance than iBGP? Surely if a route is available from within the internal network then that should be used?

Hello Gareth

By default, eBGP has an AD of 20 while iBGP has an AD of 200, and all IGRPs are somewhere between. This is done on purpose. If you learn of a route to a destination via eBGP, that means that that destination does not exist in your AS, but it was learned from another AS. If for whatever reason the same destination is advertised by any other routing protocol (IGRP or iBGP for example), the eBGP should take precedence, because if you want to reach that destination, you will definitely what it to be routed via eBGP to the external AS and not via your own network. This is because eventually, you will have to exit your network again (from the same or a different point) to get to that destination because by definition it is not in your AS.

Now if you learn of a destination via iBGP, you know that the destination is in your AS. But, if that same destination is advertised by an IGRP such as OSPF or EIGRP, then you would prefer to use those routing protocols to get there, because they converge faster and they are more appropriate for routing internally. This is why iBGP has a higher AD than the IGRPs. iBGP will only be used if the destination is not advertised in any other way.

So in short, eBGP should be preferred to any IGRPs for any destination learned via eBGP, because such a destination is in a different AS, therefore even if another routing protocol advertises the same destination, it is preferable to go directly via eBGP outside of your AS.

iBGP should always be the last choice because such a destination is in the same AS and if you have the same destination advertised via an IGRP, it is preferable to use that.

I hope this has been helpful!

Laz

2 Likes

Thanks Laz.

So if I had 195.50.1.1 /32 within my network and another ISP started to advertise it to me accidentally via eBGP, then this route would be used and cause me problems within my network?

I appreciate that you would have routing policies to prevent this but in theory, this is what would happen?

Thanks,

Gareth.

Hello Gareth

Let’s assume you have two independent ISP connections from two different telcos. You are advertising the 195.50.1.1 /32 address, which is an internal address for you, via BGP to ISP1. ISP 2 has learned of a route to 195.50.1.1 /32 via BGP on the Internet. This ISP is advertising this IP address to you and telling your network that any packets destined for this address should be sent via this second ISP.

This would indeed cause you problems as you mention in your post. However, in such situations it is your responsibility to verify that you appropriately filter all routes such that no internal public IPs will be learned from external sources such as an alternate ISP. This is typically best practice in order to avoid the kinds of problems you describe.

Remember that the default parameters set up on protocols such as BGP are designed to accommodate the most common implementations. Protocols have an abundance of parameters that can be manipulated to get the desired behaviour for almost all situations. BGP is one of the most “parameterized” protocols and can be configured to deal with virtually all enterprise needs.

I hope this has been helpful!

Laz

1 Like

anyone explain… can routers on different subnets become BGP neighbors? Explain why or why not.

Great explanation, especially on why R3 needed to run iBGP as well. That had me stumped until I read your explanation. Keep up with good work.

1 Like

Hi Rene,

You said in this post that for non-directly connected iBGP neighbour TTL value is higher but as i understood , iBGP neighbours should be full mesh. Then in which scenario we would have indirect iBGP neighbours?

Also i need to ask that if two router R1 and R2 are iBGP neighbour, how does R2 allows the prefix from R1 ( as both are in same AS). Shouldn’t be as per BGP split horizon rule, R2 when receives its on AS number in learned prefix, should reject the route from R1??

Pls help to clarify.

Hello Ankit

When Rene refers to full mesh, he is referring only to the BGP neighbor adjacencies and not the physical topology. You can have several routers in a sing AS where they are not fully meshed physically, but are fully meshed as far as the neighbor adjacenceis go. Remember that unlike Interior Gateway routing protocols, BGP neighbor adjacencies can be formed between neighbors that are not directly connected.

Concerning your second question, the split horizon rule states that any ROUTE (not AS) that is learned from an iBGP neighbor is not shared with any other iBGP neighbors. If R2 receives a route from R1, it can safely receive it without a problem, the split horizon rule does not prevent that, even if it is in the same AS. R2 however will not share this route with any other iBGP peers. Note that split horizon will not prevent a router from accepting a sent route, but will prevent a router from sending it in the first place (if the split horizon conditions are met).

I hope this has been helpful!

Laz

2 Likes

Hi,

R1–e0/0-----------e0/0 --R2 , iBGP configured but sh ip bgp shows nothing ?
Any help

configurations are below

R1 

interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface Ethernet0/0
 ip address 192.168.1.1 255.255.255.0
!

router ospf 1
 network 1.1.1.0 0.0.0.255 area 0
 network 192.168.1.0 0.0.0.255 area 0
!
router bgp 100
 bgp log-neighbor-changes
 neighbor 2.2.2.2 remote-as 100


!


R2 
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
!
interface Ethernet0/0
 ip address 192.168.1.2 255.255.255.0


router ospf 1
 network 2.2.2.0 0.0.0.0 area 0
 network 192.168.1.0 0.0.0.255 area 0
!


router bgp 100
 bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 100



R2#sh ip bgp 
R2#
R2#

Hello sims

Try issuing the show ip bgp summary. You should see that the routers are indeed becoming neighbors. However, you are not advertising any routes between the routers using BGP, so the show ip bgp command shows nothing. Add some routes using the network command under the bgp configuration of each router. For example:

R1
router bgp 100
  network 1.1.1.0 255.255.255.0
  
R2
router bgp 100
  network 2.2.2.0 255.255.255.0

I hope this has been helpful!

Laz

1 Like

Added on R1
network 1.1.1.0 mask 255.255.255.0
and R2 shows that it did not learn any prefixes

R2#sh ip bgp summary 
BGP router identifier 2.2.2.2, local AS number 100
BGP table version is 2, main routing table version 2
1 network entries using 144 bytes of memory
1 path entries using 80 bytes of memory
1/1 BGP path/bestpath attribute entries using 152 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 376 total bytes of memory
BGP activity 1/0 prefixes, 1/0 paths, scan interval 60 secs

Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4          100       0       0        1    0    0 never    Idle
R2#
R2#sh ip route       
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/11] via 192.168.1.1, 01:35:19, Ethernet0/0
      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.2.2.0/24 is directly connected, Loopback0
L        2.2.2.2/32 is directly connected, Loopback0
      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Ethernet0/0
L        192.168.1.2/32 is directly connected, Ethernet0/0

Thanks

Hello again Sims

I’m not sure if your configuration is set up this way or not, but there is a slight error on the configuration, something I missed before. In R2, you have the following under the OSPF configuration:

network 2.2.2.0 0.0.0.0 area 0

It should be

network 2.2.2.0 0.0.0.255 area 0

This would make 2.2.2.2 unreachable from R1, causing R1 not to see a BGP neighbor and consequently not being able to receive any networks from R2. Once you correct this, verify that OSPF is working correctly and that one loopback can ping the other. This should bring up the BGP adjacency. Now in your above output, you can see that R2 can see R1 as its BGP neighbor. This is the case even through R1 cannot see R2 as its neighbor because of the error in the OSPF config.

I hope this has been helpful!

Laz

1 Like

iBGP uses TTL=255
eBGP uses TTL=1

Tried configuring iBGP in Packet Tracer. Got this - “Packet Tracer does not support internal BGP in this version. Only external neighbors are supported”

Hello Jason

Yes unfortunately, PacketTracer does not support iBGP. You can however get it to function using the GNS3 emulator.

I hope this has been helpful!

Laz

1 Like

Hello Team,

Had a little doubt in this one. In this configuration we are trying to ping 1.1.1.1 from physical interface but the ping is failing as the routers doesn’t know the reverse route to the physical interface. How if we tried pinging 1.1.1.1 using any router’s source loopback? Will that be successful?

Regards
Varun

Hello Varun

If you were to initiate the same ping from the loopback interface of R5, you would still get the same result. This is because the packet would still be routed to R4, from which the same routing failure would occur. The problem is that R3 still does not have the 1.1.1.0/24 route in its routing table, thus the routing fails at R3, regardless of what source interface on R5 you use to ping.

I hope this has been helpful!

Laz

2 Likes

But you have specified next-hop self on R2 for R3. That should have worked.

Hello Varun

Actually, you’re right. In the lesson, there are two reasons why the ping to 1.1.1.1 from R5 didn’t work. The first is that R3 was not participating as an iBGP neighbour. This was resolved by using the commands found below:
image

But this was not the only problem. This resolved the connectivity from R5 to R1, but the return trip was not occurring correctly. This was due to a second problem, the fact that R1 has no clue where the 192.168.45.0/24 subnet was. In addition, according to its routing table, it has no idea where the 5.5.5.5 address is either, so even pinging from the loopback address would not result in a successful ping. By advertising the 192.168.45.0/24 network into BGP, R1 learns of this and is able to ping. If we advertised the 5.5.5.5 loopback address as well, then the ping could be achieved from the loopback as well.

Keep in mind that the whole purpose of the exercise in this lab was to gain access to R1 and its loopback address from any other router on the customers locations. If we want connectivity to and from specific subnets, those should be advertised in BGP as well.

I hope this has been helpful!

Laz

2 Likes