How to advertise networks in BGP

Hello Networklessos team,
Speaking more about null 0 routes, I have understood that:
-Null routes give you the possibility to improve stability and can give you the advantage to avoid updates frequently on your routing table, because of some interfaces are flapping.
-Null routes prevent routing loops:
ºIn case you are using summarization it creates by default a null route (I have seen this behavior in other labs)
ºIn case that not all IP addresses are always in use: routing loops can occur when external hosts try to reach IP addresses that are not currently assigned but are part of the summary route.

Let me know if that appreciation by my side is correct.

Hello Elihu

Yes, it seems that your understanding of null routes is correct. They are often misunderstood because it initially doesn’t make sense to configure a route that points to a Null next hop. But you have correctly outlined the purpose and advantages of using them.

I hope this has been helpful!

Laz

Hi ,
How to check route receiver from BGP and its interface.
Command to check the destination ip is receiving by BGP or not

Hello Ashish

If I understand correctly, you want to know how you can confirm that a particular prefix has been learned by a BGP router, and from where it has been learned. This can be done by using the show ip bgp command and by specifying the particular prefix you want to learn about. Here is an example of such output:

R2#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.0/24, version 2
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  1
    192.168.12.1 from 192.168.12.1 (192.168.12.1)
      Origin IGP, metric 0, localpref 100, valid, external, best

Here you can see that this prefix has been learned from the router with the IP address of 192.168.12.1.

Keep in mind that this has to be done from the local router. If you want to find out from the remote router if the BGP peer has received these routes, there is no way to determine this for sure. The only thing you can do is to confirm that the BGP peering is up and that the particular prefix has been shared. What the remote peer has done with that prefix cannot be determined unless you have access to the local CLI of that router.

I hope this has been helpful!

Laz

Hi Rene,
In real production environment, do we always advertise the prefixes on the EBGP router towards another AS even if the prefixes are not originated from EBGP router?

For example, I have R1, R2, and R3. R1 and R2 is running IBGP. And R2 and R3 is EBGP. The 1.1.1.1/24 is the local prefix originated from R1 (loopback interface).
R1---------IBGP---------R2---------EBGP--------R3
1.1.1.1/24

  1. If I would like R3 to learn 1.1.1.1/24 prefix, I would need to advertise it on R1? or R2?
    If I advertise on R1, R2 will learn it and advertise to R3. But, is this the best practice? Alternatively, can I advertise the 1.1.1.1/24 on R2 towards R3 if R2 already learned the 1.1.1.1/24 from R1 via EIGRP?

  2. If I have 10 prefixes originated on R1, I would like R3 to learn only 1.1.1.1/24. I think I will need to apply route-map OUT with prefix list on R2. Is there any other way we use to filter the prefixes going out to another AS in production environment?

Thank you!
Bruce

Hello Bruce

An eBGP router will only share with other eBGP routers, prefixes that are in its local BGP table. In order to enter the BGP table, a particular prefix must either be indicated using the network command on the router to which that network is directly connected, or using redistribution from another routing protocol.

In the scenario that you describe in question 1, you can do one of two things:

  1. issue the network command on R1 for that particular prefix. This will place the prefix in the BGP table, and thus this prefix will be shared using iBGP with R2. R2 will have the prefix in its BGP table, and will be able to share it using eBGP with R3.
  2. don’t issue the network command on R1, but employ redistribution on R2, where you can redistribute the prefix from EIGRP to BGP. The result is that the prefix enters the BGP table of R2 and is shared with R3 using eBGP.

Now from the point of view of R3, both will work equally. But within the AS of R1 and R2, the way in which the prefix is learned by R2 is different. For a small network like the one, you have here, using one or the other method will make little difference. But as your AS gets larger, it becomes more difficult to manage such a network, to remember what prefix you’ve redistributed to BGP and what you haven’t. Imagine you have hundreds of prefixes on dozens of routers, it would become almost impossible to go into your eBGP router and redistribute selectively the networks you want to share with another AS using eBGP.

Additionally, if you use only redistribution, you will not be able to take advantage of other BGP features such as route reflectors, confederations, and peer groups, which vastly simplify BGP implementation.

For this reason, in production networks, you would typically use the network command on the local routers to which the networks are directly connected, in order to indicate what prefixes you’d like BGP to share. The redistribution command is then used to implement exceptions, where you would like a slightly different behavior for particular destinations.

Concerning your second question, yes you could create a route map to filter out prefixes you don’t want to share with other BGP routers. Ultimately, however, if you have prefixes that you simply don’t want to be advertised outside of an AS, then just don’t include them in your network commands (or your redistribution commands). If however, you want a scenario where you need to share a particular prefix with one AS, but not with another, then yes, the most direct and simplest way is to use a route map. But you can also use prefix lists and distribute lists to filter BGP, and examples of both of those options can be seen here:

I hope this has been helpful!

Laz

1 Like

Hi Rene,
If there is BGP running between router A and router B, router A advertised an aggregated address 10.120.0.0/16. When I do show ip bgp on router B, B learned the aggregated address from router A. Router B, however, also learned a specific route 10.120.20.0/24 via EIGRP from router A. If there is traffic destined for 10.120.20.0/24, is router B going to use 10.120.20.0/24? or it is going to use the aggregated address 10.120.0.0/16?
Thank you!

Router B

B 10.120.0.0/16 [200/0] via 10.1.1.1, 01:01:01
D 10.120.20.0/24 [90/307200] via 10.1.1.1, 01:02:08

Bruce

Hello Bruce

If your scenario results in both the aggregated address and the specific route in the routing table, a routing lookup will always choose the more specific route. So in this case the 10.120.20.0/24 route would be used. This has nothing to do with how it was learned, either via BGP or EIGRP. It has to do with how specific the entry is in the routing table.

Imagine you added a static route such as 10.120.20.128/25 to the routing table like so:

B 10.120.0.0/16 [200/0] via 10.1.1.1, 01:01:01
D 10.120.20.0/24 [90/307200] via 10.1.1.1, 01:02:08
S  10.120.20.128/25 [1/0] via 10.1.1.1

If you have a packet arriving with a destination IP address of 10.120.20.130, it will match all three routes. But it would use the third entry because it is more specific.

I hope this has been helpful!

Laz

1 Like

Can we advertise a prefix in BGP with aggregate command ?

i have seen in few other vendor routers that, Lets say u have 192.168.1.0/30,192.168.1.4/30 in routing table ,But still you can advertise the 192.168.1.0/24…is it RFC standard or what ??

Hello Narad

The aggregate-address command creates an aggregate entry in the BGP table. This aggregate entry can then be advertised to other BGP routers. However, this command cannot be used to initially advertise networks. It will only aggregate prefixes that are already in the BGP table. In order for these prefixes to be in the BGP table initially, they must be advertised as described in the lesson.

The aggregate feature is described in the RFC as a transitive attribute. You can find out more about it at RFC 4271.

For more information about the aggregate-address command take a look at this Cisco documentation:

I hope this has been helpful!

Laz

Hi regarding advertized prefixes to peer for ebgp.

Will BGP advertise prefixes to peer only if its in ( installed in ) the routing table ?

example :

I have a subnet 4.30.31.160/27 as connected on the router ( routing table ) and have a BGP peer asking us to advertise only /32s meaning they need to only receive 4.30.31.164/32 for example.

Is this even possible ? If yes how can I do it ?

thanks

Hello Jyothi

BGP will only advertise a prefix to a neighbor if that prefix is in the routing table. Not only must the prefix be in the routing table, but it must also have the exact subnet mask as it appears in the routing table.

So in your case, if you have a directly connected subnet of 4.30.31.160/27, then that specific subnet must be advertised. If you issue the following BGP command:

network 4.30.31.164 255.255.255.255

then the network will not be advertised.

In order to advertise a network that is not within the routing table, you must add it to the routing table. So you could add a static route such as the following

ip route 4.31.31.164 255.255.255.255 gigabitethernet 0/1

This would put the specific network with the specific subnet mask into the routing table, so you can then advertise it via BGP. Make sure the exit interface is correct, I put this one in as an example.

More information about how BGP advertises networks, including details of these operations can be found in the lesson:

I hope this has been helpful!

Laz

HI, thanks for the reply. I agree with your assessment to use static route to install more specific route in the routing table. The issue I seem to notice is that : the subnet is advertised as a connected route and all the servers ( 4.31.31.164 ) are on the same switch. Let’s say you use a static route how will the switch route traffic destined ( return traffic ) to this particular server ?

NOTE : I obviously can’t use a static Null0 route in this case.

In the route table it will have two routes :

  1. 4.30.31.160/27 as connected/direct
  2. 4.31.31.164 as static with a next-hop to particular interface ( any un-used interface ) .

Will connected route take precedence over static and the traffic destined to the server is switched to the right port ?

thanks
Jyothi

Hello Jyothi

When an IP packet arrives on a router, the destination address is compared to the entries in the routing table. The router goes through all of the routing entries in the routing table and attempts to match it to a particular entry. If there are multiple entries that the destination IP address can match with, the following criteria are used:

  1. First, the more specific entry is matched. In other words, the entry with the smallest subnet mask is used.
  2. If the subnet mask is the same, then the entry with the lowest metric is used.
  3. If the metric is the same, then load balancing takes place.

Note that one would assume that the administrative distance (AD) also plays a role, and it does, but not in the choice of installed routes. The AD will be used to determine if a route will be installed in the routing table in the event that two identical routes, with identical prefix lengths, are learned from different sources. If this happens, the route with the lower AD will be installed. The other route will never be in the routing table, thus it is never an option for a packet coming into the router. See this Cisco documentation for more info.

Now, if we apply this to your case, you would have the following two entries in your routing table:

  • 4.30.31.160/27 as connected
  • 4.31.31.164/32 as static with a next-hop to a particular interface

Now, in this case, the prefix of the static route is more specific, therefore that static route will be matched. In this case, you should not use Null0 as the next-hop IP since any packets destined to this IP will simply be dropped. Use an exit interface to ensure that such packets will be routed correctly.

Once that static route is entered with a next-hop interface, that entry is in the routing table, therefore BGP will be able to advertise it.

I hope this has been helpful!

Laz

Excellent, I already tried the discarded route ( Null0 ) option and now I am able to advertising the /32 to BGP peer. Will have to wait and see how the traffic is flowing between this particular server and the customer over the BGP link.

Anyway, thank you for your time and explanation.

Jyothi

1 Like

Hi Rene,

I just follow this question regarding advertising using null 0.

Coz, I dont see clearly see the use of it since when router will do recursive routing it will just trash the route to null.

Why we would try to advertise a route if eventually it will be discarded?

HI my edge rotuer is connected ti isp
isp side ip address- 207.17.237.43
how we are getting below default route in bgp. Please help me to understand

Route Distinguisher: 20309:2 (default for vrf INET) VRF Router ID 75.127.209.10
 *>  0.0.0.0          207.17.237.43      

Routing Table: NET
Routing entry for 0.0.0.0/0, supernet
  Known via "bgp 65400", distance 20, metric 0, candidate default path
  Tag 17231, type external
  Redistributing via eigrp 65401
  Advertised by eigrp 65400 metric 1000000 1 255 1 1500
  Last update from 207.17.237.43 7w0d ago
  Routing Descriptor Blocks:
  * 207.17.237.43 , from 206.16.236.41, 7w0d ago
      Route metric is 0, traffic share count is 1
      AS Hops 2
      Route tag 17232
      MPLS label: none

How default is advertised above in BGP table

Hello Pavan

It looks like your local router has learned about the default route via “bgp 65400”. Is that the AS of the ISP? If that is the case, then BGP has advertised this default route to your router. It is possible to advertise a default route using BGP. To find out more about that, take a look at this post:

If you require more insight, it would be helpful if you showed us the full output of the BGP table as well as your BGP configuration.

I hope this has been helpful!

Laz

Hello Networking_Philippin

When using the Null0 entry for an aggregate route, that entry will never be used, because you have more specific routes. Take a look at this post for more details:

I hope this has been helpful!

Laz