IP Routing concepts are a core CCNA topic. As a network engineer, you will be expected to understand the key differences between distance vector and link state protocols, as well as advise your clients on the benefits and challenges associated with each protocol. You must understand the topics in this chapter if you hope to become a good Cisco engineer. We cover routing in great detail in our CCNP ENARSI course.
RIP is not specifically mentioned in the exam syllabus, but it can still be tested. RIP is a great introduction to routing principles and is super easy to configure (covered next chapter).
What Is Routing?
At its most basic level, IP routing (IP forwarding) is the process of moving information in packet format across networks from point A to B. It could be down the road to a friend’s house or across the world to a mail server. Routing occurs at the third layer of the OSI model. It is the router’s job to deal with the process of routing (hence the name).
Routing involves two processes:
- Optimal path determination – deciding the best path from A to B
- Routing/packet switching – actually sending the information from A to B
Sending the information is the easy part; determining the best route to take is the difficult part. It’s just like planning a journey across America using a map. Putting your foot on the gas and steering is the easy part; working out the route and dealing with detours and maybe getting lost en route is the hard part.
To determine how to get from A to B, the router has to perform a calculation to decide how many possible paths there are to get there. Just like making a phone call, a signal has many possible paths to choose from.
FIG 13.1 – How do you find the best path from PC X to PC Y?
In Figure 13.1 above, it may appear that PC X should use Routers A, C, and then F to get to PC Y. This is the shortest path after all. What if the link between Router C and Router F is only a 56 Kbps link? If PC X takes the path through Routers A, B, D, and then F, what if the link between Router D and Router F is not very reliable? What if it keeps going up and down (flapping) every few minutes? Should PC X take the slower path through Routers A, C, and F instead?
In finding the best path from PC X to PC Y, there are several choices to make, and each has pros and cons because the best path may not be the shortest path, and it may not be the path with the highest bandwidth. Multiple factors are used in deciding which is the best path, and these vary from protocol to protocol. Of course, as the network administrator, you can add commands so that one route is preferred over another.
In deciding which path to take, the router consults its routing table to determine the best path. This obviously requires that a routing protocol is in use, the interfaces are all correctly addressed, and static routing or at least a default gateway is there for the router to send outgoing traffic. We will look at gateways shortly. There should be both a route in the routing table AND a pointer in the form of a next-hop address or an exit interface.
If you are using a routing protocol (dynamic routing), then there must be several mechanisms in place to converge all the routes the networks learn. There must also be a mechanism to decide how a router will propagate its learned routes. If Router F learns how to reach the network PC X is connected to, for example, it may advertise this fact to Routers D, G, and C, but this may cause an issue because for these routers, surely they should use Routers C, B, or A to reach this network and not F which is further away.
There are other issues to consider, such as should the routers advertise only to the networks that are directly connected to them, or should they also be able to advertise to networks learned from neighbor routers? How should these neighbor relationships form in the first place, and how should these relationships be maintained?
Each routing protocol deals with these issues in a different way. We’ll look into the protocols covered in the CCNA syllabus (and those not but still tested). If you enjoy learning about them, then I encourage you to progress to CCNP certification after you pass your CCNA exam.
FIG 13.2 – The routing process
Referencing Figure 13.2 above, the routing table contains information about different networks, how to reach them, and how valid the path is. This information in the routing table can be entered manually by the network administrator or automatically learned from its neighbors via a routing protocol. As will be discussed shortly, the router will choose the best path to take based on the longest match rule and the administrative distance.
- When a router receives a frame, it first checks the FCS field. If an error is found, there is no point in moving to the next step, so the packet is discarded.
- The router then checks the Type field and extracts the data, discarding the data link layer header and trailer.
- The router verifies the checksum on the packet header.
- If the destination of the packet is the router itself, there is no need to forward it.
- If the TTL value is less than 1, then the packet is discarded.
- The router checks its routing table to find the most specific match (there could be more than one path to reach the destination). If there is no entry for the destination in the routing table, the packet will be dropped.
- The routing table should include the exit interface as well as the next-hop IP address. This information is required to correctly encapsulate the frame. Layer 2 and 3 addresses are also required.
- The TTL field must then be decremented and a new header checksum calculated.
- A new FCS is calculated and the frame is encapsulated with a new data link header and the destination address. The IP address will not change; however (as discussed in Proxy ARP), the data link source and destination will. This is presuming the packet is going over an Ethernet connection. A different data link address will be used for Frame Relay or PPP, for example.
Cisco offers a range of switching methods and enhancements, including Cisco Express Forwarding, which is no longer in the exam syllabus.
Routing information entered by the administrator is known as static routing. If the router automatically learns the information from its neighbors, this is known as dynamic routing.
Prefix Matching
Routers use the longest prefix match rule when determining which of the routes placed into the routing table should be used to forward traffic to a destination network or node. Longer or more specific routing table entries are preferred over less specific entries, such as summary addresses, when determining which entry to use to route traffic.
The longest prefix or the most specific route will be used to route traffic to the destination network or node, regardless of the administrative distance of the route source, or even the routing protocol metric assigned to the prefix if multiple overlapping prefixes are learned via the same routing protocol. Table 13-1 below illustrates the order of route selection on a router sending packets to the address 1.1.1.1. This order is based on the longest prefix match lookup.
Table 13-1: Matching the longest prefix
Routing Table Entry | Order Used |
1.1.1.1/32 | 1st |
1.1.1.0/24 | 2nd |
1.1.0.0/16 | 3rd |
1.0.0.0/8 | 4th |
0.0.0.0/0 | 5th |
NOTE: Although the default route is listed last in the route selection order in Table 13-1, keep in mind that a default route is not always present in the routing table. If that is the case and no other entries to address 1.1.1.1 exist, packets to that destination are simply discarded by the router. In most cases, the router will send the source host an ICMP message indicating that the destination is unreachable.
Building the IP Routing Table
Without a populated routing table or Routing Information Base (RIB) that contains entries for remote networks, routers will not be able to forward packets to those remote networks. The routing table may include specific network entries or simply a single default route. The information in the routing table is used by the forwarding process to forward traffic to the destination network or host. The routing table itself does not actually forward traffic.
Cisco routers use administrative distance, the routing protocol metric, and prefix length to determine which routes will actually be placed into the routing table, which allows the router to build the routing table. The routing table is built via the following general steps:
- If the route entry does not currently exist in the routing table, add it to the routing table.
- If the route entry is more specific than an existing route, add it to the routing table. It should also be noted that the less specific entry is still retained in the routing table.
- If the route entry is the same as an existing one but is received from a more preferred route source, replace the old entry with the new entry.
- If the route entry is the same as an existing one and is received from the same protocol:
- Discard the new route if the metric is higher than the existing route.
- Replace the existing route if the metric of the new route is lower.
- If the metric for both routes is the same, use both routes for load balancing.
When building the RIB by default, the routing protocol with the lowest administrative distance value will always win when the router is determining which routes to place into the routing table. For example, if a router receives the 10.0.0.0/8 prefix via external EIGRP, OSPF, and internal BGP, the OSPF route will be placed into the routing table. If that route is removed or is no longer received, the external EIGRP route will be placed into the routing table. Finally, if both the OSPF and the external EIGRP routes are no longer present, the internal BGP route will be used.
After routes have been placed into the routing table, by default, the most specific or longest match prefix will always be preferred over less specific routes. This is illustrated in the following example, which shows a routing table that contains entries for the 80.0.0.0/8, 80.1.0.0/16, and 80.1.1.0/24 prefixes. These three route prefixes are received via the EIGRP, OSPF, and RIP routing protocols, respectively.
R1#show ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP,
D – EIGRP, EX – EIGRP external, O – OSPF,
IA – OSPF inter area, N1 – OSPF NSSA external type 1,
N2 – OSPF NSSA external type 2, E1 – OSPF external type 1,
E2 – OSPF external type 2, i – IS-IS, L1 – IS-IS level-1,
L2 – IS-IS level-2, ia – IS-IS inter area,
* – candidate default, U – per-user static route, o – ODR,
P – periodic downloaded static route
Gateway of last resort is not set
R 80.1.1.0/24 [120/1] via 10.1.1.2, 00:00:04, Ethernet0/0.1
D 80.0.0.0/8 [90/281600] via 10.1.1.2, 00:02:02, Ethernet0/0.1
O E2 80.1.0.0/16 [110/20] via 10.1.1.2, 00:00:14, Ethernet0/0.1
Referencing the output shown above, the first route is the 80.1.1.0/24 route. This route is learned via RIP and therefore has a default administrative distance value of 120. The second route is the 80.0.0.0/8 route. This route is learned via internal EIGRP and therefore has a default administrative distance value of 90. The third route is the 80.1.0.0/16 route. This route is learned via external OSPF and therefore has an administrative distance value of 110.
NOTE: Because the routing protocol metrics are different, they are a non-factor in determining the best route to use when routes from multiple protocols are installed into the routing table.
Based on the contents of this routing table, if the router received a packet destined to 80.1.1.1, it would use the RIP route because this is the most specific entry, even though both EIGRP and OSPF have better administrative distance values and are therefore more preferred route sources. The show ip route 80.1.1.1 command illustrated below can be used to verify this statement:
R1#show ip route 80.1.1.1
Routing entry for 80.1.1.0/24
Known via “rip”, distance 120, metric 1
Redistributing via rip
Last update from 10.1.1.2 on Ethernet0/0.1, 00:00:15 ago
Routing Descriptor Blocks:
* 10.1.1.2, from 10.1.1.2, 00:00:15 ago, via Ethernet0/0.1
Route metric is 1, traffic share count is 1
Static Routing
Static routes are very common on networks both large and small. The administrator configures the router so that to get to a particular network, traffic either leaves through a certain router interface or goes to the next-hop IP address. Configuring the routing in this way gives you very precise control over which traffic goes where on your network.
Static routes are ideal when the network state does not change often. An example of this is a stub network. This is where there is only one way in and out of the network. Static routes also improve network security inasmuch that bogus dynamic routes can’t be injected into the network by an attacker (if the network is running only static routes).
The disadvantage of using static routes is that an administrator is needed to update the route when there is a change to any routes in the network. For instance, if the next hop loses its connectivity to a route, the router will continue to send traffic to it until an administrator notices this and updates or removes the route. Also, after you have more than a handful of static routes, they can become a time-consuming administrative task to change and update.
FIG 13.3 – Static routing into a stub network
In the network above, Router A will run a routing protocol to exchange routes with its neighbor routers. It has a static route to reach the 192.168.1.0 network either pointing out of the Serial interface or to the next hop of 172.16.2.2. There is no point in including Router A in the routing updates because it’s a stub network (i.e., it doesn’t lead to any other networks). All traffic that isn’t bound for the attached network of 192.168.1.0 must go to Router B.
Mini-lab – Configuring a Static Route
In order to configure a static route, the router has to be in the global configuration mode:
RouterA(config)#ip route [network prefix_mask] [address | interface] [distance]
- network – the destination network
- prefix_mask – the subnet mask for that network
- address – the IP address of the next-hop router
- interface – the interface by which the traffic leaves
- distance – (optional) the administrative distance of the route; this is an indicator of the validity of the routing protocol (source of the route), and lower distances are always preferred
There are other parameters but these have been removed as they are not relevant to the CCNA exam. Bear in mind that in order for a static route to work, the next-hop address (if used) needs to be reachable, and you must add an IP address to your exit interface. It always pays to test your configurations with a ping as we will do in our labs.
Look at Figure 13.4 below and configure the IP addressing as per the diagram. Next, add the static route below on Router A. You can replace PCs for Loopback interfaces. If you are using a PC, you will need to add a default gateway.
RouterA(config)#ip route 192.168.1.0 255.255.255.0 172.16.1.2 110
192.168.1.0 is the destination network, 255.255.255.0 is the subnet mask for that network, and 172.16.1.2 is the next hop for the router to use. 110 is the administrative distance (AD), which we will look at later. Static routes with an AD specified by the network administrator are known as floating static routes. They can serve as backup in case a dynamic route goes down by using an alternative link to reach the destination network.
Alternatively, you could have specified the interface by which the traffic leaves:
ip route 192.168.1.0 255.255.255.0 Serial0
This tells the router that to get to network 192.168.1.0, leave by interface Serial 0. A static route specifying an exit interface is given an AD of 0; this is the same as a connected network’s AD. We will discuss administrative distances shortly.
FIG 13.4 – A static route to get to Network B
[END OF MINI-LAB]When you give the router a static route to use, it is vital that the router knows how to get to that next hop. Normally, the next hop would be part of a directly connected network. Routers are automatically aware of directly connected networks. If the router does not know how to get to the next hop, then the route will not be installed in the routing table.
One important fact to remember is that communication is a two-way process, so the router on the other side (destination) must have a route back to the source. If the router is not aware of the source network, there will never be a response. Just as if you do not put a return address on an envelope, a lost packet will not be returned to the source.
FIG 13.5 – Destination devices must know how to get back to the source network
You can also specify an exit interface along with a next-hop address to prevent constant ARP broadcasts on the segment. An example of this is:
ip route 192.168.1.0 255.255.255.0 Serial0 172.16.1.2
You can view the static-only routes in the routing table with the show ip route static command.
Mini-lab – Configuring an IPv6 Static Route
IPv6 static routing follows much the same process as IPv4; however, as you know, IPv6 uses a network prefix instead of a subnet mask. You must also enable IPv6 routing because it’s disabled by default. You can add a next-hop address for any configured route or an exit interface.
We will use the simple topology in Figure 13.6 below, which uses EUI-64 addressing on Fast Ethernet interfaces and has a manually added address to Loopback 0 on Router 2.
FIG 13.6 – Mini-lab: Configuring an IPv6 static route
R1(config)#ipv6 unicast-routing
R1(config)#int f0/0
R1(config-if)#ipv6 enable
R1(config-if)#no shut
*Mar 1 00:06:05.047: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
R1(config-if)#end
R1#show ipv6 interface brief
FastEthernet0/0 [up/up]
FE80::C000:8FF:FE01:0
FastEthernet0/1 [administratively down/down]
You can now configure the IPv6 addresses on R2:
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ipv6 uni
R2(config)#int f0/0
R2(config-if)#ipv6 enable
R2(config-if)#no shut
R2(config-if)#int lo0
R2(config-if)#ipv6 address fec0::1/16
R2(config-if)#end
R2#show ipv6 int brief
FastEthernet0/0 [up/up]
FE80::C001:8FF:FE01:0
FastEthernet0/1 [administratively down/down]
Loopback0 [up/up]
FE80::C001:8FF:FE01:0
FEC0::1
You can see that there is no route to the FEC0 network on R1:
R1#show ipv6 route
IPv6 Routing Table – 1 entries
Codes: C – Connected, L – Local, S – Static, R – RIP, B – BGP,
U – Per-user Static route, M – MIPv6,
I1 – IS-IS L1, I2 – IS-IS L2, IA – IS-IS interarea,
IS – IS-IS summary, O – OSPF intra, OI – OSPF inter,
OE1 – OSPF ext 1, OE2 – OSPF ext 2, ON1 – OSPF NSSA ext 1,
ON2 – OSPF NSSA ext 2, D – EIGRP, EX – EIGRP external
L FF00::/8 [0/0]
via ::, Null0
A useful feature to determine the remote IPv6 address (if you don’t have an accurate diagram or access to the device) is CDP, which was already discussed briefly. You will need to use the detail tag:
R1#show cdp nei detail
————————-
Device ID: R2.lab.local
Entry address(es):
IPv6 address: FE80::C001:8FF:FE01:0 (link-local)
Platform: Cisco 3725, Capabilities: Router Switch IGMP
Interface: FastEthernet0/0, Port ID (outgoing port): FastEthernet0/0
Holdtime: 176 sec
[output truncated]You can ping this address to check connectivity:
R1#ping ipv6 FE80::C001:8FF:FE01:0
Output Interface: FastEthernet0/0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FE80::C001:8FF:FE01:0, timeout is 2 seconds:
Packet sent with a source address of FE80::C000:8FF:FE01:0
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/22/40 ms
It should be no surprise that the next ping fails because there is no route to it:
R1#ping ipv6 FEC0::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FEC0::1, timeout is 2 seconds:
…..
Success rate is 0 percent (0/5)
You need to add a route to reach the network. If you are doing this on a broadcast network (such as Ethernet), you also need to specify an exit interface because R2 will not respond to a neighbor solicitation for a network or host it has a route to. If it was a Serial link, you could just specify the destination network and next-hop (link-local) address. Your link-local address may well differ from mine, so please check.
R1(config)#ipv6 route fec0::/64 FastEthernet0/0 FE80::C001:8FF:FE01:0
R1(config)#end
R1#ping ipv6 FEC0::1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to FEC0::1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/20/28 ms
R1#show ipv6 route
IPv6 Routing Table – 2 entries
Codes: C – Connected, L – Local, S – Static, R – RIP, B – BGP,
U – Per-user Static route, M – MIPv6,
I1 – IS-IS L1, I2 – IS-IS L2, IA – IS-IS interarea,
IS – IS-IS summary, O – OSPF intra, OI – OSPF inter,
OE1 – OSPF ext 1, OE2 – OSPF ext 2, ON1 – OSPF NSSA ext 1,
ON2 – OSPF NSSA ext 2, D – EIGRP, EX – EIGRP external
S FEC0::/64 [1/0]
via FE80::C001:8FF:FE01:0, FastEthernet0/0
L FF00::/8 [0/0]
via ::, Null0
[END OF MINI-LAB]Gateway of Last Resort
Normally, when a router is looking for a network that is not in its routing table, it will simply drop the packet. To ensure that a router has a last resort address or interface to send packets to, you can define a gateway of last resort. This process can be enabled with the ip default-gateway command, the ip route 0.0.0.0 0.0.0.0 command, or the ip default-network command. We will also examine a couple of new configurations included in the exam syllabus.
IP Default-Gateway
The ip default-gateway command is only used on routers without IP routing enabled. Without IP routing enabled, a router is just another host that needs a default gateway. You would rarely or never need to use this command. Because it’s unlikely that you would ever use this command, watch out for trick questions in the exam. This command is used on network switches so that they can be remotely managed via Telnet, and traffic can be sent to the router in the case of interVLAN routing.
IP Route 0.0.0.0 0.0.0.0
In Figure 13.7 below, the stub network has only one way for the traffic to go to reach several different networks. To configure several static routes would be a long-winded way of achieving what could be done with one command (presuming that 192.168.1.2 is the next-hop IP address).
Router(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.2
The 0s indicate any network and any subnet mask. This means that any traffic to anywhere goes via the next-hop address 192.168.1.2.
You could have specified an exit interface instead of the next-hop address:
Router(config)#ip route 0.0.0.0 0.0.0.0 Serial0
FIG 13.7 – All traffic will leave the stub router through Serial 0
You could even have some static routes configured and then a default route at the end. A practical use may be that you work in a small office, and any unknown traffic will be passed to a larger router at your head office that can make all the routing decisions for your router.
IP Default-Network
The ip default-network command is used on routers that have IP routing enabled, and it works best alongside routing protocols. When this command is used, routes to that network are considered the gateway of last resort by the router. A static route will only affect traffic leaving the configured router. With the ip default-network command, each router will learn about the default network via a routing protocol and send traffic to that address if there is no other route in the routing table (as opposed to dropping it).
The ip default-network Command
The ip default-network command works best with routing protocols. It is not compatible with OSPF, which instead must use the default-information originate command (this will be discussed later). It will, however, work with RIP and EIGRP. The ip default-network command allows routers to forward packets when no other route exists, and the default network is sent to other routers.
Figure 13.8 below shows two routers with only the 192.168.1.0 network being advertised by RIP. The ip default-network 10.0.0.0 command is added to R1, and then the routing table is examined on R2.
R1(config)#ip default-network 10.0.0.0
FIG 13.8 – Adding the ip default-network 10.0.0.0 command to R1
R2#show ip route
[output truncated]
ia – IS-IS inter area, * – candidate default,
Gateway of last resort is 192.168.1.1 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
R* 0.0.0.0/0 [120/1] via 192.168.1.1, 00:00:00, FastEthernet0/0
Static Host Routes
Static host routes are for a single host address (as opposed to a subnet/network) that is an IP address with a 255.255.255.255 mask and creates a /32 subnet to the route. The router will use the longest match rule if there is another entry in the routing table that it matches.
Figure 13.9 below demonstrates how to configure static host routes. The first route is to a network and the second is to a specific host on the same network (matched via the longest match rule).
FIG 13.9 – Configuring static host routes
ip route 172.16.0.0 255.255.0.0 10.1.1.1
ip route 172.16.0.10 255.255.255.255 192.168.1.1
Permanent Routes
A permanent route will bypass the rule that the interface must be up and a route to the next-hop address must exist (if used). If the interface goes down for whatever reason, the route will remain in the routing table.
There could be a few reasons for doing this, but the main one is not wanting any route flapping to upstream BGP neighbors. Here is how to make a static route permanent:
ip route 172.16.0.0 255.255.0.0 10.1.1.1 permanent
Floating Static Route
Floating static routes are useful if you want a backup route to a particular network or host. The process for adding one is very simple: just configure a static route with an administrative distance (AD) higher than the primary route or routing protocol. The route with the higher AD will not be used unless the primary (better) route goes down. The route will no longer be used after the primary route recovers.
As shown in Figure 13.10 below, OSPF has been configured between R1 and R2, and a floating static route has been added. The administrative distance of 120 was chosen because it has a higher value than OSPF, which is 110. All traffic to the 172.16.0.0 network should pass via R2. If, for any reason, the link between R1 and R2 goes down, the traffic would pass via R3.
R1(config)#ip route 172.16.0.0 255.255.255.0 192.168.1.2 120
A floating static route would also need to be added on R2 for return traffic to R1.
FIG 13.10 – Adding a floating static route
Because OSPF has an AD of 110 and the static route has an AD of 120, the OSPF-learned route will be used. The static route will not appear in the routing table until the OSPF route goes down because it has the best AD.
R1#show ip route 172.16.0.0
Routing entry for 172.16.0.0/24, 1 known subnets
O 172.16.0.0 [110/74] via 10.0.0.2, 00:02:26, Serial0/0
R1#traceroute 172.16.0.2
Type escape sequence to abort.
Tracing the route to 172.16.0.2
1 10.0.0.2 4 msec 12 msec 0 msec
If the OSPF connection is lost (e.g., due to an interface going down), the router will use the static route.
R1#show ip route 172.16.0.0
Routing entry for 172.16.0.0/24, 1 known subnets
S 172.16.0.0 [120/0] via 192.168.1.2
R1#traceroute 172.16.0.2
Type escape sequence to abort.
Tracing the route to 172.16.0.2
1 192.168.1.2 4 msec * 0 msec
Floating static routes for IPv6 operate in the same way as for IPv4.
Administrative Distances
Administrative distance (AD) is used by the router to determine how believable a route learned from a routing protocol is. If a route is learned via more than one routing protocol, then the protocol (route source) with the lower AD is preferred. The most trusted routes start at 0 and go all the way up to an unknown route valued at 255, which will never be used.
Table 13-2: Administrative distances
Route Source | Default Distance |
Connected interface | 0 |
Static route (next-hop IP address) | 1 |
Enhanced IGRP summary route | 5 |
External BGP | 20 |
Internal enhanced IGRP (EIGRP) | 90 |
IGRP | 100 |
OSPF | 110 |
IS-IS | 115 |
RIP | 120 |
EGP | 140 |
External enhanced IGRP | 170 |
Internal BGP | 200 |
Unknown | 255 |
In the exam, Cisco might try to catch you out by asking which route would be preferred from a list learned via OSPF, EIGRP, static, or connected. Looking at Table 13-2 above, you already know that the router will prefer a connected network over a static route, a static route over EIGRP, and so on.
Memorize the administrative distances! The ones most commonly referred to are in bold, but you need to know them all for the exam. These are easy marks in the exam; it would be a shame for you to miss out on.
FIG 13.11 – Which path will the traffic take?
Classful and Classless Routing
Do you remember from previous sections that you can use VLSM to break down your network into subnets? Some routing protocols do not understand VLSM and presume that you are using the default subnet mask. These types of protocols are known as classful. They do not send any subnet information with their routing updates because, as far as they are concerned, variable length subnet masking does not exist. Classful protocols do not have an option of sending the subnet mask when they advertise networks, for example, RIP and IGRP. Classful routing protocols are rarely used in networks today.
Mini-lab – Classful and Classless Routing Protocols
Configure the IP addresses as per the network in Figure 13.12 below. Add a Loopback interface to R1 and add an address from the 172.16.1.0/24 network to it.
FIG 13.12 – Mini-lab: Classful and classless routing protocols
We’ll start with RIP, which is a classless routing protocol. Here is the configuration for R1. It will be the same for R2 but you need the .2 IP address, and you won’t need to advertise the 172 network:
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int f0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.240
R1(config-if)#no shut
R1(config-if)#int lo0
R1(config-if)#ip add 172.16.1.1 255.255.255.0
R1(config-if)#router rip
R1(config-router)#network 172.16.1.0
R1(config-router)#network 192.168.1.0
If you have configured R2 correctly, you should be able to see the network on the Loopback of R1 advertised:
R2#show ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
[output truncated]
Gateway of last resort is not set
R 172.16.0.0/16 [120/1] via 192.168.1.1, 00:00:01, FastEthernet0/0
192.168.1.0/28 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, FastEthernet0/0
Because RIP is classless, it will not be aware of VLSM; with this in mind, it has no need to advertise any subnet mask information. The output below shows a debug ip rip command running on R2. Notice that the networks are advertised via broadcast, and there is no subnet mask information:
*Mar 1 00:05:27.819: RIP: sending v1 flash update to
255.255.255.255 via FastEthernet0/0 (192.168.1.1)
*Mar 1 00:05:27.819: RIP: build flash update entries
*Mar 1 00:05:27.819: network 172.16.0.0 metric 1
Classless protocols do not make any such presumptions and always advertise the subnet mask with the routing update. For this reason, you are free to use subnet masks other than the default mask of Class A, B, or C networks. Examples of classless protocols are RIPv2, OSPF, EIGRP, and IS-IS.
Now add the command below to both routers:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#end
Here is the debug again; however, I’ve updated the routing protocol to RIPv2. Now you can see that updates are multicast and the subnet information is also included:
R2#
*Mar 1 06:15:40.406: RIP: received v2 update from 192.168.1.1 on FastEthernet0/0
*Mar 1 06:15:40.406: 172.16.0.0/16 via 0.0.0.0 in 1 hops
R2#
*Mar 1 06:15:42.906: RIP: sending v2 update to 224.0.0.9 via FastEthernet0/0 (192.168.1.2)
The 172 network will still show as /16 in the routing table, and in the debug above, you can see that the mask of /24 has been summarized to the default of 16. Some routing protocols will automatically do this, and we will cover this in more detail in the EIGRP section. I’ll disable the automatic summarization process on R1:
R1(config)#router rip
R1(config-router)#no auto-summary
R1(config-router)#end
Now R2 receives the /24 mask:
R2#
*Mar 1 06:18:33.586: RIP: received v2 update from 192.168.1.1 on FastEthernet0/0
*Mar 1 06:18:33.586: 172.16.1.0/24 via 0.0.0.0 in 1 hops
As I said, we’ll cover the automatic summarization part in detail later. I wanted to demonstrate the difference between classful and classless protocols in this mini-lab.
[END OF MINI-LAB]Dynamic Routing
Dynamic routing involves using a routing protocol on the router to discover which networks are present where and how best to get there. Rather than the time-consuming task of having to configure a static route to every network on every router, the network administrator configures the router with the networks to advertise for the chosen dynamic routing protocol. After that, the routers automatically carry out the task of finding the networks and working out how to reach them.
Even for the network in Figure 13.13 below, which is fairly small and simple, each router will need to be configured with several static routes, possibly requiring regular manual updates. You will also have to configure different administrative distances for the alternative paths to reach the various networks.
FIG 13.13 – Managing multiple static routes is challenging
Dynamic routing is a far easier way to manage a medium to large network; this is because the routing takes place automatically after the initial setup and configuration. Static routing is, however, still useful in small networks that change very little.
Dynamic routing protocols are divided into two types:
- Distance vector
- Link state
Both do the same job but achieve it in different ways. A hybrid of the two is called EIGRP, which we will address in this book. All routing protocols have certain roles to perform, such as:
- Advertise connected networks
- Learn other networks
- Deal with faulty or lost routes
- Determine the best loop-free path for traffic to take
We will dig into the individual metrics in more detail when we cover specific routing protocols.
Metrics
Routing protocols feature a mechanism to deal with the case that multiple routes to the same destination network are learned. Metrics run on the learned routes to choose the best path to the network. There must be a ranking system of some sort so that the preferred path is placed into the routing table.
RIP, for example, uses hop count, while EIGRP uses the lowest bandwidth and the total delay; it also builds a table of the next-best routes should the main route fail. The metrics used by routing protocols include:
- Bandwidth – the fastest link speed is chosen
- Hop count – a hop is another router, so three routers away equals three hops
- Load – the amount of traffic using the link; the lowest loaded link is chosen
- Delay – the amount of time it takes a packet to traverse a path
- Reliability – the likelihood of a link failing based on errors or interface resets
- Cost – no fixed definition of this value; it reflects a less or more preferred route
Of course, this is a simplistic view of each metric. Some protocols use one or more of the metrics above by default, but you can add others. Some protocols accept metrics such as bandwidth, but they are displayed purely for cosmetic reasons. We will revisit some of the metrics above as we progress through the guide.
Distance Vector Protocols
Distance vector protocols (also referred to as Bellman-Ford algorithms) run an algorithm to calculate the best path to reach routes advertised by other routers. They then update their routing tables, allowing them to communicate changes in the network topology. Distance refers to the measurement used to calculate the distance to the route in the table, and vector is the direction the traffic to the route should take. Figure 13.14 below demonstrates a simplified view of how distance vector protocols operate:
FIG 13.14 – Routers exchange routing tables
Distance vector routing is a property of certain routing protocols that build an internal picture of the topology by periodically exchanging full routing tables and metrics between neighbor devices. When the network first converges, routers first discover their attached networks before exchanging routing tables with all other routers in the domain. An illustration of how this occurs is shown in Figure 13.15 below:
FIG 13.15 – Routing table exchanges
The main difference between distance vector routing protocols and link state protocols is the way they exchange routing updates. Distance vector protocols function using the routing-by-rumor technique, where every router relies on its neighbors to maintain correct routing information, meaning the entire routing table is sent periodically to neighbors. This is illustrated in Figure 13.16 below. The interval varies from protocol to protocol. You will see in the show ip protocols output below that RIP sends updates every 30 seconds. Of course, this would cause you issues in a very large enterprise network.
Figure 13.16 – Distance vector routing protocol behavior
The most important advantage of distance vector routing protocols is that they are easy to implement and maintain. The downside is mostly the convergence times. A converged network is a network in which every router has the same perspective of the topology. When a topology change occurs, the routers in the respective area propagate the new information to the rest of the network. Considering this is done on a hop-by-hop basis (every router passes its full updated routing information to each neighbor), network convergence won’t be established until a significant amount of time has passed.
Besides the slow convergence downside, distance vector protocols are also bandwidth-intensive. This happens especially in large networks, where routing tables can be of considerable size. Considering these aspects, distance vector protocols are recommended only in small enterprise network implementations.
An example of a distance vector routing protocol still used in modern networks is RIPv2 (Routing Information Protocol v2, described in RFC 2453). RIPv2 uses hop count as a metric for path selection, with a maximum hop count of 15. RIPv2 updates are sent using multicast by default, although they can be configured as unicast or broadcast, and, unlike its predecessor (RIPv1), RIPv2 permits VLSM in the network as you saw in the debugs in the previous mini-lab.
Devices receive routing information from their neighbors and pass it on to other neighbors. RIP repeats this process every 30 seconds. The downside in this scenario is that when the network is stable and there are no changes in the topology, RIP still sends its routing table every 30 seconds, which is not very efficient and is somewhat pointless if there have been no changes, and, of course, it wastes bandwidth.
R1#show ip protocols
Routing Protocol is “rip”
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 15 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Neighbors in the context of routing protocols means routers sharing a common data link or common configuration information, which enables them to share routing information.
If a router that uses a distance vector protocol has inaccurate information, that information will be propagated throughout the entire network. Moreover, distance vector routing protocols are prone to major problems, including routing loops.
Distance Vector Problems
Distance vector protocols usually use low amounts of network resources (e.g., router CPU and network bandwidth). They are also easy to maintain on smaller networks and simple to configure. However, there are some drawbacks to using these protocols, especially slow convergence on larger networks due to periodic updates of full routing tables. These drawbacks, which include routing loops and counting to infinity, must be addressed by either the network administrator or the protocols themselves.
Routing Loops
Routing loops can prove catastrophic for a network. They consume network bandwidth and resources, cause loss of information, and can take time to locate and troubleshoot. Perhaps now you can see why static routes are so popular. Routing loops are caused when network convergence is slow and routers are advertising inaccurate routing tables. A router can lose connectivity to a network, but other routers are not yet aware of the problem.
In Figure 13.17 below, Router D advertises network 172.20.0.x to Router B. Router B tells Router C, which tells Router A that it knows how to get to network 172.20.0.x. For some reason, network 172.20.0.x goes down. Router D informs Router B and Router B stops routing traffic for this network to Router D.
FIG 13.17 – Routing loops can happen quickly
Eventually, the message is passed to Router C, but unfortunately, during this time, Router A thinks that 172.20.0.x is still up. Therefore, Router A advertises to Router D that it can reach 172.20.0.x (via Routers C and B) based on the previous entry it had learned before 172.20.0.x went down. Now Routers B, C, and D all believe that Router A has a path to network 172.20.0.x and route traffic to it.
When Router A receives the traffic, it routes it to Router C, thinking that it is the path to take based on the old routing entry in the routing table. When this happens, the hop count keeps increasing every hop the packet takes. There is a Time to Live field in the IP packet, as you know, and this will count down from 255, but it still means that a looping packet will pass through 255 routers before being destroyed. We’ll cover TTL shortly. The routing loop thus consumes bandwidth and router CPU cycles, degrades convergence, and causes issues with routing updates.
Counting to Infinity
Routing loops can lead to another problem known as counting to infinity, where a packet travels around the network looking for a particular IP address but never reaches its destination. This is normally because the network is down, but the sending router is not aware of this fact. Take the network in Figure 13.18 below as an example:
FIG 13.18 – Counting to infinity
Router D is advertising that it can reach the 192.168.2.0 network. When the link to that network fails, Router D will send the relevant routing update. Router A, however, has a three-hop route to 192.168.2.0 in its table, and this information is forwarded to Router B, which in turn informs Router D that an alternative (four-hop) path is available. This alternative route is forwarded from Router D to Router C, which advertises that it has a five-hop route to 192.168.2.0. Router C passes this route to Router A, which notes that the path cost has increased but still adds the route to its routing table, and so on.
Solving Distance Vector Problems
Maximum Hop Count
As the packets traverse the network, the information can become out of date, or sometimes a route that was valid when the packet was sent is now invalid. Certain safety measures have been put into place to prevent this from becoming a problem.
RIP has a maximum hop count of 15 hops; at the fifteenth hop, the packet is dropped. This means that (for RIP) a packet can travel across a network with only 15 routers, and on each router, the Time to Live (TTL) value is incremented by one. This also means that RIP can only be used in a network with a maximum diameter of 15 routers.
FIG 13.19 – TTL packet capture
If there was a routing loop, at least the looping packet would travel only 15 hops before dying, and the routing loop begins all over again. Note that the maximum hop count does NOT solve routing loop problems. It only ensures that the count to infinity problem is fixed.
You could run a packet capture and see the TTL field decrementing on each router. From RFC 1812, Requirements for IP Version 4 Routers, “When a router forwards a packet, it MUST reduce the TTL by at least one.” You would see the first router receive the packet with a TTL value of 255 and forward it with a value of 254, and so on.
FIG 13.20 – TTL value decremented each hop
Here is a capture of a ping packet from R1 arriving at R4:
FIG 13.21 – TTL packet decremented
Split Horizon
When a route is received by a router, it automatically adds this route to its routing table. The route is then advertised out of the router’s interfaces so that other routers in the network hear about the route.
FIG 13.22 – Split horizon prevents sending a route out of the interface it was learned on
A problem occurs when the route is advertised out of the same interface that the router learned the route from. Now there is some confusion as to where that network actually is. In Figure 13.22 above, Router C tells Router B to come over the Serial link if it wants to reach 10.0.0.0/8. Router B would normally send this information out of every interface, but this would cause further confusion because Router C is where the network is directly attached. The split horizon rule prevents this scenario from happening because any information or route learned on an interface from a router will not be advertised back on the same interface to the same router. In this case, Router B will not advertise network 10.0.0.0 to Router C via the Serial interface (when it learns the route via Router A). Thus, split horizon prevents the possibility of routing loops.
Holddown Timers
Holddown timers are used to prevent route update messages from being sent or received (for a period of time known as the holddown time) and from reinstalling a route that may actually be down. Sometimes, before an interface fails completely, it goes up and down rapidly. This is known as link flapping, and every time the interface comes up, the router advertises the network as up, and when it goes down, it advertises that it is no longer available.
When holddown timers are in use, the router receives the message that the network is down and begins a timer. If it receives a message that the network is up before the holddown timer expires, it will ignore the update. The theory is that by the time the timer expires, the flapping interface will have stabilized.
FIG 13.23 – Holddown timers prevent routing table updates for X seconds
What can happen is that while the holddown timer is active, an update with a better metric is received from a different router. This route will then be accepted at the end of the holddown timer, and the holddown timer ends. Holddown timers can be tuned or modified, but this should not be done without proper guidance and expertise. The downside of very high holddown timer values is that network convergence takes longer, while low values can lead to fast convergence, but this becomes ineffective in cases of link flapping.
R1#show ip protocols
Routing Protocol is “rip”
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 15 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Route Poisoning
FIG 13.24 – Route poisoning sets the hop count as unreachable on this RIP network
A form of split horizon uses a method known as route poisoning (or poison reverse). Route poisoning allows a router to set the distance to a network as infinity to allow the rest of the network to converge without receiving inaccurate updates. When used with holddown timers, route poisoning can prove to be a reliable solution to preventing loops.
In Figure 13.24 above, RIP is the protocol in use, so Router B sends an update to Router A telling it that 10.0.0.0 is 16 hops away (i.e., unreachable).
Triggered Updates
Distance vector routing protocols rely on regular updates from neighbor routers; these updates occur after the expiration of update timers. Sometimes there are changes to the network topology, but the network will not learn about these changes until the next routing update is due. This can cause serious problems for the network in terms of slow convergence, resulting in lost information and lost time and resources for the business.
A triggered update is an unscheduled routing update sent out due to a change in the network topology, including an interface coming up or going down, a route becoming unreachable, or a new route being placed into a routing table. Each router that receives the triggered update passes it on to its neighbor routers.
Using triggered updates along with holddown timers can help prevent bad routing information from being passed around the network, as well as reduce the likelihood of counting to infinity. Triggered updates happen along with regular updates.
Distance vector protocols are best suited for smaller networks with very few or, preferably, no redundant links. The two most popular distance vector protocols are RIP and IGRP, which were retired from the CCNA exam some time ago.
Link State Protocols
Link state routing protocols do not route by rumor. The routing devices exchange information between them about their link states. Each device independently builds a map of the network (and does not rely on a map of a particular node) based on the link state information each router generates and propagates to the other routers.
Unlike distance vector routing protocols, where only the best routes are exchanged between neighbors, link state protocols flood information about their links to a specific area or to all the routers in the network. This way every router in the topology has detailed knowledge of the entire network. The routing decisions are made by applying Shortest Path First (SPF), or Dijkstra’s algorithm, to the information received from various sources. The result of this calculation consists of the shortest path to each destination in the network.
FIG 13.25 – Link state routing protocol behavior
This is a much more efficient approach to building routing databases, and there is no fixed updated timer as in distance vector technologies. Link state protocols reflood their entire routing information every 30 minutes in order to ensure that the network is properly converged (this is the case for OSPF at least).
Link state protocols offer a series of important advantages compared with distance vector protocols. The most important advantage relates to the convergence factor. Convergence happens a lot faster because as soon as a network topology changes, only that specific information is sent to the routers in a given area.
The routing updates stop after all the routers learn about the specific change, thus decreasing the need for bandwidth, unlike distance vector protocols that periodically exchange routing tables, even if no topology change occurs. In link state routing, updates are triggered only when a link state changes somewhere in the network. Depending on the routing protocol in use, this can mean a link going up/down or changing some of its parameters (e.g., bandwidth).
Examples of link state routing protocols are OSPF (Open Shortest Path First), described in RFC 2328, and IS-IS (Intermediate System to Intermediate System), described in RFC 1142.
Routing Features
It’s worth mentioning a few concepts that don’t fit under either distance vector or link state protocols. These will crop up as we discuss routing and BGP.
Autonomous Systems
Some protocols, such as EIGRP, use the concept of an autonomous system (AS). An AS number (ASN) is used to specify a routing domain that is independent from other routing domains. In EIGRP, routers must be in the same AS if they are to exchange routing information. Routers in different autonomous systems can also communicate but only with protocol redistribution (which is outside the scope of the CCNA exam).
Autonomous systems are self-contained networks normally administered by one or a single group of network administrators. They contain their own addressing scheme and normally feature just one routing protocol. Autonomous systems can be joined together by a border router, which will take care of any protocol translation and routing issues. These have to be configured manually by the network administrator.
When one company buys out another company, they also acquire their network. A common method used to join the networks together is to make two autonomous systems and join them with a border router. The border router is responsible for routing between the two different autonomous systems.
FIG 13.26 – Autonomous systems joining two networks
Passive Interface
When dynamic routing protocols (such as EIGRP, RIP, or OSPF) are configured, routing updates are sent and received over a router interface configured for that protocol. If you do not want an interface to participate actively in a routing protocol, you can make that interface passive. The passive-interface command is used to make an interface passive. In RIP, this means that the interface is still able to receive updates but is unable to send any routing updates. In EIGRP and OSPF, a passive interface suppresses Hellos, so neighbor relationships cannot be formed. This means that routers can neither receive nor advertise any routing updates.
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router eigrp 10
R1(config-router)#network 192.168.1.0
R1(config-router)#passive-interface fast0/0
If you want routing updates to be sent to a certain host that is connected to Fast Ethernet 0/0, but do not want updates to be broadcast (or multicast to 244.0.0.9) out of it, you can use the neighbor command. This will send a unicast packet to the neighbor.
R1(config-router)#neighbor 192.168.1.10
The neighbor command can also be used on non-broadcast networks, such as Frame Relay (because multicast and broadcast are not supported), to allow unicast updates to pass across the media.
We will revisit the passive interface again when reviewing each routing protocol.
IP Unnumbered
There is a way for you to borrow an IP address from another interface and use it on a second interface. You may want to use this to save addresses or to make sure that the interface stays up. The ip unnumbered command is often used with Loopback interfaces to increase reliability because the Loopback interface cannot go down (it exists only in software).
R1#config t
R1#(config)#interface FastEthernet0/0
R1#(config-if)ip address 192.168.1.1 255.255.255.0
R1#(config-if)no shutdown
R1#(config-if)#interface Serial0/0
R1#(config-if)#ip unnumbered FastEthernet0/0
R1#(config-if)#no shutdown
End of Chapter Questions
Please visit www.howtonetwork.com/ccnasimplified to take the free Chapter 13 exam.
Chapter 13 Labs
Lab 1: Static Routes
The physical topology is shown in Figure 13.27 below:
FIG 13.27 – Static Routes Lab
Lab Exercise
Your task is to configure the network in Figure 13.37 to allow full connectivity using static routes. Please feel free to try the lab without following the Lab Walk-through section.
Text in Courier New font indicates commands that can be entered on the router.
Purpose
The majority of small businesses have just one router that connects to another router provided by the service provider. These routers will only need to be configured with a very basic configuration, including IP addresses and a static route to reach the ISP. This lab will show you just how to do that.
Lab Objectives
- Use the IP addressing scheme depicted in Figure 13.37. Router A needs to have a clock rate on interface Serial 0/0: set this to 64000.
- Set Telnet access for the router to use the local login permissions for username banbury and the password ccna.
- Configure the enable password to be cisco.
- Configure the static routes to provide connectivity to all networks attached to the neighbor router, except the network used for the Serial connection.
- Ensure that routing information is correct by checking the routing table for entries to the neighbor’s networks.
- Finally, try to ping all the Loopback interfaces of the neighbor’s networks, and then try to access the neighbor router via Telnet.
Lab Walk-through
- To set the IP addresses on an interface, you will need to do the following:
Router#config t
Router(config)#hostname RouterA
RouterA(config)#interface Serial0/0
RouterA(config-if)#ip address 192.168.1.1 255.255.255.252
RouterA(config-if)#clock rate 64000
RouterA(config-if)#no shutdown
RouterA(config-if)#interface Loopback0
RouterA(config-if)#ip address 172.16.1.1 255.255.0.0
RouterA(config-if)#interface Loopback1
RouterA(config-if)#ip address 172.20.1.1 255.255.0.0
RouterA(config-if)#^Z
RouterA#
To set the clock rate on a Serial interface (DCE connection only), you need to use the clock rate # command on the Serial interface, where # indicates the speed:
RouterA(config-if)#clock rate 64000
- To set Telnet access, you need to configure the VTY lines to allow Telnet access. To do this, type the following (in configuration mode):
RouterA(config)#line vty 0 4 ï Enters the VTY line configuration
RouterA(config-line)#login local ï This will use local
usernames and passwords for Telnet access
RouterA(config-line)#exit ï Exits the VTY config mode
RouterA(config)#username banbury password ccna ï Createsusername and password for Telnet access (login local)
- To set the enable password, do the following:
RouterA(config)#enable secret cisco ï Sets the enable password (encrypted)
- To configure static routes on a router, there is only one step:
RouterA(config)#ip route 172.30.0.0 255.255.0.0 192.168.1.2
RouterA(config)#ip route 172.31.0.0 255.255.0.0 192.168.1.2
The command above will configure a static route on Router A. To get to the destination networks 172.30.0.0 and 172.31.0.0, use the next-hop address 192.168.1.2. Instead of using the commands above, you can enter the ones below. This time, the router is told to use an exit interface instead of a next hop. DO NOT USE BOTH THE ABOVE AND BELOW TOGETHER.
RouterA(config)#ip route 172.30.0.0 255.255.0.0 Serial0/0
RouterA(config)#ip route 172.31.0.0 255.255.0.0 Serial0/0
- Next, configure the same commands on Router B. Set the IP addresses:
Router#config t
Router(config)#hostname RouterB
RouterB(config)#interface Serial0/0
RouterB(config-if)#ip address 192.168.1.2 255.255.255.252
RouterB(config-if)#no shutdown
RouterB(config-if)#interface Loopback0
RouterB(config-if)#ip address 172.30.1.1 255.255.0.0
RouterB(config-if)#interface Loopback1
RouterB(config-if)#ip address 172.31.1.1 255.255.0.0
RouterB(config-if)#^Z
RouterB#
- Now make sure that you can ping across the Serial link. If you cannot, then check the configurations again.
RouterA#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/31/32 ms
Configure Telnet access:
RouterB(config)#line vty 0 4
RouterB(config-line)#login local
RouterB(config-line)#exit
RouterB(config)#username banbury password ccna
Configure the enable secret password:
RouterB(config)#enable secret cisco
Set the static route:
RouterB(config)#ip route 172.16.0.0 255.255.0.0 192.168.1.1
RouterB(config)#ip route 172.20.0.0 255.255.0.0 192.168.1.1
The command above will configure a static route on Router B. To get to the destination networks 172.20.0.0 and 172.16.0.0, use the next-hop address 192.168.1.1. Instead of using the commands above, you can enter the ones below. This time, the router is told to use an exit interface instead of a next hop. DO NOT USE BOTH THE ABOVE AND BELOW TOGETHER.
RouterB(config)#ip route 172.16.0.0 255.255.0.0 Serial0/0
RouterB(config)#ip route 172.20.0.0 255.255.0.0 Serial0/0
This command will configure a static route to the 172.20.0.0 or 172.16.0.0 network, but instead of having a next-hop address, you have specified an exit interface to use.
- Use the show ip route command to check that the static routes are in the routing table and that the next-hop address is correct:
RouterA#show ip route
Codes: C – connected, S – static, I – IGRP, R – RIP,
M – mobile, B – BGP, D – EIGRP, EX – EIGRP external,
O – OSPF, IA – OSPF inter area,
N1 – OSPF NSSA external type 1,
N2 – OSPF NSSA external type 2,
E1 – OSPF external type 1, E2 – OSPF external type 2,
E – EGP, i – IS-IS, L1 – IS-IS level-1,
L2 – IS-IS level-2, ia – IS-IS inter area,
* – candidate default, U – per-user static route,
o – ODR, P – periodic downloaded static route
Gateway of last resort is not set
C 172.16.0.0/16 is directly connected, Loopback0
C 172.20.0.0/16 is directly connected, Loopback1
S 172.31.0.0/16 [1/0] via 192.168.1.2
S 172.30.0.0/16 [1/0] via 192.168.1.2
192.168.1.0/30 is subnetted, 1 subnets
C 192.168.1.0 is directly connected, Serial0/0
- To test connectivity, you will need to use the ping command, and to log in to the neighbor router, you need to use the telnet command:
RouterA#ping 172.30.1.1 ï This will send a ping packet to the address specified; there should be five replies if everything is OK.
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.30.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5),round-trip min/avg/max = 1/2/4 ms
RouterA#ping 172.31.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.31.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms
RouterA#
RouterA#telnet 172.30.1.1 ï This will open a Telnet connection to the neighbor router. If Telnet access has been set up correctly, you should be presented with a login message. Type exit to quit a Telnet session or ctrl+shift+6 to exit.
RouterA#telnet 172.30.1.1
Trying 172.30.1.1 … Open
User Access Verification
Username: banbury
Password: ï Password will not show as you type it
RouterB>exit
[Connection to 172.30.1.1 closed by foreign host]RouterA#
Do the same on Router B:
RouterB#ping 172.16.1.1
RouterB#ping 172.20.1.1
RouterB#telnet 172.16.1.1
Show Runs
RouterA#show run
Building configuration…
Current configuration: 704 bytes
!
version 15.1
!
hostname RouterA
!
username banbury password 0 ccna
!
interface Loopback0
ip address 172.16.1.1 255.255.0.0
!
interface Loopback1
ip address 172.20.1.1 255.255.0.0
!
interface Serial0/0
ip address 192.168.1.1 255.255.255.252
clockrate 64000
!
ip classless
ip route 172.30.0.0 255.255.0.0 192.168.1.2
ip route 172.31.0.0 255.255.0.0 192.168.1.2
no ip http server
!
line con 0
line 1 8
line aux 0
line vty 0 4
login local
!
end
—
RouterB# show run
Building configuration…
Current configuration: 678 bytes
!
version 15.1
!
hostname RouterB
!
username banbury password 0 ccna
!
interface Loopback0
ip address 172.30.1.1 255.255.0.0
!
interface Loopback1
ip address 172.31.1.1 255.255.0.0
!
interface Ethernet0
no ip address
shutdown
!
interface Serial0/0
ip address 192.168.1.2 255.255.255.252
!
ip classless
ip route 172.16.0.0 255.255.0.0 192.168.1.1
ip route 172.20.0.0 255.255.0.0 192.168.1.1
no ip http server
!
line con 0
line aux 0
line vty 0 4
login local
!
end
RouterB#
Cisco ip route command guide.