How do you send or receive a default route with BGP?
Show the answer
Say this first
To send one, the cleanest way is neighbor x default-originate, which sends 0.0.0.0/0 to that neighbor only;
on Cisco it does not even need a default in the local routing table. The alternatives are network 0.0.0.0,
which needs a default in the routing table, or redistributing a default together with
default-information originate. To receive one, I ask the ISP for default only or default plus partial routes
and permit 0.0.0.0/0 in my inbound prefix list.
Go deeper
Sending
router bgp 64496
neighbor 192.0.2.2 remote-as 64500
neighbor 192.0.2.2 default-originateConditional version: advertise the default only while some upstream route exists in the routing table.
ip prefix-list UPSTREAM seq 5 permit 198.51.100.0/24
!
route-map HAVE-UPSTREAM permit 10
match ip address prefix-list UPSTREAM
!
router bgp 64496
neighbor 192.0.2.2 default-originate route-map HAVE-UPSTREAMReceiving
ip prefix-list DEFAULT-ONLY seq 5 permit 0.0.0.0/0
!
router bgp 64500
neighbor 192.0.2.1 prefix-list DEFAULT-ONLY inR1# show ip route | include 0.0.0.0
Gateway of last resort is 192.0.2.1 to network 0.0.0.0
B* 0.0.0.0/0 [20/0] via 192.0.2.1, 00:12:44Spreading it inside
Do not redistribute BGP into the IGP. Originate a default into OSPF on the edge router with
default-information originate, which by default only works while the router itself has a default.
They will ask next
What does 0.0.0.0/0 le 32 match in a prefix list?
Every IPv4 prefix.
permit 0.0.0.0/0alone matches only the default route. Mixing these up is a classic way to accept a full table when you meant default only.When would you take full tables instead of a default?
When you are multihomed and want each destination to use the best exit, or need to see exactly how the internet reaches each prefix. It costs memory and CPU on the edge routers.
Traps
- Writing
0.0.0.0/0 le 32when you mean default only.