CCNP Route - IP Routing Principles

Classless / CIDR / VLSM -

Routers forward packets toward destination networks.
To forward the packets, routers must know about these remote networks and determine the best way to reach them.

IP routing main steps:
1) Routing - finding outgoing interface
2) Switching - move the packet between interfaces (process or fast switching or CEF, load balancing occurs here)
3) Encapsulation - build the layer 2 header (or layer 2 packet rewrite)

1) Find the longest match
2) Perform recursive lookup (known via, until exit interface if found: connected to Fa 0/0)
3) If same prefix match (same longest match):
 - compare metric (if same routing protocols),
 - compare AD (if different routing protocols).

Routers must be aware of destination networks to be able to forward packets to them.
A router knows about the networks directly attached to its interfaces; it calculates the subnet or network number of an interface by using the address and subnet mask configured on that interface.
For networks not directly connected to one of its interfaces, however, the router must rely on outside information.
A router can be made aware of remote networks in two ways:
■ Static routing—An administrator can manually configure the information.
■ Dynamic routing—A router can learn from other routers (Fast switching or CEF).

A network is converged when routing tables on all routers in the network are synchronized and contain a route to all destination networks. Convergence time is the time it takes for all routers in a network to agree on the new topology.
Dynamic routing provides faster convergence.

Static Routing
A static route can be used in the following circumstances:
 - undesirable to have dynamic routing updates forwarded across slow bandwidth links, such as a dialup link.
- administrator needs total control over the routes used by the router.
- backup to a dynamically recognized route is necessary.
- necessary to reach a network accessible by only one path (a stub network).
- router connects to its ISP and needs to have only a default route pointing toward the ISP router
- router is underpowered and does not have the CPU or memory resources necessary to handle a dynamic routing protocol.

- each time a new subnet or router is added, an administrator must add a static route to the new networks on several routers.
- when a topology change occurs on the internetwork, an administrator might have to reroute traffic by configuring new static routes.

Configuring a Static Route
A static route must be configured on the routers on both sides of the link. Otherwise, the remote router will not know how to return the packet to its originator located on the other network; there will be only one-way communication.

Use static routes pointing to an interface on point-to-point interfaces only, because on multiaccess interfaces the router will not know the specific address to which to send the information. (In some cases these static routes may work anyway, because of proxy
Address Resolution Protocol [ARP], but the ARP overhead may result in excessive memory and CPU consumption.) On point-to-point interfaces, the information is sent to the only other device on the network.
R(config)# ip route <prefix> <mask> {address | interface[address]}     [dhcp] [distance] [name next-hop-name] [permanent | track <number>] [tag <tag>]
! mandatory settings
<prefix> <mask> - The IP network and subnet mask for the remote network to be entered into the IP routing table.
address - The IP address of the next hop that can be used to reach the destination network.
interface - The local router outbound interface to be used to reach the destination network.
! other optional settings
dhcp - Enables a DHCP server to assign a static route to a default gateway
distance - The administrative distance to be assigned to this route.
name <nexthop-name> - Applies a name to the specified route.
permanent - Specifies that the route will not be removed from the routing table even if the interface associated with the route goes down.
track <number> - Associates a track object with this route. Valid values for the number argument range from 1 to 500.
tag <tag> - A value that can be used as a match value in route maps.
Configuring a Static Default Route
Default routes are either dynamically advertised using routing protocols or statically configured.
If the destination network is not listed in the routing table, the default route is used.
! This address is a type of wildcard designation; any destination network will match.
ip route {address| interface[address]}

Dynamic Routing
 - A static route cannot respond dynamically to changes in the network. If a link fails, the static route is no longer valid if it is configured to use that failed link, so a new static route must be configured.
 - If a new router or new link is added, that information must also be configured on every router in the network

When using a dynamic routing protocol, the administrator configures the routing protocol on each router.
When the network topology changes, the new information is dynamically propagated throughout the network, and each router updates its routing table to reflect the changes.
- The information exchanged by routers includes the metric to each destination (this value is sometimes called the distance or cost). A metricis a value that routing protocols use to measure paths to a destination.
- Different routing protocols base their metric on different measurements, including hop count, interface speed, or more-complex metrics.
-  If a routing protocol recognizes more than one way to reach a network, it compares the metric for each different path and chooses the path with the lowest metric.
 - If multiple paths have the same metric, a maximum of 16 (before 12.3(2)T it was max 6) can be installed in the routing table, and the router can perform load balancing between them. EIGRP can also perform load balancing between unequal-cost paths.

network command:
 - For RIP, EIGRP, and OSPF, the network command tells the router which interfaces are participating in that routing protocol. Any interface that has an IP address that falls within the range specified in the network statement is considered active for that protocol.
RIP allows only major network numbers.
EIGRP and OSPF permit exact specification of interfaces with a combination of a subnet or interface address and a wildcard mask
 - in BGP tells the router to originate an advertisement for that network. Without a networkstatement, BGP passes along advertisements it receives from other routers, but it does not originate any network advertisements
itself. In BGP, the network listed in the network statement does not have to be directly
connected, because it does not identify interfaces on the router as it does in other protocols.
- Integrated IS-IS does not use the network statement. Instead, interfaces participating in the IS-IS routing process are identified under interface configuration mode.

On-Demand Routing
 - A drawback of static routes is that they must be manually configured and updated when the network topology changes.
 - A drawback of dynamic routing protocols is that they use network bandwidth and router resources. In a hub-and-spoke network with hundreds of spokes, both the configuration needed for static routes and the resource usage of dynamic routing can be considerable.

There is a third option: ODR.
It is not a protocol by itself as it uses Cisco Discovery Protocol (CDP) to gather and propagate the route information between spoke (stub) routers and the hub router. ODR provides IP routing information with minimal overhead compared to a dynamic routing protocol and requires less manual configuration than static routes.
ODR is applicable in a hub-and-spoke topology only. Another name for a spoke router is stub router.
The stub router may have some LAN networks connected to it and typically has a WAN connection to the hub router. The hub router needs to recognize the networks connected to each spoke, but the spoke routers need only a default route pointing to the hub router.
ODR reports the subnet mask, so it allows different subnets within the same major network to have different subnet masks (VLSM).
The hub router, in turn, sends a default route to the spokes that points back to itself.

ODR is not a true routing protocol because the information exchanged is limited to IP prefixes and a default route. ODR reports no metric information; the hub router uses a hop count of 1 as the metric for all routes reported via ODR. However, by using ODR, routing information for stub networks can be obtained dynamically without the overhead of a dynamic routing protocol, and default routes can be provided to the stub routers without manual configuration.
CDP must be enabled on the links between the hub router and the spoke routers. Cisco routers by default have CDP enabled both globally and per interface on most interfaces. However, on some WAN links, such as ATM, CDP must be explicitly enabled.
CDP updates are sent as multicasts. CDP uses Subnetwork Access Protocol (SNAP) frames, so it runs on all media that support SNAP.
CDP updates are sent every 60 seconds by default. This setting might be too infrequent in rapidly changing networks or too often in stable ones.

Configuring ODR
router odr
router ospf 1
  redistribute odr subnets
routerB#show ip route
<output omitted> is subnetted, 4 subnets
o [160/1] via, 00:00:23, Serial0/0/1

Characteristics of Routing Protocols
IP routing protocols can also be classified as either classful or classless.
Routing protocols can be classified into different categories such as distance vector, linkstate, or advanced distance vector.

Routing Protocols
Distance vector routing protocol - all the routers periodically send their routing tables (or a portion of their tables) to only their neighboring routers. The routers then use the received information to determine whether any changes need to be made to their own routing table (for example, if a better way to a specific network is now available). This process repeats periodically.

Link-state routing protocol - each of the routers sends the state of its own interfaces (its links) to all other routers (or to all routers in a part of the network, known as an area) only when there is a change. Each router uses the received information to recalculate the best path to each network and then saves this information in its routing table.
hybrid or advanced distance vector protocol has characteristics of both distance vector and link-state protocols. These protocols send only changed information when there is a change (similar to link-state protocols) but only to neighboring routers (similar to distance vector protocols).

Classful Routing Protocol Concepts
- Routing updates sent by a classful routing protocol do not include the subnet mask. (RIPv1)
- Routing updates sent by a classless routing protocol include the subnet mask. (RIPv2, EIGRP, OSPF, IS-IS, BGP)
Most modern networks use classless protocols.

Classful Routing Protocol Behavior
Same Network
When classful protocols were originally developed, networks were very different from those used now. (slow links, slow routers)
Because no subnet mask information is known, when a classful router receives routing updates, the router makes assumptions about the subnet mask being used by the networks listed in the update, based on IP address class.
When using a classful routing protocol, it is important to use the same subnet mask on all subnets belonging to the same classful network; in other words, classful routing protocols do not support VLSM.

For example, if Router A sends an update about to Router B, and Router A and B are connected by the subnet, Router B assumes that the mask for the subnet is /16, the same mask that is on the interface that receives the update. If the subnet in the update actually has a different subnet mask, the receiving router will have incorrect information in its routing table.

Different Networks
When a router that is using a classful routing protocol needs to send an update about a subnet of a network across an interface belonging to a different network, the router assumes that the remote router will use the default subnet mask for that class of IP
Therefore, when the router sends the update, it does not include the subnet information; the update packet contains only the major (classful) network information. This process is called autosummarization across the network boundary; the router sends a summary of all the subnets in that network by sending only the major network information.
Classful routing protocols automatically create a classful summary route at major network boundaries. Classful routing protocols do not allow summarization at other points within the major network address space.
Network Summarization in Classful Routing

Summarizing Routes in a Network with Discontiguous Subnets
Discontiguous subnets are subnets of the same major network that are separated by a different major network.
Classful Routing Protocols Do Not Support Discontiguous Subnets
 RouterC receives routes about from two different directions; it therefore might make an incorrect routing decision.
Although they are classless protocols, RIPv2 and EIGRP also automatically summarize at network boundaries by default. However, this feature can be turned off in RIPv2 and EIGRP. It cannot be turned off for RIPv1.
You can resolve this situation by using RIPv2, OSPF, IS-IS, or EIGRP and not using summarization, so that the subnet routes will be advertised with their actual subnet masks.

ip classless
The behavior of a classful routing protocol changes when the ip classless global configuration command is used.
The ip classless command is enabled by default in Release 12.0 and later of the Cisco IOS Software. In earlier releases, it is disabled by default.

When you are running a classful protocol (RIPv1),ip classless must be enabled if you want the router to use the default route when it receives a packet destined to an unknown subnet of a network for which it knows some subnets. (if ip classless is notenabled, the packet is dropped).

Enabling ip classless tells the router that it should follow the best supernet route or the default route for unknown subnets of known networks, and for unknown networks.
The Routing Table Acts Classfully by default without the ip classless (and no cef) command and will do so even if no routing protocols are running:
 - if the routing table already have one network ( known from any source (connected, static), and have default route (, packets will NOT ROUTE to another network on another router (ex: with default route (and because you have other routes of class A /8 (, on the same router, default route is not used when you ping anything on 10.x.x.x destination;)
R1(debug ip packet)# *Mar  1 00:02:39.507: IP: s= (local), d=, len 100, unroutable.
 - using default route will be used to route packet to another router (with net as part of different Major network.
R1(debug ip packet)# *Mar  1 00:03:20.175: IP: tableid=0, s= (local), d= (Ethernet0/0), routed via RIB
R1(debug ip packet)# *Mar  1 00:03:20.179: IP: s= (local), d= (Ethernet0/0), len 100, sending
more info @

Classless Routing Protocol Concepts
Classless routing protocols can be considered second-generation protocols because they
are designed to address some of the limitations of the earlier classful routing protocols. (no mask in updates, discontiguous networks).
In a classless environment, the route summarization process can be controlled manually and can usually be invoked at any bit position within the address.

RIPv2 and EIGRP do Automatic Summarization at Network-Boundary (just like a classful protocol does).
Automatic summarization lets RIPv2 and EIGRP be backward compatible with their predecessors, RIPv1 and Interior Gateway Routing Protocol (IGRP is no longer supported, as of Cisco IOS Release 12.3):
 - can be disabled by using the  no auto-summary router configuration command (router will not summarize major network when passing another major network)
 - not need this command for OSPF or IS-IS because neither protocol performs automatic network summarization by default.
 - The BGP auto-summary router configuration command determines how BGP handles redistributed routes. 
Automatic Network-Boundary Summarization (problem with discontiguous Class B network
Classless routers use the longest prefix match when selecting a route from the routing table. Therefore, if one of the routers advertises without summarizing, the other routers see subnet routes and the summary route.

RIPv1 is described in RFC 1058, Routing Information Protocol. Its key characteristics
include the following:
■ RIPv1 is a classful distance vector routing protocol that does not send the subnet mask in
its updates.
■  Therefore, RIPv1 does not support VLSM or discontiguous subnets. RIPv1 automatically summarizes at the network boundary and cannot be configured not to.
■ Hop count is used as the metric for path selection.
■ uses broadcast address, so all devices, including PCs and servers, must process the update packet, UDP port 520. Most PCs and servers do not have any process running on this port and discard the packet.
■ The maximum allowable hop count is 15.
■ Routing updates are broadcast every 30 seconds by default. Because it is a distance vector routing protocol, updates are sent even if no change has occurred.
■ RIP can load balance over as many as 16 equal-cost paths (4 paths by default).
■ It has no authentication support

■ classless distance vector routing protocol defined in RFC 1721, RFC 1722, RFC 2453
■ have mask in the RIPv2 routing update packet, allowing RIPv2 to support VLSM and discontiguous subnets
■ RIPv2 automatically summarizes routes on classful network boundaries. (can be disabled)
■ uses multicast addressing ( for more-efficient periodic updating on each interface to advertise to other RIPv2 routers (RIPv2 has its own multicast MAC address),
■ RIP can fit up to 25 networks and subnets in each update, and updates are dispatched
every 30 seconds (for 1000 subnets, 40 packets are dispatched every 30 seconds (80 packets a minute))
■ RIPv2 also supports security between RIP routers using message-digest or clear-text

Devices that can distinguish between a multicast and a broadcast at Layer 2 read the start of the frame and
determine whether the destination MAC address is for them. Nonrouting devices can then discard all these packets at the interface level and not use CPU resources or buffer memory for these unwanted packets.

router rip
! By default, the Cisco IOS software processes both RIPv1 and RIPv2 packets. However, it sends only version 1 packets.
! To configure the software to send and receive packets from only one version, use the

  version{1| 2}
! specifying the major classful network number
 network <network-number>
! By default, automatic summarization for network boundaries is activated for all networks in both versions of RIP. Turn off automatic summarization using
no auto-summary
interface fa 0/0
! to control the version of RIP on each interface, use
ip rip {send | receive} version {1|2|12}
! Manual summarization is done at the interface.
ip summary-address rip <network-number> <mask>
show ip route
show ip rip database
RIP v1 and v2 coexistence
Note: the ip summary-address rip command is actually unnecessary because the no auto-summary command is also applied. The moment that the no auto-summary command is used, the   subnet is advertised as such because it uses a non-default mask (in this case, a 24-bit mask).

Populating the Routing Table

Administrative Distance (believability or trustworthiness) - select the best path when router learn of two or more routes to the same destination with the same prefix from different routing protocols.
The administrative distance is a value between 0 and 255. 
The lower the administrative distance value, the higher the protocol’s believability or trustworthiness.
Protocol                            Administrative distance
Directly connected route            0
Static route out an interface       1    (see note beyond)
Static route to next-hop address    1
EIGRP summary route                 5
External BGP                        20
Internal EIGRP                      90
IGRP                                100  (IGRP is no longer supported)
OSPF                                110
IS-IS                               115
RIPv1, RIPv2                        120
Exterior Gateway Protocol (EGP)     140  (EGP is no longer supported)
ODR                                 160
External EIGRP                      170
Internal BGP                        200
Unreachable                         255
Static routes have AD=1
R1(config)# ip route
R1(config)# ip route eth0/0
R1# sh ip route is subnetted, 1 subnets
S [1/0] via is subnetted, 1 subnets
S is directly connected, Ethernet0/0
R1# sh ip route
Routing entry for
  Known via "static", distance 1, metric 0
R1# sh ip route
Routing entry for
  Known via "static", distance 1, metric 0 (connected)
Routing Protocol Metrics
 - RIPv1 and RIPv2 use only the hop count to determine the best path (they do not consider bandwidth, RIPv1 and RIPv2 are not suitable for networks that have significantly different transmission speeds on redundant paths.
 - For networks that use diverse media on redundant paths, routing protocols must account for bandwidth and possibly the delay of the links.
 - By default EIGRP uses the minimum bandwidth and accumulated delay of the path toward the destination network in its metric calculation. Other parameters (reliability and load) can also be used, but should be configured only if the consequences are fully understood because, if misconfigured, they might affect convergence and cause routing loops. The EIGRP minimum bandwidth is the minimum (slowest) bandwidth along the path. An interface’s bandwidth is either the default value of the interface or as specified
by the bandwidth command—this command is usually used on serial interfaces.
(On Cisco routers, the bandwidth and delay metrics can be manually configured and do not necessarily reflect the link’s true speed. )
Bandwidth change:
 -  might affect the QoS provided to data.
 - EIGRP limits the amount of routing protocol traffic it sends to a percentage of the bandwidth value; changing the value could result in either too much bandwidth being used for routing protocol updates or updates not being sent in a timely manner.)
- OSPF and IS-IS use cumulative cost or metric (the lowest cost or metric path is selected). OSPF uses cost for path calculation, usually reflecting the link’s bandwidth (the OSPF RFC does not specify what the cost should be, but on Cisco routers it defaults to being inversely proportional to the link’s bandwidth).
As a result, the highest bandwidth (lowest cost) is used to select the best path.
(The IS-IS metric is known as the metric; the IS-IS specification defines four different types of metrics. All routers support cost, the default metric. Delay, expense, and error are optional metrics. The default Cisco implementation of IS-IS uses cost only, but the Cisco IOS does allow all four metrics to be set with optional parameters in the isis metric command.)
- BGP uses many attributes to select the best path. One of these is the AS-path attribute; the length of this attribute is the number of autonomous systems that must be traversed to reach a destination, and is usually a factor that influences the path selection. Another attribute is the multiexit discriminator (MED), aka metric.
BGP incorporates additional path attributes that can influence routing decisions; these can be manually configured.

Criteria for Inserting Routes into the IP Routing Table
A Cisco router chooses the best route for a specific destination among those presented by routing protocols, manual configuration, and various other means by considering the following four criteria:
1) Valid next-hop IP address—As each routing process receives updates and other information, the router first verifies that the route has a valid next-hop IP address.
2) the longest prefix match in the routing table is used
(RIPv2:  OSPF:   EIGRP:;  the router will use the subnet, advertised by RIPv2, because it is the longest match for this address )
3) Administrative distance -  If more than one route exists for the same network, and with the same prefix, from different routing sources, the router decides which route to install based on the administrative
distance of the route’s source.
4) Metric - the best path to any given destination based on the lowest metric. (if AD (same protocol), Prefix is the same)

Floating Static Routes
When you configure a static route as a backup to a dynamically learned route, you do not want the static route to be used as long as the dynamic route is available. you can manipulate the optional distanceparameter in the ip route command to make the static route appear less desirable than another static or
dynamic route.
A static route that appears in the routing table only when the primary route goes away is called a floating static route.
! static route is prefered over OSPF, but not prefered over EIGRP
ip route 100

IP Routing Protocol Comparisons
 - IGRP, EIGRP, and OSPF are transport layer protocols, because, like UDP and TCP, they run directly over IP.
 - RIP and BGP both reside at the application layer. RIP uses UDP as its transport protocol; its updates are sent unreliably with best-effort delivery. BGP uses TCP as its transport protocol; it takes advantage of TCP’s reliability mechanisms and windowing.
 - IS-IS is a network layer protocol and does not use the services of IP to carry its routing information. IS-IS packets are encapsulated directly into a data link layer frame and require knowledge of OSI protocol suite configuration.

Routing and Routing Protocols Within the Enterprise Composite Network Model
Each routing protocol has its own unique characteristics.
Although the best practice is to use one IP routing protocol throughout the enterprise if possible, in many cases multiple routing protocols might be required:
 - Campus backbone: OSPF, EIGRP, BGP,
 - Building Access: RIPv2, OSPF, EIGRP, static.
Although static routes may be used (for example, for Internet connectivity) and RIPv2 is a plausible choice for smaller networks, EIGRP and OSPF are the recommended protocols within the Enterprise. BGP is required for inter–autonomous system connectivity on the Internet.
Parameters                  EIGRP       OSPF       BGP
Size of network          Large       Large      Very large
Speed of convergence     Very high   High       Slow
Use of VLSM (yes-no)     Yes         Yes        Yes
Mixed-vendor devices     No          Yes        Yes
Network support          Good        Good       Fair
staff knowledge