Network command in BGP

Unanswered Question
Sep 22nd, 2010


I was so confuse about (network command) in BGP,

1.       I do (network without mask and auto-summary are enable and I have entry for that network in my routing table, why BGP NOT advertise that network to BGP peers with default class. No any entry in BGP table.

2.       I do (network mask and auto-summary are enable and I have entry for that network in my routing table, why BGP advertise that network with /24 and did not care about auto-summary.


I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Calin Chiorean Wed, 09/22/2010 - 03:46

BGP will always advertise a network if that network exist in the routing table:

1. - Do you have the default class (summarized) in your routing table? I suspect not

2. - You have the network statement with /24 in BGP and also in your routing table, so BGP will advertise that network.

For example, if the subnet in the routing table is mask, and you configure network under the       router bgp command, and auto-summary is enabled, BGP       introduces the classfull network mask in the BGP       table.

You can see a clear and short explanation here:

marikakis Wed, 09/22/2010 - 03:50

Please read the following from the BGP FAQ:

When you do not specify a mask in network command and auto-summary is enabled, then any subnet of the classful network is enough to cause an origination of the classful network. Now you are saying that's not the case in your scenario 1. Can you post the related output from your config, routing table and bgp table?

If you do specify a longer mask in the network statement, then auto-summary doesn't matter and you need an exact match for the prefix (same network, same mask) in the routing table for the network to be originated by BGP with that mask. So, scenario 2 agrees with that.

auosdavid2000 Wed, 09/22/2010 - 04:22

For scenario 1 find routing table with my config

router bgp 5001

no synchronization

bgp log-neighbor-changes


neighbor remote-as 5002


R1# sh ip router

Codes: 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

Gateway of last resort is not set is variably subnetted, 3 subnets, 2 masks

C is directly connected, Loopback0

C is directly connected, Loopback2

C is directly connected, Loopback1 is variably subnetted, 3 subnets, 2 masks

C is directly connected, Loopback5

C is directly connected, Loopback4

C is directly connected, Loopback3

C is directly connected, Serial0/0

And it is mean for scenario 2, when I do mask in network command it will ignore the auto-summary.

francisco_1 Wed, 09/22/2010 - 04:32

The auto-summary in bgp applies in 2 cases,

One of them is a network command is configured with a classful mask subnet for example network or network or network In this case, the classful aggregate is installed in to BGP table if there is a prefix in the IGP table that is a subnet to the classful network. for example if you advertise network than it would work if any of the prefixes or is the IGP table.


marikakis Wed, 09/22/2010 - 04:44

Classful, mask, auto-summary, etc. All this sounds very confusing to me. The exact match in the routing table requirement is generally the case and scenario 2 is clear.

In scenario 1 the network command doesn't have with the mask misssing. It has with the mask missing. If it had then any subnet of major network would suffice. As I see it, this is not an intuitive behavior.

marikakis Wed, 09/22/2010 - 04:02

Ok, maybe this has come up before in the forums, but I don't remember all the details. In scenario 1 you have network without mask. What happens if you have without mask?

francisco_1 Wed, 09/22/2010 - 04:20

Similar question asked here

The second statement (mask) match a route in the IGP and thus won't import any prefix if there is not a match in the routing table.

So inoder for a prefix to be imported, it must exactly match the specification, - i.e. if should have the same subnet number and mask. for example, if you  have a loopback0 with the ip address, then th command would be "network mask not "network mask  The second statement will not match any route in the IGP and thus wont import any prefix.



This Discussion