How to advertise networks in BGP

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

Hey, everyone!

When it comes to advertising networks into BGP, what’s the best practice or the common way to advertise them? By using the network command or the redistribute command?

Since redistribution is probably the quickest way, since we don’t have to write a specific network command for each of our prefixes. Are there any downsides to it, though?

Kind regards,
David

Hello David

The best practice for advertising networks into BGP largely depends on your specific network design and requirements. Both the network and redistribute commands have their uses, but they operate differently.

The network command in BGP is used to advertise networks that are already present in the routing table. It’s a good practice to use this command when you want to have granular control over which routes are being advertised. This method requires more configuration as you would need to manually specify each network that you wish to advertise.

On the other hand, the redistribute command is used to take routes from other routing protocols and inject them into BGP. This is a more automated way of advertising routes, as it doesn’t require manual configuration for each network. Although the redistribute command requires that the redistributed prefixes be in the routing table, it doesn’t require an exact match as the network command does. However, it can potentially lead to the advertisement of unwanted routes if not properly controlled, which may cause routing loops or other issues.

Keep in mind that using the ‘redistribute’ command without proper route filtering can lead to the propagation of unnecessary routes, which can increase the size of the routing table and use more resources. It could also inadvertently advertise routes that you do not want to advertise.

So, if you have a small to medium-sized network where you can easily manage and control all your routes, you might prefer using the ‘network’ command. If you have a large network with many dynamic routes, then ‘redistribute’ might be more efficient, but you should be careful to apply appropriate filtering.

Always consider your network’s specific requirements and constraints when choosing between these methods.

I hope this has been helpful!

Laz

1 Like

Great info, I have 3 routers in location A peering with a WAN link that connects to another router in location B. The router in location B is peering with the ISP router. How would I advertise the default route in my entire network using BGP? Do I need to statically add it to the routing table first in order for BGP to advertise it? Is this my only option. Thanks

Hello Joseph

You can advertise a default route via BGP in a couple of ways. Take a look at this NetworkLessons note on the topic for more details.

This is the case regardless of the topology that you may have. Let us know if you have any more specific questions.

I hope this has been helpful!

Laz