BGP Route Maps

Revised March 9, 2002

Questions? Comments? E-mail AL "at" CatSpace "dot" com


These exercises require the use of BGP prefix lists and regular expressions. If you're not up to speed on these topics, I recommend the "Prefix Lists" and "Regular Expressions" review exercises.


EXERCISES:

1. Construct a route map that sets the MED to 6000 for routes that were injected by your AS, and denies all other routes.

2. Construct a route map that sets the local preference to 775 for all class "C" networks, and sets the local preference to 850 for all other networks and all subnets.

3. Construct a route map that sets the weight for all private networks (and their subnets) to 25,000, and permits all other networks (without modifying their weights).

4. Construct a route map that sets the origin code to "incomplete" for any routes that were injected by AS 1864, and permits all other routes (without modifying their origin codes).

5. Construct a route map that sets the MED to 20000 for any paths that pass through AS 5432, 902 or 7823, and denies all other routes.

6. Construct a route map that sets the BGP local preference to 200 for any paths learned directly from AS 307, sets the local pref to 400 for any paths learned directly from AS 698 that pass through AS 405, and denies all other paths.

7. Construct a route map that sets the BGP weight to 4000 and the local pref to 500 for any path whose routes were injected by AS 106, 1006, or 10006, and permits all other paths (without modifying their weight or local preference).

8. Construct a route map that:

9. Your router lies in AS 907, and it has a BGP neighbor in AS 62 with IP address 212.54.101.9/30. Configure your router so that the only BGP paths advertised to this peer are those paths that were not injected by your AS, and so that any paths that are advertised have the MED set to 30000. Supply all commands necessary to configure the required route map, any associated access list(s), and to invoke the route map with the BGP peer.

10. Your router lies in AS 146, and it has a BGP peer in AS 29 with IP address 112.72.201.75/29. Configure your router so that your AS number is prepended three times (instead of the usual one) to all paths that it advertises to this neighbor.

11. Your router lies in AS 872, and it has a BGP neighbor in AS 5832 with IP address 172.42.11.91/30. Configure your router so that the only BGP paths it accepts from this peer are those that transits either or both AS 2984 or 5713.

12. Your router lies in AS 16, and it has a BGP neighbor in AS 195 with IP address 64.19.145.27/30. Configure your router so that no paths for which AS 692 has used a route map to prepend its AS number are advertised to this neighbor.

13. Your router lies in AS 202, and it has a BGP peer in AS 9239 with IP address 77.44.11.98/30. Configure your router so that the only BGP paths it accepts from this peer were injected by either the peer's AS or AS 2984.

14. Your router lies in AS 691, and it has an iBGP peer with IP address 169.182.84.101/30. Configure your router so that all routes learned from this peer that passed through any privately-numbered AS have their local prefs set to 50, and all other routes learned from this peer have their local prefs set to 300.

15.

16.

17.

18.

19.

20.


ANSWERS:

1. The route map is:

 route-map test1 permit 10
  match as-path 1
  set metric 6000
The associated AS path ACL is:
 ip as-path access-list 1 permit ^$

2. The route map is:

 route-map test2 permit 10
  match ip address prefix test2
  set local-preference 775
 route-map test2 permit 20
  set local-preference 850
The associated prefix list is:
 ip prefix-list test2 seq 5 permit 192.0.0.0/3 ge 24 le 24

3. The route map is:

 route-map test3 permit 10
  match ip address prefix test3
  set weight 25000
 route-map test3 permit 20
The associated prefix list is:
 ip prefix-list test3 seq 5 permit 10.0.0.0/8 le 32
 ip prefix-list test3 seq 10 permit 172.16.0.0/12 le 32
 ip prefix-list test3 seq 15 permit 192.168.0.0/16 le 32

4. The route map is:

 route-map test4 permit 10
  match as-path 4
  set origin incomplete
 route-map test4 permit 20
The associated AS path ACL is:
 ip as-path access-list 4 permit _1864$

5. The route map is:

 route-map test5 permit 10
  match as-path 5
  set metric 20000
The associated AS path ACL is:
 ip as-path access-list 5 permit 5432|902|7823

6. The route map is:

 route-map test6 permit 10
  match as-path 6
  set local preference 200
 route-map test6 permit 20
  match as-path 61
  set local preference 400
The associated AS path ACLs are:
 ip as-path access-list 6 permit ^307_
 ip as-path access-list 61 permit ^698_(.+_)*405_

7. The route map is:

 route-map test7 permit 10
  match as-path 7
  set weight 4000
  set local-preference 500
 route-map test7 permit 20
The associated AS path ACL is:
 ip as-path access-list 7 permit _106$
 ip as-path access-list 7 permit _1006$
 ip as-path access-list 7 permit _10006$
This AS path ACL is a little more elegant:
 ip as-path access-list 7 permit _1(0|00|000)6$
Since the range of ASNs is 1 to 65535, this will also work:
 ip as-path access-list 7 permit _10+6$

8. The route map is:

 route-map test8 permit 10
  match ip address prefix test8a
  set origin incomplete
  set local-preference 50
 route-map test8 permit 20
  match ip address prefix test8b
  set weight 10000
  set local-preference 60
 route-map test8 permit 30
  match ip address prefix test8c
  set local-preference 70
The associated prefix lists are:
 ip prefix-list test8a seq 5 permit 10.0.0.0/8 le 32
 ip prefix-list test8b seq 5 permit 172.16.0.0/12 le 32
 ip prefix-list test8c seq 5 permit 192.168.0.0/16 le 32


Return to the top of this Exercise!

Return to the directory of Goodies!


Copyright © 2002 Alchemy, Inc. All rights reserved.