Network Layer I
Objectives
• Design Issues of the Network Layer
• Routing Algorithms
01/31/2024 1
The OSI Layers
01/31/2024 2
OSI … TCP/IP Layers
01/31/2024 3
Hosts, Routers, & Switches
01/31/2024 4
The Network Layer (OSI)
• Within the context of the 4-Layer TCP/IP model,
this layer is known as Internet Protocol Layer (IP
Layer).
• The main function of this layer is routing packets
from the source to the destination machine.
01/31/2024 5
OSI … TCP/IP Layers
• Data unit from application layer….STREAM
• Down to the next layer…..SEGMENT (Transport)
• Down to the next layer…..DATAGRAM (IP Layer)
• Down to the next layer….. FRAMES/PACKETS
01/31/2024 6
Datagram Format
01/31/2024 7
Datagram Fields …1
• VERS specifies the version of IP that created the datagram. IPv4
or IPv6
• HLEN specifies the number of 32-bit words that makes up the
header
• SERVICE TYPE specifies how the datagram should be handled –
low delay, high throughput, high reliability…see diagram below
PRECEDENCE bits(3) specify prioritization of datagrams (0 for
low, and 7 for high). The D bit when set is for low delay, the T bit is
for high throughput, and the R is for high reliability
01/31/2024 8
Datagram Fields …2
• TOTAL LENGTH specifies the length of the entire IP datagram
measured in octets (including the header and data); 16bits =
65,535 octets datagram size
• TIME TO LIVE (TTL) is set to specify the time, in seconds, the
datagram should be hopping around. At every router it is
decreased by 1. It is discarded at 0 and an error message is sent
to the sending station.
• PROTOCOL specifies which high-level protocol was used to
create the datagram (TCP=6 or UDP=17)
• CHECKSUM used for error detection of datagram headers
• SOURCE & DESTINATION IP ADDRESSES IP addresses of sending
and receiving sites
01/31/2024 9
Overview of NL
routing algorithm Two processes in router:
Forwarding: forward packets
local routing table according to routing table
header value output link
Routing: change and fill routing table
0100 3
0101 2 according to routing algorithms
0111 2
1001 1
value in arriving
packet’s header
0111 1
3 2
01/31/2024 10
Overview of the Network Layer
• Sending: transport layer sends SEGMENTS to receiving
host – Network/IP layer
• Sending: IP layer encapsulates SEGMENTS to
DATAGRAMS
• Network layer protocols are implemented in every host -
router
• Router examines header fields in all IP datagrams
passing through it
01/31/2024 11
Packet Switching
• Store-and-Forward Packet Switching
ISP’s Equipment shown in the shaded oval with Routers A,B,C,D,E.
Router F is on a customer’s premises. H1 is connected straight to A,
whereas H2 is connected to E through F. p356 Tanenbaum
01/31/2024 12
Routers
Linksys wireless Router. Back view
01/31/2024 13
Linksys Router
Front View
01/31/2024 14
Linksys Router. Early model
01/31/2024 15
Routing
01/31/2024 16
Routing
Topics
• Wide Area Networks (WAN)
• Routing algorithms
01/31/2024 17
Wide Area Networks
• Wide area networks cover larger areas than
LANs, sometimes spanning continents
• WANs evolved by connecting existing
networks such as X.25, ATMs
• Whereas LANs are managed by individual
organisations, there are no central authority
responsible for fixing WAN problems.
01/31/2024 18
Wide Area Networks
01/31/2024 19
Early Switching Offices
From p55, Tanenbaum 5ed
01/31/2024 20
Generalized Network Topology
• Routing essentially means determining the path from
one node to another.
• Network protocols make the routing decisions
Suppose X sends something to Y. Two possible paths
are X-A-B-C-D-Y and X-A-Z-D-Y. Which is better? – The
answer depends on costs and time
01/31/2024 21
Routing Tables
• Network nodes use routing tables to get to intended
destinations.
• Routing tables do not specify the entire route. They
only specify the next node in a route to a specified
destination and the cost
• To get to F from A, A-B-F costs 9, and A-C-F costs 8
01/31/2024 22
Partial Routing Tables
01/31/2024 23
Graph Abstraction
Graph: G = (N,E)
N = set of routers = { u, v, w, x, y, z }
E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y),
(w,z), (y,z) }
01/31/2024 24
Graph Abstraction
Goal:
Find the shortest path from source to target
The meaning of “Shortest” depends on which
criteria is used:
Hops
Euclidean distances
Traffic condition (e.g., link utilization)
Cost of money
Approaches:
Distributed: distance vector routing algorithm
Centralized: link state routing algorithm
01/31/2024 25
Graph Abstraction Costs
• c(x,x’)= cost of
link (x,x’)
- e.g., c(w,z) = 5
Cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
01/31/2024 26
Types of Routing
The process by which a routing table is defined
is known as a routing algorithm.
There are several types. Major ones are
centralized routing, distributed routing, static
routing, and dynamic or adaptive routing.
01/31/2024 27
Centralized Routing
This means that all interconnection information is
generated and maintained at one single location
This single location then broadcasts this information
to all network nodes so that each defines its own
routing table.
A routing matrix is created that has rows (source
nodes) and columns (destination nodes)
01/31/2024 28
Routing Matrix
01/31/2024 29
Distributed Routing
In this routing, there is no central control.
Each node must determine and maintain its
routing information independently.
It does this by knowing its neighbors and
calculating the cost to get there.
01/31/2024 30
Static & Dynamic Routing
• Static routing means that once a node determines
its routing table, the node does not change it. The
assumption is that the conditions that led to the
table definition have not changed.
• Dynamic routing allows changes to be made to a
routing table when conditions with respect to cost
and congestion change
01/31/2024 31
Summary
Routin Type Advantages Disadvantages
Centralized Simple, one location assumes Failure of central location has a
control – Routing Control Center severe impact. Heavy traffic at RCC
Distributed Failure of a node or link has little Takes longer for a node to learn of
impact on providing routing info conditions in remote locations
Static Nodes do not have to execute Insensitive to changing conditions
routing algorithm repeatedly
Dynamic Provides the most current High overheads because nodes
information regarding link costs must maintain current
information. Transmitting info
regarding changing conditions
adds to network traffic.
01/31/2024 32
Distant Vector Algorithm (1)
Bellman-Ford Equation (dynamic
programming)
Define
dx(y) := cost of least-cost path from x to y
Then
dx(y) = min {c(x,v) + dv(y) }
where min is taken over all neighbors {v} of x
01/31/2024 33
Distant Vector Algorithm (2)
Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3
B-F equation says:
du(z) = min { c(u,v) + dv(z),
c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
Router that achieves minimum is next
hop in shortest path forwarding table
01/31/2024 34
Distant Vector Algorithm (3)
Dx(y) = estimate of least cost from x to y
Distance vector: Dx = [Dx(y): y є N ]
Node x knows cost to each neighbor v:
c(x,v)
Node x maintains Dx = [Dx(y): y є N ]
Node x also maintains its neighbors’
distance vectors
For each neighbor v, x maintains
Dv = [Dv(y): y є N ]
01/31/2024 35
Dijkstra’s Algorithm
This algorithm is sometimes called the shortest
path algorithm
It is a centralized, static algorithm
Requires that a node executing it have
information regarding link costs among network
nodes.
01/31/2024 36
Dijkstra’s Algorithm (2)
link costs known to all nodes Notation:
accomplished via “link c(x,y): link cost from node x to
state broadcast” y; = ∞ if not direct neighbors
all nodes have same info D(v): current value of cost of
computes least cost paths path from source to dest. v
from one node (‘source”) to p(v): predecessor node along
all other nodes path from source to v
gives routing table for that N': set of nodes whose least cost
node path definitively known
iterative: after k iterations,
know least cost path to k
dest.’s
01/31/2024 37
The End
01/31/2024 38