BGP IPv4 - Default Route

Default Route

The BGP IPv4 Default Route, often referred to as the default route or gateway of last resort, is a mechanism in the Border Gateway Protocol (BGP) used to handle traffic destined for networks not explicitly listed in the BGP routing table. This default route is a valuable tool in network design, allowing routers to efficiently forward traffic to a predefined next-hop when no specific route exists for a given destination. It plays a crucial role in simplifying routing tables and aiding in the effective management of network traffic by providing a fallback route for unspecified destinations. The implementation of a default route in BGP enhances the scalability and flexibility of large-scale networks, ensuring optimal routing decisions in diverse and dynamic environments.

Lab:

BGP Topology

Configure IPv4 BGP Process for Autonomous

Step 1: In the configuration mode of router configure IPv4 BGP Process by following command:

R1: 
interface Ethernet0/0
ip address 12.0.0.1 255.255.255.0
no shutdown

ip route 33.0.1.3 255.255.255.255 12.0.0.2
ip route 33.0.2.3 255.255.255.255 12.0.0.2
ip route 33.0.3.3 255.255.255.255 12.0.0.2
ip route 44.0.1.4 255.255.255.255 12.0.0.2
ip route 44.0.2.4 255.255.255.255 12.0.0.2
ip route 44.0.3.4 255.255.255.255 12.0.0.2
exit

R2: 
interface Ethernet0/0
ip address 12.0.0.2 255.255.255.0
no shut

interface Ethernet0/1
ip address 23.0.0.2 255.255.255.0
no shut

interface Ethernet0/2
ip address 24.0.0.2 255.255.255.0
no shut

ip route 0.0.0.0 0.0.0.0 12.0.0.1

router ospf 1
network 0.0.0.0 0.0.0.0 area 0
exit

router bgp 65000
neighbor 23.0.0.3 remote-as 65000
neighbor 23.0.0.4 remote-as 65200
exit

R3: 
interface Ethernet0/0
ip address 23.0.0.3 255.255.255.0
no shut

interface Loopback1
ip address 33.0.1.3 255.255.255.0
interface Loopback2
ip address 33.0.2.3 255.255.255.0
interface Loopback3
ip address 33.0.3.3 255.255.255.0

router ospf 1
network 0.0.0.0 0.0.0.0 area 0
exit

router bgp 65000
neighbor 23.0.0.2 remote-as 65000
address-family ipv4
network 33.0.1.0 mask 255.255.255.0
network 33.0.2.0 mask 255.255.255.0
network 33.0.3.0 mask 255.255.255.0
exit


R4:
interface Ethernet 0/0
ip address 24.0.0.4 255.255.255.0
no shutdown

interface Loopback1
ip address 44.0.1.4 255.255.255.0
interface Loopback2
ip address 44.0.2.4 255.255.255.0
interface Loopback3
ip address 44.0.3.4 255.255.255.0

router ospf 1
network 0.0.0.0 0.0.0.0 area 0
exit

router bgp 65200
neighbor 24.0.0.2 remote-as 65000
address-family ipv4
network 44.0.1.0 mask 255.255.255.0
network 44.0.2.0 mask 255.255.255.0
network 44.0.3.0 mask 255.255.255.0
exit

Step 2: Verify IPv4 BGP routes by following command

R2 is learning the loopbacks from R3 and R4. 

R2#show ip bgp ipv4 unicast
BGP table version is 19, local router ID is 22.0.3.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          	Next Hop      Metric 	 LocPrf   	Weight  	Path
 *>i 33.0.1.0/24      	23.0.0.3        0    	  100      	0         	i
 *>i 33.0.2.0/24      	23.0.0.3        0    	  100      	0         	i
 *>i 33.0.3.0/24      	23.0.0.3        0    	  100      	0         	i
 *>  44.0.1.0/24      	24.0.0.4        0    	         	0 	        65200 i
 *>  44.0.2.0/24      	24.0.0.4        0    	        	0 	        65200 i
 *>  44.0.3.0/24      	24.0.0.4        0    	        	0 	        65200 i

R2 has a default route towards R1.
The goal is to announce default route in BGP. Redistribute static should be
enough to announce the default route.

R2(config)#router bgp 65000
R2(config-router)address-family ipv4
R2(config-router-af)#redistribute static

R4#show ip bgp ipv4 unicast
BGP table version is 19, local router ID is 44.0.3.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - i                                                                             nternal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-                                                                                  Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
	
     Network          	Next Hop        Metric  	LocPrf  	Weight  	Path
 *>  33.0.1.0/24      	24.0.0.2          0           0 		            65000 i
 *>  33.0.2.0/24      	24.0.0.2          0           0 		            65000 i
 *>  33.0.3.0/24      	24.0.0.2          0           0 		            65000 i
 *>  44.0.1.0/24      	0.0.0.0           0         		    32768 	     i
 *>  44.0.2.0/24      	0.0.0.0           0         		    32768 	     i
 *>  44.0.3.0/24      	0.0.0.0           0         		    32768 	     i

Is it in the BGP RIB of R2?

R2#show ip bgp ipv4 unicast
BGP table version is 19, local router ID is 22.0.3.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          	Next Hop       Metric   	LocPrf  	Weight     Path
 *>i 33.0.1.0/24      	23.0.0.3         0       	100      	0 	        i
 *>i 33.0.2.0/24      	23.0.0.3         0       	100      	0         	i
 *>i 33.0.3.0/24      	23.0.0.3         0       	100      	0 	        i
 *>  44.0.1.0/24      	24.0.0.4         0    	      	        0 	        65200 i
 *>  44.0.2.0/24      	24.0.0.4         0    	      	        0 	        65200 i
 *>  44.0.3.0/24      	24.0.0.4         0    	      	        0 	        65200 i 

It is not. BGP does not redistribute a static default route unless the
default-information command is used. This protects against someone accidentally
redistributing a default route in BGP which could potentially be disastrous.

R2(config)#router bgp 65000
R2(config-router)#address-family ipv4
R2(config-router)#default-information originate
R2(config-router)#exit

R2#show ip bgp ipv4 unicast
BGP table version is 20, local router ID is 22.0.3.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          	Next Hop         Metric 	LocPrf  	Weight  	Path
 *>  0.0.0.0          	12.0.0.1           0         		    32768 	    ?
 *>i 33.0.1.0/24      	23.0.0.3           0    	100      	0        	i
 *>i 33.0.2.0/24      	23.0.0.3           0    	100      	0        	i
 *>i 33.0.3.0/24      	23.0.0.3           0    	100      	0        	i
 *>  44.0.1.0/24      	24.0.0.4           0    	      	    0 	        65200 i
 *>  44.0.2.0/24      	24.0.0.4           0    	      	    0 	        65200 i
 *>  44.0.3.0/24      	24.0.0.4           0    	      	    0 	        65200 i 

R3#show bgp ipv4 unicast
BGP table version is 20, local router ID is 33.0.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          	Next Hop        Metric 	    LocPrf  	Weight 	   Path
 *>i 0.0.0.0          	12.0.0.1          0    	    100         0 	        ?
 *>  33.0.1.0/24      	0.0.0.0           0         		    32768   	i
 *>  33.0.2.0/24      	0.0.0.0           0         		    32768   	i
 *>  33.0.3.0/24      	0.0.0.0           0         		    32768   	i
 *>i 44.0.1.0/24      	24.0.0.4          0         100 	    0	       65200 i
 *>i 44.0.2.0/24      	24.0.0.4          0         100 	    0	       65200 i
 *>i 44.0.3.0/24      	24.0.0.4          0         100 	    0	       65200 i 

R4#show bgp ipv4 unicast
BGP table version is 20, local router ID is 44.0.3.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          	Next Hop       Metric   	LocPrf  	Weight  	Path
 *>  0.0.0.0          	24.0.0.2         0               	    0	        65000 ?
 *>  33.0.1.0/24      	24.0.0.2                               	0	        65000 i
 *>  33.0.2.0/24      	24.0.0.2                               	0	        65000 i
 *>  33.0.3.0/24      	24.0.0.2                               	0	        65000 i
 *>  44.0.1.0/24      	0.0.0.0          0         		        32768 	     i
 *>  44.0.2.0/24      	0.0.0.0          0         		        32768 	     i
 *>  44.0.3.0/24      	0.0.0.0          0         		        32768 	     i 

Task 2: Configure IPv4 Default Route in BGP using OSPF

Step 1: In the configuration mode of router configure IPv4 default route by following command:

R2:
router bgp 65000
no redistribute static
no ip route 0.0.0.0 0.0.0.0 12.0.0.1
interface Ethernet0/0
ip ospf 1 area 0
exit

R1:
interface Ethernet0/0
ip ospf 1 area 0
exit

router ospf 1
default-information originate always
exit

Step 2: Verify IPv4 OSPF routes by following command:

There is now a default route learned via OSPF

R2#show ip route ospf Codes: L -E local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP + - replicated route, % - next hop override

Gateway of last resort is 12.0.0.1 to network 0.0.0.0

O*E2 0.0.0.0/0 [110/1] via 12.0.0.1, 00:00:58, Ethernet0/0 33.0.0.0/8 is variably subnetted, 6 subnets, 2 masks O 33.0.1.3/32 [110/11] via 23.0.0.3, 00:26:48, Ethernet0/1 O 33.0.2.3/32 [110/11] via 23.0.0.3, 00:26:48, Ethernet0/1 O 33.0.3.3/32 [110/11] via 23.0.0.3, 00:26:48, Ethernet0/1 44.0.0.0/8 is variably subnetted, 6 subnets, 2 masks O 44.0.1.4/32 [110/11] via 24.0.0.4, 00:23:10, Ethernet0/2 O 44.0.2.4/32 [110/11] via 24.0.0.4, 00:23:10, Ethernet0/2 O 44.0.3.4/32 [110/11] via 24.0.0.4, 00:23:10, Ethernet0/2


**Step 3:**	In the configuration mode of router redistribute OSPF into BGP

R2: router bgp 65000 address-family ipv4 redistribute ospf 1 match external exit

R2#show bgp ipv4 unicast BGP table version is 22, local router ID is 22.0.3.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found

 Network          	Next Hop            Metric 	LocPrf 	Weight Path

*> 0.0.0.0 12.0.0.1 1 32768 ? *>i 33.0.1.0/24 23.0.0.3 0 100 0 i *>i 33.0.2.0/24 23.0.0.3 0 100 0 i *>i 33.0.3.0/24 23.0.0.3 0 100 0 i *>i 44.0.1.0/24 24.0.0.4 0 100 0 65200 i *>i 44.0.2.0/24 24.0.0.4 0 100 0 65200 i *>i 44.0.3.0/24 24.0.0.4 0 100 0 65200 i

R3#show bgp ipv4 unicast BGP table version is 22, local router ID is 33.0.3.3 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path *>i 0.0.0.0 12.0.0.1 1 100 0 ? *> 33.0.1.0/24 0.0.0.0 0 32768 i *> 33.0.2.0/24 0.0.0.0 0 32768 i *> 33.0.3.0/24 0.0.0.0 0 32768 i *> 44.0.1.0/24 24.0.0.2 0 0 65200 i *> 44.0.2.0/24 24.0.0.2 0 0 65200 i *> 44.0.3.0/24 24.0.0.2 0 0 65200 i

R4#show bgp ipv4 unicast BGP table version is 22, local router ID is 44.0.3.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found

 Network             Next Hop            Metric LocPrf Weight Path

*> 0.0.0.0 24.0.0.2 0 65000 ? *> 33.0.1.0/24 24.0.0.2 0 0 65000 i *> 33.0.2.0/24 24.0.0.2 0 0 65000 i *> 33.0.3.0/24 24.0.0.2 0 0 65000 i *> 44.0.1.0/24 0.0.0.0 0 32768 i *> 44.0.2.0/24 0.0.0.0 0 32768 i *> 44.0.3.0/24 0.0.0.0 0 32768 i

Thus Default Route in BGP can be propogated using static as well as IGP protocols

R4#show bgp ipv4 unicast BGP table version is 22, local router ID is 44.0.3.4 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found

 Network          Next Hop       Metric      LocPrf     Weight     Path

*> 0.0.0.0 24.0.0.2 0 65000 ? *> 33.0.1.0/24 24.0.0.2 0 0 65000 i *> 33.0.2.0/24 24.0.0.2 0 0 65000 i *> 33.0.3.0/24 24.0.0.2 0 0 65000 i *> 44.0.1.0/24 0.0.0.0 0 32768 i *> 44.0.2.0/24 0.0.0.0 0 32768 i *> 44.0.3.0/24 0.0.0.0 0 32768 i

Thus Default Route in BGP can be propogated using static as well as IGP protocols