ROUTING
ROUTING
ROUTING
Routing Fundamentals
Things we’ll cover
●
What is routing?
●
The routing table on a Cisco router
→Connected and Local routes
●
Routing fundamentals (route selection)
What is routing?
●
Routing is the process that routers use to determine the path that IP packets should take over a network to reach their destination.
→Routers store routes to all of their known destinations in a routing table.
→When routers receive packets, they look in the routing table to find the best route to forward that packet.
●
There are two main routing methods (methods that routers use to learn routes):
Dynamic Routing: Routers use dynamic routing protocols (ie. OSPF) to share routing information with each other automatically and build
their routing tables.
→We will cover this later in the course.
next-hop = the next router in
Static Routing: A network engineer/admin manually configures routes on the router. the path to the destination.
→We will cover this in the next video.
●
A route tells the router: to send a packet to destination X, you should send the packet to next-hop Y.
→or, if the destination is directly connected to the router, send the packet directly to the destination.
→or, if the destination is the router’s own IP address, receive the packet for yourself (don’t forward it).
●
In the next video, we will configure static routes on the routers to allow PC1 and PC4 to communicate with each other.
→This video will focus on two types of routes automatically added to a router’s routing table.
R1 R3 WAN (Wide Area Network) =
LAN WAN a network that extends over a
G0/0 G0/0 large geographical area.
PC1 G0/2
.10 .1 .1 192.168.13.0/24 .3
G0/1 .1 .3 G0/1
192.168.1.0/24 192.168.12.0/24 192.168.34.0/24 LAN
G0/0 192.168.4.0/24
.2 .4 G0/1
.4 .10
R2 G0/1 G0/0 G0/2 PC4
.2 192.168.24.0/24 .4 R4
R1 Pre-configurations (IP Addresses)
R1# conf t
R1(config)# interface g0/0
R1(config-if)# ip address 192.168.13.1 255.255.255.0 There is no need to use exit to return to global config
R1(config-if)# no shutdown mode before entering interface g0/1. You can use
the interface g0/1 command directly from interface
R1(config-if)# interface g0/1 config mode.
R1(config-if)# ip address 192.168.12.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# interface g0/2
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown
R1# show ip int br
Interface IP-Address OK? Method Status Protocol
GigabitEthernet0/0 192.168.13.1 YES manual up up
GigabitEthernet0/1 192.168.12.1 YES manual up up
GigabitEthernet0/2 192.168.1.1 YES manual up up
GigabitEthernet0/3 unassigned YES NVRAM administratively down down
R1 R3
●
A local route is a route to the exact IP address configured on the interface.
●
A /32 netmask is used to specify the exact IP address of the interface.
→/32 means all 32 bits are ‘fixed’, they can’t change.
●
Even though R1’s G0/2 is configured as 192.168.1.1/24, the connected route is to 192.168.1.1/32.
●
R1 knows: “If I receive a packet destined for this IP address, the message is for me”.
R1 R3
●
A packet destined for 192.168.1.1 is matched by both routes: When R1 receives a packet destined for 192.168.1.1,
192.168.1.0/24 it will select the route to 192.168.1.1/32.
→R1 will receive the packet for itself, rather than
192.168.1.1/32
forward it out of G0/2.
Local route = keep the packet, don’t forward
●
Which route will R1 use for a packet destined for 192.168.1.1?
→It will choose the most specific matching route.
●
The route to 192.168.1.0/24 includes 256 different IP addresses (192.168.1.0 – 192.168.1.255)
●
The route to 192.168.1.1/32 includes only 1 IP address (192.168.1.1)
→This route is more specific.
●
Most specific matching route = the matching route with the longest prefix length.
R1 PACKET R3
Dst. IP: 192.168.1.1
●
These three lines are not routes. They mean the following:
● 192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
→In the routing table, there are two routes to subnets that fit within the 192.168.1.0/24 Class C network, with two different netmasks (/24 and /32).
● 192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
→In the routing table, there are two routes to subnets that fit within the 192.168.12.0/24 Class C network, with two different netmasks (/24 and /32).
● 192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
→In the routing table, there are two routes to subnets that fit within the 192.168.13.0/24 Class C network, with two different netmasks (/24 and /32).
●
We will cover subnetting soon (in another video)! For now, I just wanted to point out that these three lines are not routes.
R1 R3
R1
.1 .1
192.168.1.0/24 192.168.13.0/24
PACKET 1 G0/2 G0/0
Dst. IP: 192.168.1.1
.1
G0/1
1) Dst. IP 192.168.1.1
→Receive for myself
192.168.12.0/24
Route Selection Practice (2)
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/2
L 192.168.1.1/32 is directly connected, GigabitEthernet0/2
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, GigabitEthernet0/1
L 192.168.12.1/32 is directly connected, GigabitEthernet0/1
192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.13.0/24 is directly connected, GigabitEthernet0/0
L 192.168.13.1/32 is directly connected, GigabitEthernet0/0
R1
.1 .1
192.168.1.0/24 192.168.13.0/24
PACKET 2 G0/2 G0/0
Dst. IP: 192.168.13.3
.1
G0/1
1) Dst. IP 192.168.1.1
→Receive for myself
2) Dst. IP 192.168.13.3
192.168.12.0/24 →Send to the destination (connected to G0/0)
Route Selection Practice (3)
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/2
L 192.168.1.1/32 is directly connected, GigabitEthernet0/2
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, GigabitEthernet0/1
L 192.168.12.1/32 is directly connected, GigabitEthernet0/1
192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.13.0/24 is directly connected, GigabitEthernet0/0
L 192.168.13.1/32 is directly connected, GigabitEthernet0/0
R1
.1 .1
192.168.1.0/24 192.168.13.0/24
G0/2 G0/0
.1
G0/1
1) Dst. IP 192.168.1.1
→Receive for myself
2) Dst. IP 192.168.13.3
192.168.12.0/24 →Send to the destination (connected to G0/0)
3) Dst. IP 192.168.1.244
→Send to the destination (connected to G0/2)
PACKET 3
Dst. IP: 192.168.1.244
Route Selection Practice (4)
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/2
L 192.168.1.1/32 is directly connected, GigabitEthernet0/2
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, GigabitEthernet0/1
L 192.168.12.1/32 is directly connected, GigabitEthernet0/1
192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.13.0/24 is directly connected, GigabitEthernet0/0
L 192.168.13.1/32 is directly connected, GigabitEthernet0/0
R1
.1 .1
192.168.1.0/24 192.168.13.0/24
G0/2 G0/0
PACKET 4
Dst. IP: 192.168.12.1
.1
G0/1
1) Dst. IP 192.168.1.1
→Receive for myself
2) Dst. IP 192.168.13.3
192.168.12.0/24 →Send to the destination (connected to G0/0)
3) Dst. IP 192.168.1.244
→Send to the destination (connected to G0/2)
4) Dst. IP 192.168.12.1
→Receive for myself
Route Selection Practice (5)
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/2
L 192.168.1.1/32 is directly connected, GigabitEthernet0/2
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, GigabitEthernet0/1
L 192.168.12.1/32 is directly connected, GigabitEthernet0/1
192.168.13.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.13.0/24 is directly connected, GigabitEthernet0/0
L 192.168.13.1/32 is directly connected, GigabitEthernet0/0
R1
.1 .1
192.168.1.0/24 192.168.13.0/24
G0/2 G0/0
PACKET 5
Dst. IP: 192.168.4.10
X
.1
G0/1
1) Dst. IP 192.168.1.1
→Receive for myself
2) Dst. IP 192.168.13.3
192.168.12.0/24 →Send to the destination (connected to G0/0)
3) Dst. IP 192.168.1.244
→Send to the destination (connected to G0/2)
4) Dst. IP 192.168.12.1
→Receive for myself
5) Dst. IP 192.168.4.10
→Drop (no route)
Summary
●
Routers store information about destinations they know in their routing table.
→When they receive packets, the look in the routing table to find the best route to forward the packet.
●
Each route in the routing table is an instruction:
→To reach destinations in network X, send the packet to next-hop Y (the next router in the path to the destination).
→If the destination is directly connected (Connected route) send the packet directly to the destination.
→If the destination if your own IP address (Local route), receive the packet for yourself.
*We will look at how next-hops work in the next video on static routes.
●
When you configure an IP address on an interface and enable the interface, two routes are automatically added to the routing table:
Connected route (code C in the routing table): A route to the network connected to the interface.
→ie. if the interface’s IP is 192.168.1.1/24, the route will be to 192.168.1.0/24.
→Tells the router: “To send a packet to a destination in this network, send it out of the interface specified in the route”.
Local route (code L in the routing table): A route to the exact IP address configured on the interface.
→ie. if the interface’s IP is 192.168.1.1/24, the route will be to 192.168.1.1/32.
→Tells the router: “Packets to this destination are for you. You should receive them for yourself (not forward them)”.
●
A route matches a destination if the packet’s destination IP address is part of the network specified in the route.
→ie. a packet to 192.168.1.60 is matched by a route to 192.168.1.0/24, but not by a route to 192.168.0.0/24.
●
If a router receives a packet and it doesn’t have a route that matches the packet’s destination, it will drop the packet.
→This is different than switches, which flood frames if they don’t have a MAC table entry for the destination.
●
If a router receives a packet and it has multiple routes that match the packet’s destination, it will use the most specific matching route to
forward the packet.
→Most specific matching route = the matching route with the longest prefix length.
→This is different than switches, which look for an exact match in the MAC address table to forward frames.
Things we covered
●
What is routing?
●
The routing table on a Cisco router
→Connected and Local routes
●
Routing fundamentals (route selection)
Quiz 1
The IP address configured on a router interface will appear in the routing table as what kind of
route?
a) Static
b) Connected
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/2
c) Local L 192.168.1.1/32 is directly connected, GigabitEthernet0/2
d) Dynamic
Quiz 2
Examine R1’s routing table. What will it do when it receives a packet destined for 192.168.3.25?
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.1.0/24 is directly connected, GigabitEthernet0/0
L 192.168.1.1/32 is directly connected, GigabitEthernet0/0
192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.2.0/24 is directly connected, GigabitEthernet0/1
L 192.168.2.1/32 is directly connected, GigabitEthernet0/1
192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.3.0/24 is directly connected, GigabitEthernet0/2
L 192.168.3.25/32 is directly connected, GigabitEthernet0/2