Questions? Call 1.800.716.8955

Chapter 19

Routing Fundamentals and the Routing Table

Exam topics covered

3.1 Interpret the components of routing table (3.1.a Routing protocol code, 3.1.b Prefix,

3.1.c Network mask, 3.1.d Next hop, 3.1.e Administrative distance, 3.1.f Metric, 3.1.g Gateway of last resort)

3.2 Determine how a router makes a forwarding decision by default (3.2.a Longest prefix

match, 3.2.b Administrative distance, 3.2.c Routing protocol metric)

Foundation. Switches move frames inside a LAN; routers move packets between networks. Every forwarding decision a router makes is driven by one data structure: the routing table. This chapter opens Part III by taking the routing table apart field by field. You will learn how a router forwards a packet hop by hop, where routes come from (connected, local, static and dynamic), how to read every column of show ip route , and, most importantly for the exam, the three rules a router uses to pick one route over another: longest prefix match, administrative distance and metric. Domain 3.0 is worth 25% of the CCNA exam, and almost every question in it assumes you can read a routing table fluently.

19.1 How a Router Forwards a Packet

A router is a Layer 3 device. It connects two or more IP networks, and its job is to receive a packet on one interface, decide which interface (and which neighbouring device) brings the packet closer to its destination, and send it out. The decision is made on the destination IP address only; the source address plays no part in normal routing.

Because the incoming Ethernet header is addressed to the router itself and means nothing on the next link, the router performs three operations for every packet:

  • 1. De-encapsulate. The router receives the frame, checks the FCS for errors, confirms the destination MAC address is its own interface MAC (or a broadcast/multicast it is listening to), and strips off the data-link header and trailer to expose the IP packet.
  • 2. Look up. The router reads the destination IP address, decrements the TTL (discarding the packet and sending an ICMP Time Exceeded message if it reaches 0), and searches the routing table for the best matching route. The matching route supplies the outgoing interface and, for remote networks, the next-hop IP address.
  • 3. Re-encapsulate. The router builds a brand-new frame for the outgoing link. On Ethernet that means the source MAC is the outgoing interface's MAC and the destination MAC is the MAC of the next hop (or of the destination host itself if it is on a directly connected subnet), learned through ARP. The frame is then transmitted.

Orange fields are rebuilt at every hop; the blue IP addresses stay the same end to end (only TTL and checksum change).

Figure 19-1 The Layer 2 header is replaced at every router hop while the source and destination IP addresses are unchanged.

Figure 19-1 captures the most important idea in routing: MAC addresses are hop-by-hop,

IP addresses are end-to-end. (Network Address Translation, covered in Chapter 24, is the deliberate exception.)

If the lookup finds no matching route, and there is no default route, the router discards the packet and normally sends an ICMP Destination Unreachable message back to the source. This is a key difference from a switch: a switch floods unknown unicast frames, but a router never floods an unroutable packet.

Note

For speed, Cisco Express Forwarding (CEF) precomputes a Forwarding Information Base (FIB) from the routing table and an adjacency table of pre-built Layer 2 headers; the logic is unchanged. All command output in this chapter is illustrative of Cisco IOS 15 / IOS XE.

19.2 Where Routes Come From

A router can only forward to networks that appear in its routing table. Routes enter the table in three ways:

Connected and local routes are added automatically when an interface has an IP address and is in the up/up state.

Static routes are typed in by an administrator with ip route (Chapter 20). Dynamic routes are learned from neighbouring routers through a routing protocol such as OSPF, EIGRP, RIP or BGP (Chapters 21 and 22).

19.2.1 Connected and local routes

When you configure ip address 10.1.1.1 255.255.255.0 on G0/0 and the interface comes up, IOS adds two routes:

A connected route (code C ) for the whole subnet, 10.1.1.0/24 . It tells the router that any destination in that subnet is on the wire attached to G0/0, so it should ARP directly for the destination host.

A local route (code L ) for the interface's own address as a host route, 10.1.1.1/32 . It tells the router that packets addressed to that exact IP are for the router itself (for example, a ping, an SSH session or an OSPF packet) and must be processed locally rather than forwarded.

Local routes were introduced in IOS 15. Both route types disappear immediately if the interface goes down (for example, the cable is unplugged or you type shutdown ), which is why a router can instantly stop using a failed link. Connected routes have an administrative distance of 0, the most trusted value possible.

You can list just these routes with show ip route connected and show ip route local . An interface that is administratively down, or up/down because of a Layer 1 or 2 problem, contributes no routes, so if a connected subnet is missing, check show ip interface brief first.

19.2.2 The sample network

The rest of this chapter uses the network in Figure 19-2. R1 is a branch router with a user LAN, two links into the company core (R2 and R3, which also connect to each other), and an Internet link to an ISP. R1, R2 and R3 run OSPF with default costs (cost 1 on every Gigabit interface). The administrator has also configured a static default route towards the ISP and a static route for a partner network, 172.16.0.0/16, reachable through R3.

Isp

  • R1
  • R2
  • R3

Lan

Figure 19-2 The sample network used in this chapter.

19.3 Reading the Routing Table

The command you will use more than any other in Part III is show ip route . Figure 19-3 shows R1's complete routing table. Take a minute to scan it before we walk through each part.

R1 — console

R1# show ip route

Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area * - candidate default, U - per-user static route (legend trimmed)

  • Gateway of last resort is 203.0.113.1 to network 0.0.0.0
  • S* 0.0.0.0/0 [1/0] via 203.0.113.1
  • 10.0.0.0/8 is variably subnetted, 9 subnets, 3 masks
  • C 10.0.12.0/30 is directly connected, GigabitEthernet0/1
  • L 10.0.12.1/32 is directly connected, GigabitEthernet0/1
  • C 10.0.13.0/30 is directly connected, GigabitEthernet0/2
  • L 10.0.13.1/32 is directly connected, GigabitEthernet0/2

O 10.0.23.0/30 [110/2] via 10.0.13.2, 00:14:22, GigabitEthernet0/2 [110/2] via 10.0.12.2, 00:14:22, GigabitEthernet0/1

C 10.1.1.0/24 is directly connected, GigabitEthernet0/0

L 10.1.1.1/32 is directly connected, GigabitEthernet0/0

O 10.2.2.0/24 [110/2] via 10.0.12.2, 00:14:22, GigabitEthernet0/1 O 10.3.3.0/24 [110/2] via 10.0.13.2, 00:14:22, GigabitEthernet0/2 S 172.16.0.0/16 [1/0] via 10.0.13.2

  • 203.0.113.0/24 is variably subnetted, 2 subnets, 2 masks
  • C 203.0.113.0/30 is directly connected, GigabitEthernet0/3
  • L 203.0.113.2/32 is directly connected, GigabitEthernet0/3

Figure 19-3 The full IPv4 routing table on R1, with connected, local, static, OSPF and default routes.

The output has three parts. The codes legend at the top explains the one- or two-letter code at the start of each route. The gateway of last resort line tells you whether a default route exists. Below that come the routes, sorted numerically and grouped under their classful network (the indented heading lines such as 10.0.0.0/8 is variably subnetted, 9 subnets, 3 masks are only headings; they are not routes and cannot be used to forward packets).

19.3.1 Anatomy of a route entry

Figure 19-4 dissects one OSPF route from Figure 19-3. Every learned route (static or dynamic)

contains these same fields; connected and local routes show only the prefix and the interface. O 10.2.2.0/24 [110/2] via 10.0.12.2, 00:14:22, GigabitEthernet0/1 Route source

Figure 19-4 The parts of a single route entry in show ip route .

Mapping the figure to the exam blueprint: the routing protocol code (3.1.a) says how the route was learned (C, L, S, O, IA, D, R, B, with * marking a candidate default); the prefix (3.1.b) and network mask (3.1.c) together define the range of destinations covered; the next hop (3.1.d) is the neighbouring router to send to (connected routes have none); in the brackets, the first number is the administrative distance (3.1.e) and the second the metric (3.1.f), which is 0 for static routes. The gateway of last resort (3.1.g) is covered next. A note on masks: if every subnet of a classful network uses the same mask, the heading line shows it once ( 172.20.0.0/24 is subnetted, 3 subnets ) and the route lines omit it. If masks differ, the heading reads is variably subnetted and each route carries its own prefix length.

19.3.2 The gateway of last resort

A default route is a route to 0.0.0.0/0 . A /0 prefix has zero bits to match, so it matches every possible destination, but it is also the least specific route possible. That combination makes it the perfect "catch-all": it is used only when nothing better exists. When a default route is installed, IOS marks it with * (candidate default) and prints Gateway of last resort is <next

hop> to network 0.0.0.0 . When no default route exists you see Gateway of last resort is not

set , and packets to unknown destinations are dropped.

Expect a routing table exhibit with a question such as "Which next hop will R1 use for a packet to 10.2.2.77?" or "What is the administrative distance of the route to 10.3.3.0?". Remember: in [110/2] the first number is AD and the second is metric. And remember that the gateway of last resort is just the next hop of the 0.0.0.0/0 route.

19.4 How the Router Chooses: Three Rules

A routing table often contains several routes that could apply to a single packet. The exam objective 3.2 asks you to know how the router decides by default. There are three tools, and the key to understanding them is to recognise when each is applied:

Table 19-1 The three route-selection tools and when each applies Tool Compares Applied when

Lower or higher

wins?

offered by different sources (e.g.

In practice this means the order of thinking is: metric picks the best path within each protocol; AD picks between protocols for the same prefix; and finally, when a packet arrives, the longest prefix match picks between all the different prefixes in the table. The longest match always wins, even if it comes from a source with a worse AD. A /24 learned by RIP (AD

  • 120) beats a /16 learned by OSPF (AD 110) for a destination inside that /24, because those two routes are for different prefixes and both are installed.

19.5 Longest Prefix Match

The routing table is not searched top to bottom for the "first" match. Instead the router considers every route whose prefix contains the destination address and chooses the one with the longest prefix length (the largest number after the slash). A longer prefix describes a smaller, more specific set of addresses, so it is assumed to be a more precise instruction. 0.0.0.0/0 (every address)

Figure 19-5 Nested prefixes. Each dot is forwarded using the innermost box that contains it.

Figure 19-5 draws five routes as nested address ranges. 10.1.1.200 sits inside all five boxes,

so all five routes match, and the /25 wins. 10.1.1.50 is inside the /24 but not the /25 (the /25 starts at .128), so the /24 wins. 10.1.7.7 matches only the /16, /8 and /0, so the /16 wins. 10.99.0.1 matches the /8, and 8.8.8.8 falls through to the default route.

19.5.1 A method for working LPM problems

On the exam, use a repeatable method: (1) work out the address range each route covers, from subnet ID to broadcast address (the Chapter 7 skill); (2) cross out every route whose range does not contain the destination; (3) of those left, choose the largest prefix length; (4) if none is left, use the default route, or drop the packet if there is none. The trap is always in step 1. A route such as 172.16.32.0/19 covers 172.16.32.0 to 172.16.63.255, so 172.16.60.5 matches it even though the third octets look different. Converting the interesting octet to binary removes all doubt, as Figure 19-6 shows.

Destination 172.16. 001 11100.5 = 172.16.60.5

Route A /19 172.16. 001 00000.0 172.16.32.0/19: first 19 bits equal MATCH Route B /20 172.16. 0011 0000.0 172.16.48.0/20: first 20 bits equal MATCH Route C /21 172.16. 0011 0000.0 172.16.48.0/21: bit 21 differs NO Matching routes: A (/19) and B (/20). Longest match: Route B, 172.16.48.0/20

Figure 19-6 Comparing the third octet in binary (60 = 00111100). Only the bits covered by each prefix length must be equal.

19.5.2 Worked example

Router R5 has the following routing table (codes and timers trimmed). Use it for the worked example and the practice problems that follow.

R5 — console

R5# show ip route

...

  • Gateway of last resort is 198.51.100.1 to network 0.0.0.0
  • S* 0.0.0.0/0 [1/0] via 198.51.100.1
  • 10.0.0.0/8 is variably subnetted, 5 subnets, 5 masks

O 10.0.0.0/8 [110/50] via 192.168.1.2, 01:02:11, GigabitEthernet0/1 O 10.10.0.0/16 [110/20] via 192.168.1.6, 01:02:11, GigabitEthernet0/2 D 10.10.4.0/22 [90/3072] via 192.168.1.10, 00:40:05, GigabitEthernet0/3 S 10.10.5.0/24 [1/0] via 192.168.1.14

O 10.10.5.64/26 [110/30] via 192.168.1.2, 01:02:11, GigabitEthernet0/1 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

O 172.16.32.0/19 [110/40] via 192.168.1.6, 01:02:11, GigabitEthernet0/2 R 172.16.48.0/20 [120/2] via 192.168.1.10, 00:00:17, GigabitEthernet0/3 ...

Figure 19-7 R5's routing table with overlapping prefixes, used for longest-prefix-match practice.

Question: A packet arrives for 10.10.5.100. Which next hop does R5 use?

Solution: List the ranges. 10.0.0.0/8 covers 10.0.0.0–10.255.255.255 (match). 10.10.0.0/16 covers 10.10.0.0–10.10.255.255 (match). 10.10.4.0/22 covers 10.10.4.0–10.10.7.255 (match). 10.10.5.0/24 covers 10.10.5.0–10.10.5.255 (match). 10.10.5.64/26 covers 10.10.5.64– 10.10.5.127 (match, because 100 is between 64 and 127). The default route also matches. The longest is /26, so R5 forwards to 192.168.1.2 out G0/1. Notice that the /26 is an OSPF route with AD 110 while the /24 is a static route with AD 1: AD is irrelevant here because the prefixes are different.

19.5.3 Practice problems

Using Figure 19-7, decide the next hop for each destination. Answers follow; cover them up first.

  • 1. 10.10.5.200
  • 2. 10.10.6.1
  • 3. 10.10.8.1
  • 4. 10.20.1.1
  • 5. 172.16.60.5
  • 6. 172.16.40.1
  • 7. 172.16.64.1
  • 8. 10.10.5.63

Answers. (1) 10.10.5.200 is outside the /26 (64–127) but inside 10.10.5.0/24, so the static route to 192.168.1.14 wins. (2) 10.10.6.1 is in 10.10.4.0/22 (4–7 in the third octet) but not in 10.10.5.0/24, so EIGRP to 192.168.1.10. (3) 10.10.8.1 is outside the /22, so 10.10.0.0/16 via 192.168.1.6. (4) 10.20.1.1 matches only 10.0.0.0/8 and the default, so 192.168.1.2. (5) 172.16.60.5 matches both the /19 and the /20 (Figure 19-6); the /20 RIP route wins, so 192.168.1.10, even though RIP's AD of 120 is worse than OSPF's 110. (6) 172.16.40.1 is in the /19 (32–63) but not the /20 (48–63), so OSPF via 192.168.1.6. (7) 172.16.64.1 is outside both 172.16 routes, so the default route via 198.51.100.1. (8) 10.10.5.63 is one address short of the /26, so the /24 static route via 192.168.1.14.

Tip

On a real router you can let IOS do the work: show ip route 10.10.5.100 (with a host address, not a prefix) displays the single route that the router would use for that destination, including the longest match. This is the fastest way to confirm your reasoning in a lab.

19.6 Administrative Distance

Different routing sources measure distance in incompatible ways: OSPF uses cost derived from bandwidth, RIP counts hops and EIGRP uses a composite of bandwidth and delay. An OSPF cost of 20 and a RIP hop count of 2 cannot be compared meaningfully. So when two sources offer a route to exactly the same prefix and prefix length, IOS uses administrative distance (AD), a number from 0 to 255 that ranks how much the router trusts each source. The route with the lowest AD is installed; the other is kept in reserve by its own protocol and is installed only if the preferred route disappears.

Table 19-2 Default administrative distances (memorise these)

  • Route source AD Route source AD
  • Connected interface 0 OSPF 110
  • Static route 1 IS-IS 115
  • EIGRP summary route 5 RIP (v1 and v2) 120
  • External BGP (eBGP) 20 External EIGRP 170
  • Internal EIGRP 90 Internal BGP (iBGP) 200
  • IGRP (legacy) 100 Unknown / unusable (never installed) 255

A static route configured with an exit interface only (no next-hop IP) is also shown with AD 1 in modern IOS. You can override the AD of a static route by adding a number to the end of the ip route command. Setting it higher than the dynamic protocol's AD creates a floating static route, a backup that only appears in the table when the dynamic route is lost; Chapter 20 configures one.

Exam alert

A classic exam question shows a router learning 10.5.0.0/16 from OSPF, EIGRP and RIP and asks which one appears in the routing table. The answer is EIGRP (AD 90). But if the question offers 10.5.0.0/16 from EIGRP and 10.5.1.0/24 from RIP, both are installed, and a packet to 10.5.1.1 uses the RIP /24. Always check whether the prefixes are identical before you reach for AD.

19.7 Metrics and Equal-Cost Multipath

A routing protocol may learn several paths to the same prefix. It uses its metric to pick the best one, and only the best path(s) are offered to the routing table. Each protocol has its own metric: RIP counts hops (16 = unreachable), OSPF sums interface costs derived from bandwidth, and EIGRP combines the slowest bandwidth and cumulative delay.

When two or more paths have exactly the same best metric, the protocol installs all of them, up to a limit (4 by default for OSPF and EIGRP on most IOS platforms, configurable with maximum-paths ). This is equal-cost multipath (ECMP) load balancing. In Figure 19-2, R1 can reach 10.0.23.0/30 through R2 (cost 1 + 1) or through R3 (cost 1 + 1), so both appear:

R1 — console

R1# show ip route 10.0.23.0

Routing entry for 10.0.23.0/30

Known via "ospf 1", distance 110, metric 2, type intra area

Last update from 10.0.12.2 on GigabitEthernet0/1, 00:14:22 ago Routing Descriptor Blocks:

* 10.0.13.2, from 3.3.3.3, 00:14:22 ago, via GigabitEthernet0/2 Route metric is 2, traffic share count is 1

10.0.12.2, from 2.2.2.2, 00:14:22 ago, via GigabitEthernet0/1

Route metric is 2, traffic share count is 1

Figure 19-8 Two equal-cost OSPF paths installed for the same prefix. Traffic share count 1 for both means a 1:1 split.

With CEF, the default load-sharing method is per-destination (actually per source/destination pair): a hash of the source and destination IP addresses chooses the path, so all packets of one conversation follow the same path and arrive in order, while different conversations spread across both links. Per-packet load sharing is possible but rarely used because it causes packet reordering.

19.8 Static and Dynamic Routing

Static routes cost no CPU or bandwidth and are completely predictable, but they must be typed on every router and do not react to failures (unless their exit interface goes down or a floating backup exists). They suit stub networks, default routes to an ISP and backup paths. Dynamic routing protocols learn routes automatically and reconverge around failures, at the price of CPU, memory, update traffic and the need for authentication. Most networks combine both.

19.8.1 IGP and EGP

Routing protocols are divided by where they run. An autonomous system (AS) is a network under a single administrative control, such as a company or an ISP. An Interior Gateway Protocol (IGP) routes inside one AS; OSPF, EIGRP, RIP and IS-IS are IGPs. An Exterior Gateway Protocol (EGP) routes between autonomous systems; the only EGP used today is BGP version 4, the routing protocol of the Internet. BGP focuses on policy control and enormous scale rather than fastest-path convergence.

19.8.2 Distance vector and link state

Distance vector protocols (RIP, and historically IGRP) work by "routing by rumour". Each router periodically sends its neighbours a list of the networks it knows and its distance to each. A neighbour adds its own distance and passes the list on. No router ever sees the whole topology; each knows only a direction (vector) and a distance for each destination. They are simple but converge slowly and need loop-prevention features such as split horizon and route poisoning.

Link state protocols (OSPF and IS-IS) work differently. Each router describes its own links in a link-state advertisement and floods it to every router in the area. Every router therefore builds an identical map of the network, the link-state database, and runs the Shortest Path First (Dijkstra) algorithm on it to compute its own best paths. Link state protocols converge quickly and scale well, at the cost of more memory and CPU. Chapter 21 explores this in depth.

EIGRP is officially an advanced distance vector protocol (sometimes called a hybrid): it sends distance-vector-style updates, but only when something changes, and it uses the DUAL algorithm to keep loop-free backup paths.

  • Distance vector Link state
  • RA RB
  • "I reach 10.9.0.0
  • in 2 hops"

RA learns: 10.9.0.0 is 3 hops, via RB.

RA never sees the topology beyond RB.

Figure 19-9 Distance vector routers share conclusions; link-state routers share raw topology and compute their own conclusions.

Table 19-3 Routing protocol classification summary

  • Protocol IGP / EGP Type Metric AD
  • RIPv2 IGP Distance vector Hop count 120
  • EIGRP IGP Advanced distance vector Bandwidth + delay 90 / 170
  • OSPF IGP Link state Cost 110
  • IS-IS IGP Link state Cost (default 10 per link) 115
  • BGP EGP Path vector Path attributes 20 / 200

19.9 The Router's ARP Process

Once the router has chosen a route, it still needs a destination MAC address for the outgoing frame. Which IP address it ARPs for depends on the type of route:

Remote route with a next hop (for example O 10.2.2.0/24 via 10.0.12.2 ): the router ARPs for the next-hop IP, 10.0.12.2, never for the final destination. The final destination is not on any of the router's links, so it could never answer.

Connected route (for example C 10.1.1.0/24 ): the destination is on the attached link, so the router ARPs for the destination IP itself (for example 10.1.1.10).

If the ARP cache already has an entry, the frame is built immediately. If not, the router sends an ARP request and, on Cisco IOS, typically drops the packet that triggered it while waiting for the reply. This is why the first ping to a new destination through a router often shows a period ( .!!!! ): the first echo request was lost while ARP resolved.

R1 — console

R1# show ip arp
  • Protocol Address Age (min) Hardware Addr Type Interface
  • Internet 10.0.12.1 - 0011.2233.0002 ARPA GigabitEthernet0/1
  • Internet 10.0.12.2 12 0022.3344.0001 ARPA GigabitEthernet0/1
  • Internet 10.0.13.1 - 0011.2233.0003 ARPA GigabitEthernet0/2
  • Internet 10.0.13.2 12 0033.4455.0001 ARPA GigabitEthernet0/2
  • Internet 10.1.1.1 - 0011.2233.0001 ARPA GigabitEthernet0/0
  • Internet 10.1.1.10 3 0050.56aa.0001 ARPA GigabitEthernet0/0

Internet 203.0.113.1 45 00a0.c9ee.1001 ARPA GigabitEthernet0/3 Internet 203.0.113.2 - 0011.2233.0004 ARPA GigabitEthernet0/3

R1# show ip cef 10.2.2.50

10.2.2.0/24

nexthop 10.0.12.2 GigabitEthernet0/1

Figure 19-10 R1's ARP cache holds next-hop MACs (10.0.12.2) and local host MACs (10.1.1.10), but never the MAC of a

remote host such as 10.2.2.50. Entries with age "-" are R1's own interfaces. When a host sends to a remote destination, the frame it builds carries the default gateway's MAC and the remote host's IP. When a router forwards towards a remote network it ARPs for the next-hop address. Questions that ask "what is the destination MAC of the frame as it leaves R1?" are testing exactly this.

LAB Exploring the routing table

Goal: Build R1 from Figure 19-2, watch connected and local routes appear and disappear, and use the routing table to predict forwarding decisions. Any simulator (Packet Tracer, CML, GNS3) or real hardware will do. OSPF on R2 and R3 can be added later in Chapter 22; for now R1's interfaces and static routes are enough. Steps:

  • 1. Address the four interfaces and bring them up:
R1(config)# interface g0/0
R1(config-if)# ip address 10.1.1.1 255.255.255.0
R1(config-if)# no shutdown

! repeat for G0/1 10.0.12.1/30, G0/2 10.0.13.1/30, G0/3 203.0.113.2/30

  • 2. Run show ip route . Count the C and L entries: you should see four of each, and Gateway of last resort is not set .
  • 3. Add a default route and a partner route:
R1(config)# ip route 0.0.0.0 0.0.0.0 203.0.113.1
R1(config)# ip route 172.16.0.0 255.255.0.0 10.0.13.2
  • 4. Run show ip route again. Confirm the S* line, the [1/0] values and the new gateway of last resort.
  • 5. Shut down G0/2. Run show ip route and note that the connected and local routes for 10.0.13.0/30 vanish, and so does the static route to 172.16.0.0/16, because its next hop is no longer reachable. Bring G0/2 back up with no shutdown .
  • 6. Predict, then verify with show ip route <address> , the route used for 10.1.1.77, 172.16.200.1 and 8.8.8.8.

Verify: show ip route 8.8.8.8 should report Routing entry for 0.0.0.0 0.0.0.0, supernet ... candidate default path via 203.0.113.1.

Expected results: 10.1.1.77 uses the connected route on G0/0 (R1 will ARP for 10.1.1.77 directly); 172.16.200.1 uses the static /16 via 10.0.13.2; 8.8.8.8 matches only the default route and goes to the ISP at 203.0.113.1.

Key terms

routing table (RIB)

Fib / cef

Ecmp

autonomous system

Igp

Egp / bgp

  • distance vector
  • link state
  • Review questions
  • 1. In the routing entry O 10.2.2.0/24 [110/2] via 10.0.12.2, 00:14:22, GigabitEthernet0/1 , what does the value 2 represent?
  • A. Administrative distance
  • B. Hop count
  • C. OSPF cost metric
  • D. Number of equal-cost paths
  • 2. A router has routes to 10.0.0.0/8 (OSPF), 10.4.0.0/14 (static) and 10.4.4.0/24 (RIP). Which route is used for a packet to 10.4.4.9?
  • A. 10.0.0.0/8, because OSPF has a better metric
  • B. 10.4.0.0/14, because static routes have the lowest AD
  • C. 10.4.4.0/24, because it is the longest prefix match
  • D. The packet is load-balanced across all three
  • 3. A router learns 192.168.50.0/24 from EIGRP, OSPF and RIP. Which route is installed in the routing table?
  • A. RIP
  • B. OSPF
  • C. EIGRP
  • D. All three
  • 4. Which two routes are added automatically when an interface is configured with 172.16.5.1/24 and comes up? (Choose two.)
  • A. C 172.16.5.0/24
  • B. L 172.16.5.1/32
  • C. S 172.16.5.0/24
  • D. L 172.16.5.0/24
  • E. C 172.16.0.0/16
  • 5. What does Gateway of last resort is not set indicate?
  • A. The router has no connected interfaces
  • B. No default route is present in the routing table
  • C. The default route has AD 255
  • D. The router uses the first route in the table as a default
  • 6. A packet must be forwarded via the route S 10.8.0.0/16 [1/0] via 10.0.0.2 . For which IP address does the router send an ARP request?
  • A. The packet's destination IP
  • B. 10.0.0.2
  • C. 10.8.0.0
  • D. The packet's source IP
  • 7. What is the default administrative distance of an OSPF route?
  • A. 90
  • B. 100
  • C. 110
  • D. 120
  • 8. Which routes match destination 172.16.60.5? (Choose two.)
  • A. 172.16.32.0/19
  • B. 172.16.48.0/20
  • C. 172.16.56.0/22
  • D. 172.16.64.0/18
  • E. 172.16.0.0/19
  • 9. OSPF has two paths to 10.9.0.0/16 with cost 30 each. What happens by default?
  • A. Only the path with the lowest router ID is installed
  • B. Both paths are installed and traffic is shared
  • C. The router falls back to AD to break the tie
  • D. Neither is installed until the tie is resolved
  • 10. Which protocol is an EGP?
  • A. OSPF
  • B. EIGRP
  • C. IS-IS
  • D. BGP
  • 11. Which statements describe link-state routing protocols? (Choose two.)
  • A. Each router has a full map of the area's topology
  • B. Routers send their entire routing table to neighbours every 30 seconds
  • C. Each router runs the SPF algorithm
  • D. They use hop count as the metric
  • E. They are used between autonomous systems
  • 12. A packet's destination matches no route and the routing table has no default route. What does the router do?
  • A. Floods it out all interfaces
  • B. Sends it to the connected interface with the lowest IP
  • C. Drops it and typically sends ICMP Destination Unreachable to the source
  • D. Holds it until a route is learned

Answers

  • 1. C. In [110/2] the first value is AD and the second is the metric, which for OSPF is cost.
  • 2. C. All three match, and the longest prefix (/24) always wins regardless of AD or metric.
  • 3. C. Same prefix from different sources, so the lowest AD wins: EIGRP 90 beats OSPF 110 and RIP 120.
  • 4. A and B. A connected route for the subnet and a local /32 route for the interface address.
  • 5. B. The gateway of last resort is the next hop of a default route; "not set" means there is none.
  • 6. B. For a route with a next hop the router ARPs for the next-hop address, not the final destination.
  • 7. C. OSPF is 110. EIGRP internal is 90, IGRP 100 and RIP 120.
  • 8. A and B. 172.16.32.0/19 covers .32–.63 and 172.16.48.0/20 covers .48–.63 in the third octet. The /22 covers .56–.59, so 60 is outside; /18 starting at 64 and /19 at 0 do not include
  • 9. B. Equal-cost paths are all installed (up to maximum-paths , 4 by default), giving ECMP.
  • 10. D. BGP is the exterior gateway protocol; the others are IGPs.
  • 11. A and C. Link-state routers flood LSAs, build an identical LSDB and run SPF. Periodic full-table updates and hop count describe RIP.
  • 12. C. Routers never flood unroutable packets. They drop them and usually return ICMP Destination Unreachable.
Use ← → to move between sections