cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1791
Views
0
Helpful
7
Replies

Network command in BGP

auosdavid2000
Level 1
Level 1

Hi,

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

1.       I do (network 172.16.1.0) 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 172.16.1.0 mask 255.255.255.0) 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.

BR.

7 Replies 7

Calin C.
Level 5
Level 5

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  75.75.75.0 mask       255.255.255.0, and you configure network 75.0.0.0 under the       router bgp command, and auto-summary is enabled, BGP       introduces the classfull network 75.0.0.0 mask 255.0.0.0 in the BGP       table.

You can see a clear and short explanation here:

https://www.cisco.com/en/US/tech/tk365/technologies_q_and_a_item09186a00800949e8.shtml#five

marikakis
Level 7
Level 7

Please read the following from the BGP FAQ:

https://www.cisco.com/en/US/tech/tk365/technologies_q_and_a_item09186a00800949e8.shtml#five

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.

For scenario 1 find routing table with my config

router bgp 5001

no synchronization

bgp log-neighbor-changes

network 172.16.1.0

neighbor 192.168.1.2 remote-as 5002

auto-summary

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

    172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks

C       172.16.1.0/24 is directly connected, Loopback0

C       172.16.3.1/32 is directly connected, Loopback2

C       172.16.2.0/24 is directly connected, Loopback1

     10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks

C       10.3.0.0/18 is directly connected, Loopback5

C       10.2.1.0/24 is directly connected, Loopback4

C       10.1.1.0/24 is directly connected, Loopback3

C    192.168.1.0/24 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.

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 54.0.0.0 or network 155.1.0.0 or network 192.168.1.0. 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 150.1.0.0 than it would work if any of the prefixes 150.1.2.0/24 or 150.1.3.0/24 is the IGP table.

Francisco.

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 172.16.0.0 with the mask misssing. It has 172.16.1.0 with the mask missing. If it had 172.16.0.0 then any subnet of major network would suffice. As I see it, this is not an intuitive behavior.

marikakis
Level 7
Level 7

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

Similar question asked here https://supportforums.cisco.com/message/3142377#3142377

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 10.1.1.1/24, then th command would be "network 10.1.1.0 mask 255.255.255.0 not "network 150.1.1.1 mask 255.255.255.0.  The second statement will not match any route in the IGP and thus wont import any prefix.

Francisco. 

Review Cisco Networking for a $25 gift card