Border Gateway Protocol (BGP), as an exterior gateway protocol, is in a class on its own. It is the de facto standard routing protocol used on the Internet. Unlike its Interior Gateway Protocol (IGP) cousins, such as OSPF or EIGRP, BGP advertises networks in a somewhat different way.

In this article, we will highlight the ways in which BGP advertises networks, and we’ll examine specific configurations for doing so on Cisco IOS routers.
Two Primary Methods of Advertising
BGP uses two methods to advertise a network. This can be done by either injecting a network directly into BGP using the network command, or by redistributing a prefix into BGP.
The network command
When configuring IGPs, you can issue the network command under the router configuration mode to specify the networks you wish to advertise.
IGPs will typically examine which interfaces on the router have IP address that fall within the range of the network command, and will advertise those directly connected networks.
Unlike IGPs, BGP doesn’t take into account the directly connected networks on the local router. When you apply the network command under the BGP router configuration, there are a couple of prerequisites for this command to operate successfully.
- You must specify the exact subnet mask of the network you wish to advertise.
- The prefix with the exact subnet mask must exist within the routing table in order for it to be advertised successfully.
Remember, BGP is used to advertise networks from one Autonomous System (AS) to another. For this reason, it is important that the network being advertised to other BGP peers, and eventually to BGP routers outside of the local AS, be reachable from the local router.
By advertising the network using BGP, the local router is essentially telling all BGP peers that “I have a route to this particular destination”.
So, it will only be advertised if an exact match, including the subnet mask, exists in the local routing table.
In other words, it will be advertised only if the local router knows how to get to that network. That route in the routing table may be a static route, a directly connected route, or it may be learned from another routing protocol, just as long as it is in the routing table.
The network command should be thought of as the origination of a specific network into BGP. It is routing information that the local router has that can be used to reach the destination in question.
Redistribution into BGP
The other way that routes can be advertised in BGP uses redistribution. A route that is learned from one source, such as EIGRP, OSPF, a static route, or even a directly connected route, can be redistributed into BGP.
Redistributing networks can be done without specifying specific networks. You can redistribute all routes learned via OSPF, or EIGRP, or all static or directly connected routes with just a few commands. Any routes learned by the router from these sources will be automatically redistributed into BGP.
Taking a closer look with configuration examples
At first glance, these two methods seem to be almost the same, and sound like they can be used interchangeably.
However, this is not the case. The following examples of how they can be used will help to clarify the characteristics of each. We will be using this topology to show the examples:

The initial configuration of BGP on R1 and R2 looks like this:
R1#show running-config | section bgp
router bgp 100
neighbor 10.10.12.2 remote-as 200
R2#show running-config | section bgp
router bgp 200
neighbor 10.10.12.1 remote-as 100
The result of the above configuration is an eBGP peering between R1 and R2.
Network command example
Let’s use the network command on R1 to advertise the 1.1.1.0/25 network. This is the network that is directly connected to Loopback0 of R1. First, let’s take a look at our routing table in R1 and see how this network is displayed:
R1#show ip route 1.1.1.0 255.255.255.128
Routing entry for 1.0.0.0/25, 2 known subnets
Attached (2 connections)
Variably subnetted with 3 masks
C 1.1.1.0/25 is directly connected, Loopback1
L 1.1.1.1/32 is directly connected, Loopback1
You can see that the network is shown with a /25 prefix in the routing table. To advertise this network using the network command under BGP router configuration mode, do the following:
R1(config)#router bgp 100
R1(config-router)#network 1.1.1.0 mask 255.255.255.128
By issuing the exact subnet mask that matches that in the routing table, that network is now being advertised from R1 to R2.
Let’s take a look at the BGP table of R2:
R2#show ip bgp
BGP table version is 2, local router ID is 10.10.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/25 10.10.12.1 0 32768 100 200 i
R2 has received the BGP advertisement and has inserted the route to 1.1.1.0/25 in the routing table. It has registered a next hop IP of 10.10.12.1, which is that of R1, as expected.
One additional detail that I’d like to draw your attention to is the “i” at the very end of the entry. It looks like it’s part of the Path heading, but it is not. It actually comes after that column.
The “i” is the Origin code for this route, which according to the legend above indicates “IGP”. This essentially tells us that the route was injected into BGP using the network command.
Network command with auto-summary
The auto-summary keyword will make the BGP network command behave more like the network command used with an IGP.
When auto-summary is enabled, you can advertise a classful network without needing to include the mask parameter.
BGP will automatically advertise the classful network if either the classful network itself or any of its subnets are present in the routing table.
For example, the following commands will advertise the 1.1.1.0/25 network successfully from R1 to R2:
R1(config)#router bgp 100
R1(config-router)#auto-summary
R1(config-router)#network 1.0.0.0
Auto-summary is disabled by default. The above commands will enable it and will advertise all networks in the routing table that are within the 1.0.0.0/8 classful network range, including the 1.1.1.0/25 network.
Advertising a Null route
There’s an additional trick that you can use to advertise a route using BGP without actually having that route natively within your routing table. You can artificially add it to the routing table by creating a static Null route.
Let’s say you want to advertise the 2.2.2.0/24 network from R1. However, this network does not exist in the routing table, so if you issue this command, no BGP routes will be advertised:
R1(config)#router bgp 100
R1(config-router)#network 2.2.2.0 mask 255.255.255.0
So, as expected, if you look at the BGP table of R2, you will not see this route:
R2#show ip bgp
BGP table version is 2, local router ID is 10.10.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/25 10.10.12.1 0 32768 100 200 i
However, if you issue this command on R1, the route will be advertised to R2 using BGP:
R1(config)#ip route 2.2.2.0 255.255.255.0 null 0
This creates a static route for the 2.2.2.0/24 network and places it in the routing table. Now the prerequisite of the route existing in the routing table is fulfilled, and thus you will see the route advertised to R2 like so:
R2#show ip bgp
BGP table version is 2, local router ID is 10.10.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/25 10.10.12.1 0 32768 100 200 i
*> 2.2.2.0/24 10.10.12.1 0 32768 100 200 i
The static route that was created is called a discard route. Any packets destined for this network on R1 will be discarded. However, the route was advertised because it was added to the routing table.
Null routes are useful tools to adjust the way BGP operates, and can be used in specific scenarios, which we won’t go into here.
Redistribution Example
To see how a route can be advertised by BGP by redistribution, let’s add another Loopback interface to our R1 router:
R1(config)#interface loopback 1
R1(config-if)#ip address 11.11.11.1 255.255.255.0
R1(config-if)#exit
Let’s advertise this network using OSPF like so:
R1(config)#router ospf 1
R1(config-router)#network 11.11.11.0 0.0.0.255 area 0
And finally, let’s redistribute this network, and all OSPF-learned networks into BGP:
R1(config)#router bgp 100
R1(config-router)#redistribute ospf 1
All routes learned via OSPF that exist in the routing table will now be redistributed into BGP and advertised using BGP. Take a look at the resulting BGP table of R2:
R2#show ip bgp
BGP table version is 2, local router ID is 10.10.12.2
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external, f RT-Filter
Origin codes: i – IGP, e – EGP, ? – incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.0/25 10.10.12.1 0 32768 100 200 i
*> 2.2.2.0/24 10.10.12.1 0 32768 100 200 i
*> 11.11.11.0/24 10.10.12.1 0 32768 100 200 ?
You can see that the 11.11.11.0/24 network has been learned via BGP by R2.
But there is also one more interesting thing here. We see that the Origin code is actually “?”. And according to the legend, this indicates an “incomplete” Origin. What this means practically is that this route was learned via redistribution.
Importance of the Origin code
Now the terminology used for the Origin code is misleading.
To simplify it, if you see an “i”, you know that the route was introduced into BGP using the network command.
If you see a “?”, you know that the route was introduced into BGP using redistribution.
You should never see an “e” because that indicates that the EGP routing protocol is in use, which is the deprecated predecessor of BGP and hasn’t been used for decades.
The Origin code is an important part of the BGP best path algorithm. An Origin code of “i” is preferable to an Origin code of “?” and is used as one of the tie breaking attributes to determine the best path. But that’s a different story.
Conclusion
When advertising networks in BGP, the network command allows for precise control over which networks are advertised, while redistribution integrates routes from other protocols, as well as static and directly connected routes, into BGP, enhancing routing efficiency. Together, these features enable robust and flexible network management essential for complex, large-scale environments.
Related Posts
- Difference Between Routers and Switches in TCP/IP Networks
- 11 Different Types of IP Addresses Used in Computer Networks
- Compare and Contrast Network Topologies (Star, Mesh, Bus, Hybrid etc)
- 11 Networking Companies Like Cisco (Competitors)
- What is a Wildcard Mask – All About Wildcard Masks Used in Networking