xkonekt
Language: EN
  • English
  • Türkçe
  • Español, Coming soon
  • Português, Coming soon
  • Deutsch, Coming soon
  • Français, Coming soon

IP routing · Introduction · Module 1

Routers and the routing table: where each packet goes next

Show topologyHide topology
R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24

Interfaces and addresses · Et0/0 = Ethernet0/0. R2, R3 and R4 each also hold one more network: 10.2.1.0/24, 198.51.100.0/24 and 10.2.3.0/24.

  • 10.1.1.0/24R1 Et0/0 10.1.1.1H1 eth0 10.1.1.10
  • 10.0.12.0/24R1 Et0/1 10.0.12.1R2 Et0/0 10.0.12.2
  • 10.0.14.0/24R1 Et0/2 10.0.14.1R4 Et0/0 10.0.14.4
  • 203.0.113.0/24R1 Et0/3 203.0.113.2R3 Et0/0 203.0.113.1
Topology · R1, the office router, joins four networks: H1’s office network and its links to R2 (HQ), R4 (the branch) and R3 (the provider).

Five device icons joined by four plain cables, in a cross with R1, the office router, at the center. Above it, R3, the provider router, holding 198.51.100.1/24, on a cable labeled 203.0.113.0/24. Left of it, R2, the HQ router, holding 10.2.1.2/24, on a cable labeled 10.0.12.0/24. Right of it, R4, the branch router, holding 10.2.3.4/24, on a cable labeled 10.0.14.0/24. Under it, H1, the office host, a laptop, on a cable labeled 10.1.1.0/24. The list under the drawing gives the interface and the address at each end of each cable.

What routing is

A router and its table

A router joins networks

H1 sends a packet to 10.2.3.4, an address in another network. How does the packet get there?

A host sends straight to an address in its own network, and to a router for any other address. 10.2.3.4 is not in H1’s network, 10.1.1.0/24, so H1 hands the packet to R1.

R1 is joined to four networks. It has one interface, with one address, in each network it joins. A device like this is a router, a device that joins two or more networks and passes each packet on toward the network it is for. The router in your home does the same between your home network and your provider’s.

One step of the trip, across one link to the next device, is a hop. Each router chooses only the next device and sends the packet one hop closer. The next router then chooses again.

R1 does not plan the whole path. For HQ’s network it keeps only the next router, R2 at 10.0.12.2.

H1’s packet goes from H1 to R1, then from R1 to R4, the branch router, which holds 10.2.3.0/24 (Figure 1.1). R4 answers H1 from 10.2.3.4.

R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24first hopsecond hop
Figure 1.1 · R1 joins four networks. H1’s packet for 10.2.3.4 crosses R1 and reaches R4’s network.

The network: R1 at the center of a cross, R3 above it, R2 left of it, R4 right of it and H1 under it. Each of the four cables is labeled with its network. A short arrow beside the cable from H1 points up toward R1, marked “first hop”, and a second short arrow beside the cable from R1 points right toward R4, marked “second hop”. R4 holds 10.2.3.4/24.

203.0.113.0/24 and 198.51.100.0/24 are set aside for documentation, and here they stand in for public addresses on the internet. The first is R1’s link to R3, the second the network R3 holds on the internet side.

H1 sends a packet to 10.2.3.4. How many hops does it take?

The routing table and its routes

R1 has four ways out. How does it know which one a packet should take?

From a list it keeps. A routing table is the list a router checks to choose where each packet goes. For each network the router knows, the table says where its packets go.

Each entry of the list is a route, one network and the way to send packets for it. The network of a route is its prefix, written as a network address and a prefix length, such as 10.2.1.0/24.

How does a network get into the table? On R1, in one of two ways. Either R1 has an interface in that network, or an administrator typed the route in, which makes it a static route. R1 knows only the networks in its table.

You might expect a router to know the whole internet. R1’s table holds its four own networks and two typed-in routes, one to HQ and one to the branch, and no route for all other addresses.

Take R1’s static route to HQ’s network (Figure 1.2).

Show R1 got it10.2.1.0/24the network: the prefixvia 10.0.12.2next hop: R2Ethernet0/1interface: out of R1
Figure 1.2 · The static route names a network, the next router its packets go to, and the interface they leave by.

Four cards in two rows. Top row: “S”, how R1 got the route (static); then “10.2.1.0/24”, the network it is for. Bottom row, highlighted: “via 10.0.12.2”, the next hop, R2; then “Ethernet0/1”, the interface out of R1.

The S in front, the route’s code, says how R1 got it, as a static route. The next hop is the address R1 sends the packet to next, here 10.0.12.2 on R2, and Ethernet0/1 is the interface the packets leave by.

Key idea

A routing table lists the networks a router knows; each route gives the prefix, the interface out and, for a network beyond the router, the next hop.

Which of these is NOT part of a route?

How it works

Routes appear, routes are followed

Connected and local routes

Before any route is typed in, R1’s table already holds lines. Where do they come from?

They come from R1’s own interfaces. A connected route, code C, is the route to a network that one of R1’s interfaces is in. On R1, a connected route appears when an interface comes up with an address and goes when the interface is turned off.

R1’s interface Ethernet0/3 has the address 203.0.113.2/24. When it comes up, R1 adds a C line for 203.0.113.0/24 and a second line, code L, with /32: exactly one address. Which address does that L line hold?

That second line is a local route, code L. It holds R1’s own address on that interface with /32, one address, so a packet sent to it is for R1 itself.

“Local” here means R1’s own address, not the local network; the network is on the C line.

Both lines name Ethernet0/3 (Figure 1.3).

R3provider routerhas 198.51.100.1/24R1office router203.0.113.0/24Et0/3.2R1’s routing tableC 203.0.113.0/24the whole networkL 203.0.113.2/32R1’s own addressboth: out of Ethernet0/3
Figure 1.3 · One interface, two lines: C for the whole network 203.0.113.0/24, L for R1’s own address in it.

R3, the provider router, at the top, and R1 under it, joined by one cable labeled 203.0.113.0/24. At R1’s end of the cable: “Et0/3” on one side and R1’s short address “.2” on the other. Under R1, a panel titled “R1’s routing table” holds two lines: “C 203.0.113.0/24”, noted “the whole network”, and, highlighted, “L 203.0.113.2/32”, noted “R1’s own address”. Under them, a note says that both lines lead out of Ethernet0/3.

You can watch the two lines appear. show ip route connected lists the C and L lines, and R1 runs it first while Ethernet0/3 is still turned off.

On R1, with Ethernet0/3 turned off:

Three networks, each with a C and an L line; nothing for 203.0.113.0/24.

Output · IOS XE 17.18.2
R1#show ip route connected… 15 more lines (see Full output)1      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masksC        10.0.12.0/24 is directly connected, Ethernet0/1L        10.0.12.1/32 is directly connected, Ethernet0/1C        10.0.14.0/24 is directly connected, Ethernet0/2L        10.0.14.1/32 is directly connected, Ethernet0/22C        10.1.1.0/24 is directly connected, Ethernet0/02L        10.1.1.1/32 is directly connected, Ethernet0/0
  1. A heading that groups the lines under it. It has no code letter, so it is not a route. Its count, 8 subnets, includes the two S routes, which this command leaves out.
  2. A C line and its L line: H1’s network 10.1.1.0/24 and R1’s own address in it, 10.1.1.1/32.
Full output · 22 lines
R1#show ip route connectedCodes: L - local, 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, m - OMP       n - NAT, Ni - NAT inside, No - NAT outside, Nd - NAT DIA       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2       ia - IS-IS inter area, * - candidate default, U - per-user static route       H - NHRP, G - NHRP registered, g - NHRP registration summary       o - ODR, P - periodic downloaded static route, l - LISP       a - application route       + - replicated route, % - next hop override, p - overrides from PfR       & - replicated local route overrides by connected Gateway of last resort is not set       10.0.0.0/8 is variably subnetted, 8 subnets, 2 masksC        10.0.12.0/24 is directly connected, Ethernet0/1L        10.0.12.1/32 is directly connected, Ethernet0/1C        10.0.14.0/24 is directly connected, Ethernet0/2L        10.0.14.1/32 is directly connected, Ethernet0/2C        10.1.1.0/24 is directly connected, Ethernet0/0L        10.1.1.1/32 is directly connected, Ethernet0/0

The C and L lines on R1 again, with Ethernet0/3 up:

Both lines for 203.0.113.0/24 appeared when Ethernet0/3 came up, so R1 now has four networks.

Output · IOS XE 17.18.2
R1#show ip route connected… 15 more lines (see Full output)      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masksC        10.0.12.0/24 is directly connected, Ethernet0/1L        10.0.12.1/32 is directly connected, Ethernet0/1C        10.0.14.0/24 is directly connected, Ethernet0/2L        10.0.14.1/32 is directly connected, Ethernet0/2C        10.1.1.0/24 is directly connected, Ethernet0/0L        10.1.1.1/32 is directly connected, Ethernet0/0      203.0.113.0/24 is variably subnetted, 2 subnets, 2 masks1C        203.0.113.0/24 is directly connected, Ethernet0/32L        203.0.113.2/32 is directly connected, Ethernet0/3
  1. C: the whole network 203.0.113.0/24, out of Ethernet0/3.
  2. L: R1’s own address, 203.0.113.2/32.
Full output · 25 lines
R1#show ip route connectedCodes: L - local, 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, m - OMP       n - NAT, Ni - NAT inside, No - NAT outside, Nd - NAT DIA       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2       ia - IS-IS inter area, * - candidate default, U - per-user static route       H - NHRP, G - NHRP registered, g - NHRP registration summary       o - ODR, P - periodic downloaded static route, l - LISP       a - application route       + - replicated route, % - next hop override, p - overrides from PfR       & - replicated local route overrides by connected Gateway of last resort is not set       10.0.0.0/8 is variably subnetted, 8 subnets, 2 masksC        10.0.12.0/24 is directly connected, Ethernet0/1L        10.0.12.1/32 is directly connected, Ethernet0/1C        10.0.14.0/24 is directly connected, Ethernet0/2L        10.0.14.1/32 is directly connected, Ethernet0/2C        10.1.1.0/24 is directly connected, Ethernet0/0L        10.1.1.1/32 is directly connected, Ethernet0/0      203.0.113.0/24 is variably subnetted, 2 subnets, 2 masksC        203.0.113.0/24 is directly connected, Ethernet0/3L        203.0.113.2/32 is directly connected, Ethernet0/3

Key idea

Bring an interface of R1 up with an address and R1 adds two routes: C for the network, L for its own address. Turn the interface off and both lines go.

Following a route

R1 has a packet for 10.2.1.2, which is in none of its own networks. Which way does it send the packet?

It looks for a route that matches the destination. A route matches when the destination’s first bits, as many as the prefix length, equal the route’s prefix. For a /24 prefix, that is the first three numbers of the address.

The matching route then gives a next hop and an interface. A connected route, for a network R1 is in, names no next-hop address: R1 sends the packet straight to the destination, so the destination itself is the next hop.

The outgoing interface is the interface R1 sends the packet out of. It is the way out, not the way the packet came in.

How can you see the choice? With debug ip packet on, R1 prints lines about each packet that starts or ends at R1. R1 sent one test packet to 10.2.1.2 and one to H1, and looked up each in its table (Figure 1.4).

Step 1 of 6

to 10.2.1.2R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24

R1 starts with a test packet of its own for 10.2.1.2.

Step 2 of 6

to 10.2.1.2checks each routeR3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24

R1 compares 10.2.1.2 with the prefix of each route in its table, ten routes.

Which line of R1’s table matches 10.2.1.2?

  • C 10.0.12.0/24 is directly connected, Ethernet0/1: This is the network of R1’s link to R2. Its first three numbers, 10.0.12, differ from the destination’s 10.2.1.
  • L 10.0.12.1/32 is directly connected, Ethernet0/1: A /32 covers a single address, and this one is R1’s own, 10.0.12.1, not 10.2.1.2.
  • 10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks: Without a code letter or a next hop, this line is a heading that groups the routes under it. R1 sends nothing by it.
  • S 10.2.1.0/24 [1/0] via 10.0.12.2, Ethernet0/1 (Correct): Its 24 network bits fix the first three numbers at 10.2.1, and 10.2.1.2 starts with exactly those numbers.

Step 3 of 6

to 10.2.1.2S 10.2.1.0/24R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24

Of the ten, only the static route for 10.2.1.0/24 matches: its 24 network bits equal the first 24 bits of 10.2.1.2.

Step 4 of 6

to 10.2.1.2S 10.2.1.0/24via 10.0.12.2 · Et0/1R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24

The route gives next hop 10.0.12.2, R2, and interface Ethernet0/1, so R1 sends the packet one hop, to R2.

Step 5 of 6

to 10.2.1.2S 10.2.1.0/24via 10.0.12.2 · Et0/1R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24

R2 holds 10.2.1.2, so it answers. The reply comes back to R1 on Ethernet0/1.

Step 6 of 6

to 10.1.1.10C 10.1.1.0/24Et0/0 · next hop H1R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24

For H1, in R1’s own network 10.1.1.0/24, the matching route is connected. R1 sends straight out of Ethernet0/0, and the next hop is H1 itself.

Step 1 of 6

A strip at the top holds two chips: the destination, and the route R1 uses. Under it, the network: R1 at the center, R3 above it, R2 left, R4 right and H1 under it. Step 1: the destination chip reads “to 10.2.1.2”. Step 2: the route chip reads “checks each route”. Step 3: “S 10.2.1.0/24”. Step 4: “S 10.2.1.0/24, via 10.0.12.2 · Et0/1”, and a short arrow beside the cable to R2 points from R1 to R2. Step 5: the arrow there points back from R2 to R1. Step 6: the chips read “to 10.1.1.10” and “C 10.1.1.0/24, Et0/0 · next hop H1”, and a short arrow beside the cable to H1 points down from R1 to H1.

Figure 1.4 · R1 finds the route whose prefix matches the destination and sends the packet out of its interface to its next hop.R1 starts with a test packet of its own for 10.2.1.2.R1 compares 10.2.1.2 with the prefix of each route in its table, ten routes.Of the ten, only the static route for 10.2.1.0/24 matches: its 24 network bits equal the first 24 bits of 10.2.1.2.Debug line at this stepIP: tableid=0, s=10.0.12.1 (local), d=10.2.1.2 (Ethernet0/1) nexthop=10.0.12.2, routed via FIBThe route gives next hop 10.0.12.2, R2, and interface Ethernet0/1, so R1 sends the packet one hop, to R2.Debug line at this stepIP: s=10.2.1.2 (Ethernet0/1), d=10.0.12.1 (nil), len 100, rcvd 2R2 holds 10.2.1.2, so it answers. The reply comes back to R1 on Ethernet0/1.Debug line at this stepIP: tableid=0, s=10.1.1.1 (local), d=10.1.1.10 (Ethernet0/0) nexthop=10.1.1.10, routed via FIBFor H1, in R1’s own network 10.1.1.0/24, the matching route is connected. R1 sends straight out of Ethernet0/0, and the next hop is H1 itself.

On R1, the lines debug ip packet printed for the two test packets:

A sent packet’s first line has the destination after d=, the interface in the parentheses after it and the next hop after nexthop=.

Lines appear as you step through.

Output · IOS XE 17.18.2
R1#show logging | include IP:4IP: tableid=0, s=10.0.12.1 (local), d=10.2.1.2 (Ethernet0/1) nexthop=10.0.12.2, routed via FIB… 3 more lines (see Full output)5IP: s=10.2.1.2 (Ethernet0/1), d=10.0.12.1 (nil), len 100, rcvd 2… 2 more lines (see Full output)6IP: tableid=0, s=10.1.1.1 (local), d=10.1.1.10 (Ethernet0/0) nexthop=10.1.1.10, routed via FIB… 6 more lines (see Full output)
Full output · 14 lines
R1#show logging | include IP:IP: tableid=0, s=10.0.12.1 (local), d=10.2.1.2 (Ethernet0/1) nexthop=10.0.12.2, routed via FIBIP: s=10.0.12.1 (local), d=10.2.1.2 (Ethernet0/1), len 100, sendingIP: s=10.0.12.1 (local), d=10.2.1.2 (Ethernet0/1), len 100, sending full packetIP: s=10.2.1.2 (Ethernet0/1), d=10.0.12.1 (nil), len 100, input feature, MCI Check(110), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSEIP: s=10.2.1.2 (Ethernet0/1), d=10.0.12.1 (nil), len 100, rcvd 2IP: s=10.2.1.2 (Ethernet0/1), d=10.0.12.1 (nil), len 100, stop process pak for forus packetIP: tableid=0, s=10.2.1.2 (Ethernet0/1), d=10.0.12.1 (Ethernet0/1) nexthop=10.0.12.1, routed via RIBIP: tableid=0, s=10.1.1.1 (local), d=10.1.1.10 (Ethernet0/0) nexthop=10.1.1.10, routed via FIBIP: s=10.1.1.1 (local), d=10.1.1.10 (Ethernet0/0), len 100, sendingIP: s=10.1.1.1 (local), d=10.1.1.10 (Ethernet0/0), len 100, sending full packetIP: s=10.1.1.10 (Ethernet0/0), d=10.1.1.1 (nil), len 100, input feature, MCI Check(110), rtype 0, forus FALSE, sendself FALSE, mtu 0, fwdchk FALSEIP: s=10.1.1.10 (Ethernet0/0), d=10.1.1.1 (nil), len 100, rcvd 2IP: s=10.1.1.10 (Ethernet0/0), d=10.1.1.1 (nil), len 100, stop process pak for forus packetIP: tableid=0, s=10.1.1.10 (Ethernet0/0), d=10.1.1.1 (Ethernet0/0) nexthop=10.1.1.1, routed via RIB

Impact A debug adds work for the router. Keep it on for a few seconds only, then turn it off again.

In the debug output, the packet for 10.2.1.2 left through Ethernet0/1 to next hop 10.0.12.2, but the packet for 10.1.1.10 had H1 itself as its next hop. Why the difference?

H1 is in one of R1’s own networks, so R1 sent straight to it. 10.2.1.2 is not, so R1 sent its packet to the next-hop address, 10.0.12.2.

Key idea

R1 finds the route whose prefix matches the destination and sends the packet out of that route’s interface to its next hop, which is the destination itself only for a network R1 is in.

The matching route is given; read where it sends the packet.

R1 has a packet for 10.2.3.4. The matching route is S 10.2.3.0/24 [1/0] via 10.0.14.4, Ethernet0/2. Where does R1 send the packet?

Here each test packet matched exactly one route. When two routes match the same address, as R1’s own address matches both its C and its L line, the one with the longer prefix wins.

Verify

Read R1’s routing table

R1 prints its whole table with one command. What does each route line in it show?

show ip route prints a legend of the codes, then one line per route with its code and prefix, the next hop if the route has one, and the interface.

On R1, the whole table:

The legend, then the “Gateway of last resort” line, which says R1 has no route for all other addresses, then the routes.

Output · IOS XE 17.18.2
R1#show ip route1Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP… 12 more lines (see Full output)Gateway of last resort is not set       10.0.0.0/8 is variably subnetted, 8 subnets, 2 masksC        10.0.12.0/24 is directly connected, Ethernet0/1L        10.0.12.1/32 is directly connected, Ethernet0/1C        10.0.14.0/24 is directly connected, Ethernet0/2L        10.0.14.1/32 is directly connected, Ethernet0/2C        10.1.1.0/24 is directly connected, Ethernet0/0L        10.1.1.1/32 is directly connected, Ethernet0/0S        10.2.1.0/24 [1/0] via 10.0.12.2, Ethernet0/1S        10.2.3.0/24 [1/0] via 10.0.14.4, Ethernet0/2      203.0.113.0/24 is variably subnetted, 2 subnets, 2 masksC        203.0.113.0/24 is directly connected, Ethernet0/3L        203.0.113.2/32 is directly connected, Ethernet0/3
  1. L - local, C - connected, S - static: the three codes in R1’s table. Most of the other codes mark routes that a router learns in other ways.
Full output · 27 lines
R1#show ip routeCodes: L - local, 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, m - OMP       n - NAT, Ni - NAT inside, No - NAT outside, Nd - NAT DIA       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2       ia - IS-IS inter area, * - candidate default, U - per-user static route       H - NHRP, G - NHRP registered, g - NHRP registration summary       o - ODR, P - periodic downloaded static route, l - LISP       a - application route       + - replicated route, % - next hop override, p - overrides from PfR       & - replicated local route overrides by connected Gateway of last resort is not set       10.0.0.0/8 is variably subnetted, 8 subnets, 2 masksC        10.0.12.0/24 is directly connected, Ethernet0/1L        10.0.12.1/32 is directly connected, Ethernet0/1C        10.0.14.0/24 is directly connected, Ethernet0/2L        10.0.14.1/32 is directly connected, Ethernet0/2C        10.1.1.0/24 is directly connected, Ethernet0/0L        10.1.1.1/32 is directly connected, Ethernet0/0S        10.2.1.0/24 [1/0] via 10.0.12.2, Ethernet0/1S        10.2.3.0/24 [1/0] via 10.0.14.4, Ethernet0/2      203.0.113.0/24 is variably subnetted, 2 subnets, 2 masksC        203.0.113.0/24 is directly connected, Ethernet0/3L        203.0.113.2/32 is directly connected, Ethernet0/3

In R1’s table, each route line comes from a connected interface or a typed-in route (Figure 1.5).

R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office hostEt0/0C + LEt0/1C + L + SEt0/2C + L + SEt0/3C + L
Figure 1.5 · R1’s four interfaces give four C and four L lines; the routes to HQ and the branch give two S lines: ten routes.

The network, with two values beside each cable, one on each side of it: R1’s interface on that cable and the route lines it carries. They sit at R1’s end of the cables to H1, R2 and R4, and half-way along the cable to R3, above R1’s name. “Et0/0” and “C + L” on the cable to H1, “Et0/1” and “C + L + S” on the cable to R2, “Et0/2” and “C + L + S” on the cable to R4, and “Et0/3” and “C + L” on the cable to R3. The S on the cables to R2 and R4 stands for the static routes to the networks they hold.

| begin Gateway starts the list at the line that holds “Gateway”, so the legend is left out.

On R1, the routes only:

Tap a line, or “Not in the output”, then submit.

Find the line R1 uses for a packet to 10.2.3.4.

Output · IOS XE 17.18.2
R1#show ip route | begin Gateway

R1 has four networks of its own, each with a C and an L line, and two typed-in routes.

  1. A heading, not a route: no code, no next hop.
  2. A C and L pair: H1’s network on Ethernet0/0.
  3. S: HQ’s network, next hop 10.0.12.2, R2, out of Ethernet0/1.
  4. S: the branch network, next hop 10.0.14.4, R4, out of Ethernet0/2.

You can also ask R1 about one address. show ip route 10.2.3.4 prints the route R1 uses for it.

On R1, asking for one address:

R1 uses one route for this address, the branch route.

Output · IOS XE 17.18.2
R1#show ip route 10.2.3.41Routing entry for 10.2.3.0/24  Known via "static", distance 1, metric 0  Routing Descriptor Blocks:2  * 10.0.14.4, via Ethernet0/2      Route metric is 0, traffic share count is 1
  1. The route that matches: 10.2.3.0/24.
  2. The next hop, 10.0.14.4, and the interface, Ethernet0/2.

Key idea

In show ip route, each route line gives code, prefix, the next hop if any, and interface. Headings without a code only group the lines.

In R1’s routes, which line sends a packet for 10.1.1.10, and what is its next hop?

Troubleshoot

When a route stops working

The branch stops answering R1. Is its route gone, or is the route still there and not carrying packets?

R1 tests first with ping, which by default sends five test packets. Each ! is a reply, and each . a packet that got no reply in time.

Case 1 of 2.R1 gets no answer from the branch

  1. Case 1 · Symptom

    R1 tests the branch address 10.2.3.4 and gets no answer.

    Output · IOS XE 17.18.2
    R1#ping 10.2.3.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.2.3.4, timeout is 2 seconds:1.....2Success rate is 0 percent (0/5)
    1. Five dots, one for each test packet.
    2. Success rate is 0 percent: not one answer came back.
  2. Case 1 · Command

    Is there still a route for 10.2.3.4?

  3. Case 1 · Output

    On R1:

    Output · IOS XE 17.18.2
    R1#show ip route | begin GatewayGateway of last resort is not set 1      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masksC        10.0.12.0/24 is directly connected, Ethernet0/1L        10.0.12.1/32 is directly connected, Ethernet0/1C        10.1.1.0/24 is directly connected, Ethernet0/0L        10.1.1.1/32 is directly connected, Ethernet0/02S        10.2.1.0/24 [1/0] via 10.0.12.2, Ethernet0/1      203.0.113.0/24 is variably subnetted, 2 subnets, 2 masksC        203.0.113.0/24 is directly connected, Ethernet0/3L        203.0.113.2/32 is directly connected, Ethernet0/3
    1. Key line Only 5 subnets: no lines for 10.0.14.0/24 and none for 10.2.3.0/24.
    2. The HQ route is still there.
  4. Case 1 · How far it reaches

    R1 lists its interfaces and then tests HQ, to see what else is affected.

    On R1, its interfaces:

    Three interfaces are up; Ethernet0/2 is not.

    Output · IOS XE 17.18.2
    R1#show ip interface briefInterface Ethernet0/0IP-Address 10.1.1.1OK? YESMethod TFTPStatus upProtocol upInterface Ethernet0/1IP-Address 10.0.12.1OK? YESMethod TFTPStatus upProtocol up1Interface Ethernet0/2IP-Address 10.0.14.1OK? YESMethod TFTPStatus administratively downProtocol downInterface Ethernet0/3IP-Address 203.0.113.2OK? YESMethod TFTPStatus upProtocol up
    1. Ethernet0/2 is administratively down: turned off on R1.
    Full output · 5 lines
    R1#show ip interface briefInterface              IP-Address      OK? Method Status                ProtocolEthernet0/0            10.1.1.1        YES TFTP   up                    up      Ethernet0/1            10.0.12.1       YES TFTP   up                    up      Ethernet0/2            10.0.14.1       YES TFTP   administratively down down    Ethernet0/3            203.0.113.2     YES TFTP   up                    up      

    On R1, a test of HQ, 10.2.1.2:

    Output · IOS XE 17.18.2
    R1#ping 10.2.1.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.2.1.2, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
    1. Success rate is 100 percent: HQ answers.
  5. Case 1 · What it means

    R1office routerH1office hostR4branch routerhas 10.2.3.4/24Et0/2 off
    Figure 1.6 · Case 1 · R1’s Ethernet0/2 is off, so its routes to 10.0.14.0/24 and the branch are gone.

    R1 with R4 right of it and H1 under it. A cross sits just under the cable to R4 at R1’s end, with the note “Et0/2 off” above the cable there. The cable to H1 has no cross.

    • The lines through Ethernet0/2 are gone: its C and L lines, and the branch route through next hop 10.0.14.4 with them.
    • Without those lines R1 has no way to 10.2.3.4.
    • HQ still answers: the routes through other interfaces keep working.
  6. Case 1 · Fix

    Turn Ethernet0/2 on again.

    On R1, the lines that turn it on:

    Output · IOS XE 17.18.2
    R1#configure terminalEnter configuration commands, one per line.  End with CNTL/Z.1R1(config)#interface Ethernet0/22R1(config-if)#no shutdownR1(config-if)#end
    1. Picks Ethernet0/2.
    2. Turns it on.

    Impact Turning an interface on or off changes R1’s table at once.

  7. Case 1 · Proof

    R1 tests the branch again.

    Output · IOS XE 17.18.2
    R1#ping 10.2.3.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.2.3.4, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
    1. Success rate is 100 percent: the branch answers again.

End of case 1. Solved: Ethernet0/2 is up; its routes are back.

Case 2 of 2.R1 gets no answer from the branch, though nothing on R1 has changed

  1. Case 2 · Symptom

    R1 tests 10.2.3.4 and gets no answer, although nothing on R1 has changed.

    Output · IOS XE 17.18.2
    R1#ping 10.2.3.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.2.3.4, timeout is 2 seconds:1.....2Success rate is 0 percent (0/5)
    1. Five dots: no answers.
    2. Success rate is 0 percent: none of the five came back.
  2. Case 2 · Command

    Read R1’s route for the branch.

  3. Case 2 · Output

    On R1:

    Output · IOS XE 17.18.2
    R1#show ip route | begin GatewayGateway of last resort is not set       10.0.0.0/8 is variably subnetted, 8 subnets, 2 masksC        10.0.12.0/24 is directly connected, Ethernet0/1L        10.0.12.1/32 is directly connected, Ethernet0/11C        10.0.14.0/24 is directly connected, Ethernet0/21L        10.0.14.1/32 is directly connected, Ethernet0/2C        10.1.1.0/24 is directly connected, Ethernet0/0L        10.1.1.1/32 is directly connected, Ethernet0/0S        10.2.1.0/24 [1/0] via 10.0.12.2, Ethernet0/12S        10.2.3.0/24 [1/0] via 10.0.14.4, Ethernet0/2      203.0.113.0/24 is variably subnetted, 2 subnets, 2 masksC        203.0.113.0/24 is directly connected, Ethernet0/3L        203.0.113.2/32 is directly connected, Ethernet0/3
    1. The C and L lines for 10.0.14.0/24 are here: Ethernet0/2 is up.
    2. Key line The branch route is still here, unchanged: next hop 10.0.14.4, out of Ethernet0/2.
  4. Case 2 · How far it reaches

    R1 tests the next hop 10.0.14.4 itself, then HQ, and R4 lists its own address lines.

    On R1, a test of the next hop:

    Output · IOS XE 17.18.2
    R1#ping 10.0.14.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.0.14.4, timeout is 2 seconds:.....1Success rate is 0 percent (0/5)
    1. Success rate is 0 percent: the next hop does not answer.

    On R1, a test of HQ:

    Output · IOS XE 17.18.2
    R1#ping 10.2.1.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.2.1.2, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
    1. Success rate is 100 percent: HQ answers.

    On R4:

    Output · IOS XE 17.18.2
    R4#show running-config | include ip address ip address 10.2.3.4 255.255.255.01 ip address 10.0.14.40 255.255.255.0 no ip address no ip address no ip address
    1. The line in the link network 10.0.14.0/24 is R4’s address on its link to R1. It reads 10.0.14.40, not 10.0.14.4.
  5. Case 2 · What it means

    R1office routerH1office hostR4branch routerhas 10.2.3.4/24route via10.0.14.4Et0/0: 10.0.14.40
    Figure 1.7 · Case 2 · R1 still points branch packets at 10.0.14.4, but no device has that address now.

    R1 with R4 right of it and H1 under it. There is no cross at R1’s end of the cable to R4; above that end a two-line note reads “route via 10.0.14.4”; a cross sits just under the cable at R4’s end, and under R4’s name a highlighted note reads “Et0/0: 10.0.14.40”.

    • The table is fine: R1 still picks this route, out of Ethernet0/2 toward next hop 10.0.14.4.
    • The next hop itself does not answer: R4 now has 10.0.14.40 on that link, so no device takes the packets for the branch.
    • HQ still answers, so R1 itself is fine; the next hop does not, so the trouble is at 10.0.14.4, on the link to R4.
  6. Case 2 · Fix

    Give R4 its planned address on that link again.

    On R4, the lines that give it back:

    Output · IOS XE 17.18.2
    R4#configure terminalEnter configuration commands, one per line.  End with CNTL/Z.1R4(config)#interface Ethernet0/02R4(config-if)#ip address 10.0.14.4 255.255.255.0R4(config-if)#end
    1. Picks R4’s interface toward R1.
    2. The planned address, 10.0.14.4, with its mask.

    Impact Changing an interface’s address breaks the traffic that still uses the old address.

  7. Case 2 · Proof

    R1 tests the branch again.

    Output · IOS XE 17.18.2
    R1#ping 10.2.3.4Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.2.3.4, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
    1. Success rate is 100 percent: the branch answers again.

End of case 2. Solved: R4 has 10.0.14.4 again; the route carries packets again.

Both cases

Key idea

A route carries packets only while its interface is up and its next hop is there to take the packet. A route in the table says where to send a packet; it does not show that the packet arrives.

R1’s Ethernet0/1 is turned off. R1 then tests HQ, H1 and the branch. What does it see?

Check

R1’s interface Ethernet0/0 has the address 10.1.1.1/24. Which lines does it give R1’s table?
R1’s typed-in routes are S 10.2.1.0/24 [1/0] via 10.0.12.2, Ethernet0/1 and S 10.2.3.0/24 [1/0] via 10.0.14.4, Ethernet0/2. Where does R1 send a packet for 10.2.1.77?

On R1, at another time:

Tap a line, or “Not in the output”, then submit.

Find the line for R1’s link to R3, 203.0.113.0/24.

Output · IOS XE 17.18.2
R1#show ip route | begin Gateway
R1 has a packet for 10.0.12.2. Which route does it use?
R1’s Ethernet0/3 is turned off. Which lines leave R1’s table?

Summary

to 10.1.1.10C 10.1.1.0/24Et0/0 · next hop H1R3provider routerhas 198.51.100.1/24R2HQ routerhas 10.2.1.2/24R1office routerR4branch routerhas 10.2.3.4/24H1office host10.1.1.0/2410.0.12.0/2410.0.14.0/24203.0.113.0/24
Figure 1.4, recap · For H1, in R1’s own network 10.1.1.0/24, the matching route is connected. R1 sends straight out of Ethernet0/0, and the next hop is H1 itself.

The network under a strip of two chips: “to 10.1.1.10” and “C 10.1.1.0/24, Et0/0 · next hop H1”. A short arrow beside the cable to H1 points down from R1 to H1.

  • A router joins networks and sends each packet one hop on; its routing table lists the networks it knows and the way out for each.
  • An interface that is up with an address gives a C line for its network and an L line for the router’s own address.
  • R1 sends a packet out of the matching route’s interface to its next hop; for a network R1 is in, the next hop is the destination itself.
  • show ip route shows code, prefix, interface and any next hop on each route line; headings with no code group them.
  • A route carries packets only while its interface is up and its next hop is there to take the packet.