BGP Multihoming

BGP Multihoming

Network topology:

Here, R1 and R2 routers of the customer run eBGP connection with two PE routers of the same Service Provider (SP). The SP advertises only the default-route to the customer. The requirement is to allow all traffic (incoming and outgoing) to go through the Primary Link and in case of failure, the Secondary Link should be used.

The customer runs OSPF within their internal network. R1 and R2 routers only advertise the default-route to internal R3 router. All clients are connected to R3 router, hence it is acting as a default-gateway for them.

R1 and R2 routers should only advertise their internal network to the SP.

BGP Configuration:

Initial BGP Configuration

R1 router:
interface loopback 0
 ip address 10.210.0.150 255.255.255.255
!
interface serial 0/0
 description Primary Link
 ip address 10.1.1.1 255.255.255.0
!
interface fastethernet 0/0
 description Internal LAN Link
 ip address 192.168.1.1 255.255.255.0
 ip ospf 1 area 0
!
router bgp 65001
 neighbor 10.1.1.2 remote-as 7474
 neighbor 192.168.1.2 remote-as 65001
 network 10.210.0.150 mask 255.255.255.0

network 192.168.1.0

 network 10.1.1.0 mask 255.255.255.0
!
 R2 router:
interface loopback 0
 ip address 10.210.0.151 255.255.255.255
!
interface serial 0/0
 description Secondary Link
 ip address 10.2.2.1 255.255.255.0
!
interface fastethernet 0/0
 description Internal LAN Link
 ip address 192.168.1.2 255.255.255.0
 ip ospf 1 area 0
!
router bgp 65001
 neighbor 10.2.2.2 remote-as 7474
 neighbor 192.168.1.1 remote-as 65001
 network 10.210.0.151 mask 255.255.255.255
 network 192.168.1.0
 network 10.2.2.0 mask 255.255.255.0
!

Now, R1 and R2 routers should only advertise their internal networks to the SP. In other words, all the prefixes with empty AS_PATH list must be advertised.

Also, R2 router should also advertise all the internal prefixes with a longer AS_PATH list so that the PE routers will prefer the path with shorter AS_PATH list. Hence, we will prepend the local AS multiple times for all prefixes advertised by R2 router to the SP.

Advertise only Internal networks

R1 router:
router bgp 65001
 neighbor 10.1.1.2 filter-list 10 out
!
ip as-path access-list 10 permit ^$
!
 R2 router:
router bgp 65001
 neighbor 10.2.2.2 route-map APPEND_AS out
!
ip as-path access-list 10 permit ^$
!
route-map APPEND_AS permit 10
 match as-path 10
 set as-path prepend 65001 65001 65001
!

Also, R1 will advertise all routes that it received from SP PE routers (only default-route in this case) to R2 router. To notify R2 that if it receives any traffic for outside network, it must send to R1 router. To do this, R1 router advertises all prefixes with higher local-preference hence these routes would be preferred over the routes that R2 receives from its PE router.

High Local preference

R1 router:
router bgp 65001
 neighbor 192.168.1.2 route-map LOCAL_PREF out
!
route-map LOCAL_PREF permit 10
 set local-preference 150
!

OSPF Configuration:

OSPF is used as the IGP within the customer network. R1 and R2 routers only advertise default-route to the internal R3 router. However, R3 router will use R1 router as the primary path only if R1's WAN link is UP, otherwise, R3 will use the secondary path through R2 router.

So, when R1 advertises default-route within the internal network using OSPF, it advertises the default-route with a lower metric and if its WAN link is functioning properly. R2 router will advertise the default-route with a higher metric.

OSPF Configuration

R1 router:
router ospf 1
 default-information originate always metric 10 route-map Primary_Link
!
access-list 10 permit 10.1.1.0 0.0.0.255
!
route-map Primary_Link permit 10
 match ip address 10
!
 R2 router:
router ospf 1
 default-information originate always metric 100
!

Verification:

R1 router receives a default-route from the SP PE1 router. Same is true for R2 and PE2 router.

R1 BGP table

R1# show ip bgp
BGP table version is 8, local router ID is 10.210.0.150
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 0.0.0.0          10.1.1.2                 0             0 7474 i
*> 10.1.1.0/24      0.0.0.0                  0         32768 i
*> 10.210.0.150/32  0.0.0.0                  0         32768 i
*>i10.210.0.151/32  192.168.1.2              0    100      0 i
* i192.168.1.0      192.168.1.2              0    100      0 i
*>                  0.0.0.0                  0         32768 i

R1 advertises all prefixes to R2 router with local-preference 150. NOTE: A default-route from PE2 router is not seen on R2 router as it is not configured here for simplicity.

R2 BGP table

R2# show ip bgp
BGP table version is 8, local router ID is 10.210.0.151
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*>i0.0.0.0          10.1.1.2                 0    150      0 7474 i
*>i10.1.1.0/24      192.168.1.1              0    150      0 i
*>i10.210.0.150/32  192.168.1.1              0    150      0 i
*> 10.210.0.151/32  0.0.0.0                  0         32768 i
*> 192.168.1.0      0.0.0.0                  0         32768 i
* i                 192.168.1.1              0    150      0 i

As long as the Primary Link is UP, R1 router will advertise the default-route to R3 router with metric 10. R2 will also advertise the default-route to R3 router due to "always" keyword with metric 100. However, only the default-route from R1 is accepted.

R3 Route Table Before Primary Link Failure

R3# show ip route ospf
O*E2 0.0.0.0/0 [110/10] via 192.168.1.1, 00:28:58, FastEthernet0/0

R3 Route Table After Primary Link Failure

R3# show ip route ospf
O*E2 0.0.0.0/0 [110/100] via 192.168.1.2, 00:00:02, FastEthernet0/0