# Multihomed Enterprise Challenge (XRv)

**Topology**: bgp-mh-xr

<figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2Fwmsn5ACj3Dm7i0jTtEfI%2Fimage.png?alt=media&#x26;token=042eeef6-4781-4d19-8280-ed0fb25adfd2" alt=""><figcaption></figcaption></figure>

```
configure
load bootflash:init.cfg
commit r
y
```



This lab is the same as the previous "Multihomed Enterprise Challenge" lab, just with XRv nodes instead of IOL nodes.



* All links are in the format 100.X.Y.X/24.
  * For example, the link between R4 and R7 is 100.4.7.0/24.
* Lo0 is X.X.X.X/32 and is used for iBGP
* Lo1 is \<AS>.0.0.X/32 and is used as a public IP address that is pingable. The public Lo1 addresses are aggregated into a /8 at each edge router.
* eBGP and iBGP is fully preconfigured, but no policies are configured.



Goals:

* Configure AS50 as a stub AS - it should not provide transit
* Configure AS20 and AS30 to only advertise a default plus partial routes to AS50
  * AS20 must advertise prefixes of directly connected customers, which is AS40
* AS50 has two uplinks to AS20, and the R7-R4 link is better. Configure outbound traffic flow so that traffic always prefers this link as opposed to the R8-R5 link. But additionally, traffic destined for AS30 should prefer the R9-R6 link.
* Influence inbound traffic flow into AS50 so that it arrives via the R7-R4 link for all traffic except for traffic originated in AS30. This traffic should arrive over the direct link. AS30 provides the following communities that AS50 can use to influence LP, in route-map **CUSTOMER\_IN**.
  * 30:80 (set LP=80)
  * 30:120 (set LP=120)















































## Answer <a href="#d303d82a-1579-4fae-a2b2-059d4369b885" id="d303d82a-1579-4fae-a2b2-059d4369b885"></a>

```
#R2, R4, R5

community-set CUSTOMER_ROUTES
 20:1000
end-set
!
community-set LOCAL_ROUTES
 20:2000
end-set
!
route-policy SET_LOCAL_ROUTE_COMMUNITY
 set community (20:2000)
 pass
end-policy
!
route-policy CUSTOMER_IN
 set community (20:1000)
 pass
end-policy
!
route-policy PARTIAL_TABLE
 if destination in (0.0.0.0/0) then pass endif
 if community matches-any LOCAL_ROUTES then pass endif
 if community matches-any CUSTOMER_ROUTES then pass endif
end-policy
!
router bgp 20
 add ipv4 uni
  network 20.0.0.0/8 route-policy SET_LOCAL_ROUTE_COMMUNITY
  
#R2
router bgp 20
 neighbor 100.2.10.10
  add ipv4 uni
   route-policy CUSTOMER_IN in

#R4
router bgp 20
 nei 100.4.7.7
  add ipv4 uni
   route-policy PARTIAL_TABLE OUT
   default-originate
   
#R5
router bgp 20
 nei 100.5.8.8
  add ipv4 uni
   route-policy PARTIAL_TABLE OUT
   default-originate
   

#R3, R6
community-set CUSTOMER_ROUTES
 30:1000
end-set
!
community-set LOCAL_ROUTES
 30:2000
end-set
!
route-policy SET_LOCAL_ROUTE_COMMUNITY
 set community (30:2000)
 pass
end-policy
!
route-policy CUSTOMER_IN
  if community matches-any (30:80) then
    set local-preference 80
  endif
  if community matches-any (30:120) then
    set local-preference 120
  endif
  set community (30:1000)
end-policy
!
route-policy PARTIAL_TABLE
 if destination in (0.0.0.0/0) then pass endif
 if community matches-any LOCAL_ROUTES then pass endif
 if community matches-any CUSTOMER_ROUTES then pass endif
end-policy
!
router bgp 30
 add ipv4 uni
  network 30.0.0.0/8 route-policy SET_LOCAL_ROUTE_COMMUNITY

#R6
router bgp 30
 nei 100.6.9.9
  add ipv4 uni
   route-policy PARTIAL_TABLE out
   default-originate
   
   
#R7
route-policy R4_IN
 set local-pref 110
end-policy
!
route-policy R4_OUT
 if as-path is-local then pass endif
end-policy
!
router bgp 50
 nei 100.4.7.4
  add ipv4 uni
   route-policy R4_IN in
   route-policy R4_OUT out
   
#R8
route-policy R5_OUT
 if as-path is-local then
  prepend as-path own-as 2
 endif
end-policy
!
router bgp 50
 nei 100.5.8.5
  add ipv4 uni
   route-policy R5_OUT out
   
#R9
route-policy R6_OUT
 if as-path is-local then
  prepend as-path own-as 2
  set community (30:120)
 endif
end-policy
!
router bgp 50
 nei 100.6.9.6
  add ipv4 uni
   route-policy R6_OUT out
   send-community-ebgp
```



Verification is the same as the previous lab which uses IOL nodes.
