You are on page 1of 45

Computer Networks

Part 5 : Network Layer


Protocol Architecture
LAN/WAN/ptp-link
LAN LAN

Router Router

TCP
TCP
IP
IP IP IP
LLC
LLC LLC LLC
MAC MAC
MAC MAC
PHY
PHY PHY PHY PHY PHY
Network layer : Introduction

• Network layer is concerned with end-to-end


transmission (source - destination)
 Addressing : identification of nodes
 routing : determine routes data has to follow
 internetworking : source and destination belong to
different network.
IP Addressing (1)

• IP address is 32 bits; 3 classes


 class A : 7 net-id + 24 host-id (limited number of large
networks)
 class B : 14 net-id + 16 host-id (average size networks; this
class is most used)
 class C : 21 net-id + 8 host-id (high number of small
networks)
• Example
 00001010 00000000 00000000 00000000 : 10.0.0.0
 11000000 00000000 00000001 11111111 : 192.0.1.155
IP addressing (2)

class
1.0.0.0 to
A 0 network host 127.255.255.255

B network 128.0.0.0 to
10 host
191.255.255.255
192.0.0.0 to
C 110 network host
239.255.255.255
240.0.0.0 to
D 1110 multicast address
247.255.255.255
32 bits
IP Addressing (3)

• Network may be collection of many LANs


• Subnet addressing
• host-id : subnet-id and local host-id
 subnet-id : identity of LAN
 local host-id : identity of host
• IP addresses managed by Internet Corporation for Assigned
Names and Numbers (ICANN)
• In mobile environment : addressing problem
IP addressing: Classless Addressing
• Goal: extend address space
• Invented in 1990s
• Works throughout Internet
• Accommodates
 Original classful addresses
 Subnet addresses
 Other forms
• Technique
 Allow arbitrary prefix size
 Represent network address as pair

(address, mask_size)
• Known as Classless Inter-Domain Routing (CIDR)
Classless Inter-Domain Routing
• Uses slash notation
• Example
128.211.0.0/17
Means that the boundary between prefix and suffix occurs after the first
17 bits
• Each network can be as large or small as needed (power of two)
IP addressing: example (1)

223.1.1.1

223.1.2.1
223.1.1.2
223.1.1.4 223.1.2.9

223.1.2.2
223.1.1.3 223.1.3.27

LAN

223.1.3.1 223.1.3.2
IP addressing: example (2)
223.1.1.2
223.1.1.1 223.1.1.4

223.1.1.3

223.1.9.2 223.1.7.0

223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0

223.1.2.6 223.1.3.27

223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2


Routing: terminology
• Forwarding
 Refers to datagram transfer
 Performed by host or router
 Uses routing table
• Routing
 Refers to propagation of routing information
 Performed by routers
 Inserts / changes values in routing table
The Internet Network layer
Host, router network layer functions:

Transport layer: TCP, UDP

Routing protocols IP protocol


•path selection •addressing conventions
•RIP, OSPF, BGP •datagram format
Network •packet handling conventions
layer routing
table ICMP protocol
•error reporting
•router “signaling”

Link layer

physical layer
Forwarding: Getting a datagram from source to
destination (1)
routing table in A
Dest. Net. next router Nhops
223.1.1 1
223.1.2 223.1.1.4 2
IP datagram: 223.1.3 223.1.1.4 2
misc source dest A
data 223.1.1.1
fields IP addr IP addr
223.1.2.1
• datagram remains 223.1.1.2
223.1.1.4 223.1.2.9
unchanged, as it
B
travels source to 223.1.2.2
223.1.1.3 223.1.3.27 E
destination
223.1.3.2
• address fields of 223.1.3.1

interest here
Forwarding: Getting a datagram from source to
destination (2)
misc
data
fields 223.1.1.1 223.1.1.3 Dest. Net. next router Nhops
223.1.1 1
Starting at A, given IP 223.1.2 223.1.1.4 2
datagram addressed to 223.1.3 223.1.1.4 2
B: A 223.1.1.1
• look up net. address of B 223.1.2.1
223.1.1.2
• find B is on same net. as A
223.1.1.4 223.1.2.9
• link layer will send B
223.1.2.2
datagram directly to B 223.1.1.3 223.1.3.27 E
inside link-layer frame
223.1.3.1 223.1.3.2
 B and A are directly
connected
Forwarding: Getting a datagram from source to
destination (3)

misc Dest. Net. next router Nhops


data
fields 223.1.1.1 223.1.2.2
223.1.1 1
Starting at A, dest. E: 223.1.2 223.1.1.4 2
• look up network address of E 223.1.3 223.1.1.4 2
• E on different network
A 223.1.1.1
 A, E not directly attached
• routing table: next hop router to E 223.1.2.1
223.1.1.2
is 223.1.1.4 223.1.2.9
223.1.1.4
• link layer sends datagram to router B
223.1.1.4 inside link-layer frame 223.1.2.2
223.1.1.3 223.1.3.27 E
• datagram arrives at 223.1.1.4
• continued….. 223.1.3.1 223.1.3.2
Forwarding: Getting a datagram from source to
destination (4)
Dest. next
misc network router Nhops interface
data
fields 223.1.1.1 223.1.2.2
223.1.1 - 1 223.1.1.4
Arriving at 223.1.4, destined for 223.1.2 - 1 223.1.2.9
223.1.2.2 223.1.3 - 1 223.1.3.27
• look up network address of E
A 223.1.1.1
• E on same network as router’s
interface 223.1.2.9 223.1.2.1
223.1.1.2
 router, E directly attached
223.1.1.4 223.1.2.9
• link layer sends datagram to B
223.1.2.2 inside link-layer frame via 223.1.2.2
interface 223.1.2.9 223.1.1.3 223.1.3.27 E
• datagram arrives at 223.1.2.2!!! 223.1.3.2
223.1.3.1
(hooray!)
Routing : terminology

• Two classes
 Non-adaptive routing algorithms : independent of current
situation = static routing algorithms
 Adaptive algorithms : based on current network state
(topology, traffic situation)
• centralized : global information collected and used to
take routing decisions
• isolated : each host takes decisions based on locally
available information (e.g. length of buffers)
• distributed : mixture of local and global information are
used to take routing decisions
Routing: Shortest Path Algorithm

• Network is presented as graph


 nodes : hosts
 lines : communication links
• Length of a path
 number of hops
 geographical distance
 waiting time and transmission time
 combination of different notions
• Example : Dijkstra’s shortest path algorithm
Dijkstra’s Algorithm
7
B C

2 3
2 3

A E 2 F D

6 1 2 2
4
G H
Multipath Routing

• Multipath routing
 several candidates to be used as path
 may improve reliability
• first path : shortest path
• second path : shortest path disjunct with first path
 improves load balancing
• circuit switching
• packet switching
Multipath Routing : Example

A B C D

E F G H

I J K L
Centralized Routing
• Routing Control Center :
 RCC receives information from nodes
 RCC computes routes leading to routing tables
 RCC distributes periodically routing tables
• Advantages
 RCC uses global information to compute routes
 hardware/software only in RCC
• Disadvantages
 reliability : if RCC fails, network fails
 inconsistencies due to long distances
 overhead due to routing messages
Isolated Routing

• Hot-Potato Algorithm
 route packet to line with shortest queue
 combine with other routing strategies
• Backward Learning Algorithm
 packet contains number of hops
 use this information to determine routes
Flooding

• Transmit packet to all outgoing lines


• Elimination of redundant packets
 hop-counter
 sequence number
 selective flooding (according to e.g. direction of
destination)
Distance Vector Routing (= distributed)

• Each node A maintains tabel (X,l,Y)


 X : destination node
 l : length between A and X via Y
 Y : neighbor of A used to reach X
• This routing table is sent to its neighbors who
use it to update their routing tables
Distance Vector Routing: example

1
B C cost to destination via
7 E
A 8 2 D () A B D
1
E D A 1 14 5
2

E D B 7 8 5

destination
D (C,D) = c(E,D) + minw {D (C,w)}
= 2+2 = 4
E D
C 6 9 4
D (A,D) = c(E,D) + minw {D (A,w)}
= 2+3 = 5 loop! D 4 11 2
E B
D (A,B) = c(E,B) + minw{D (A,w)}
= 8+6 = 14 loop!
Distance table gives routing table

cost to destination via


E Outgoing link
D () A B D to use, cost

A 1 14 5 A A,1

B 7 8 5 B D,5
destination

destination
C 6 9 4 C D,4

D 4 11 2 D D,2

Distance table Routing table


Distance Vector Routing: overview

Iterative, asynchronous: each local Each node:


iteration caused by:
• local link cost change
• message from neighbor: its wait for (change in local link
least cost path change from cost of msg from neighbor)
neighbor
Distributed:
• each node notifies neighbors recompute distance table
only when its least cost path to
any destination changes
 neighbors then notify their
neighbors if necessary
if least cost path to any dest
has changed, notify
neighbors
Traffic Based Routing
• Network for which is known
 the topology
 capacity matrix Cij (capacity of line connecting
node i and node j)
 traffic matrix Fij (mean expected traffic between
node i and node j)
1
• mean waiting time in M/M/1 queue T =
µC − λ
 C: capacity of the line (bits/s)
 λ: number of packets per second
 1/µ: mean packet size (bits)
Hierarchical Routing

• Divide nodes in groups


• Each node in a group knows how to route
packets to a node of the same group
• A node has no knowledge of internal routing
in other groups
• Packets are routed to appropriate group and
then routed to destination.
Hierarchical Routing: Example

C.b
B.a
A.a Host
b A.c c h2
a C a
b
a B
Host d
h1 c
A b
Datagram in IPv4
version H length Type of Service
Total length
Identification
D M Fragment offset
Time to live Protocol
Header checksum
Source IP address

Destination IP address

Options

Data ( ≤ 65537 bytes )


IPv4: Shortcomings

• Addressing : 32 bits address is not enough


• Performance : faster routers to deal with
higher speeds and increased load
• QoS : multiservice networks require a
better support of QoS
• Security : need for authentication and
privacy
IP version 6 (IPv6)
Internet Protocol IPv6
• IPv6 protocol data unit format
IPv6 header Extension …. Extension Transport
header header level PDU
40 bytes 0 or more
• Fixed size header of 40 bytes
• Extension headers :
 Hop-by-hop options header
 Routing header
 Fragment header
 Destination options
 Authentication
 Encapsulation security payload
IPv6 Header

Version Traffic Flow Label


Class
Next Hop
Payload Length
Header Limit
Source Address

Destination Address
IPv6 Header Fields

• Version (4bits) : 6
• Traffic Class (8 bits)
 different priority classes
• Flow Label (20 bits)
 label for sequences of packets which require a
certain QoS
• Payload Length (16 bit)
 Length of the IPv6 payload
 Extension headers are considered as payload
IPv6 Header Fields

• Next Header (8 bits)


 type of header follow-
ing the IPv6 header
 e.g. next header: TCP; next header: routing
• Hop Limit (8 bits)
 decremented by 1 by each node that forwards the
packet
 Packet is discarded if counter is zero
• Source Address (128 bits)
• Destination Address (128 bits)
Fragmentation and Reassembly

• Intranet fragmentation
 SAR performed on a per network basis
• Internet fragmentation
 Fragmentation performed if required
 No reassembly per network
• IP uses Internet fragmentation
Routing in the Internet (1)

• IP uses distributed routing


• Core backbone network to which a number of Internets
(=Autonomous Systems) are connected.
• Two different gateways :
 interior gateway : gateway within autonomous system
(Interior Gateway Protocol)
 exterior gateway : gateway that connects autononous
system to backbone (Exterior Gateway Protocol)
Routing in the Internet (2)

• Host : maintains information to forward data


to hosts or interior gateway of the same
network
• Interior Gateway: maintains information to
forward data to hosts or gateways belonging
to same autonomous system
• Exterior Gateway : maintains information to
forward data to interior gateway of the same
autonomous system or other exterior gateway
Routing Protocols (1)
• Interior gateway protocols (or Intra-autonomous
System Routing Protocols)
 Routing Information Protocol (RIP)
• Distance Vector Routing protocol
• Distance = hop count (each link gets distance 1)
• Maximum distance in RIP is 15 (max diameter of Autonomous
System using RIP is 15)
• Exchange routing information every 30 sec with 25 entries : RIP
advertisement
(destination network, next router, distance to destination)
• If no advertisement received within 180 sec : router is no longer
reachable
• RIP uses UDP port number 520
Routing Protocols (2)
• Interior Gateway Protocols
 Open Shortest Path First Protocol (OSPF)
• Each router constructs graph of AS
• Dijkstra’s algorithm is used to find shortest paths
• Different link distances can be used for different types
of traffic (TOS byte)
• Flooding is used to distribute link-state information
• An AS can be subdivided into areas; area border
routers are responsible for routing within area
• One OSPF area is defined to be the backbone
 Enhanced Internal Gateway Routing Protocol
• Cisco’s propriety protocol
Routing Protocols (3)

• Intra-autonomous System Routing Protocols


 Border Gateway Protocol (BGP)
• It propagates a sequence of Autonomous Systems to
reach a destination AS
Intra-AS and Inter-AS routing

Inter-AS
C.b routing
between B.a
A.a A and B Host
b A.c c h2
a C a
b
a B
Host d c Intra-AS routing
h1 b
A within AS B
Intra-AS routing
within AS A
Internet Control Message Protocol

• ICMP
 Used by hosts and gateways for network
management purposes
 Functions :
• Error reporting
• Reachability testing
• Congestion control
• Route exchange
• Performance measuring
• Submit addressing

You might also like