How to advertise networks in BGP

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

Hi Lagapides,

BGP 65400 is not ISP one and it is my local router AS connected to ISP router

Is there possibility it should come forn ISP router ?

Below output shows redistributing via eigrp

We have below command

address-family ipv4 in BGP so this will get impact to bgp routing table in vrf NET
  network 0.0.0.0
BGP configuration in VRF NET
-----------------------------------------------
address-family ipv4 vrf  NET
 redistribute eigrp 65400

So from above entire eigrp wil be distributed or we also have eigrp config for vrf NET
so EIGRP which belongs to NET will be distributed?

Is there possibility it should come forn ISP router

Hello Pavan

A default route in BGP can be learned in a couple of ways. It can be configured as a static route in the routing table and then it can be injected into BGP using the network command, or it can be redistributed either from a static route in the routing table or from another routing protocol. In the second case, you will require the use of the default-originate keyword in your BGP neighbor command. More info on this can be found at the BGP advertising a default route NetworkLessons note.

I suggest you share your BGP configuration with us as well as your routing table, your EIGRP configuration, and any static routes you have configured. This way we’ll be able to help you further.

I hope this has been helpful!

Laz

Is there a lesson, explaining redistribution between BGP, EIGRP and OSPF?

Hello Shree

This lesson has a section that deals with redistribution from OSPF into BGP:

If you have any specific questions, feel free to let us know!

I hope this has been helpful!

Laz

Hi Rene.

I just wanted to ask regarding with one of your lessons in BGP. You said If you advertise a network 1.0.0.0 mask 255.0.0.0 on R1 it will not work since this entry is not in the routing table but the thing is, this is a parent route right? cause if I type show ip route it shows the following:

1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.1.1.0/24 is directly connected, Loopback0
L        1.1.1.1/32 is directly connected, Loopback0

So should this be work then? Appreciate your response

Hello Joed

A prefix will be advertised by a BGP router only if both of the following two conditions are met:

  • the network command is used to specify the prefix to be advertised
  • The prefix, with the exact subnet mask, exists within the routing table

This means that if you issue the network command with a parent route, it will not be advertised.

Take a look at this NetworkLessons note on BGP Advertising a prefix for more information.

I hope this has been helpful!

Laz

Can anyone explain the difference between Null route and blackhole

Hello Gayathri

When dealing with routing, a black hole is a term used to refer to a situation where network traffic or packets are dropped or lost without any notification or error message being sent back to the sender. Specifically, this can occur when a router receives traffic for a destination network that it cannot route or forward.

Instead of returning an error message to the sender indicating the destination is unreachable, the router discards the packets, creating a “black hole” where traffic goes in but never comes out.

There are various reasons that this can occur, including routing misconfiguration or device failure. One way to create a black hole manually is to create a null route. Any traffic destined for the network in the null route will simply be dropped.

Now in the case of the null route in this lesson, it doesn’t create a black hole. Why? Because the null route doesn’t actually route any traffic! If it did, it would be a black hole. The null route here serves as a way to advertise a network to its neighbors using BGP.

So by using the null route to 1.0.0.0/8 in R1, R2 learns about it. When R2 wants to send traffic to 1.1.1.20 for example, it will know to send such traffic to R1. When R1 receives it, it’s not the null route that routes the traffic, but the more specific route that matches 1.1.1.0/24.

Now if R2 wants to send traffic to a destination of 1.1.20.1, then yes, that would be sent to R1 and a black hole would be created. But that’s where network engineers should be smart about how they create null routes and what networks they include.

I hope this has been helpful!

Laz