Module 6 - Routing and Routing ProtocolsCCNA 2 version 3.1 Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 2 Overview • Explain the significance of static routing • Config
Trang 1Module 6 - Routing and Routing Protocols
CCNA 2 version 3.1
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 2
Overview
• Explain the significance of static routing
• Configure static and default routes
• Verify and troubleshoot static and default routes
• Identify the classes of routing protocols
• Identify distance vectorrouting protocols
• Identifylink-staterouting protocols
• Describe the basic characteristics of common routing protocols
• Identify interior gatewayprotocols
• Identify exterior gatewayprotocols
• Enable Routing Information Protocol(RIP) on a router
Trang 2Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 3
The Routing Table
directly connected routes.
• This is information which is not in the curriculum, but will
give you a better understanding of what is taking place.
Directly Connected Networks and the IP Routing Table
RTA#show ip route
Codes: C - connected, S - static, I - IGRP, 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, 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
Trang 3Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 5
• Adding an ip address/mask to an interface tells the router that it is a member, “Directly
Connected” to that network – just like when a host computer is configured with an ip
address/mask.
• Notice the route is shown with the subnet mask and the “exit-interface.”
• Don’t forget the “no shutdown”
• Don’t forget the interface must be in “up” and “up”
Directly Connected Networks and the IP Routing Table
RTA(config)#inter e 0
RTA(config-if)#ip add 192.168.2.1 255.255.255.0
RTA(config-if)#no shutdown
RTA#show ip route
Codes: C - connected, <Other codes and gateway information omitted>
C 192.168.2.0/24 is directly connected, Ethernet0
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 6
Directly Connected Networks and the IP Routing Table
RTA#show ip route
Codes: C - connected, <Other codes and gateway information omitted>
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
RTB#show ip route
Codes: C - connected, <Other codes and gateway information omitted>
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.1.0/24 is directly connected, Serial1
RTC#show ip route
Codes: C - connected, <Other codes and gateway information omitted>
C 10.0.0.0/8 is directly connected, Ethernet0
C 192.168.1.0/24 is directly connected, Serial1
The Routing Tables
• Notice that the routers only know about their own directly connected networks.
• They are not sharing routing information because we have not configured any static routes or dynamic
routing protocols.
Trang 4Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 7
Configuring an interface which has a subnet mask greater than the classful mask
• We will discuss this in much more detail later using the presentation – “The Routing Table.”
• For now, notice that when the subnet mask is not a classful mask, but a subnetted /16 mask
• The routing table information shows the route to the subnetted network
• The mask is shown in the above, “parent” classful network.
Directly Connected Networks and the IP Routing Table
C 10.1.0.0 is directly connected, Ethernet0
C 192.168.1.0/24 is directly connected, Serial1
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
Trang 5Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 9
Routing– Routing tables must have the necessary network routes
• Question: If RTA can ping RTB’s 172.16.0.2 interface why can’t it ping RTB’s 192.168.1.1
interface? - RTA does not have a route to it in its routing table.
• Question: Would an extended ping from RTA, using the source IP address of 192.168.2.1 be able
to ping 172.16.0.2 on RTB? Why or why not? Where does the echo request or echo reply fail?
Directly Connected Networks and the IP Routing Table
RTA#show ip route
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 10
Routing– Routing tables must have the necessary network routes
• Question: Would an extended ping from RTA, using the source IP address of 192.168.2.1 be able
to ping 172.16.0.2 on RTB? Why or why not?
• The echo request from RTA reaches RTB because RTA has a route to 172.16.0.0/16 in its routing
table.
• However, the echo reply from RTB back to RTA fails, because RTB does not have a route for
192.168.2.0/24 in its routing table.
Directly Connected Networks and the IP Routing Table
RTA#show ip route
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
RTB#show ip route
Codes: C - connected, <Other codes and gateway information omitted>
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.1.0/24 is directly connected, Serial1
RTA#ping
Protocol [ip]:
Target IP address: 172.16.0.2
Extended commands [n]: y
Source address or interface: 192.168.2.1
Sending 5, 100-byte ICMP Echos to 172.16.0.2, timeout is 2 seconds:
Trang 6Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 11
Routing Table Principles Revisited (Zinin, Cisco IP Routing)
• Every router makes its decision alone , based on the information it has in its own routing table
• The fact that one router has certain information in its routing table does not mean that other routers
have the same information
• Routing information about a path from one network to another does not provide routing information
about the reverse, or return path.
Directly Connected Networks and the IP Routing Table
RTA#show ip route
Codes: C - connected, <Other codes and gateway information omitted>
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
RTB#show ip route
Codes: C - connected, <Other codes and gateway information omitted>
C 172.16.0.0/16 is directly connected, Serial0
C 192.168.1.0/24 is directly connected, Serial1
RTC#show ip route
Codes: C - connected, <Other codes and gateway information omitted>
10.0.0.0/16 is subnetted, 1 subnets
C 10.1.0.0 is directly connected, Ethernet0
C 192.168.1.0/24 is directly connected, Serial1
Trang 7Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 13
Routing Types
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 14
Static Route Operation
Hoboken#show ip route
Codes: C - connected, S - static,
S 172.16.1.0/24 [1/0] is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
Trang 8Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 15
RTR(config)# ip route prefix mask {address |
interface} [distance] [tag tag] [permanent]
• prefix IP route prefix for the destination.
• mask Prefix mask for the destination.
• address IP address of the “next hop” that can be used to reach
that network
• interface Network interface to use (exit-interface)
• distance (Optional) An administrative distance.
• tag tag (Optional) Tag value that can be used as a "match" value
for controlling redistribution via route maps (CCNP Advanced Routing)
• Permanent (Optional) Specifies that the route will not be removed,
even if the interface shuts down (CCNP Advanced Routing)
Static Route Operation
Trang 9Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 17
Static Route Operation
• If the router cannot reach the outgoing interface that is being used in the route,
the route will not be installed in the routing table
• This means if that interface is down, the route will not be placed in the routing
table
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 18
Administrative Distance and Metric
• [ administrative distance / routing metric (or cost) ]
• The cost for all static routes is “0”
• The default administrative distance for static routes is “1”
Hoboken#show ip route
Codes: C - connected, S - static,
S 172.16.1.0/24 [1/0] is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
Trang 10Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 19
Administrative Distance
• Administrative Distance is the “trustworthiness” of the routing information
• Lower the administrativedistance the more trustworthy the information
• If the router hears about a route to the same network from more than one
source it will use the administrative distance to decide which route to put in the
routing table
Examples from the curriculum
Trang 11Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 21
Examples from the curriculum
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 22
Examples from the curriculum
“default route”
Trang 12Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 23
Static Routing
• Some extra information on static routing that is not in the
curriculum
Static Routing
Router(config)#ip route prefix
destination-prefix-mask {address | interface} [distance] [tag tag]
[permanent]
Trang 13Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 25
Static Routing
Configuring static routes
• Routers do not need to configure static routes for their own directly connected
networks
• We need to configure static routes for networks this router needs to reach
• We will need to configure static routes for the other routers as well, as “routing
information about a path from one network to another does not provide routing
information about the reverse, or return path.”
• Convergence–When all the routers in the network (AS) have accurate and
consistent information, so that proper routing and packet forwarding can take
place
• Convergence will not happen until all the routers have complete and accurate
routing information, meaning we must configure static routes on all the routers
before packets will be correctly delivered
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 26
Basic static route example
• Be sure to use the proper subnet mask!
RTA(config)#ip route 192.168.1.0 255.255.255.0 172.16.0.2
RTA#show ip route
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
S 192.168.1.0/24 [1/0] via 172.16.0.2
C 192.168.2.0/24 is directly connected, Ethernet0
Network/subnet route
Intermediate-Address (usually “next-hop”)
Trang 14Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 27
Basic static route example (continued)
• [1/0] – [ Administrative Distance / Metric ]
• Administrative Distance– This is the “trustworthiness” of the routing information The
default administrative distance of static routes is 1.
• The Administrative Distance of a directly connected route is 0.
• Lower the AD the more trustworthy.
• If the router learns about a route to a network from more than one source, it will install the
route with the lower administrative distance in the routing table.
RTA(config)#ip route 192.168.1.0 255.255.255.0 172.16.0.2
RTA#show ip route
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
Trang 15Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 29
Recursive Lookup
• The router knows it can get to 192.168.1.0/24 network by forwarding the packets to the
router at the ip address of 172.16.0.2
• How does the router know how to get to the ip address 172.16.0.2?
• It does a recursive lookup – first (1) by looking up the 192.168.1.0/24 network and
finding it needs to forward the packet to 172.16.0.2 – the router then (2) looks up the
172.16.0.0 network and sees it can forward it out the interface Serial 0.
RTA(config)#ip route 192.168.1.0 255.255.255.0 172.16.0.2
RTA#show ip route
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 30
Configuring all of the static routes
• Notice that the intermediate-address is always the next-hop ip
address.
• Good idea to do a “copy running-config startup-config” if everything is
working right.
• To verify the routes are in there, you can do a:
Router# show running-config
Trang 16Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 31
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
Trang 17Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 33
Recursive Lookup (continued)
• We can take this even further.
• One route can be used to resolve the route of another.
• It doesn’t matter how the routes are resolved, whether they are directly connected,
static or dynamic.
• Note: If an intermediate address cannot be resolved, that route and any routes it
affects are not installed in the routing table.
RTA(config)#ip route 10.1.0.0 255.255.0.0 192.168.1.2
RTA#show ip route
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
Static Routing – Recursive Lookups
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 34
Note regarding recursive route lookups
• Every route that does not reference an exit-interface must finally be resolved
via a route with an interface descriptor reference in the corresponding path
descriptor – a route with an exit-interface
• Static routes cannot be recursively resolved and will not be in the routing table
• Consider these three static routes:
Route1: ip route 10.1.0.0 255.255.0.0 20.1.1.1
Route2: ip route 20.1.0.0 255.255.0.0 30.1.1.1
Route3: ip route 30.1.0.0 255.255.0.0 10.1.1.1
• Route1 is resolved by Route2 which is resolved by Route3
• None of these routes are finally resolved via a route with an exit-interface
• This leads to endless recursion
• The routing table process will not permit these static routes to be entered in the
routing table
Static Routing – Recursive Lookups
Trang 18Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 35
• Need only to use only an exit interface
• For point-to-point serial interfaces, the next-hop address in the routing table
is never used by the packet-delivery procedure, so it is not needed (It could
even reference a bogus IP address.)
• Notice that the static route appears in the routing table as directly connected,
however it is still a static route with an administrative distance of 1
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
S 192.168.1.0/24 is directly connected, Serial0
C 192.168.2.0/24 is directly connected, Ethernet0
Static Routing – Point-to-Point Links
RTA(config)#ip route 192.168.1.0 255.255.255.0 172.16.0.2
RTA#show ip route
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Serial0
Trang 19Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 37
Using both an intermediate address instead and an exit-interface:
• Notice we changed 172.16.0.0 to an Ethernet link
• Static routes via broadcast links, it is best to use both an exit interface and
intermediate address
• This saves the router from having to do a recursive route lookup for the
intermediate address of 172.16.0.2, knowing the exit interface is Ethernet 1
Codes: C - connected, S - static,
C 172.16.0.0/16 is directly connected, Ethernet1
S 192.168.1.0/24 [1/0] via 172.16.0.2 Ethernet1
C 192.168.2.0/24 is directly connected, Ethernet0
Static Routing – Ethernet interfaces
Học viện mạng Cisco Bách Khoa - Website: www.ciscobachkhoa.com 38
Static Route Rule of Thumb
Static routes via point-to-point links
• It is best to configure static routes with only the exit interface
• For point-to-point serial interfaces, the next-hop address in the routing table is
never used by the packet-delivery procedure, so it is not needed (It could
even reference a bogus IP address.)
Static routes via broadcast networks such as Ethernet
• It is best to configure static routes with both the next-hop addressand the
exit-interface
Using only an intermediate address
• “What about static routes referencing only intermediate network address? In
short, try to avoid using them The reason is that these static routes are not
bound to any interface, rely on intermediate address resolvability, and thus
converge more slowly They can also create unexpected routing loops.” Alex
Zinin, Cisco IP Routing
NOTE: Most of our examples in this course do not follow either of these
rules-of-thumb – but you may want to use it on your network