Understanding Local IP Routing
Understanding Local IP Routing
Rick Graziani
Cabrillo College
graziani@[Link]
Routing
Host Can Send a Packet To Itself
The IP address [Link] is a loopback interface that is automatically
assigned to a TCP/IP host.
Any IP address within the network [Link]/8 refers to the local
host.
Useful for testing purposes.
C:\Users\Admin> ping [Link]
C:\Users\Admin>
3
Host Can Send a Packet To a Local Host
Hosts on the same network, sending host and receiving host share the
same network address.
.10
PC1 [Link]/24
.1
.11 G0/0
PC2
R1
.10 G0/1
PC3 .1
.11 [Link]/24
PC4
4
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.
.10
PC1 [Link]/24
.1
.11 G0/0
PC2
R1
.10 G0/1
PC3 .1
.11 [Link]/24
PC4
5
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 [Link]/24
.1
.11 G0/0
PC2
R1
.10 G0/1
PC3 .1
.11 [Link]/24
PC4
6
Default Gateway
7
Configuring Default Gateway on Hosts
The default gateway address can be configured on the host
manually or learned dynamically.
8
Default Gateway – ipconfig
C:\Users\Admin>ipconfig
Windows IP Configuration
C:\Users\Admin>
9
C:\Users\Admin> ipconfig /all
Windows IP Configuration
<Output omitted>
<Output omitted>
13
[Link]
• This is the local default route.
• Forwards all non-matching packets.
netstat IPv4 Information • All non-matching destination routes are sent to [Link]
(R1) exiting from the interface with IP address [Link].
[Link] – [Link]
• These loopback addresses all relate to the direct connection
and provide services to the local host.
[Link] - [Link]
• These addresses all relate to the host and local network.
• [Link] - The local network route address.
C:\Users\PC1> netstat -r • [Link] - The address of the local host.
• [Link] - The network broadcast address.
<Output omitted>
[Link]
IPv4 Route Table • Special multicast addresses reserved for use through either
the loopback interface or the host IP address.
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
[Link] [Link] [Link] [Link] 25
[Link] [Link] On-link [Link] 306
[Link] [Link] On-link [Link] 306
[Link] [Link] On-link [Link] 306
[Link] [Link] On-link [Link] 281
[Link] [Link] On-link [Link] 281
[Link] [Link] On-link [Link] 281
[Link] [Link] On-link [Link] 306
[Link] [Link] On-link [Link] 281
[Link] [Link] On-link [Link] 306
[Link] [Link] On-link [Link] 281
===========================================================================
[Link]
<Output omitted> • Limited broadcast IP address values for use through either the
loopback interface or the host IP address.
14
PC1 wants to ping PC2.
Which route will be chosen?
C:\Users\PC1> netstat -r
<Output omitted>
<Output omitted>
15
PC1 wants to ping [Link].
Which route will be chosen?
C:\Users\PC1> netstat -r
<Output omitted>
<Output omitted>
16
Default Gateway on a Switch S1# show running-config
Building configuration...
!
<output omitted>
service password-encryption
!
hostname S1
!
Interface Vlan1
ip address [Link]
!
ip default-gateway [Link]
<output omitted>
.10
PC1 [Link]/24 [Link]/24
.1 .1
G0/0 G0/1 S2
S1 R1
.11 .5
PC2
.10
PC1 [Link]/24 [Link]/24
.1 .1
S1 G0/0 G0/1 S2
.11 R1
PC2 .5
18
Router Routing Tables
Routers
21
Routing IP Packets
22
Routing IP Packets
23
Router Operational Goal
24
Routing IP Packets
25
Routing IP Packets
26
Routing IP Packets
27
Routing IP Packets
28
Routing Table Routes
29
Routing Table
Routes
31
IPv4 Router Routing Table
[Link]/24 [Link]/24
.10 G0/0 .10
PC1 [Link] /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1
[Link]/24 [Link]/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
[Link]/24
[Link]/24 [Link]/24
A B C
C [Link]/24 is directly connected, GigabitEthernet0/0
L [Link]/32 is directly connected, GigabitEthernet0/0
34
Remote Network Routing Table Entries
[Link]/24 [Link] [Link]/24
.10 G0/0 .10
PC1 [Link] /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1
[Link]/24 [Link]/24
35
Destination Network
[Link]/24 [Link]/24
.10 G0/0 .10
PC1 [Link] /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1
[Link]/24 [Link]/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
[Link]/24 [Link]/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
[Link]/24 [Link]/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
Which Route?
[Link]/24 [Link] [Link]/24
.10 G0/0 .10
PC1 [Link] /30
.1 .1
.225 .226
R1 S0/0/0 R2
.10 .1 .1 .10
PC2 G0/1
[Link]/24 [Link]/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
[Link]/24 [Link]/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
[Link]/24 [Link]/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
42
A Day in the Life of a Packet
43
A Day in the Life of a Packet
44
A Day in the Life of a Packet
45
A Day in the Life of a Packet
46
A Day in the Life of a Packet
47
A Day in the Life of a Packet
48
A Day in the Life of a Packet
49
A Day in the Life of a Packet
50
A Day in the Life of a Packet
51
A Day in the Life of a Packet
52
A Day in the Life of a Packet
53
A Day in the Life of a Packet
54
A Day in the Life of a Packet
55
A Day in the Life of a Packet
56
A Day in the Life of a Packet
57