Senior Acquisitions Editor: Kenyon Brown Development Editor: Kim Wimpsett



Yüklə 22,5 Mb.
Pdf görüntüsü
səhifə38/69
tarix26.10.2019
ölçüsü22,5 Mb.
#29436
1   ...   34   35   36   37   38   39   40   41   ...   69
Todd Lammle CCNA Routing and Switching


Chapter 9

IP Routing

The following ICND1 exam topics are covered in

this chapter:

3.0 Routing Technologies

3.1 Describe the routing concepts

3.1.a Packet handling along the path through a network

3.1.b Forwarding decision based on route lookup

3.1.c Frame rewrite

3.2 Interpret the components of routing table

3.2.a Prefix

3.2.b Network mask

3.2.c Next hop

3.2.d Routing protocol code

3.2.e Administrative distance

3.2.f Metric

3.2.g Gateway of last resort

3.3 Describe how a routing table is populated by different routing

information sources

3.3.a Admin distance

3.5 Compare and contrast static routing and dynamic routing

3.6 Configure, verify, and troubleshoot IPv4 and IPv6 static

routing

3.6.a Default route



3.6.b Network route

3.6.c Host route

3.6.d Floating static

3.7 Configure, verify, and troubleshoot RIPv2 for IPv4 (excluding

authentication, filtering, manual summarization, redistribution)

It’s time now to turn our focus toward the core

topic of the ubiquitous IP routing process. It’s integral to networking

because it pertains to all routers and configurations that use it, which is

easily the lion’s share. IP routing is basically the process of moving

packets from one network to another network using routers. And by

routers, I mean Cisco routers, of course! However, the terms router and



layer 3 device are interchangeable, and throughout this chapter when I

use the term router, I am referring to any layer 3 device.

Before jumping into this chapter, I want to make sure you understand the

difference between a routing protocol and a routed protocol. Routers use

routing protocols to dynamically find all networks within the greater

internetwork and to ensure that all routers have the same routing table.

Routing protocols are also employed to determine the best path a packet

should take through an internetwork to get to its destination most

efficiently. RIP, RIPv2, EIGRP, and OSPF are great examples of the most

common routing protocols.

Once all routers know about all networks, a routed protocol can be used

to send user data (packets) through the established enterprise. Routed

protocols are assigned to an interface and determine the method of

packet delivery. Examples of routed protocols are IP and IPv6.

I’m pretty confident I don’t have to underscore how crucial it is for you to

have this chapter’s material down to a near instinctive level. IP routing is

innately what Cisco routers do, and they do it very well, so having a firm


grasp of the fundamentals and basics of this topic is vital if you want to

excel during the exam and in a real-world networking environment as

well!

In this chapter, I’m going to show you how to configure and verify IP



routing with Cisco routers and guide you through these five key subjects:

Routing basics

The IP routing process

Static routing

Default routing

Dynamic routing

I want to start by nailing down the basics of how packets actually move

through an internetwork, so let’s get started!

To find up-to-the-minute updates for this chapter, please see

www.lammle.com/ccna

or the book's web page at

www.sybex.com/go/ccna

.

Routing Basics

Once you create an internetwork by connecting your WANs and LANs to

a router, you’ll need to configure logical network addresses, like IP

addresses, to all hosts on that internetwork for them to communicate

successfully throughout it.

The term routing refers to taking a packet from one device and sending it

through the network to another device on a different network. Routers

don’t really care about hosts—they only care about networks and the best

path to each one of them. The logical network address of the destination

host is key to getting packets through a routed network. It’s the hardware

address of the host that’s used to deliver the packet from a router and

ensure it arrives at the correct destination host.

Routing is irrelevant if your network has no routers because their job is to

route traffic to all the networks in your internetwork, but this is rarely the

case! So here’s an important list of the minimum factors a router must


know to be able to effectively route packets:

Destination address

Neighbor routers from which it can learn about remote networks

Possible routes to all remote networks

The best route to each remote network

How to maintain and verify routing information

The router learns about remote networks from neighboring routers or

from an administrator. The router then builds a routing table, which is

basically a map of the internetwork, and it describes how to find remote

networks. If a network is directly connected, then the router already

knows how to get to it.

But if a network isn’t directly connected to the router, the router must use

one of two ways to learn how to get to the remote network. The static

routing method requires someone to hand-type all network locations into

the routing table, which can be a pretty daunting task when used on all

but the smallest of networks!

Conversely, when dynamic routing is used, a protocol on one router

communicates with the same protocol running on neighboring routers.

The routers then update each other about all the networks they know

about and place this information into the routing table. If a change occurs

in the network, the dynamic routing protocols automatically inform all

routers about the event. If static routing is used, the administrator is

responsible for updating all changes by hand onto all routers. Most

people usually use a combination of dynamic and static routing to

administer a large network.

Before we jump into the IP routing process, let’s take a look at a very

simple example that demonstrates how a router uses the routing table to

route packets out of an interface. We’ll be going into a more detailed

study of the process soon, but I want to show you something called the

“longest match rule” first. With it, IP will scan a routing table to find the

longest match as compared to the destination address of a packet. Let’s

take a look at

Figure 9.1

to get a picture of this process.


FIGURE 9.1

A simple routing example

Figure 9.1

shows a simple network. Lab_A has four interfaces. Can you

see which interface will be used to forward an IP datagram to a host with

a destination IP address of 10.10.10.30?

By using the command

show ip route

on a router, we can see the routing

table (map of the internetwork) that Lab_A has used to make its

forwarding decisions:

Lab_A#


sh ip route

Codes: L - local, C - connected, S - static,

[output cut]

10.0.0.0/8 is variably subnetted, 6 subnets, 4 masks

C 10.0.0.0/8 is directly connected, FastEthernet0/3

L 10.0.0.1/32 is directly connected, FastEthernet0/3

C 10.10.0.0/16 is directly connected, FastEthernet0/2


L 10.10.0.1/32 is directly connected, FastEthernet0/2

C 10.10.10.0/24 is directly connected, FastEthernet0/1

L 10.10.10.1/32 is directly connected, FastEthernet0/1

S* 0.0.0.0/0 is directly connected, FastEthernet0/0

The

C

in the routing table output means that the networks listed are



“directly connected,” and until we add a routing protocol like RIPv2,

OSPF, etc. to the routers in our internetwork, or enter static routes, only

directly connected networks will show up in our routing table. But wait—

what about that

L

in the routing table—that’s new, isn’t it? Yes it is,



because in the new Cisco IOS 15 code, Cisco defines a different route,

called a local host route. Each local route has a /32 prefix, defining a

route just for the one address. So in this example, the router has relied

upon these routes that list their own local IP addresses to more efficiently

forward packets to the router itself.

So let’s get back to the original question: By looking at the figure and the

output of the routing table, can you determine what IP will do with a

received packet that has a destination IP address of 10.10.10.30? The

answer is that the router will packet-switch the packet to interface

FastEthernet 0/1, which will frame the packet and then send it out on the

network segment. This is referred to as frame rewrite. Based upon the

longest match rule, IP would look for 10.10.10.30, and if that isn’t found

in the table, then IP would search for 10.10.10.0, then 10.10.0.0, and so

on until a route is discovered.

Here’s another example: Based on the output of the next routing table,

which interface will a packet with a destination address of 10.10.10.14 be

forwarded from?

Lab_A#


sh ip route

[output cut]

Gateway of last resort is not set

C 10.10.10.16/28 is directly connected, FastEthernet0/0

L 10.10.10.17/32 is directly connected, FastEthernet0/0

C 10.10.10.8/29 is directly connected, FastEthernet0/1

L 10.10.10.9/32 is directly connected, FastEthernet0/1

C 10.10.10.4/30 is directly connected, FastEthernet0/2

L 10.10.10.5/32 is directly connected, FastEthernet0/2

C 10.10.10.0/30 is directly connected, Serial 0/0

L 10.10.10.1/32 is directly connected, Serial0/0

To figure this out, look closely at the output until you see that the network

is subnetted and each interface has a different mask. And I have to tell


you—you just can’t answer this question if you can’t subnet! 10.10.10.14

would be a host in the 10.10.10.8/29 subnet that’s connected to the

FastEthernet0/1 interface. Don’t freak if you’re struggling and don’t get

this! Instead, just go back and reread Chapter 4, “Easy Subnetting,” until

it becomes clear to you.

The IP Routing Process

The IP routing process is fairly simple and doesn’t change, regardless of

the size of your network. For a good example of this fact, I’ll use

Figure


9.2

to describe step-by-step what happens when Host A wants to

communicate with Host B on a different network.

FIGURE 9.2

IP routing example using two hosts and one router

In

Figure 9.2



a user on Host_A pinged Host_B’s IP address. Routing

doesn’t get any simpler than this, but it still involves a lot of steps, so let’s

work through them now:

1.  Internet Control Message Protocol (ICMP) creates an echo request

payload, which is simply the alphabet in the data field.

2.  ICMP hands that payload to Internet Protocol (IP), which then creates

a packet. At a minimum, this packet contains an IP source address, an

IP destination address, and a Protocol field with 01h. Don’t forget that

Cisco likes to use 0x in front of hex characters, so this could also look

like 0x01. This tells the receiving host to whom it should hand the

payload when the destination is reached—in this example, ICMP.

3.  Once the packet is created, IP determines whether the destination IP

address is on the local network or a remote one.

4.  Since IP has determined that this is a remote request, the packet must

be sent to the default gateway so it can be routed to the remote


network. The Registry in Windows is parsed to find the configured

default gateway.

5.  The default gateway of Host_A is configured to 172.16.10.1. For this

packet to be sent to the default gateway, the hardware address of the

router’s interface Ethernet 0, which is configured with the IP address

of 172.16.10.1, must be known. Why? So the packet can be handed

down to the Data Link layer, framed, and sent to the router’s interface

that’s connected to the 172.16.10.0 network. Because hosts

communicate only via hardware addresses on the local LAN, it’s

important to recognize that for Host_A to communicate to Host_B, it

has to send packets to the Media Access Control (MAC) address of the

default gateway on the local network.

MAC addresses are always local on the LAN and never go

through and past a router.

6.  Next, the Address Resolution Protocol (ARP) cache of the host is

checked to see if the IP address of the default gateway has already

been resolved to a hardware address.

If it has, the packet is then free to be handed to the Data Link layer for

framing. Remember that the hardware destination address is also

handed down with that packet. To view the ARP cache on your host,

use the following command:

C:\>


arp -a

Interface: 172.16.10.2 --- 0x3

Internet Address Physical Address Type

172.16.10.1 00-15-05-06-31-b0 dynamic

If the hardware address isn’t already in the ARP cache of the host, an

ARP broadcast will be sent out onto the local network to search for the

172.16.10.1 hardware address. The router then responds to the request

and provides the hardware address of Ethernet 0, and the host caches

this address.

7.  Once the packet and destination hardware address are handed to the

Data Link layer, the LAN driver is used to provide media access via

the type of LAN being used, which is Ethernet in this case. A frame is

then generated, encapsulating the packet with control information.


Within that frame are the hardware destination and source addresses

plus, in this case, an Ether-Type field, which identifies the specific

Network layer protocol that handed the packet to the Data Link layer.

In this instance, it’s IP. At the end of the frame is something called a

Frame Check Sequence (FCS) field that houses the result of the cyclic

redundancy check (CRC). The frame would look something like what

I’ve detailed in

Figure 9.3

. It contains Host A’s hardware (MAC)

address and the destination hardware address of the default gateway.

It does not include the remote host’s MAC address—remember that!

FIGURE 9.3

Frame used from Host A to the Lab_A router when

Host B is pinged

8.  Once the frame is completed, it’s handed down to the Physical layer to

be put on the physical medium (in this example, twisted-pair wire)

one bit at a time.

9.  Every device in the collision domain receives these bits and builds the

frame. They each run a CRC and check the answer in the FCS field. If

the answers don’t match, the frame is discarded.

If the CRC matches, then the hardware destination address is

checked to see if it matches (which, in this example, is the router’s

interface Ethernet 0).

If it’s a match, then the Ether-Type field is checked to find the

protocol used at the Network layer.

10.  The packet is pulled from the frame, and what is left of the frame is

discarded. The packet is handed to the protocol listed in the Ether-

Type field—it’s given to IP.

11.  IP receives the packet and checks the IP destination address. Since the

packet’s destination address doesn’t match any of the addresses

configured on the receiving router itself, the router will look up the

destination IP network address in its routing table.

12.  The routing table must have an entry for the network 172.16.20.0 or

the packet will be discarded immediately and an ICMP message will

be sent back to the originating device with a destination network



unreachable message.

13.  If the router does find an entry for the destination network in its table,

the packet is switched to the exit interface—in this example, interface

Ethernet 1. The following output displays the Lab_A router’s routing

table. The

C

means “directly connected.” No routing protocols are



needed in this network since all networks (all two of them) are directly

connected.

Lab_A>

sh ip route

C 172.16.10.0 is directly connected, Ethernet0

L 172.16.10.1/32 is directly connected, Ethernet0

C 172.16.20.0 is directly connected, Ethernet1

L 172.16.20.1/32 is directly connected, Ethernet1

14.  The router packet-switches the packet to the Ethernet 1 buffer.

15.  The Ethernet 1 buffer needs to know the hardware address of the

destination host and first checks the ARP cache.

If the hardware address of Host_B has already been resolved and

is in the router’s ARP cache, then the packet and the hardware

address will be handed down to the Data Link layer to be framed.

Let’s take a look at the ARP cache on the Lab_A router by using

the

show ip arp



command:

Lab_A#


sh ip arp

Protocol Address Age(min) Hardware Addr Type

Interface

Internet 172.16.20.1 - 00d0.58ad.05f4 ARPA

Ethernet1

Internet 172.16.20.2 3 0030.9492.a5dd ARPA

Ethernet1

Internet 172.16.10.1 - 00d0.58ad.06aa ARPA

Ethernet0

Internet 172.16.10.2 12 0030.9492.a4ac ARPA

Ethernet0

The dash (-) signifies that this is the physical interface on the

router. This output shows us that the router knows the 172.16.10.2

(Host_A) and 172.16.20.2 (Host_B) hardware addresses. Cisco

routers will keep an entry in the ARP table for 4 hours.

Now if the hardware address hasn’t already been resolved, the

router will send an ARP request out E1 looking for the 172.16.20.2

hardware address. Host_B responds with its hardware address,



and the packet and destination hardware addresses are then both

sent to the Data Link layer for framing.

16.  The Data Link layer creates a frame with the destination and source

hardware addresses, Ether-Type field, and FCS field at the end. The

frame is then handed to the Physical layer to be sent out on the

physical medium one bit at a time.

17.  Host_B receives the frame and immediately runs a CRC. If the result

matches the information in the FCS field, the hardware destination

address will then be checked next. If the host finds a match, the Ether-

Type field is then checked to determine the protocol that the packet

should be handed to at the Network layer—IP in this example.

18.  At the Network layer, IP receives the packet and runs a CRC on the IP

header. If that passes, IP then checks the destination address. Since a

match has finally been made, the Protocol field is checked to find out

to whom the payload should be given.

19.  The payload is handed to ICMP, which understands that this is an

echo request. ICMP responds to this by immediately discarding the

packet and generating a new payload as an echo reply.

20.  A packet is then created including the source and destination

addresses, Protocol field, and payload. The destination device is now

Host_A.

21.  IP then checks to see whether the destination IP address is a device on



the local LAN or on a remote network. Since the destination device is

on a remote network, the packet needs to be sent to the default

gateway.

22.  The default gateway IP address is found in the Registry of the

Windows device, and the ARP cache is checked to see if the hardware

address has already been resolved from an IP address.

23.  Once the hardware address of the default gateway is found, the packet

and destination hardware addresses are handed down to the Data

Link layer for framing.

24.  The Data Link layer frames the packet of information and includes the

following in the header:

The destination and source hardware addresses



The Ether-Type field with 0x0800 (IP) in it

The FCS field with the CRC result in tow

25.  The frame is now handed down to the Physical layer to be sent out

over the network medium one bit at a time.

26.  The router’s Ethernet 1 interface receives the bits and builds a frame.

The CRC is run, and the FCS field is checked to make sure the answers

match.

27.  Once the CRC is found to be okay, the hardware destination address is



checked. Since the router’s interface is a match, the packet is pulled

from the frame and the Ether-Type field is checked to determine

which protocol the packet should be delivered to at the Network layer.

28.  The protocol is determined to be IP, so it gets the packet. IP runs a

CRC check on the IP header first and then checks the destination IP

address.


IP does not run a complete CRC as the Data Link layer

does—it only checks the header for errors.

Since the IP destination address doesn’t match any of the router’s

interfaces, the routing table is checked to see whether it has a route to

172.16.10.0. If it doesn’t have a route over to the destination network,

the packet will be discarded immediately. I want to take a minute to

point out that this is exactly where the source of confusion begins for a

lot of administrators because when a ping fails, most people think the

packet never reached the destination host. But as we see here, that’s

not always the case. All it takes for this to happen is for even just one

of the remote routers to lack a route back to the originating host’s

network and— poof!—the packet is dropped on the return trip, not on

its way to the host!

Just a quick note to mention that when (and if) the packet is

lost on the way back to the originating host, you will typically see a

request timed-out message because it is an unknown error. If the

error occurs because of a known issue, such as if a route is not in


the routing table on the way to the destination device, you will see

a destination unreachable message. This should help you

determine if the problem occurred on the way to the destination or

on the way back.

29.  In this case, the router happens to know how to get to network

172.16.10.0—the exit interface is Ethernet 0—so the packet is switched

to interface Ethernet 0.

30.  The router then checks the ARP cache to determine whether the

hardware address for 172.16.10.2 has already been resolved.

31.  Since the hardware address to 172.16.10.2 is already cached from the

originating trip to Host_B, the hardware address and packet are then

handed to the Data Link layer.

32.  The Data Link layer builds a frame with the destination hardware

address and source hardware address and then puts IP in the Ether-

Type field. A CRC is run on the frame and the result is placed in the

FCS field.

33.  The frame is then handed to the Physical layer to be sent out onto the

local network one bit at a time.

34.  The destination host receives the frame, runs a CRC, checks the

destination hardware address, then looks into the Ether-Type field to

find out to whom to hand the packet.

35.  IP is the designated receiver, and after the packet is handed to IP at

the Network layer, it checks the Protocol field for further direction. IP

finds instructions to give the payload to ICMP, and ICMP determines

the packet to be an ICMP echo reply.

36.  ICMP acknowledges that it has received the reply by sending an

exclamation point (!) to the user interface. ICMP then attempts to

send four more echo requests to the destination host.

You’ve just experienced Todd’s 36 easy steps to understanding IP routing.

The key point here is that if you had a much larger network, the process

would be the same. It’s just that the larger the internetwork, the more

hops the packet goes through before it finds the destination host.

It’s super-important to remember that when Host_A sends a packet to


Host_B, the destination hardware address used is the default gateway’s

Ethernet interface. Why? Because frames can’t be placed on remote

networks—only local networks. So packets destined for remote networks

must go through the default gateway.

Let’s take a look at Host_A’s ARP cache now:

C:\ >


Yüklə 22,5 Mb.

Dostları ilə paylaş:
1   ...   34   35   36   37   38   39   40   41   ...   69




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin