cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

689
Views
5
Helpful
19
Replies
Highlighted
Enthusiast

BGP Not advertising routes

I was trying to troubleshoot a BGP issue where the peer isn't receiving some of the routes I'm like to advertise.  I can get the actual configuration, but this is basically what I have and what I'm trying to accomplish:

 

int gi 0/0

 IP address A.B.D.1 255.255.255.224

 description WAN Public IPs

 

int g0/1

 IP address 1.1.1.1 255.255.255.252

 description Uplink to ISP

 

ip route A.B.C.32 255.255.255.224 192.168.10.1

ip route E.F.G.0 255.255.255.0 192.168.10.1

ip route A.B.C.92 255.255.255.248 192.168.10.2

ip route A.B.C.0 255.255.255.0 Null0 250

 

router bgp 12345

 router-id A.B.C.1

 bgp log-neighbor-changes

 neighbor 1.1.1.2 remote-as 6789

 

address-family ipv4

 neighbor 1.1.1.2 activate

 network A.B.C.0 mask 255.255.255.0

 network A.B.D.0 mask 255.255.255.0

 network E.F.G.0 mask 255.255.255.0

 

A.B.C.0 and A.B.D.0 are adjoining (192.168.58.0 and 192.168.59.0) and the carrier advised they have a prefix-list applied to only accept routes A.B.C.0/23 and E.F.G.0 from my router.  They're getting the E.F.G.0/24 advertisement w/o any issues, but the A.B.C.0/24 and A.B.D.0/24 don't get advertised.  I've tried using more specific network statements and clearing the bgp session but had the same results.  I'll get the output of a "sh ip bgp neighbors 1.1.1.2 advertised-routes" tomorrow but wondering if there is something else I missed.  I tried using a prefix-list and matching the 2 /24 networks but that didn't work either.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: BGP Not advertising routes

Hi,

 

If you use network statement under BGP, it should match the valid route in your Routing table with exact subnet mask and thats the reason your E.F.G.0/24 is advertising. Your IP Route E.F.G.0/24 and Network E.F.G.0/24 entry in BGP config matches.

 

To meet your ISP requirement, you can add below route and advertise it in your BGP

 

ip route a.b.c.0 255.255.254.0 NULL0

 

outer bgp 12345

 router-id A.B.C.1

 bgp log-neighbor-changes

 neighbor 1.1.1.2 remote-as 6789

!

address-family ipv4

 neighbor 1.1.1.2 activate

 network A.B.C.0 mask 255.255.254.0

  network E.F.G.0 mask 255.255.255.0

 

You can confirm which Routes have been advertised to your neighbor using command

 show ip bgp neighbor x.x.x.x advertised routes

 

View solution in original post

19 REPLIES 19
Highlighted

Re: BGP Not advertising routes

Hi,

 

If you use network statement under BGP, it should match the valid route in your Routing table with exact subnet mask and thats the reason your E.F.G.0/24 is advertising. Your IP Route E.F.G.0/24 and Network E.F.G.0/24 entry in BGP config matches.

 

To meet your ISP requirement, you can add below route and advertise it in your BGP

 

ip route a.b.c.0 255.255.254.0 NULL0

 

outer bgp 12345

 router-id A.B.C.1

 bgp log-neighbor-changes

 neighbor 1.1.1.2 remote-as 6789

!

address-family ipv4

 neighbor 1.1.1.2 activate

 network A.B.C.0 mask 255.255.254.0

  network E.F.G.0 mask 255.255.255.0

 

You can confirm which Routes have been advertised to your neighbor using command

 show ip bgp neighbor x.x.x.x advertised routes

 

View solution in original post

Highlighted
Beginner

Re: BGP Not advertising routes

Hello,

 

The "neighbor 1.1.1.2 remote-as 6789" command must be under "address-family ipv4". If you configure address familiy every neighbor command must be under it.

 

BR.

Highlighted
Enthusiast

Re: BGP Not advertising routes

Thanks for this.  I thought about adding the null0 route after i reverted the changes for the night; turns out it worked as expected.  Now I just have to figure out some other issues w/ the setup.  Each router should go learn the default route from it's upstream carrier and use the secondary bgp route that the other router has.  There is also OSPF configured on each of these 2 routers and router w/ A.B.C.1 has the default-originate command.  I set the local preference to 150 for routes from it's carrier which worked to have it go out that carrier by default, but as it was also advertising the default via ospf the remote router installed that route in the routing table over the locally learned eBGP route so i'm trying to understand why.  I labbed it up in GNS3 and get the exact same behavior as well.

Highlighted

Re: BGP Not advertising routes

Hi,

 

Can you check whether it is iBGP or eBGP. eBGP have AD of 20 which it should take over the OSPF learned Route. Also, check whether default Route have been learned on this Router.

 

You can check with show ip BGP command to see the BGP entries.

Highlighted
Enthusiast

Re: BGP Not advertising routes

It should be eBGP as the AS is different. And the route is preferred over the OSPF default originate route until I changed the local preference. I'll try to grab the show commands, but from I remember when R1 is peered correctly with ISP (eBGP) and R2 (iBGP and OSPF) and R2 has the default originate it routes normally. R1 and R2 both go out R1s eBGP default route. When I modify R2 to change the local preference of the default route from it's upstream eBGP peer it advertises that to R1 via OSPF and then both R1 and R2 route out through R2s eBGP peer. 

Highlighted

Re: BGP Not advertising routes

Hi,

 

You can also consider using Weight parameter instead of Local-Preference if you do not want R2 to influence its decision to R1.

Highlighted
Enthusiast

Re: BGP Not advertising routes

Thanks. I'll look into that. Why would the default route learned via OSPF take preference over the eBGP route and get inserted into the route table on R1?
Highlighted
Hall of Fame Guru

Re: BGP Not advertising routes

 

It sounds like you have somehow modified the local preference so the IBGP route is being preferred and if that is the case then the OSPF route would be used because OSPF (AD 110) is preferred over IBGP (AD 200).

 

Jon

Highlighted
Enthusiast

Re: BGP Not advertising routes

Well R1 is getting an eBGP route from directly connected ISP so metric should be 20. Even if R2 is advertising default route, AD should be 110 correct so shouldn't get into routing table I thought. I updated local preference on R2 because I wanted R2 to go out its eBGP route but that also caused R1 to use that route.
Highlighted
Hall of Fame Guru

Re: BGP Not advertising routes

 

That’s the point I was trying to make. 

 

Local preference is coming before EBGP vs IBGP in the BGP path selection algorithm. 

 

Are you sure that that when you modified the local preference on R2 that did not make R1 prefer the default route from R2 which would be an IBGP route. 

 

Jon

Highlighted
Enthusiast

Re: BGP Not advertising routes

Thanks for the feedback. Here's snippets of what was done and what I got from the associated "show commands":

 

On R2 I issued:

route-map setloc_pref permit 10
 set local-preference 150

router bp gp 12345
  address-family ipv4
    neighbor 1.1.1.2 route-map setloc_pref in


R2#sh ip bgp
BGP table version is 11689805, local router ID is 204.144.58.121
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i0.0.0.0          A.B.C.2             0    100      0 3333 i
*>                  1.1.1.2                150      0 4444 5555 i

Then i connected to R1 to check:

R1#sh ip bgp
BGP table version is 7309131, local router ID is 10.0.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
r>i0.0.0.0          1.1.1.2           0    150      0 4444 5555 i


R1#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
       + - replicated route, % - next hop override

Gateway of last resort is 192.168.100.1 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 192.168.100.1, 00:05:19, GigabitEthernet0/0


192.168.100.1 being the LAN-IP of R2
Highlighted
Hall of Fame Guru

Re: BGP Not advertising routes

 

So R1 is using the IBGP router advertised by R2 so it chooses the OSPF route to put into the routing table because OSPF has better AD than IBGP. 

 

Note also the next hop on R1's IBGP default route ie. 1.1.1.2 (R2's ISP peer), if R1 needed to use that route then it may not be able to because it may not have a route to 1.1.1.2. 

 

You would need to add this to R2 BGP configuration - 

 

neighbor <R1 peer IP> next-hop-self 

 

the real issue though is why is R1 choosing R2 and not using its own default route. 

 

Did you also modify the local preference on R1 ?

 

Jon

Highlighted
Enthusiast

Re: BGP Not advertising routes

"the real issue though is why is R1 choosing R2 and not using its own default route. "

 

yes, that's exactly what I'm trying to figure out.  Now, local preference on R1 hasn't been modified.

This is "show ip bgp" from R1 before the local-preference was changed on R2.

R1t#sh ip bgp
BGP table version is 7107687, local router ID is 10.0.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0          A.B.C.2                          0 3333 i
Highlighted
Hall of Fame Guru

Re: BGP Not advertising routes

 

If local preference has not been modified on R1 then that is why it is using R2's default because as I said before local preference comes before EBGP vs IBGP in the BGP path selection algorithm and you have given R2's default route a better local preference.

 

It's not clear why you are setting local preference though as each router should be using it's own EBGP default route. 

 

Jon