0% found this document useful (0 votes)
8 views75 pages

Ch06 Routing

The document explains the concept of routing in TCP/IP networks, detailing how hosts can send packets to themselves, local hosts, and remote hosts, emphasizing the role of the default gateway. It discusses the structure of host routing tables, the use of subnet masks, and the commands used to view and modify routing information. Additionally, it provides examples of IP addressing and the significance of the default gateway for communication beyond the local network.

Uploaded by

hala meltaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views75 pages

Ch06 Routing

The document explains the concept of routing in TCP/IP networks, detailing how hosts can send packets to themselves, local hosts, and remote hosts, emphasizing the role of the default gateway. It discusses the structure of host routing tables, the use of subnet masks, and the commands used to view and modify routing information. Additionally, it provides examples of IP addressing and the significance of the default gateway for communication beyond the local network.

Uploaded by

hala meltaha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 75

Routing

Host Can Send a Packet To Itself


• The IP address 127.0.0.1 is a loopback interface that is automatically assigned to a TCP/IP host.

• Any IP address within the network 127.0.0.0/8 refers to the local host.
• Used by the host different application to communicate with each other.
• Useful for testing purposes.

C:\Users\Admin> ping 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:


Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:


Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

C:\Users\Admin>

2
Host Can Send a Packet To a Local Host

Hosts are on the same network : sending host and receiving host share the same network address.

• PC1 (192.168.10.10 /24) sends a packet to PC2 (192.168.10.11 /24)


• Since they are both on the same network (192.168.10.x /24) the services of a default gateway
are not required.

MAC PC1 = Sender MAC PC2 = Destination Data

MAC add Port


MAC PC1 F0/0 .10
PC1 192.168.10.0/24
MAC PC2 F0/1
.1
MAC R1 F0/2 PC2
.11 G0/0

R1
.10 G0/1
PC3 .1

.11 192.168.11.0/24
PC4
3
Host Can Send a Packet To a Remote Host

 When a host on a remote network, the hosts do not share the same network address.
• A default gateway IP address is required.

 PC1 (192.168.10.10 /24) sends a packet to PC4 (192.168.11.11 /24)


• Since they are on different networks (192.168.10.x /24 and 192.168.11.x /24) the services
of a default gateway is required.

.10
PC1 192.168.10.0/24
.1
.11 G0/0
PC2

R1
.10 G0/1
PC3 .1

.11 192.168.11.0/24
PC4

4
Host Can Send a Packet To a Remote Host

• The default gateway is the device (i.e, router) that routes traffic from the local network to
remote networks.

• A host sending a packet to a remote host does not maintain routing information beyond
the local network.

• The default gateway maintains a routing table containing directly connected and remote
network route information.

.10
PC1 192.168.10.0/24
.1
.11 G0/0
PC2

R1
.10 G0/1
PC3 .1

.11 192.168.11.0/24
PC4

5
Default gateway

 Hosts doesn’t know the address of every device on the Internet it might communicate to.

 When a host needs to communicate with another network, an intermediary device, or router, acts as a
gateway to the other network.

 Each host contain a routing table that contains at the minimum a “gateway”.

 The default gateway IP address is typically a host IP address “router” which is on the same network as
the host itself which is used to forward packets out of the network.

• The host only has to be aware of:

• Its own network address

• Default gateway IP address to reach all devices outside its own network
Host Routing Table

netstat –r
Or route print

You can use the


following options for
the route command to
modify the routing
table contents:

route ADD ,route DELETE


, route CHANGE

• Host routing table usually only contains:


• Its own network address (directly connected network)
• Default gateway IP address
• Hosts usually do not have remote networks in their routing tables
• The router also needs a routing table that defines where to forward the packet next. This is called the next-hop address or default
route.

7
Subnet Mask

A host on the 192.168.1.0/24 network.”

• When the host is to send data , it uses the subnet mask to check if the destination packet is on the same
network.

• So, it knows whether to encapsulate the IP packet into an Ethernet frame with:

• The Destination MAC Address of the default gateway


• Must know the default gateway’s IP address , using ARP it will get the MAC

• The Destination MAC Address of the host with the Destination IP address of the packet.

8
IP Addresses – First look

Network Address 172.16.0.0

172.16.10.100/16

Network Address
192.168.1.0/30
172.16.10.55/16
ISP
Internet
192.168.1.2/30
172.16.1.1/16
192.168.1.1/30 172.16.10.3/16

9
IP Addresses – First look

Network Address 172.16.0.0

172.16.10.100/16 Gateway: 172.16.1.1

Network Address
192.168.1.0/30
172.16.10.55/16
ISP Gateway: 172.16.1.1

Internet
192.168.1.2/30
172.16.1.1/16
192.168.1.1/30 172.16.10.3/16 Gateway: 172.16.1.1

• All hosts in the same network will typically have the same default gateway IP address.

• The ipconfig or ifconfig commands at the command line are used in windows and Linux .

10
Default Gateway

11
Configuring Default Gateway on Hosts
• The default gateway address can be configured on the host manually or learned dynamically.

12
Default Gateway – ipconfig

C:\Users\Admin>ipconfig

Windows IP Configuration

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . : cisco.com


Link-local IPv6 Address . . . . . : fe80::b572:c6c:f983:cadc%11
IPv4 Address. . . . . . . . . . . : 192.168.11.99
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.11.1

C:\Users\Admin>

13
Host Routing Table
C:\Users\PC1> netstat -r

<Output omitted>

IPv4 Route Table


=========================================================
Active Routes:

• Every host on the network has its own routing table.


• The local routing table of the host typically contains:
• Direct connection - A route to the loopback interface (127.0.0.1) ( To it self).
• Local network route - The host’s network IP address.
• Local default route - The default route which is the IP address of the network interface of
the router that is connected to the local network. 0.0.0.0
• The route print or netstat -r command can be used to display the host routing
table on a Windows host.

14
netstat IPv4 Information Lists reachable networks

Lists a subnet mask used by the host to


determine the network / host portions of the IP
address.
Lists the address to get to a remote network. A
directly reachable destination displays “On-link”.

Lists the address of the physical interface used to


send the packet to the gateway.
C:\Users\PC1> netstat -r
Lists the cost of each route and is used to
determine the best route to a destination.
<Output omitted>

IPv4 Route Table


===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.10.1 192.168.10.10 25
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
192.168.10.0 255.255.255.0 On-link 192.168.10.10 281
192.168.10.10 255.255.255.255 On-link 192.168.10.10 281
192.168.10.255 255.255.255.255 On-link 192.168.10.10 281
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.10.10 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.10.10 281
===========================================================================

<Output omitted>

15
0.0.0.0
• This is the local default route.
• Forwards all non-matching packets.
netstat IPv4 Information • All non-matching destination routes are sent to 192.168.10.1
(R1) exiting from the interface with IP address 192.168.10.10.

127.0.0.0 – 127.255.255.255
•These loopback addresses all relate to the direct connection and
provide services to the local host.

192.168.10.0 - 192.168.10.255
• These addresses all relate to the host and local network.
• 192.168.10.0 - The local network route address.
C:\Users\PC1> netstat -r • 192.168.10.10 - The address of the local host.
• 192.168.10.255 - The network broadcast address.
<Output omitted>
224.0.0.0
• Special multicast addresses reserved for use through either
IPv4 Route Table
the loopback interface or the host IP address.
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.10.1 192.168.10.10 25
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
192.168.10.0 255.255.255.0 On-link 192.168.10.10 281
192.168.10.10 255.255.255.255 On-link 192.168.10.10 281
192.168.10.255 255.255.255.255 On-link 192.168.10.10 281
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.10.10 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.10.10 281
===========================================================================
255.255.255.255
<Output omitted> • Limited broadcast IP address values for use through either the
loopback interface or the host IP address.

16
PC1 wants to ping PC2.
Which route will be chosen?

C:\Users\PC1> netstat -r

<Output omitted>

IPv4 Route Table


===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.10.1 192.168.10.10 25
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
192.168.10.0 255.255.255.0 On-link 192.168.10.10 281
192.168.10.10 255.255.255.255 On-link 192.168.10.10 281
192.168.10.255 255.255.255.255 On-link 192.168.10.10 281
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.10.10 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.10.10 281
===========================================================================

<Output omitted>

17
PC1 wants to ping 10.10.10.10.
Which route will be chosen?

C:\Users\PC1> netstat -r

<Output omitted>

IPv4 Route Table


===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.10.1 192.168.10.10 25
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
192.168.10.0 255.255.255.0 On-link 192.168.10.10 281
192.168.10.10 255.255.255.255 On-link 192.168.10.10 281
192.168.10.255 255.255.255.255 On-link 192.168.10.10 281
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.10.10 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.10.10 281
===========================================================================

<Output omitted>

18
S1# show running-config
Building configuration...
!
Default Gateway on a Switch <output omitted>
service password-encryption
!
hostname S1
!
Interface Vlan1
ip address 192.168.10.5
!
ip default-gateway 192.168.10.1
<output omitted>

.10
PC1 192.168.10.0/24 192.168.11.0/24
.1 .1
G0/0 G0/1 S2
S1 R1
.11 .5
PC2

• A switch must (should) also be configured with a default gateway address, because packets
that originate from the switch are handled just like packets that originate from a host device.
• This is not used by normal user frames!
• Use the ip default-gateway global config command.

19
Default Gateway on a Switch
• For example, the administrator wants to Telnet to the S1.
• Without the default gateway configured on S1, packets from S1 would not be able to
reach the administrator at 192.168.11.10.
S1# show running-config
Building configuration...
!
<output omitted>
service password-encryption
!
hostname S1
!
Interface Vlan1
ip address 192.168.10.5
!
ip default-gateway 192.168.10.1
<output omitted>
.10
PC1 192.168.10.0/24 192.168.11.0/24
.1 .1
S1 G0/0 G0/1 S2
.11 R1
PC2 .5

20
Router Routing Tables
Packet Forwarding
• Routing is done packet-by-packet and hop-by-hop.
• At each hop, the router examines the destination IP address for each packet and then checks the
routing table for forwarding information
• The router will do one of 3 things with the packet: Forward it to the default route “gateway” , Forward
it to the destination host or Drop it

23
Routing IP Packets

 A router goal is to forward a packet destined to outside the network to its correct
destination!
 To do so, a router keeps track of local and remote networks.
 This information is stored in a routing table.

24
Routing IP Packets

25
Router Operational Goal

• Once a router receives a frame …

• Check the packet checksum


• De-capsulates the data link header.
• Examines the IP address to determine the destination network.
• Consults its routing tables to determine which of its interfaces it will use to send the frame.
• It encapsulates the frame and forwards it after adding the new checksum.

26
Routing IP Packets

27
Routing IP Packets

28
Routing IP Packets

29
Routing IP Packets

30
Routing Table Routes

31
Local Net2
R2
Local Net5
Directed Connected
Network ( Local R0
Network 1)

Loc
al N
et6
R0 connect directly with
Local Networks 1, 5,6
R3
R0 connect remotely with Local Net3
Network 2 via R2 where
as R0 connect remotely Local Net4
with Networks 3 and 4 via
R3
Routing Table Routes

Directed Connected Networks = Local Network


Remote Network= local network for next router

Directed connected route


Remote route

• The routing table of a router stores information about:


• Directly-connected routes:
• These routes come from the active router interfaces.
• Routers Add a directly connected route when an interface is configured with an IP
address and is activated.
• Remote routes:
• These routes come from remote networks connected to other routers.
• Routes to these networks can either be manually configured or dynamically learned
using a dynamic routing protocol.

33
Routers and the Network Layer

34
IPv4 Router Routing Table
192.168.10.0/24 10.1.1.0/24
.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

R1#show ip route ( Used to check the routing table of the router)


Codes: L - local, C - connected, S - static, 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, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1# 35
Directly Connected Interfaces
192.168.10.0/24
.10 G0/0
PC1 209.165.200.224 /30
.1
.225
R1 S0/0/0
.10 .1
PC2 G0/1

192.168.11.0/24

• Two routing table entries are automatically created when an active router interface is
configured with an IP address and subnet mask.
• C: Directed connected network
• Identifies a directly connected network.
• Directly connected networks are automatically created when an interface is
configured with an IP address and activated.
• L: Directed connected route
• Appeared in I.O.S (15) and might not appear before
• Identifies that this is a local route, the IP address of the interface.
• Local routes are automatically created when an interface is configured with an IP
address and activated.

36
Directly Connected Routing Table Entries

192.168.10.0/24 64.100.0.1 10.1.1.0/24


.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

A B C
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0

A Identifies how the network was learned by the router.


B Identifies the destination network and how it is connected.
C Identifies the interface on the router connected to the destination network.

37
Remote Network Routing Table Entries

192.168.10.0/24 64.100.0.1 10.1.1.0/24


.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0

A Identifies how the network was learned by the router.


B Identifies the destination network.
C Identifies the administrative distance (trustworthiness) of the route source.
D Identifies the metric to reach the remote network.
E Identifies the next hop IP address to reach the remote network.
F Identifies the amount of elapsed time since the network was discovered.
G Identifies the outgoing interface on the router to reach the destination network.

38
Destination Network
192.168.10.0/24 10.1.1.0/24
.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24
R1#show ip route
Codes: L - local, C - connected, S - static, 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, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1# 39
Next-Hop Address
192.168.10.0/24 10.1.1.0/24
.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24
R1#show ip route
Codes: L - local, C - connected, S - static, 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, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1# 40
PC1 wants to ping another host PC1 wants to ping R1 G0/0.1
on the same network.
Which Route?
192.168.10.0/24 64.100.0.1 10.1.1.0/24
.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

R1#show ip route
Codes: L - local, C - connected, S - static, 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, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1# 41
PC1 wants to ping PC2

Which Route?
192.168.10.0/24 64.100.0.1 10.1.1.0/24
.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

R1#show ip route
Codes: L - local, C - connected, S - static, 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, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1# 42
PC1 wants to ping the R2 WAN
Interface
Which Route?
192.168.10.0/24 64.100.0.1 10.1.1.0/24
.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

R1#show ip route
Codes: L - local, C - connected, S - static, 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, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1# 43
PC1 wants to ping 10.1.1.10

Which Route?
192.168.10.0/24 64.100.0.1 10.1.1.0/24
.10 G0/0 .10
PC1 209.165.200.224 /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1

192.168.11.0/24 10.1.2.0/24

R1#show ip route
Codes: L - local, C - connected, S - static, 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, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks


D 10.1.1.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
D 10.1.2.0/24 [90/2170112] via 209.165.200.226, 00:00:05, Serial0/0/0
192.168.10.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.10.0/24 is directly connected, GigabitEthernet0/0
L 192.168.10.1/32 is directly connected, GigabitEthernet0/0
192.168.11.0/24 is variably subnetted, 2 subnets, 3 masks
C 192.168.11.0/24 is directly connected, GigabitEthernet0/1
L 192.168.11.1/32 is directly connected, GigabitEthernet0/1
209.165.200.0/24 is variably subnetted, 2 subnets, 3 masks
C 209.165.200.224/30 is directly connected, Serial0/0/0
L 209.165.200.225/32 is directly connected, Serial0/0/0
R1# 44
More routing details….

The routing table stores three types of route entries:


• Directly-connected networks - These network route entries are active router interfaces. Routers add a
directly connected route when an interface is configured with an IP address and is activated. Each router
interface is connected to a different network segment. In the figure, the directly-connected networks in
the R1 IPv4 routing table would be 192.168.10.0/24 and 209.165.200.224/30.
• Remote networks - These network route entries are connected to other routers. Routers learn about
remote networks either by being explicitly configured by an administrator or by exchanging route
information using a dynamic routing protocol. In the figure, the remote network in the R1 IPv4 routing
table would be 10.1.1.0/24.
• Default route – Like a host, most routers also include a default route entry, a gateway of last resort. The
default route is used when there is no better (longer) match in the IP routing table. In the figure, the R1
IPv4 routing table would most likely include a default route to forward all packets to router R2.

45
More routing details….

Route information might be learned statically or dynamically.

• Static route

• Requires the administrator to have a good knowledge about how to reach all networks and/or
default route.
• Administrative cost - Manual configuration and maintenance of the routing table to ensure.
• If any network were modified , static routing requires the admin. to reconfigure the routing table.

• Dynamic routing – Using routing protocols “set of rules by which routers dynamically share their
routing information “.

• When a router receives information about new or changed routes, it updates its own routing table
and, in turn, passes the information to other routers.

46
Static Routing
Dynamic Routes Automatically:
• Discover remote networks
• Maintain up-to-date information
• Choose the best path to the destination
• Find new best paths when there is a topology change
Dynamic routing can also share static default routes with the other routers.

 When a router is manually configured with a static route or learns about a remote network
dynamically using a dynamic routing protocol, the remote network address and next hop address
are entered into the IP routing table. As shown in the figure, if there is a change in the network
topology, the routers will automatically adjust and attempt to find a new best path.

47
Routing Protocols

• Routing Information Protocol (RIP)


• Enhanced Interior Gateway Protocol (EIGRP)
• Open Shortest Path First (OSPF)
• Some of the protocols do not understand classless IP
addresses , these are called classfull protocols as RIP V1
and IGRP.”Other are classless”

Costs of using routing protocols


 The exchange of dynamic route information adds overhead that consumes network bandwidth ..

 Routers employing these protocols must have sufficient processing capacity to both implement the
protocol's algorithms and to perform timely packet routing and forwarding
A Quick Look at Routing
Routing – First Look

Network 192.168.1.0/24

Network 192.168.2.0/24
192.168.1.254/24

C 192.168.2.0/24 is direction connected, FastEthernet0/1

Routers know about routes either statically or dynamically using a routing protocol:
• Directly connected networks (C):
• Network addresses of its interfaces
• Remote networks : learned by static or dynamic Routing Protocol (R = RIP)

50
Routing – First Look

Network 192.168.1.0/24

Network 192.168.2.0/24
192.168.1.254/24

C 192.168.2.0/24 is direction connected, FastEthernet0/1

• Routers know about:


• Directly connected networks (C):
• Network addresses of its interfaces
• When a router is configured with the IP address/mask on an interface the router knows that it
has an interface which is part of that network.
• This is just like a host that is configured with an IP address/mask. (coming)
51
Route: A Path to a Network

Destination Network
Next Hop

Metric

• Remote networks are networks not directly connected to the router (manual configuration or learned
dynamically).
Routing Table

• The router matches the destination address in the packet header with the destination network of
a route in the routing table and forwards the packet to the next-hop router specified by that
route.

53
Destination Network - Routing Table Entries

• The hierarchical nature of Layer 3 addressing means that…

• One route entry could refer to a large general network.


• Another entry could refer to a subnet of that same network.
• When forwarding a packet, the router will select the most specific route.
Destination Network - Routing Table Entries

• The default route in a routing table performs as a default gateway in a PC.

• If a route for a packet cannot be found in the routing table, and a default route is present, that
route will be used to forward the packet.

• A next-hop is the address of the device that will process the packet next.
Destination Network - Routing Table Entries
Destination Network
Next Hop

Metric

• Some routes can have multiple next-hops. This indicates that there are multiple paths to the same
destination network . The metric is used to decide which route appears on the routing table.
• If a packet arrives destined for 207.23.124.56, the router would check the table in the following order:
• 10.0.0.0
• 10.1.1.0
• 10.1.0.0
• 192.168.1.0 Since the route doesn’t exist and a default route is
configured, the packet would be forwarded to the
• 0.0.0.0
next hop.
Packet Forwarding: Route Found

Data for Host 10.1.2.2 /


24

L2 IP TCP DATA L2

Network 10.1.1.0
IP TCP DATA

Network 10.1.2.0

IP Address 10.1.2.2 is on
network 10.1.2.0
L2 IP TCP DATA L2
Packet Forwarding: Default Route

Data for Host 207.1.1.1 /


24

L2 IP TCP DATA L2

Network 10.1.1.0
IP TCP DATA

Network 10.1.2.0

IP Address 207.1.1.1 is on
network 207.1.1.0
L2 IP TCP DATA L2
Packet Forwarding: Route Not Found

?
Data for Host 207.1.1.1 /
24

L2 IP TCP DATA L2

Network 10.1.1.0
IP TCP DATA

Network 10.1.2.0

IP Address 207.1.1.1 is on
network 207.1.1.0
A Day in the Life of a Packet

60
A Day in the Life of a Packet

61
A Day in the Life of a Packet

62
A Day in the Life of a Packet

63
A Day in the Life of a Packet

64
A Day in the Life of a Packet

65
A Day in the Life of a Packet

66
A Day in the Life of a Packet

67
A Day in the Life of a Packet

68
A Day in the Life of a Packet

69
A Day in the Life of a Packet

70
A Day in the Life of a Packet

71
A Day in the Life of a Packet

72
A Day in the Life of a Packet

73
A Day in the Life of a Packet

74
A Day in the Life of a Packet

75

You might also like