Where BGP routes come from
BGP has no discovery of its own. It does not look at your interfaces and decide what to tell the world. Every prefix in the BGP table arrived in one of two ways: a neighbour sent it, or something on this router put it there. This lesson is about the second way. The routers that do it are said to originate the route.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
What an originated route looks like on the wire
Whichever way a route starts, it leaves in an UPDATE message. The prefix goes in the NLRI field. The attributes go beside it: ORIGIN, an AS_PATH (empty inside the originating AS, your AS number added when it crosses an eBGP session), NEXT_HOP and so on.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
The network command and the exact-match rule
On small screens, swipe sideways or focus the diagram and use the arrow keys.
The network command does not turn BGP on for an interface the way it does in OSPF or EIGRP. It says: if this exact prefix is in my routing table, put it in the BGP table. The check is against the RIB, so a connected, static or IGP route all qualify. If the prefix is missing, or the mask differs by even one bit, the statement does nothing and the router gives no warning.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
ip route 198.51.100.0 255.255.252.0 Null0
!
router bgp 64500
address-family ipv4 unicast
network 198.51.100.0 mask 255.255.252.0R1. The static route to Null0 is the usual way to make the exact aggregate prefix exist when the address space is spread across several smaller subnets. More specific routes still carry the real traffic.
R1#show ip bgp 198.51.100.0/22 BGP routing table entry for 198.51.100.0/22, version 2 Paths: (1 available, best #1, table default) Advertised to update-groups: 1 Local 0.0.0.0 from 0.0.0.0 (192.0.2.254) Origin IGP, metric 0, localpref 100, weight 32768, valid, sourced, local, best
Local with a next hop of 0.0.0.0 means this router originated the route. Weight 32768 is what IOS gives locally sourced routes. Origin IGP is the i you see in the table.Classful networks and auto-summary
If you type network 1.0.0.0 with no mask, IOS assumes the classful mask for that address (here /8) and still needs exactly 1.0.0.0/8 in the routing table. Nothing is advertised if the router only has 1.1.1.1/32. The auto-summary command changes that: with it, the router originates the classful network as soon as any subnet of it is in the routing table. Auto-summary is off by default in current IOS XE, which is what you want, because a summary the router does not really have can attract traffic it cannot deliver.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
Redistribution and the incomplete origin
The redistribute command copies routes from another source into BGP. It saves typing, but it takes everything: every connected subnet, every OSPF route, whatever happens to be there. The ORIGIN attribute records how a route entered BGP, and redistributed routes get incomplete (?), because BGP does not know where they came from.
On small screens, swipe sideways or focus the diagram and use the arrow keys.
ORIGIN is the third tie-breaker in the best-path order after weight, local preference and locally originated: IGP is preferred to EGP, which is preferred to incomplete. For one prefix reachable by two methods, this decides the winner.
route-map CONNECTED-TO-BGP permit 10
match ip address prefix-list OWN-PREFIXES
!
router bgp 64500
address-family ipv4 unicast
redistribute connected route-map CONNECTED-TO-BGPR1. If you must redistribute, always pass the routes through a route map so only the prefixes you own can enter. An unfiltered redistribute connected can advertise your link subnets to the internet.
Sending a default route with default-originate
On small screens, swipe sideways or focus the diagram and use the arrow keys.
An ISP often sends a customer nothing but a default route. Rather than put 0.0.0.0/0 in its own table, it can tell BGP to give the default to one neighbour directly.
router bgp 64501
address-family ipv4 unicast
neighbor 192.0.2.2 default-originateISP A. Sends 0.0.0.0/0 to the neighbour whether or not the ISP itself has a default route. The route is not added to the ISP's own BGP table.
Add a route map and the default is sent only while the route map matches something. That makes it conditional: advertise a default only while a route that proves the upstream is healthy is present.
ip prefix-list UPSTREAM-OK seq 5 permit 203.0.113.0/24
!
route-map DEFAULT-IF-UP permit 10
match ip address prefix-list UPSTREAM-OK
!
router bgp 64501
address-family ipv4 unicast
neighbor 192.0.2.2 default-originate route-map DEFAULT-IF-UPISP A. With the route map, the default is advertised only while 203.0.113.0/24 is in the routing table.
R1#show ip bgp neighbors 192.0.2.1 received-routes Network Next Hop Metric LocPrf Weight Path *> 0.0.0.0 192.0.2.1 0 64501 i Total number of prefixes 1
Verifying that a route was originated and advertised
On small screens, swipe sideways or focus the diagram and use the arrow keys.
show ip route 198.51.100.0 255.255.252.0
show ip bgp 198.51.100.0/22
show ip bgp neighbors 192.0.2.1 advertised-routesPrivileged EXEC mode. The first confirms the network statement can match, the second that BGP originated it, the third that your outbound policy let it through.
Technical reference: RFC 4271, A Border Gateway Protocol 4 (BGP-4), sections 4.3 and 5.1.1. Output above is illustrative.
Check your understanding
You configure network 198.51.100.0 mask 255.255.255.0, but the RIB holds only 198.51.100.0/23 from OSPF. What does BGP advertise?
A prefix enters BGP by redistribute connected. What does show ip bgp show as the origin code?
neighbor 192.0.2.2 default-originate route-map DEFAULT-IF-UP is configured. When is the default sent?