Route Selection in Cisco Routers. Route Selection One of the intriguing aspects of Cisco routers,...

79
Route Selection in Cisco Routers

Transcript of Route Selection in Cisco Routers. Route Selection One of the intriguing aspects of Cisco routers,...

Route Selection in Cisco Routers

Route Selection

• One of the intriguing aspects of Cisco routers, especially for those new to routing, is how the router chooses which route is the best.

Route Selection

• To understand it completely requires some knowledge about the way Cisco routers work.

Processes Involved

• There are three processes involved in building and maintaining the routing table in a Cisco router:

Processes Involved

• There are three processes involved in building and maintaining the routing table in a Cisco router:

• Various routing processes (Protocols) RIP EIGRP etc.

Processes Involved

• There are three processes involved in building and maintaining the routing table in a Cisco router:

• Various routing processes (Protocols) RIP EIGRP etc.

• The routing table itself

Processes Involved

• There are three processes involved in building and maintaining the routing table in a Cisco router:

• Various routing processes (Protocols) RIP EIGRP etc.

• The routing table itself

• The forwarding process

Routing Processes

• Dynamic Routing Protocols

• IGRP –

• EIGRP –

• OSPF –

• RIP –

• These processes populate the routing table.

The Routing Table

• Accepts information from the routing processes and also replies to requests for information from the forwarding process.

Forwarding Process

• Requests information from the routing table to make a packet forwarding decisions as to which router interface to forward the packet to.

Building the routing table

• Let's examine the interaction between the routing protocols and the routing table to understand how the routing table is built.

Building the routing table

• As each routing process ( EIGRP, RIP etc..) receives updates and other information, it chooses the best path to any given destination and attempts to install this path into the routing table.

Building the routing table

• For instance, if EIGRP learns of a path towards 10.1.1.0/24, and decides this particular path is the best EIGRP path to this destination, it tries to install the path it has learned into the routing table.

Building the routing table

• The router decides whether or not to install the routes presented by the routing processes based on the ….

• administrative distance of the route in question.

Administrative distance

• This is the believability of the route trying to be inserted into the routing table.

Administrative distance

• This is the believability of the route trying to be inserted into the routing table.

• Some Routing Processes are more trustworthy than others.

Administrative distance

• This is the believability of the route trying to be inserted into the routing table.

• Some Routing Processes are more trustworthy than others.

• Each Routing Process has a given Administrative Distance as a number.

Administrative distance

• The smaller the number the more believable the route.

Administrative distance

• The smaller the number the more believable the route.

• If two routing processes try to install the same route into the table one will be rejected.

Example

• To understand this better, let's look at an example.

Example

• To understand this better, let's look at an example.

Example

• Assume a router has four routing processes running: EIGRP, OSPF, RIP, and IGRP.

• Now, all four of these processes have learned of various routes to the 10.168.24.0/24 network, and each has chosen its best path to that network through its internal metrics and processes .

Example

• Each of these four processes attempts to install their route toward 10.168.24.0/24 into the routing table

Example

• The routing processes are each assigned an administrative distance, which is used to decide which route to install.

Example

• Since the internal EIGRP route has the best administrative distance, it's installed in the routing table

Backup Routes

• What do the other protocols? RIP, IGRP, and OSPF? do with the routes that weren't installed?

Backup Routes

• What do the other protocols? RIP, IGRP, and OSPF? do with the routes that weren't installed?

• What if the most preferred route, learned from EIGRP, fails?

Backup Routes

• Cisco IOS® Software uses two approaches to solve this problem:

Backup Routes

• Cisco IOS® Software uses two approaches to solve this problem:

1. The first is to have each routing process attempt to install its best routes periodically

Backup Routes

• Cisco IOS® Software uses two approaches to solve this problem:

1. The first is to have each routing process attempt to install its best routes periodically ( RIP, IGRP )

2. The second method is to store the route in a database and attempt to install it if the primary route fails. ( EIGRP, OSPF )

Prefix Lengths

• Let's look at another scenario to see how the router handles another common situation? varying prefix lengths.

Prefix Lengths

Assume, again, that a router has four routing processes running on it, and each process has received these routes:

• EIGRP (internal): 10.168.32.0/26

• RIP: 10.168.32.0/24

• OSPF: 10.168.32.0/19

Prefix Lengths

• Which of these routes will be installed in the routing table?

• EIGRP (internal): 10.168.32.0/26

• RIP: 10.168.32.0/24

• OSPF: 10.168.32.0/19

Prefix Lengths

• Since EIGRP internal routes have the best administrative distance, it's tempting to assume the first one will be installed.

Prefix Lengths

• Since EIGRP internal routes have the best administrative distance, it's tempting to assume the first one will be installed.

• However, since each of these routes has a different prefix length (subnet mask), they're considered different destinations, and they will all be installed in the routing table.

Making Forwarding Decisions

• Which routing table entry show I use to get to the required destination ?

Making Forwarding Decisions

Let's look at the three routes we just installed in the routing table, and see how they look on the router.

....

Making Forwarding Decisions

Pod1_1603#show ip route D   10.168.32.0/26 [90/25789217] via

10.1.1.1R   10.168.32.0/24 [120/4] via 10.1.1.2O   10.168.32.0/19 [110/229840] via

10.1.1.3

Identifies which Process installed the route.D = EIGRP, R = RIP, O = OSPF

Making Forwarding Decisions

Pod1_1603#show ip route D   10.168.32.0/26 [90/25789217] via

10.1.1.1R   10.168.32.0/24 [120/4] via 10.1.1.2O   10.168.32.0/19 [110/229840] via

10.1.1.3 Identifies the Admin Distance.

Making Forwarding Decisions

Pod1_1603#show ip route D   10.168.32.0/26 [90/25789217] via

10.1.1.1R   10.168.32.0/24 [120/4] via 10.1.1.2O   10.168.32.0/19 [110/229840] via

10.1.1.3 Identifies the next HOP IP address or Interface to Forward the packet to.

Making Forwarding Decisions

Pod1_1603#show ip route D   10.168.32.0/26 [90/25789217] via

10.1.1.1R   10.168.32.0/24 [120/4] via 10.1.1.2O   10.168.32.0/19 [110/229840] via 10.1.1.3

If a packet arrives on a router interface destined for 10.168.32.1, which route would the router choose?

Making Forwarding Decisions

Pod1_1603#show ip route D   10.168.32.0/26 [90/25789217] via 10.1.1.1R   10.168.32.0/24 [120/4] via 10.1.1.2O   10.168.32.0/19 [110/229840] via 10.1.1.3

It depends on the prefix length, or the number of bits set in the subnet mask.

Longer prefixes are always preferred over shorter ones when forwarding a packet.

Making Forwarding Decisions

Pod1_1603#show ip route D   10.168.32.0/26 [90/25789217] via 10.1.1.1R   10.168.32.0/24 [120/4] via 10.1.1.2O   10.168.32.0/19 [110/229840] via 10.1.1.3

It depends on the prefix length, or the number of bits set in the subnet mask.

Longer prefixes are always preferred over shorter ones when forwarding a packet.

Making Forwarding Decisions

Pod1_1603#show ip route D   10.168.32.0/26 [90/25789217] via

10.1.1.1R   10.168.32.0/24 [120/4] via 10.1.1.2O   10.168.32.0/19 [110/229840] via 10.1.1.3

Before I tell you which route is preferred lets break down each route to see what it is describing !

Routing table entries

• D   10.168.32.0/26• /26 = 255.255.255.192• 256 – 192 = 64 • So networks are 0, 64, 128, 192• This route is describing Subnetwork 0• 10.168.32.0/26• IP host addresses covered = ( 1 thru

63 )

Routing table entries

• R 10.168.32.0/24• /24 = 255.255.255.0• 256 – 255 = 1 • So networks are 0,1, 2, 3, 4 in 3rd Octet• This route is describing Network

10.168.32.0• IP host addresses covered = ( 1 thru

255 )

Routing table entries

• O   10.168.32.0/19• /19 = 255.255.224.0• 256 – 224 = 32 • So networks are 0,32,64,96,etc.. in 3rd

Octet• This route is describing Network

10.168.32.0• IP host addresses covered = ( 1 thru

255 )

Back to our Example

• If a packet arrives on a router interface destined for 10.168.32.1, which route would the router choose?

• /26 IP host addresses covered = ( 1 thru 63 )

• /24 IP host addresses covered = ( 1 thru 255 )

• /19 IP host addresses covered = ( 1 thru 255 )

Back to our Example

• If a packet arrives on a router interface destined for 10.168.32.1, which route would the router choose?

• /26 IP host addresses covered = ( 1 thru 63 )• /24 IP host addresses covered = ( 1 thru 255

)• /19 IP host addresses covered = ( 1 thru 255

)

• This is for Host 1 on network 10.168.32.0

Back to our Example

• If a packet arrives on a router interface destined for 10.168.32.1, which route would the router choose?

• /26 IP host addresses covered = ( 1 thru 63 )• /24 IP host addresses covered = ( 1 thru 255 )• /19 IP host addresses covered = ( 1 thru 255 )

• This is for Host 1 on network 10.168.32.0• All entries cover this host, so the longest Prefix

is used.

Back to our Example

• If a packet arrives on a router interface destined for 10.168.32.100, which route would the router choose?

• /26 IP host addresses covered = ( 1 thru 63 )• /24 IP host addresses covered = ( 1 thru 255

)• /19 IP host addresses covered = ( 1 thru 255

)

• This is for Host 100 on network 10.168.32.0

Back to our Example• If a packet arrives on a router interface destined for

10.168.32.100, which route would the router choose?

• /26 IP host addresses covered = ( 1 thru 63 )• /24 IP host addresses covered = ( 1 thru 255 )• /19 IP host addresses covered = ( 1 thru 255 )

• This is for Host 100 on network 10.168.32.0• /26 Does not cover this host address• ( 10.168.32.64 / 26 now this does !!!!! But that’s

not in the table )

Back to our Example

• If a packet arrives on a router interface destined for 10.168.32.100, which route would the router choose?

• /24 IP host addresses covered = ( 1 thru 255 )• /19 IP host addresses covered = ( 1 thru 255 )

• This is for Host 100 on network 10.168.32.0• Both cover host 100• So longest Prefix is used = /24

Back to our Example

• If a packet arrives on a router interface destined for 10.168.32.100, which route would the router choose?

• /24 IP host addresses covered = ( 1 thru 255 )• /19 IP host addresses covered = ( 1 thru 255 )

• This is for Host 100 on network 10.168.32.0• Both cover host 100• So longest Prefix is used = /24

Conclusion

• These examples are to make you think and to examine just what the routing table entry is describing.

Conclusion

• Its tempting to just go for the Longest prefix

Conclusion

• That’s OK if the longest prefix describes your host !!!!

IP Classless

• Where the ip classless configuration command falls within the routing and forwarding processes is often confusing.

IP Classless

• In reality, IP classless only affects the operation of the forwarding processes in IOS; it doesn't affect the way the routing table is built.

IP Classless

• If IP classless isn't configured (using the no ip classless command), the router won't forward packets to subnets it does not specifically know about !!!!

• As an example, let's again place three routes in the routing table and route packets through the router

IP Classless

router#show ip route....     172.30.0.0/16 is variably subnetted, 2 subnets,

2 masksD    172.30.32.0/20 [90/4879540] via

10.1.1.2D    172.30.32.0/24 [90/25789217]  via

10.1.1.1

S*   0.0.0.0/0 [1/0] via 10.1.1.3

IP Classless

• Remembering that the

172.30.32.0/24 network = Addresses 172.30.32.1 through 172.30.32.255

( /24 = Network bits = 255.255.255.0 )

( Networks increment in 1’s )

( As such just one network is described )

IP Classless

• Remembering that the

172.30.32.0/24 network = Addresses 172.30.32.1 through 172.30.32.255

( /24 = Network bits = 255.255.255.0 )

( Networks increment in 1’s )

( As such just one network is described )

IP Classless

• Remembering that the

172.30.32.0/24 network = Addresses 172.30.32.0 through 172.30.32.255

( /24 = Network bits = 255.255.255.0 )

( Networks increment in 1’s )

( As such just one network is described )

IP Classless

• and the 172.30.32.0/20 network includes the addresses

• 172.30.32.0 through 172.30.47.255

• ( /20 = 255.255.240.0 )• ( Networks increment in 16’s )• Networks 0,16,32,48,64 etc…..• This mask therefore describes networks 32 - 47

NO IP Classless

• Finally the routing table entry 0.0.0.0/0

• Is the DEFAULT route to take

• However the NO IP CLASSLESS command affects how this works.

NO IP Classless

• You only take the Default route for a subnet if your table knows of NO other subnet for the CLASSFULL MAJOR NETWORK

NO IP Classless

• We can try switching three packets through this routing table and see what the results are.

• D    172.30.32.0/20  [90/4879540] via 10.1.1.2

• D    172.30.32.0/24 [90/25789217]via 10.1.1.1

• S*   0.0.0.0/0 [1/0] via 10.1.1.3

NO IP Classless

• A packet destined to 172.30.32.1 is forwarded to 10.1.1.1, since this is the longest prefix match.

• D    172.30.32.0/20  [90/4879540] via 10.1.1.2

• D    172.30.32.0/24 [90/25789217]via 10.1.1.1

• S*   0.0.0.0/0 [1/0] via 10.1.1.3

NO IP Classless

• A packet destined to 172.30.33.1 is forwarded to 10.1.1.2, since this is the longest prefix match.

• D    172.30.32.0/20  [90/4879540] via 10.1.1.2

• D    172.30.32.0/24 [90/25789217]via 10.1.1.1

• S*   0.0.0.0/0 [1/0] via 10.1.1.3

NO IP Classless

• A packet destined to 10.168.10.1 is forwarded to 10.1.1.3; since this network doesn't exist in the routing table, this packet is forwarded to the default route.

• D    172.30.32.0/20  [90/4879540] via 10.1.1.2

• D    172.30.32.0/24 [90/25789217]via 10.1.1.1• S*   0.0.0.0/0 [1/0] via 10.1.1.3

NO IP Classless

• A packet destined to 172.30.254.1 is dropped.

• D    172.30.32.0/20  [90/4879540] via 10.1.1.2

• D    172.30.32.0/24 [90/25789217]via 10.1.1.1

• S*   0.0.0.0/0 [1/0] via 10.1.1.3

NO IP Classless

• A packet destined to 172.30.254.1 is dropped.

• Because No table entry described this route

• IP CLASSLESS will not allow the default route to be taken, because we know some routes to the MAJOR network 172.30.0.0

• So its dropped !!

No IP Classless

No IP Classless

Blocks access to any 10.x.x.x subnet in the cloud but allows

internet access to any other Major Network / Subnetwork.

Lets Break and then attempt LAB 4