• No results found

This section covers four main routing protocols:

RIP

EIGRP

OSPF

BGP

Before discussing the characteristic of each protocol, this section covers how routers (Cisco routers, in particular) generally route IP packets.

Routing is a process whereby a path to a destination host is selected by either a dynamic or static routing protocol. A routing protocol is an algorithm that routes data across the network. Each router makes routing decisions from host to destination based on specific metrics used by the operating routing protocol. For example, RIP uses hop count (commonly known as the network diameter) to decide what router interface the data is sent. A lower hop count is always preferred. OSPF, on the other hand, uses a cost metric; the lower the cost, the more preferred a path to the destination.

Routing IP across a network of Cisco routers requires IP address allocation to interfaces and then a static or dynamic routing protocol to advertise these networks to local or remote routers. After these networks are advertised, IP data can flow across the network. Routing occurs at Layer 3 (the network layer) of the OSI model.

By default, IP routing is enabled on Cisco routers. The command used to start or disable IP routing is [no] ip routing. By default, IP routing is enabled so you will not see this command by viewing the configuration. Consider a one-router network with two directly connected Ethernet interfaces as an introductory example. Figure 2-13 displays a two-port Ethernet router configured with two subnets.

Figure 2-13 Connected Routes

PC1 can communicate with PC2 as shown in Figure 2-13, because Cisco routers will route to directly connected interfaces.

R1# show ip route

Codes C- connected, S- static, I- IGRP, R- RIP, M- mobile, B- BGP D- EIGRP, EX- EIGRP external, Q- QSPF, 1A- 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.*-candidate default U- per-user static route, o- ODR

-

Gateway of last resort is not set -

172.108.0.0/24 is subnetted, 2 subnets

C 172.108.1.0 is directly connected, Ethernet0 C 172.108.2.0 is directly connected, Ethernet1 R1#

PC 1 PC 2

172.108.1.1/24

Directly Connected Networks

172.108.2.1/24 E0

R1

The IOS command show ip route is used to view the IP routing table, and a number of symbols define how remote or local networks have been discovered. Table 2-7 defines the various symbols and their meanings. The Cisco Documentation CD defines the routing fields or codes as follows.

Table 2-7 show ip route Defined*

Field Description

O Indicates protocol that derived the route.

Possible values include the following: I—IGRP derived R—RIP derived O—OSPF derived C—Connected S—Static E—EGP derived B—BGP derived D—EIGRP EX—EIGRP external I—IS-IS derived Ia—IS-IS M—Mobile

P—Periodic downloaded static route U—Per-user static route

O—On-demand routing

E2 Type of route. Possible values include the

following:

*—Indicates the last path used when a packet was forwarded. It pertains only to the nonfast-switched packets. However, it does not indicate what path will be used next when forwarding a nonfast-switched packet, except when the paths are equal cost. IA—OSPF interarea route

E1—OSPF external type 1 route E2—OSPF external type 2 route L1—IS-IS Level 1 route L2—IS-IS Level 2 route

N1—OSPF NSSA external type 1 route N2—OSPF NSSA external type 2 route

By default, Cisco IOS assigns each routing protocol an administrative distance (AD) that indicates the trustworthiness of a routing entry if there is more than one path to a remote network running two or more routing algorithms. You can configure the AD value from the default with the distanceadministrative-distance IOS command if you want to manually choose RIP over OSPF, for example. The value for administrative-distance can be 1 to 255. Table 2-8 displays the administrative distances enabled by default on Cisco routers.

172.108.0.0/24 is subnetted, 2 subnets C 172.108.1.0 is directly connected, Ethernet0 C 172.108.2.0 is directly connected, Ethernet1 R1#

Indicates the address of the remote network.

[160/5] The first number in the brackets is the

information source’s administrative distance; the second number is the metric for the route.

via Specifies the address of the next router to

the remote network.

0:01:00 Specifies the last time the route was updated

in hours:minutes:seconds.

Ethernet0 Specifies the interface through which the

specified network can be reached.

* Part of this table taken from

http://www.cisco.com/univercd/cc/td/doc/product/software/ios122/122cgcr/fiprrp_r/ind_r/1rfindp2.htm#102251, all rights are reserved to Cisco.

Table 2-8 Default Administrative Distances

Route Source Default Distance

Connected interface (or static route via a connected interface)

0

Static route 1

Enhanced IGRP summary route 5

External BGP 20

Internal enhanced IGRP 90

IGRP 100

Table 2-7 show ip route Defined* (Continued)

For example, Table 2-8 demonstrates that an EIGRP (AD 90) route is preferred over a network entry discovered by RIP (AD 120) because the AD is lower, or more trustworthy.

NOTE The IP address source and destination in an IP datagram does not alter, but the Layer 2 MAC source and destination do, for example, when PC1 sends a packet to PC2 in Figure 2-13. The TCP/IP software on PC1 identifies that the remote destination (172.108.2.0/24) is not locally connected and sends the Layer 3 frame to the local gateway address, 171.108.1.1/24. For the Layer 2 frame to transverse the local Ethernet, the destination Layer 2 Mac address must be that of the local router or gateway. PC2 resides on a different subnet, so the destination MAC address will be that of Router R1 (E0 burnt in address), or the default gateway address of 172.108.1.1. Router R1 will then strip the Layer 2 header and install its own Layer 2 header when the packet enters the network where PC2 resides. The Layer 2 header contains the source address (Layer 2) of R1 E1 and destination address of PC2’s MAC address. The Layer 3 IP source and destination addresses do not change during the routing of the IP packet. The excep- tion to changes in Layer 3 addressing is when Network Address Translation (NAT) is used.