BGP Network Command



Network Command


The format of the network command follows:

network network−number [mask network−mask]

The network command controls what networks are originated by this box. This is a different concept from what you are used to configuring with IGRP and RIP. With this command we are not trying to run BGP on a certain interface, rather we are trying to indicate to BGP what networks it should originate from this box. The mask portion is used because BGP4 can handle subnetting and supernetting. A maximum of 200 entries of the network command are accepted. The network command will work if the network you are trying to advertise is known to the router, whether connected, static or learned dynamically.

An example of the network command follows:

RTA#
router bgp 1
network 192.213.0.0 mask 255.255.0.0
ip route 192.213.0.0 255.255.0.0 null 0

The above example indicates that router A, will generate a network entry for 192.213.0.0/16. The /16 indicates that we are using a supernet of the class C address and we are advertizing the first two octets (the first 16 bits).

Note that we need the static route to get the router to generate 192.213.0.0 because the static route will put a matching entry in the routing table.

Redistribution

The network command is one way to advertise your networks via BGP. Another way is to redistribute your IGP (IGRP, OSPF, RIP, EIGRP, etc.) into BGP. This sounds scary because now you are dumping all of your internal routes into BGP, some of these routes might have been learned via BGP and you do not need to send them out again. Careful filtering should be applied to make sure you are sending to the internet only routes that you want to advertise and not everything you have. Let us look at the example below.

RTA is announcing 129.213.1.0 and RTC is announcing 175.220.0.0. Look at RTC's configuration:



If you use a network command you will have:

RTC#
router eigrp 10
network 175.220.0.0
redistribute bgp 200
default−metric 1000 100 250 100 1500
router bgp 200
neighbor 1.1.1.1 remote−as 300
network 175.220.0.0 mask 255.255.0.0 (this will limit the networks originated by your AS to 175.220.0.0)

If you use redistribution instead you will have:

RTC#
router eigrp 10
network 175.220.0.0
network 175.220.0.0
redistribute bgp 200
default−metric 1000 100 250 100 1500
router bgp 200
neighbor 1.1.1.1 remote−as 300
redistribute eigrp 10 (eigrp will inject 129.213.1.0 again into BGP)
This will cause 129.213.1.0 to be originated by your AS. This is misleading because you are not the source of 129.213.1.0 but AS100 is. So you would have to use filters to prevent that network from being sourced out by your AS. The correct configuration would be:
RTC#
router eigrp 10
network 175.220.0.0
redistribute bgp 200
default−metric 1000 100 250 100 1500
router bgp 200
neighbor 1.1.1.1 remote−as 300
neighbor 1.1.1.1 distribute−list 1 out
redistribute eigrp 10
access−list 1 permit 175.220.0.0 0.0.255.255
The access−list is used to control what networks are to be originated from AS200.