Configuring IP Routing Protocol-Independent Features: Use Variable-Length Subnet Masks
Configuring IP Routing Protocol-Independent Features: Use Variable-Length Subnet Masks
Protocol-Independent Features
This chapter describes how to configure IP routing protocol-independent features. For a complete
description of the IP routing protocol-independent commands in this chapter, refer to the “IP
Routing Protocol-Independent Commands” chapter of the Network Protocols Command Reference,
Part 1. To locate documentation of other commands in this chapter, use the command reference
master index or search online.
Previous chapters addressed configurations of specific routing protocols. The following sections
describe optional features that are protocol-independent:
• Use Variable-Length Subnet Masks
• Configure Static Routes
• Specify Default Routes
• Change the Maximum Number of Paths
• Redistribute Routing Information
• Filter Routing Information
• Enable Policy Routing
• Manage Authentication Keys
• Monitor and Maintain the IP Network
See the section “IP Routing Protocol-Independent Configuration Examples” at end of this chapter
for configuration examples.
Note Consider your decision to use VLSMs carefully. You can easily make mistakes in address
assignments and you will generally find it more difficult to monitor your network using VLSMs.
The best way to implement VLSMs is to keep your existing numbering plan in place and gradually
migrate some networks to VLSMs to recover address space. See the “Variable-Length Subnet Mask
Example” section at the end of this chapter for an example of using VLSMs.
Command Purpose
ip route prefix mask {address | interface} [distance] [tag Establish a static route.
tag] [permanent]
See the “Overriding Static Routes with Dynamic Protocols Example” section at the end of this
chapter for an example of configuring static routes.
The software remembers static routes until you remove them (using the no form of the ip route
global configuration command). However, you can override static routes with dynamic routing
information through prudent assignment of administrative distance values. Each dynamic routing
protocol has a default administrative distance, as listed in Table 5. If you would like a static route to
be overridden by information from a dynamic routing protocol, simply ensure that the administrative
distance of the static route is higher than that of the dynamic protocol.
Static routes that point to an interface will be advertised via RIP, IGRP, and other dynamic routing
protocols, regardless of whether redistribute static commands were specified for those routing
protocols. This is because static routes that point to an interface are considered in the routing table
to be connected and hence lose their static nature. However, if you define a static route to an interface
that is not one of the networks defined in a network command, no dynamic routing protocols will
advertise the route unless a redistribute static command is specified for these protocols.
When an interface goes down, all static routes through that interface are removed from the IP routing
table. Also, when the software can no longer find a valid next hop for the address specified as the
forwarding router’s address in a static route, the static route is removed from the IP routing table.
Command Purpose
ip default-network network-number Specify a default network.
Command Purpose
maximum-paths maximum Configure the maximum number of parallel
paths allowed in a routing table.
Command Purpose
route-map map-tag [permit | deny] [sequence-number] Define any route maps needed to control
redistribution.
One or more match commands and one or more set commands typically follow a route-map
command. If there are no match commands, then everything matches. If there are no set commands,
nothing is done (other than the match). Therefore, you need at least one match or set command. To
define conditions for redistributing routes from one routing protocol into another, use at least one of
the following commands in route-map configuration mode:
Command Purpose
match as-path path-list-number Match a BGP autonomous system path access
list.
match community-list community-list-number [exact] Match a BGP community list.
match ip address {access-list-number | name} Match a standard access list.
[...access-list-number | name]
match metric metric-value Match the specified metric.
match ip next-hop {access-list-number | name} Match a next-hop router address passed by one
[...access-list-number | name] of the access lists specified.
match tag tag-value [...tag-value] Match the specified tag value.
match interface type number [...type number] Match the specified next-hop route out one of
the interfaces specified.
Command Purpose
match ip route-source {access-list-number | name} Match the address specified by the specified
[...access-list-number | name] advertised access lists.
match route-type {local | internal | external [type-1 | Match the specified route type.
type-2] | level-1 | level-2}
One or more match commands and one or more set commands must follow a route-map command.
To define conditions for redistributing routes from one routing protocol into another, perform at least
one of the following tasks in route-map configuration mode:
Command Purpose
set community {community-number [additive]} | none Set the COMMUNITIES attribute.
set dampening halflife reuse suppress max-suppress-time Set BGP route dampening factors.
set local-preference value Assign a value to a local BGP path.
set weight weight Specify the BGP weight for the routing table.
set origin {igp | egp as | incomplete} Set the BGP origin code.
set as-path {tag | prepend as-path-string} Modify the BGP autonomous system path.
set next-hop next-hop Specify the address of the next hop.
set automatic-tag Enable automatic computing of tag table.
set level {level-1 | level-2 | level-1-2 | stub-area | For routes that are advertised into the specified
backbone} area of the routing domain.
set metric metric-value Set the metric value to give the redistributed
routes (for any protocol except IGRP or IP
Enhanced IGRP).
set metric bandwidth delay reliability loading mtu Set the metric value to give the redistributed
routes (for IGRP or IP Enhanced IGRP only).
set metric-type {internal | external | type-1 | type-2} Set the metric type to give redistributed routes.
set metric-type internal Set the MED value on prefixes advertised to
EBGP neighbor to match the IGP metric of the
next hop.
set tag tag-value Set the tag value to associate with the
redistributed routes.
See the “BGP Route Map Examples” section in the “Configuring BGP” chapter for examples of
BGP route maps. See the “BGP Community with Route Maps Examples” section in the
“Configuring BGP” chapter for examples of BGP communities and route maps.
To distribute routes from one routing domain into another and to control route redistribution, use the
following commands in router configuration mode:
Command Purpose
redistribute protocol [process-id] {level-1 | level-1-2 | Redistribute routes from one routing protocol
level-2} [metric metric-value] [metric-type type-value] to another routing protocol.
[match internal | external type-value] [tag tag-value]
[route-map map-tag] [weight weight] [subnets]
default-metric number Cause the current routing protocol to use the
same metric value for all redistributed routes
(BGP, OSPF, RIP).
Command Purpose
default-metric bandwidth delay reliability loading mtu Cause the IGRP or Enhanced IGRP routing
protocol to use the same metric value for all
non-IGRP redistributed routes.
no default-information {in | out} Disable the redistribution of default
information between IGRP processes. This is
enabled by default.
The metrics of one routing protocol do not necessarily translate into the metrics of another. For
example, the RIP metric is a hop count and the IGRP metric is a combination of five quantities. In
such situations, an artificial metric is assigned to the redistributed route. Because of this unavoidable
tampering with dynamic information, carelessly exchanging routing information between different
routing protocols can create routing loops, which can seriously degrade network operation.
Note When routes are redistributed between OSPF processes, no OSPF metrics are preserved.
OSPF and IS-IS behave somewhat differently. In OSPF, the interface address you specify as passive
appears as a stub network in the OSPF domain. OSPF routing information is neither sent nor
received through the specified router interface. In IS-IS, the specified IP addresses are advertised
without actually running IS-IS on those interfaces.
To prevent routing updates through a specified interface, use the following command in router
configuration mode:
Command Purpose
passive-interface type number Suppress the sending of routing updates
through the specified interface.
See the “Passive Interface Examples” section at the end of this chapter for examples of configuring
passive interfaces.
Command Purpose
distribute-list {access-list-number | name} out Permit or deny routes from being advertised in
[interface-name] routing updates depending upon the action
listed in the access list.
Command Purpose
distribute-list {access-list-number | name} in Suppress routes listed in updates from being
[interface-name] processed.
To filter sources of routing information, use the following command in router configuration mode:
Command Purpose
distance weight {ip-address {ip-address mask}} Filter on routing information sources.
[ip standard list] [ip extended list]
There are no general guidelines for assigning administrative distances, because each network has its
own requirements. You must determine a reasonable matrix of administrative distances for the
network as a whole. Table 5 shows the default administrative distance for various routing
information sources.
For example, consider a router using IGRP and RIP. Suppose you trust the IGRP-derived routing
information more than the RIP-derived routing information. In this example, because the default
IGRP administrative distance is lower than the default RIP administrative distance, the router uses
the IGRP-derived information and ignores the RIP-derived information. However, if you lose the
source of the IGRP-derived information (because of a power shutdown in another building, for
example), the router uses the RIP-derived information until the IGRP-derived information reappears.
For an example of filtering on sources of routing information, see the section “Administrative
Distance Examples” at the end of this chapter.
Note You also can use administrative distance to rate the routing information from routers running
the same routing protocol. This application is generally discouraged if you are unfamiliar with this
particular use of administrative distance, because it can result in inconsistent routing information,
including forwarding loops.
Command Purpose
ip policy route-map map-tag Identify the route map to use for policy routing.
You must also define the route map to be used for policy routing. Use the following command in
global configuration mode:
Command Purpose
route-map map-tag [permit | deny] Define a route map to control where packets are
[sequence-number] output.
The next step is to define the criteria by which packets are examined to see if they will be
policy-routed. No match clause in the route map indicates all packets. Use one or more of the
following commands in route-map configuration mode:
Command Purpose
match length min max Match the Level 3 length of the packet.
match ip address {access-list-number | name} Match the destination IP address that is permitted
[...access-list-number | name] by one or more standard or extended access lists.
The last step is to set the precedence and specify where the packets that pass the match criteria are
output. To do so, use the following commands in route-map configuration mode:
Command Purpose
set ip precedence value Set the precedence value in the IP header.
set ip next-hop ip-address [...ip-address] Specify the next hop to which to route the packet.
The next hop must be an adjacent router.
set interface type number [...type number] Specify the output interface for the packet.
set ip default next-hop ip-address [...ip-address] Specify the next hop to which to route the packet, if
there is no explicit route for this destination. The
next hop must be an adjacent router.
set default interface type number [...type number] Specify the output interface for the packet, if there
is no explicit route for this destination.
The precedence setting in the IP header determines whether, during times of high traffic, the packets
will be treated with more or less precedence than other packets. By default, the Cisco IOS software
leaves this value untouched; the header remains with the precedence value it had.
The precedence bits in the IP header can be set in the router when policy routing is enabled. When
the packets containing those headers arrive at another router, the packets are ordered for transmission
according to the precedence set, if the queuing feature is enabled. The router does not honor the
precedence bits if queuing is not enabled; the packets are sent in first in, first out order.
You can change the precedence setting, using either a number or name. The names came from
RFC 791, but are evolving. You can enable other features that use the values in the set ip precedence
command to determine precedence. Table 6 lists the possible numbers and their corresponding
name, from least important to most important.
Number Name
0 routine
1 priority
2 immediate
Number Name
3 flash
4 flash-override
5 critical
6 internet
7 network
The set commands can be used in conjunction with each other. They are evaluated in the order shown
in the previous task table. A usable next hop implies an interface. Once the local router finds a next
hop and a usable interface, it routes the packet.
To display the cache entries in the policy route-cache, use the show ip cache policy command.
If you want policy routing to be fast-switched, see the section “Enable Fast-Switched Policy
Routing,” which follows.
See the “Policy Routing Example” section at the end of this chapter for an example of policy routing.
Command Purpose
ip route-cache policy Enable fast switching of policy routing.
Command Purpose
ip local policy route-map map-tag Identify the route map to use for local policy
routing.
Use the show ip local policy command to display the route map used for local policy routing, if one
exists.
Command Purpose
key chain name-of-chain Identify a key chain.
key number In key chain configuration mode, identify the
key number.
key-string text In key chain key configuration mode, identify
the key string.
accept-lifetime start-time {infinite | end-time | Specify the time period during which the key
duration seconds} can be received.
send-lifetime start-time {infinite | end-time | Specify the time period during which the key
duration seconds} can be sent.
Use the show key chain command to display key chain information. For examples of key
management, see the “Manage Authentication Keys” section at the end of this chapter.
Command Purpose
clear ip route {network [mask] | *} Clear one or more routes from the IP routing
table.
Command Purpose
show ip cache policy Display the cache entries in the policy
route-cache.
show ip local policy Display the local policy route map, if any.
show ip policy Display policy route maps.
show ip protocols Display the parameters and current state of the
active routing protocol process.
show ip route [address [mask] [longer-prefixes]] | Display the current state of the routing table.
[protocol [process-id]]
show ip route summary Display the current state of the routing table in
summary form.
show ip route supernets-only Display supernets.
show key chain [name] Display authentication key information.
show route-map [map-name] Display all route maps configured or only the
one specified.
interface serial 0
ip address 131.107.254.1 255.255.255.252
! 2 bits of address space reserved for serial lines
Router A
Router B 131.108.3.4
Router C
10.0.0.0
S1269a
Router D
The following example assigns the router with the address 192.31.7.18 an administrative distance of
100, and all other routers on subnet 192.31.7.0 an administrative distance of 200:
distance 100 192.31.7.18 0.0.0.0
distance 200 192.31.7.0 0.0.0.255
However, if you reverse the order of these commands, all routers on subnet 192.31.7.0 are assigned
an administrative distance of 200, including the router at address 192.31.7.18:
distance 200 192.31.7.0 0.0.0.255
distance 100 192.31.7.18 0.0.0.0
Assigning administrative distances is a problem unique to each network and is done in response to
the greatest perceived threats to the connected network. Even when general guidelines exist, the
network manager must ultimately determine a reasonable matrix of administrative distances for the
network as a whole.
In the following example, the distance value for IP routes learned is 90. Preference is given to these
IP routes rather than routes with the default administrative distance value of 110.
router isis
distance 90 ip
To transfer a route to 192.31.7.0 into autonomous system 71 (without passing any other information
about autonomous system 109), use the command in the following example:
router igrp 71
redistribute igrp 109
distribute-list 3 out igrp 109
access-list 3 permit 192.31.7.0
In this example, the router global configuration command starts an IGRP routing process. The
network router configuration command specifies that network 128.1.0.0 (the regional network) is to
receive IGRP routing information. The redistribute router configuration command specifies that
RIP-derived routing information be advertised in the routing updates. The default-metric router
configuration command assigns an IGRP metric to all RIP-derived routes.
The distribute-list router configuration command instructs the Cisco IOS software to use access
list 10 (not defined in this example) to limit the entries in each outgoing update. The access list
prevents unauthorized advertising of university routes to the regional network.
To transfer a route from 192.31.7.0 into autonomous system 71 (without passing any other
information about autonomous system 109), use the command in the following example:
router eigrp 71
redistribute eigrp 109 route-map 109-to-71
route-map 109-to-71 permit
match ip address 3
set metric 10000 100 1 255 1500
access-list 3 permit 192.31.7.0
The following example is an alternative way to transfer a route to 192.31.7.0 into autonomous
system 71. Unlike the previous configuration, this one does not allow you to arbitrarily set the metric.
router eigrp 71
redistribute eigrp 109
distribute-list 3 out eigrp 109
access-list 3 permit 192.31.7.0
In this example, the router global configuration command starts an IP Enhanced IGRP routing
process. The network router configuration command specifies that network 128.1.0.0 (the regional
network) is to send and receive IP Enhanced IGRP routing information. The redistribute router
configuration command specifies that RIP-derived routing information be advertised in the routing
updates. The default-metric router configuration command assigns an IP Enhanced IGRP metric to
all RIP-derived routes.
The distribute-list router configuration command instructs the Cisco IOS software to use access list
10 (not defined in this example) to limit the entries in each outgoing update. The access list prevents
unauthorized advertising of university routes to the regional network.
The following example illustrates the assignment of four area IDs to four IP address ranges. In the
example, OSPF routing process 109 is initialized, and four OSPF areas are defined: 10.9.50.0, 2, 3,
and 0. Areas 10.9.50.0, 2, and 3 mask specific address ranges, while Area 0 enables OSPF for all
other networks.
router ospf 109
network 131.108.20.0 0.0.0.255 area 10.9.50.0
network 131.108.0.0 0.0.255.255 area 2
network 131.109.10.0 0.0.0.255 area 3
network 0.0.0.0 255.255.255.255 area 0
!
! Interface Ethernet0 is in area 10.9.50.0:
interface ethernet 0
ip address 131.108.20.5 255.255.255.0
!
! Interface Ethernet1 is in area 2:
interface ethernet 1
ip address 131.108.1.5 255.255.255.0
!
! Interface Ethernet2 is in area 2:
interface ethernet 2
ip address 131.108.2.5 255.255.255.0
!
! Interface Ethernet3 is in area 3:
interface ethernet 3
ip address 131.109.10.5 255.255.255.0
!
! Interface Ethernet4 is in area 0:
interface ethernet 4
ip address 131.109.1.1 255.255.255.0
!
! Interface Ethernet5 is in area 0:
interface ethernet 5
ip address 10.1.0.1 255.255.0.0
Each network router configuration command is evaluated sequentially, so the specific order of these
commands in the configuration is important. The Cisco IOS software sequentially evaluates the
address/wildcard-mask pair for each interface. See the “IP Routing Protocols Commands” chapter
of the Network Protocols Command Reference, Part 1 for more information.
Consider the first network command. Area ID 10.9.50.0 is configured for the interface on which
subnet 131.108.20.0 is located. Assume that a match is determined for interface Ethernet 0. Interface
Ethernet 0 is attached to Area 10.9.50.0 only.
The second network command is evaluated next. For Area 2, the same process is then applied to all
interfaces (except interface Ethernet 0). Assume that a match is determined for interface Ethernet 1.
OSPF is then enabled for that interface and Ethernet 1 is attached to Area 2.
This process of attaching interfaces to OSPF areas continues for all network commands. Note that
the last network command in this example is a special case. With this command, all available
interfaces (not explicitly attached to another area) are attached to Area 0.
Area 1
Router A Router B
E1 E2 Interface address:
Interface address:
131.108.1.1 131.108.1.2
Network: 131.108.1.0
Interface address:
E3 131.108.1.3
Router C
S0 Interface address:
131.108.2.3
Network: 131.108.2.0
S1 Area 0
Interface address:
Router D 131.108.2.4
E4
Interface address:
10.0.0.4
Network: 10.0.0.0 Interface address:
10.0.0.5
E5
Interface address: Remote address:
Router E S2 11.0.0.5 11.0.0.6
in autonomous
Network: 11.0.0.0
system 110
S1030a
In this configuration, five routers are configured in OSPF autonomous system 109:
• Router A and Router B are both internal routers within Area 1.
• Router C is an OSPF area border router. Note that for Router C, Area 1 is assigned to E3 and
Area 0 is assigned to S0.
• Router D is an internal router in Area 0 (backbone area). In this case, both network router
configuration commands specify the same area (Area 0, or the backbone area).
• Router E is an OSPF autonomous system boundary router. Note that BGP routes are redistributed
into OSPF and that these routes are advertised by OSPF.
Note It is not necessary to include definitions of all areas in an OSPF autonomous system in the
configuration of all routers in the autonomous system. You must only define the directly connected
areas. In the example that follows, routes in Area 0 are learned by the routers in Area 1 (Router A
and Router B) when the area border router (Router C) injects summary link state advertisements
(LSAs) into Area 1.
Autonomous system 109 is connected to the outside world via the BGP link to the external peer at
IP address 11.0.0.6.
Router C—ABR
interface ethernet 3
ip address 131.108.1.3 255.255.255.0
interface serial 0
ip address 131.108.2.3 255.255.255.0
interface serial 1
ip address 131.108.2.4 255.255.255.0
Router E—ASBR
interface ethernet 5
ip address 10.0.0.5 255.0.0.0
interface serial 2
ip address 11.0.0.5 255.0.0.0
E2
Area ID: 0
Configured as backbone area
• Create a stub area with area id 36.0.0.0. (Note that the authentication and stub options of the
area router configuration command are specified with separate area command entries, but can
be merged into a single area command.)
• Specify the backbone area (Area 0).
Configuration tasks associated with redistribution are as follows:
• Redistribute IGRP and RIP into OSPF with various options set (including metric-type, metric,
tag, and subnet).
• Redistribute IGRP and OSPF into RIP.
The following example redistributes RIP routes with a hop count equal to 1 into OSPF. These routes
will be redistributed into OSPF as external link state advertisements with a metric of 5, metric type
of Type 1, and a tag equal to 1.
router ospf 109
redistribute rip route-map rip-to-ospf
!
route-map rip-to-ospf permit
match metric 1
set metric 5
set metric-type type1
set tag 1
The following example redistributes OSPF learned routes with tag 7 as a RIP metric of 15:
router rip
redistribute ospf 109 route-map 5
!
route-map 5 permit
match tag 7
set metric 15
The following example redistributes OSPF intra-area and interarea routes with next-hop routers on
serial interface 0 into BGP with an INTER_AS metric of 5:
router bgp 109
redistribute ospf 109 route-map 10
!
route-map 10 permit
match route-type internal
match interface serial 0
set metric 5
The following example redistributes two types of routes into the integrated IS-IS routing table
(supporting both IP and CLNS). The first are OSPF external IP routes with tag 5; these are inserted
into Level 2 IS-IS LSPs with a metric of 5. The second are ISO-IGRP derived CLNS prefix routes
that match CLNS access list 2000. These will be redistributed into IS-IS as Level 2 LSPs with a
metric of 30.
router isis
redistribute ospf 109 route-map 2
redistribute iso-igrp nsfnet route-map 3
!
route-map 2 permit
match route-type external
match tag 5
set metric 5
set level level-2
!
route-map 3 permit
match address 2000
set metric 30
With the following configuration, OSPF external routes with tags 1, 2, 3, and 5 are redistributed into
RIP with metrics of 1, 1, 5, and 5, respectively. The OSPF routes with a tag of 4 are not redistributed.
router rip
redistribute ospf 109 route-map 1
!
route-map 1 permit
match tag 1 2
set metric 1
!
route-map 1 permit
match tag 3
set metric 5
!
route-map 1 deny
match tag 4
!
route map 1 permit
match tag 5
set metric 5
Given the following configuration, a RIP learned route for network 160.89.0.0 and an ISO-IGRP
learned route with prefix 49.0001.0002 will be redistributed into an IS-IS Level 2 LSP with a metric
of 5:
router isis
redistribute rip route-map 1
redistribute iso-igrp remote route-map 1
!
route-map 1 permit
match ip address 1
match clns address 2
set metric 5
set level level-2
!
access-list 1 permit 160.89.0.0 0.0.255.255
clns filter-set 2 permit 49.0001.0002...
The following configuration example illustrates how a route map is referenced by the
default-information router configuration command. This is called conditional default origination.
OSPF will originate the default route (network 0.0.0.0) with a Type 2 metric of 5 if 140.222.0.0 is
in the routing table. Extended access-lists cannot be used in a route map for conditional default
origination.
route-map ospf-default permit
match ip address 1
set metric 5
set metric-type type-2
!
access-list 1 140.222.0.0 0.0.255.255
!
router ospf 109
default-information originate route-map ospf-default
See more route map examples in the sections “BGP Route Map Examples” and “BGP Community
with Route Maps Examples” in the “Configuring BGP” chapter.
IGRP router
S1067a
E1
No routing updates
sent to this interface
In the following example, as in the first example, IGRP updates are sent to all interfaces on network
131.108.0.0 except interface Ethernet 1. However, in this case a neighbor router configuration
command is included, which permits the sending of routing updates to specific neighbors. One copy
of the routing update is generated per neighbor.
router igrp 109
network 131.108.0.0
passive-interface ethernet 1
neighbor 131.108.20.4
In OSPF, hello packets are not sent on an interface that is specified as passive. Hence, the router will
not be able to discover any neighbors, and none of the OSPF neighbors will be able to see the router
on that network. In effect, this interface will appear as a stub network to the OSPF domain. This is
useful if you want to import routes associated with a connected network into the OSPF domain
without any OSPF activity on that interface.
The passive-interface router configuration command typically is used when the wildcard
specification on the network router configuration command configures more interfaces than is
desirable. The following configuration causes OSPF to run on all subnets of 131.108.0.0:
interface ethernet 0
ip address 131.108.1.1 255.255.255.0
interface ethernet 1
ip address 131.108.2.1 255.255.255.0
interface ethernet 2
ip address 131.108.3.1 255.255.255.0
!
router ospf 109
network 131.108.0.0 0.0.255.255 area 0
If you do not want OSPF to run on 131.108.3.0, enter the following commands:
router ospf 109
network 131.108.0.0 0.0.255.255 area 0
passive-interface ethernet 2