Title: IP Routing
1IP Routing
Short Course on TCP/IP
- Dr. Nasir Darwish
- darwish_at_kfupm.edu.sa
- Information and Computer Science Department
- King Fahd University of Petroleum and Minerals
- Dhahran, Saudi Arabia
2 IP Network Addressing
IP is Internetwork Protocol. Each Host (and
Router) network interface uses a 32-bit
IP-address, part of which is a network
address. The network part of the address is same
for all hosts on the same physical network (e.g.
LAN).
32 bits
8, 16, or 24 bits from InterNIC (or locally
chosen)
Varies with subnet mask
Network ID Host ID
Router
Physical LAN
3IP Address Classes
- Class Net Part Host Part First Byte
Value Subnet Mask - A 8 24 1 - 127 255.0.0.0
- B 16 16 128 - 191 255.255.0.0
- C 24 8 192 - 223 255.255.255.0
-
4IP Routing Next Hop?
Which router (hop) to forward the IP packet to
next?
5Router Basic Function
- The router matches the IP destination address of
an incoming packet with an entry in his routing
table - The router then encapsulates the IP packet in an
outgoing frame addressed to the hardware address
of next router (or to destination host)
200.1.1.1
196.1.1.1
data
A
R0
200.1.1.1
196.1.1.1
data
R1
B
200.1.1.1
196.1.1.1
R0
R1
Host B
Host A
A/R0 (R1/B) From/To Data Link layer
addresses Note IP addresses are unchanged
6Routing Table at a Host
202.10.10.0
173.4.0.0
201.12.5.0
202.10.10.3
173.4.0.1
201.12.5.1
200.1.1.10
200.1.1.11
200.1.1.12
200.1.1.1
- Dest. Network Subnet Mask Next Hop
200.1.1.0 255.255.255.0 Directly Conn. - 200.12.5.0 255.255.255.0 200.1.1.10
- 202.10.10.0 255.255.255.0 200.1.1.11
- 173.4.0.0 255.255.0.0 200.1.1.12
other hosts
Host A
7Routing Table at a Router
202.10.10.0
173.4.0.0
201.12.5.0
202.10.10.3
173.4.0.1
P2
201.12.5.1
R0
200.1.1.10
200.1.1.11
P1
200.1.1.12
Routing Table for R0
200.1.1.0
- Dest. Network Subnet Mask Next Hop Interface
- 200.1.1.0 255.255.255.0 Directly Conn. P1
- 201.12.5.0 255.255.255.0 Directly Conn. P2
- 202.10.10.0 255.255.255.0 200.1.1.11 P1
- 173.4.0.0 255.255.0.0 200.1.1.12 P1
8Processing Steps for Incoming Packet
- Incoming packets wait in a queue (memory buffer).
That is why a router is a store-and-forward of
packets in contrast to a bridge which is a
store-and-forward of frames. - The header is checked for errors by recomputing
checksum and matching it with the received
checksum. Next, verify that various field values
in the IP header are valid. If not OK, drop the
packet and send ICMP message to source host. - Decrement TTL and drop packet if TTL reaches 0,
send ICMP message to source host otherwise,
update the header checksum. - The router compares the routing table Dest.
Network entry with NetID part of IP-DA (Is IP-DA
and Mask Dest. Network?) until a matching entry
is found. Then the router uses the information in
the matching row to determine the data-link layer
(DL) destination address for the outgoing frame
-- i.e., It may use ARP to find the DL address of
next router (or destination host) from its IP
address. - The packet is then encapsulated in an outgoing
frame whose DL-DA is that found in step 3 DL-SA
is that of the outgoing interface.
9TCP/IP 5-Layer Model
Application Transport Network Data Link Physical
Application Transport Network Data Link
Physical
TCP
Network Data Link Physical
IP
Computer B
Computer A
IP Router
10IP-Layer Operation
B
Y
X
C
A
X
Y
Application TCP IP Data Link Physical
Application TCP IP Data Link Physical
TCP is end-to-end layer
IP Data Link Physical
IP Data Link Physical
IP Data Link Physical
A
B
C
11Static versus Dynamic Routes
- Static Route uses a protocol route that a network
administrator enters into the router. - Dynamic Route uses a route that a network routing
protocol adjusts automatically for topology or
traffic changes.
12Static Route Example
Point-to-point or circuit-switched connection
Only a single network connection with no need for
routing updates
local network
- Fixed route to address reflects administrators
knowledge.
13Default Route Example
Company X
B
A
Internet
Routing Table If no entry for destination net Try
Router B (default router)
- Use if next hop is not explicitly listed in the
routing table
14Adapting to Topology Change
- An alternate route can substitute for a failed
route.
15Dynamic Routing Operations
Network Layer
Routing Protocol
Routing Protocol
A router passes routing information to its
neighbors
Routing Table
Routing Table
16Dynamic Routing Operations
- Routing protocol maintains and distributes
routing information. - The success of dynamic routing depends on two
basic router functions - Maintenance of routing table
- Timely distribution of knowledge -- in the form
of routing updates -- to other routers - Dynamic routing relies on a routing protocol to
disseminate knowledge.
17Representing Distance with Metrics
- The metrics most commonly used by routers are
- Bandwidth
- Delay
- Load
- Reliability
- Hop Count
- Cost
18Classes of Routing Protocols
- Most routing algorithms can be classified as
conforming to one of two basic algorithms
distance vector and link state. - The distance vector routing approach determines
the direction (vector) and distance to any link
in the internetwork. - The link-state approach re-creates the exact
topology of the entire internetwork (or at least
the partition in which the router is situated).
19One Issue Time to Convergence
- Convergence occurs when all routers use a
consistent perspective of network topology - After a topology changes, routers must recompute
routes, which disrupts routing - The process and time required for router
reconvergence varies in routing protocols
20Distance Vector Concept
- Distance vector based routing algorithm (also
known as Bellman-Ford algorithms) - passes periodic copies of a routing table from
router to router. - Regular updates between routers communicate
topology changes. - Each router receives a routing table from its
direct neighbor. For example, in the graphic,
router B receives information from router A.
Router B adds a distance vector number (such as a
number of hops) increasing the distance vector,
then passes the routing table to its other
neighbor, C. The process continues between
direct-neighbor routers. - In this way, the algorithm accumulates network
distances so it can maintain a database of
internetwork topology information.
21Distance Vector Network Discovery
A
B
C
W
Z
X
Y
Routing Table W 0 X 0 Y
1 Z 2
Routing Table Y 0 Z 0 X
1 W 2
22Distance Vector Network Discovery
- Each router using distance vector routing begins
by identifying its own neighbors. In the graphic,
the port to each directly connected network is
shown as having a distance of 0. - As the distance vector network discovery process
proceeds, routers discover the best path to
destination networks based on accumulated metrics
from each neighbor.
23Routing Information Protocol (RIP)
- Included as routed (route-dee) program which is
part of Berkley's Unix TCP/IP. - RIP was in widespread use years before it was
standardized in as RFC 1058 in 1988. Version 2 of
RIP was completed in 1994. - Uses Hop Count ( of routers to destination) as a
distance metric. - Each router broadcasts its routing table every
30-sec. - Routes are not updated beyond a hop count of 15
- RIP messages Use UDP packets with source and
destination ports set to 520
24RIP Update Mechanism
- When a router receives a neighbor's table, it
examines it entry by entry - Adds 1 (or sometimes more if the corresponding
link is slow) to the metric - If the destination is new, it is added to the
local routing table - If the destination is known before and the update
provides a smaller metric, the existing entry in
the local routing table is replaced - If for existing non-direct entry no router update
info. Is received within three cycles (90 sec),
the entry is removed
25Triggered Updates
- To speed up the process of discovering change
- Whenever a router changes its metric for a route,
it broadcasts the change. This may lead to more
triggered updates by other routers - It is best that whenever an update occurs , that
the router waits for some short time and send
updates in batches - If a destination is marked unreachable it
includes a hold down rule (time period) during
which updates are ignored. This prevents
misinformation from spreading.
26Incorrect Route Info Lead to Loops
A
B
C
D
10 hops
link broken
Network N
Info. at A, B, C (before link is broken)
Network N, Metric2 After link is broken, what if
Router D gets a scheduled update from A with the
old info.
Network N Next HopA Metric 3
D sends traffic for Network N to A which sends to
D which sends to A ---
27Split Horizon Technique
- The router records the interface over which a new
route is received. The router does not send this
update back through the interface on which it is
received - In the previous example, Router A updates on the
shown interface will not include entries for
Network N
28Break