المقالة التالية وجدتها أثناء بحثي في موضوع Route Maps، وهي على بساطتها ساعدتني كثيراً في فهم هذا الموضوع الشائك. وهي للأمانة منشورة على موقع Cramsession. أصبحت لدي عقدة من كتب Cisco Press. وأظن أن مؤلف الكتاب يعتقد أنه سيذهب إلى الجحيم إذا ما تحلى بالبساطة في شرحه لمثل هكذا موضوع.
Route Maps – Using route maps for policy-based routing
In a complex network, where there are multiple paths for data to travel, it is often desirable to control the route the packets will take through the network. Route maps are often used to enhance the predictability of data flows in a complex environment. In this week’s newsletter I will be writing about policy-based routing using route maps.
Route maps are similar to access lists, and are used when the route that a packet takes needs to be altered. When a route map is applied to an interface, packets on that interface are tested against conditions that are configured using match commands. If the conditions are met, an action can be taken. Actions are defined using set commands and can be used modify the packet or routes (this is the major difference between access lists and route maps).
Route maps are identified by a map name that is assigned when the route map is created. A route map may be composed of multiple lines each with a sequence number. Each line can have multiple match and set commands. A packet is compared to each line of the route map until there is a match, then the set actions for that line are applied to the packet similar to the way an access list is applied. Also like an access list, the last line of a route-map is an implicit deny.
Take the following example:
access-list 1 permit 192.168.1.1
access-list 2 permit 192.168.2.0 0.0.0.255
route-map test permit 10
match ip address 1
match route-type internal
set interface Serial0
route-map test permit 20
match ip address 2
set interface Null0
If this route map were configured on an interface, packets received would be tested against each line in order. For traffic to be passed to serial interface 0, it would have to have a source of 192.168.1.1 (note the access list), and the route would have to be internal (inter/intra area OSPF). Any traffic from the 192.168.2.X subnet would be sent to the Nul interface.
The commands used to configure the first line of the route map are:
lab2501(config)#route-map test permit 10
lab2501(config-route-map)#match ip address 1
lab2501(config-route-map)#match route-type internal
lab2501(config-route-map)#set interface s0
To display configured route maps, the ‘show route-map [map name]’ command can be used. For a route map to be useful, it has to be applied to an interface. Use the command:
lab2501(config-if)#ip policy route-map test
This command applies the route map to Ethernet interface one on the lab2501 router. To see what route maps are applied to an interface, you can use the show ip policy command:
lab2501#show ip policy
Interface Route map
The ‘debug ip policy’ command can be used to view IP policy activity. The command allows you to see the effect of route maps on packets, and to troubleshoot problems with applied route maps. It is important to note that the debug command can utilize significant router resources, and should be used during low traffic periods.
This week, I introduced route maps as a means to alter the route that a packet takes through the network based on predefined criteria. Route maps are quite simple in their most basic form, but they very versatile, and can become complex in short order. The links below lead to Cisco’s documentation on using route maps in policy-based routing. Understanding route maps is also an objective of the Building Cisco Scalable Networks (BSCN) and the Building Cisco Scalable Internetworks (BSCI) exams, so any exam guide for those exams should provide information on route maps. See you next week.