PacketLab
Unit 1 · Route origination

Advertising Networks

An established session does not advertise every local route. Choose a prefix, originate it in BGP, then verify what the neighbor receives.

Lab network

R1 in AS 65010 peers directly with R2 in AS 65020. Advertise R1's 198.51.100.0/24 loopback network to R2. Start with an established session and no originated prefixes.

Direct eBGP labIllustrative topology
Customer · AS 65010Provider · AS 65020192.0.2.0/30Gi1 · .1Gi1 · .2R1Lo0: 10.255.0.1/32R2Lo0: 10.255.0.2/32Lo10: 198.51.100.1/24Lo10: 203.0.113.1/24
Solid line: physical link. Interface names and addresses match the configurations. All addresses and AS numbers are lab examples.
Baseline configuration

R1

interface GigabitEthernet1
 ip address 192.0.2.1 255.255.255.252
 no shutdown
exit
interface Loopback0
 ip address 10.255.0.1 255.255.255.255
exit
interface Loopback10
 ip address 198.51.100.1 255.255.255.0
exit
router bgp 65010
 bgp router-id 10.255.0.1
 no bgp default ipv4-unicast
 neighbor 192.0.2.2 remote-as 65020
 address-family ipv4 unicast
  neighbor 192.0.2.2 activate
 exit-address-family

R2

interface GigabitEthernet1
 ip address 192.0.2.2 255.255.255.252
 no shutdown
exit
interface Loopback0
 ip address 10.255.0.2 255.255.255.255
exit
interface Loopback10
 ip address 203.0.113.1 255.255.255.0
exit
router bgp 65020
 bgp router-id 10.255.0.2
 no bgp default ipv4-unicast
 neighbor 192.0.2.1 remote-as 65010
 address-family ipv4 unicast
  neighbor 192.0.2.1 activate
 exit-address-family
Illustrative router output · selected lines
R1# show ip bgp summary
Neighbor       V      AS  Up/Down  State/PfxRcd
192.0.2.2      4   65020  00:03:10             0
Illustrative router output · selected lines
R2# show ip bgp summary
Neighbor       V      AS  Up/Down  State/PfxRcd
192.0.2.1      4   65010  00:03:10             0

Confirm Established on both routers before investigating advertisements. A numeric State/PfxRcd value of 0 can mean an established session receiving no prefixes.

Network command

The network statement selects an exact prefix already present in the local IP routing table. It does not enable BGP on an interface.

R1(config)# router bgp 65010
R1(config-router)# address-family ipv4 unicast
R1(config-router-af)# network 198.51.100.0 mask 255.255.255.0
Illustrative router output · selected lines
R1# show ip route 198.51.100.0
Routing entry for 198.51.100.0/24
  Known via "connected", distance 0, metric 0
  * directly connected, via Loopback10
Illustrative router output · selected lines
R1# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, best #1, table default)
  Local
    0.0.0.0
      Origin IGP, localpref 100, valid, sourced, local, best
Illustrative router output · selected lines
R1# show ip bgp neighbors 192.0.2.2 advertised-routes
     Network          Next Hop       Metric LocPrf Weight Path
 *>  198.51.100.0/24   0.0.0.0             0         32768 i

This is R1’s local advertised-routes view; R2’s received path includes R1’s AS.

Illustrative router output · selected lines
R2# show ip bgp 198.51.100.0/24
BGP routing table entry for 198.51.100.0/24
Paths: (1 available, best #1, table default)
  65010
    192.0.2.1
      Origin IGP, localpref 100, valid, external, best
Illustrative router output · selected lines
R2# show ip route 198.51.100.0
Routing entry for 198.51.100.0/24
  Known via "bgp 65020", distance 20, metric 0
  * 192.0.2.1

R1 originates the prefix and prepends AS 65010 when sending it to R2. The final i is the origin code. Advertised-routes alone does not prove that R2 accepted or installed it—check R2 as well.

Exact prefix match

A connected host route does not satisfy a network statement for a larger subnet. Add a second loopback on R1 and deliberately use the wrong mask.

R1(config)# interface Loopback20
R1(config-if)# ip address 192.0.2.129 255.255.255.255
R1(config-if)# exit
R1(config)# router bgp 65010
R1(config-router)# address-family ipv4 unicast
R1(config-router-af)# network 192.0.2.128 mask 255.255.255.128
Illustrative router output · selected lines
R1# show ip bgp 192.0.2.128/25
% Network not in table

Before correcting the mask, there is no originated /25 entry.

The routing table has 192.0.2.129/32, not 192.0.2.128/25. With no exact /25 route, that network statement originates nothing. Correct it to match the installed host route.

R1(config-router-af)# no network 192.0.2.128 mask 255.255.255.128
R1(config-router-af)# network 192.0.2.129 mask 255.255.255.255
Illustrative router output · selected lines
R2# show ip bgp 192.0.2.129/32
BGP routing table entry for 192.0.2.129/32
Paths: (1 available, best #1, table default)
  65010
    192.0.2.1
      Origin IGP, localpref 100, valid, external, best

R2 should now see the /32 via 192.0.2.1 with AS path 65010.

Optional: originate a covering prefix

A discard route can supply the exact routing-table entry for a covering advertisement. In this separate experiment, R1 advertises 198.51.100.0/23 while keeping its connected 198.51.100.0/24.

R1(config)# ip route 198.51.100.0 255.255.254.0 Null0
R1(config)# router bgp 65010
R1(config-router)# address-family ipv4 unicast
R1(config-router-af)# network 198.51.100.0 mask 255.255.254.0

Traffic matching the connected /24 follows that more-specific route. Traffic for the rest of the /23 is discarded unless another more-specific route exists. The advertisement does not create reachability for those addresses.

Illustrative router output · selected lines
R1# show ip route 198.51.100.1
Routing entry for 198.51.100.0/24
  Known via "connected", distance 0, metric 0
  * directly connected, via Loopback10
Illustrative router output · selected lines
R1# show ip route 198.51.101.1
Routing entry for 198.51.100.0/23
  Known via "static", distance 1, metric 0
  * directly connected, via Null0

The unused half follows the covering discard route; it does not reach a host.

Illustrative router output · selected lines
R2# show ip bgp 198.51.100.0/23
BGP routing table entry for 198.51.100.0/23
Paths: (1 available, best #1, table default)
  65010
    192.0.2.1
      Origin IGP, localpref 100, valid, external, best

Remove the optional experiment before continuing.

R1(config)# router bgp 65010
R1(config-router)# address-family ipv4 unicast
R1(config-router-af)# no network 198.51.100.0 mask 255.255.254.0
R1(config-router-af)# exit-address-family
R1(config-router)# exit
R1(config)# no ip route 198.51.100.0 255.255.254.0 Null0

Redistribution

Redistribution imports routes from another routing source. Use a filter so connected transit and management networks are not unintentionally exported. This alternative replaces the /24 network statement.

R1(config)# ip prefix-list BGP-EXPORT seq 10 permit 198.51.100.0/24
R1(config)# route-map CONNECTED-TO-BGP permit 10
R1(config-route-map)# match ip address prefix-list BGP-EXPORT
R1(config-route-map)# exit
R1(config)# router bgp 65010
R1(config-router)# address-family ipv4 unicast
R1(config-router-af)# no network 198.51.100.0 mask 255.255.255.0
R1(config-router-af)# redistribute connected route-map CONNECTED-TO-BGP
Illustrative R2 result after convergence
R2# show ip bgp
     Network          Next Hop       Metric LocPrf Weight Path
 *>  198.51.100.0/24   192.0.2.1           0             0 65010 ?

The prefix is still present, but the origin is now incomplete (?). The prefix list permits exactly the /24; it does not export the interface /30 or loopback /32s. The source determines route eligibility. On the command platform used here, OSPF redistribution can also include connected prefixes participating in that OSPF process; those entries still appear as connected in the IP routing table. Inspect the source and the actual BGP result rather than assuming every eligible prefix has an O route code.

OSPF redistribution · filtered local-prefix example

Keep the two-router topology. Add one host prefix on R1, enable it in OSPF process 1 and permit only that prefix into BGP. R2 does not need to run OSPF for this example.

R1(config)# interface Loopback30
R1(config-if)# ip address 198.51.101.1 255.255.255.255
R1(config-if)# exit
R1(config)# router ospf 1
R1(config-router)# passive-interface Loopback30
R1(config-router)# network 198.51.101.1 0.0.0.0 area 0
R1(config-router)# exit
R1(config)# ip prefix-list OSPF-EXPORT seq 10 permit 198.51.101.1/32
R1(config)# route-map OSPF-TO-BGP permit 10
R1(config-route-map)# match ip address prefix-list OSPF-EXPORT
R1(config-route-map)# exit
R1(config)# router bgp 65010
R1(config-router)# address-family ipv4 unicast
R1(config-router-af)# redistribute ospf 1 match internal route-map OSPF-TO-BGP
R1(config-router-af)# end
Illustrative output · selected lines
R1# show ip route 198.51.101.1
Routing entry for 198.51.101.1/32
  Known via "connected", distance 0, metric 0
  * directly connected, via Loopback30

R2# show ip bgp 198.51.101.1/32
BGP routing table entry for 198.51.101.1/32
Paths: (1 available, best #1, table default)
  65010
    192.0.2.1 from 192.0.2.1
      Origin incomplete, localpref 100, valid, external, best

This demonstrates a connected prefix participating in OSPF being eligible for OSPF-to-BGP redistribution. The filter excludes unrelated routes. OSPF external route types need explicit selection when required; that policy detail belongs in the redistribution lessons.

Verification and review

Troubleshooting

CheckQuestion
Local IP routeDoes the exact prefix and mask exist?
Local BGP entryDid the network statement or filtered redistribution originate it?
Outbound advertisementIs the address family active, and does policy permit the route?
Remote BGP entryDid the neighbor accept it?
Remote IP routeWas the selected route installed and its next hop resolved?

Key Takeaways

  • A BGP network statement needs an exact prefix-and-mask match in the local IP routing table; it does not activate BGP on an interface.
  • A discard route can support a covering advertisement, but uncovered traffic following that route is discarded.
  • Redistribution imports eligible routes from a selected source; explicit filters control what leaves the router.
  • Network origination normally sets origin i; redistribution normally sets origin ? unless policy changes it.
  • Verify the local route, local BGP entry, advertisement, remote BGP entry and remote installed route separately.

Advertising Networks Quiz

Six questions · four options each · select one answer per question. Submit all answers to see your score and explanations.

1. R1 has 192.0.2.129/32 installed. Does network 192.0.2.128 mask 255.255.255.128 originate a /25?
2. What does the BGP network command do in this lesson?
3. R1 has a connected /24 and a covering /23 static route to Null0. Where does traffic for the connected /24 go?
4. Why use a prefix list and route map on connected redistribution?
5. After replacing a network statement with redistribution, the origin becomes ?. What does that mean?
6. R1 lists a route under advertised-routes. What must you still check?
Command references

basic BGP configuration · OSPF-to-BGP redistribution behavior. Outputs are illustrative; command support and formatting vary by image. Router-symbol attribution.