Task: Implementing BGP on IOS-XE and IOS-XR
All routers have been pre-configured with IPv4 addressing. As a network engineer for INE, you have been
assigned the following tasks to complete:
1. Configure eBGP adjacency between R1 and R5 and between R2 and R5. R1 and R2 belongs to BGP AS
100 and R5 belongs to BGP AS 5. R5 must advertise 150.5.5.1/32 and 150.5.5.2/32 with ORIGIN Code as
"igp" and 150.5.5.3/32, 150.5.5.4/32, and 150.5.5.5/32 with ORIGIN code as "incomplete".
2. Configure eBGP adjacency between XR11 and XR13 and between XR12 and XR13. XR11 and XR12
belongs to BGP AS 100 and XR13 belongs to BGP AS 13. XR13 must advertise 150.13.13.1/32 and
150.13.13.2/32 with ORIGIN Code as "incomplete" and 150.13.13.3/32, 150.13.13.4/32, and
150.13.13.5/32 with ORIGIN code as "igp".
3. Configure eBGP adjacency between R2 and R7 and between R7 and XR12. Ensure eBGP neighborship is
done using the Loopback0 interface. You must use a static route to accomplish this. R2 and XR12 belongs
to BGP AS 100 and R7 belongs to BGP AS 7. Advertise 150.7.7.1/32, 150.7.7.2/32, 150.7.7.3/32,
150.7.7.4/32, and 150.7.7.5/32 using the network statement.
4. Configure iBGP adjacency between R3 and XR14 using the Loopback0 interface. R3 and XR14 must be
the route-reflector for all their neighbors. R1, R2, XR11, and XR12 must peer with both the route-
reflectors using the Loopback0 interface. Your task is complete when you are able to ping from 150.5.5.1
to 150.13.13.1 and from 150.5.5.5 to 150.7.7.5.
5. Configure R5 to select R2 as the primary path and backup as R1 to reach 150.13.13.1/32. No other route
should be affected with your solution. Configure XR13 to select XR12 as the primary path and backup as
XR11 to reach 150.5.5.1/32. No other route should be affected with your solution. Use the most
influential BGP path selection attribute.
6. Configure R5 to select R2 as the primary path and backup as R1 to reach 150.13.13.2/32. No other route
should be affected with your solution. Configure XR13 to select XR12 as the primary path and backup as
XR11 to reach 150.5.5.2/32. No other route should be affected with your solution. Use a well-known
discretionary BGP path selection attribute.
7. Configure R1 in such a way that R5 selects R2 as the primary path and backup as R1 to reach
150.13.13.3/32. No other route should be affected with your solution. Configure XR11 in such a way that
XR13 selects XR12 as the primary path and backup as XR11 to reach 150.5.5.3/32. No other route should
be affected with your solution. Use a well-known mandatory BGP path selection attribute.
8. Configure R1 in such a way that R5 selects R2 as the primary path and backup as R1 to reach
150.13.13.4/32. No other route should be affected with your solution. Configure XR11 in such a way that
XR13 selects XR12 as the primary path and backup as XR11 to reach 150.5.5.4/32. No other route should
be affected with your solution. Use an optional non-transitive BGP path selection attribute.
1.
Solutions:
Routes advertised using the network statement has the default ORIGIN code which is igp. Routes
advertised using the redistribute statement has the ORIGIN code as incomplete.
R1:
router bgp 100
neighbor 10.1.5.5 remote-as 5
R2:
router bgp 100
neighbor 10.2.5.5 remote-as 5
R5:
route-map ORIGIN_INCOMPLETE permit 10
match interface Loopback2
route-map ORIGIN_INCOMPLETE permit 20
match interface Loopback3
route-map ORIGIN_INCOMPLETE permit 30
match interface Loopback4
!
router bgp 5
network 150.5.5.1 mask 255.255.255.255
network 150.5.5.2 mask 255.255.255.255
redistribute connected route-map ORIGIN_INCOMPLETE
neighbor 10.1.5.1 remote-as 100
neighbor 10.2.5.2 remote-as 100
2. You can use RPL to make the BGP attribute changes as desired.
XR11:
route-policy TO_XR13
pass
end-policy
route-policy FROM_XR13
pass
end-policy
router bgp 100
address-family ipv4 unicast
neighbor 10.11.13.13
remote-as 13
address-family ipv4 unicast
route-policy FROM_XR13 in
route-policy TO_XR13 out
commit
XR12:
route-policy TO_XR13
pass
end-policy
route-policy FROM_XR13
pass
end-policy
router bgp 100
address-family ipv4 unicast
neighbor 10.12.13.13
remote-as 13
address-family ipv4 unicast
route-policy FROM_XR13 in
route-policy TO_XR13 out
commit
XR13:
route-policy TO_XR11
pass
end-policy
route-policy TO_XR12
pass
end-policy
!
route-policy FROM_XR11
pass
end-policy
route-policy FROM_XR12
pass
end-policy
route-policy ORIGIN_INCOMPLETE
if destination in (150.13.13.1/32, 150.13.13.2/32) then
set origin incomplete
endif
end-policy
router bgp 13
address-family ipv4 unicast
network 150.13.13.3/32
network 150.13.13.4/32
network 150.13.13.5/32
redistribute connected route-policy ORIGIN_INCOMPLETE
neighbor 10.11.13.11
remote-as 100
address-family ipv4 unicast
route-policy FROM_XR11 in
route-policy TO_XR11 out
neighbor 10.12.13.12
remote-as 100
address-family ipv4 unicast
route-policy FROM_XR12 in
route-policy TO_XR12 out
commit
3. BGP uses TCP port 179. This means that the source of the BGP packet must be reachable to establish BGP
neighborship. To make the neighbors Loopback IP reachable we have used a static route. By default the
TTL for eBGP is 1, thus we must change the eBGP multi-hop value to higher than 1.
R7:
ip route 150.2.2.1 255.255.255.255 10.2.7.2
ip route 150.12.12.1 255.255.255.255 10.7.12.12
router bgp 7
network 150.7.7.1 mask 255.255.255.255
network 150.7.7.2 mask 255.255.255.255
network 150.7.7.3 mask 255.255.255.255
network 150.7.7.4 mask 255.255.255.255
network 150.7.7.5 mask 255.255.255.255
neighbor 150.2.2.1 remote-as 100
neighbor 150.2.2.1 ebgp-multihop 255
neighbor 150.2.2.1 update-source Loopback0
neighbor 150.12.12.1 remote-as 100
neighbor 150.12.12.1 ebgp-multihop 255
neighbor 150.12.12.1 update-source Loopback0
R2:
ip route 150.7.7.1 255.255.255.255 10.2.7.7
router bgp 100
neighbor 150.7.7.1 remote-as 7
neighbor 150.7.7.1 ebgp-multihop 255
neighbor 150.7.7.1 update-source Loopback0
XR12:
router static
address-family ipv4 unicast
150.7.7.1/32 GigabitEthernet0/0/0/3 10.7.12.7
route-policy TO_R7
pass
end-policy
route-policy FROM_R7
pass
end-policy
router bgp 100
address-family ipv4 unicast
neighbor 150.7.7.1
remote-as 7
update-source lo0
ebgp-multihop
address-family ipv4 unicast
route-policy FROM_R7 in
route-policy TO_R7 out
commit
4. By default when routes learned from an eBGP neighbor are advertised to an iBGP neighbor, the
advertising router will not set the next-hop address to self. We must manually set the next-hop to self on
the advertising router towards the iBGP neighbor.
R1:
router bgp 100
neighbor 150.3.3.1 remote-as 100
neighbor 150.3.3.1 update-source Loopback0
neighbor 150.3.3.1 next-hop-self
neighbor 150.14.14.1 remote-as 100
neighbor 150.14.14.1 update-source Loopback0
neighbor 150.14.14.1 next-hop-self
R2:
router bgp 100
neighbor 150.3.3.1 remote-as 100
neighbor 150.3.3.1 update-source Loopback0
neighbor 150.3.3.1 next-hop-self
neighbor 150.14.14.1 remote-as 100
neighbor 150.14.14.1 update-source Loopback0
neighbor 150.14.14.1 next-hop-self
R3:
router bgp 100
neighbor 150.1.1.1 remote-as 100
neighbor 150.1.1.1 update-source Loopback0
neighbor 150.1.1.1 route-reflector-client
neighbor 150.2.2.1 remote-as 100
neighbor 150.2.2.1 update-source Loopback0
neighbor 150.2.2.1 route-reflector-client
neighbor 150.11.11.1 remote-as 100
neighbor 150.11.11.1 update-source Loopback0
neighbor 150.11.11.1 route-reflector-client
neighbor 150.12.12.1 remote-as 100
neighbor 150.12.12.1 update-source Loopback0
neighbor 150.12.12.1 route-reflector-client
neighbor 150.14.14.1 remote-as 100
neighbor 150.14.14.1 update-source Loopback0
neighbor 150.14.14.1 route-reflector-client
XR11:
router bgp 100
neighbor 150.3.3.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
next-hop-self
neighbor 150.14.14.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
next-hop-self
!
commit
XR12:
router bgp 100
neighbor 150.3.3.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
next-hop-self
neighbor 150.14.14.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
next-hop-self
commit
XR14:
router bgp 100
address-family ipv4 unicast
neighbor 150.3.3.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
route-reflector-client
neighbor 150.1.1.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
route-reflector-client
neighbor 150.2.2.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
route-reflector-client
neighbor 150.11.11.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
route-reflector-client
neighbor 150.12.12.1
remote-as 100
update-source Loopback0
address-family ipv4 unicast
route-reflector-client
commit
5. WEIGHT is the most influential BGP path selection attribute as per Cisco. Higher WEIGHT is better.
Default WEIGHT is 0 for routes learned from a neighbor and 32768 if the route is a locally originated
BGP route.
R5:
access-list 1 permit 150.13.13.1
route-map FROM_R2 permit 10
match ip address 1
set weight 5000
route-map FROM_R2 permit 10000
router bgp 5
neighbor 10.2.5.2 route-map FROM_R2 in
XR13:
route-policy FROM_XR12
if destination in (150.5.5.1/32) then
set weight 13000
else
pass
endif
end-policy
commit
6. Local Preference is a well-known discretionary BGP attribute. Higher local preference is better. Default
is 100. Since local preference is a non-transitive attribute, it can only be applied outbound to an iBGP
neighbor or inbound from an eBGP neighbor but NOT outbound to an eBGP neighbor.
R5:
access-list 2 permit 150.13.13.2
route-map FROM_R2 permit 20
match ip address 2
set local-preference 5000
XR13:
route-policy FROM_XR12
if destination in (150.5.5.1/32) then
set weight 13000
elseif destination in (150.5.5.2/32) then
set local-preference 13000
else
pass
endif
end-policy
commit
7. AS-PATH is a well-known mandatory BGP attribute. Shorter hops of AS are better.
R1:
access-list 1 permit 150.13.13.3
route-map TO_R5 permit 10
match ip address 1
set as-path prepend 100 100 100
route-map TO_R5 permit 10000
router bgp 100
neighbor 10.1.5.5 route-map TO_R5 out
XR11:
route-policy TO_XR13
if destination in (150.5.5.3/32) then
prepend as-path 100 3
else
pass
endif
end-policy
commit
8. MED is an optional non-transitive BGP attribute. Lower MED is better.
R1:
access-list 2 permit 150.13.13.4
route-map TO_R5 permit 20
match ip address 2
set metric 1000
XR11:
route-policy TO_XR13
if destination in (150.5.5.3/32) then
prepend as-path 100 3
elseif destination in (150.5.5.4/32) then
set med 1000
else
pass
endif
end-policy
commit