Octet

How do you get a prefix into BGP, and why might a network statement not work?

Show the answer

Say this first

Three ways: a network statement, redistribution, or aggregate-address. Unlike OSPF, the BGP network command does not enable anything on interfaces. It means "advertise this prefix if an exact match, same prefix and same mask, is in the routing table". It usually fails because of a mask mismatch or no matching route. The fix is the right mask, or a static route to Null0 that anchors the prefix.

Go deeper

Cisco IOS
ip route 203.0.113.0 255.255.255.0 Null0
!
router bgp 64500
 network 203.0.113.0 mask 255.255.255.0
Output
R1# show ip bgp | begin Network
     Network          Next Hop            Metric LocPrf Weight Path
 *>  203.0.113.0      0.0.0.0                  0         32768 i

Why the Null0 route

The /24 stays in the table as long as the router is up, so the announcement does not flap when a LAN subnet goes down. Inside, more specific routes for the real subnets win by longest match. Traffic for unused parts of the block hits Null0 and is dropped instead of looping toward the default route.

Common mistakes

  • network 203.0.113.0 without mask assumes the classful mask. Fine for a /24 in class C space, wrong for 10.20.0.0 which IOS would read as /8.
  • The RIB has 203.0.113.0/25 and /25, but you asked for the /24. No exact match, no advertisement.

Redistribution

redistribute ospf 1 route-map OSPF-TO-BGP sets origin ? and copies the IGP metric into MED. Always use a route map at the internet edge; never redistribute the full BGP table into an IGP.

Traps

  • Expecting network 203.0.113.0 mask 255.255.255.0 to summarise smaller routes. It needs the exact /24 in the RIB.
How did you do?Book 4.1 Global Internet