www.CCIEtrack.com
Del.icio.us!Digg!StumbleUpon!Email a Friend!

BGP Route Maps Exercises

We recommend you understand Regular Expression theory, prior to doing these exersizes.

Also, 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 "BGP Regular Expressions" review exercises.

This is article is based on Al's BGP Route Maps exersizes at catspace.com.

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:

  • Sets the origin code to "incomplete" and the local preference to 50 for the 10.0.0.0/8 network and any of its subnets.
  • Sets the weight to 10,000 and the local preference to 60 for networks in the range 172.16.0.0/16 to 172.31.0.0/16 network, and any of their subnets.
  • Sets the local preference to 70 for any 192.168.x.0/24 network or subnet.
  • Denies all other prefixes.





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