Network Layer - 中華大學-Chung Hua University

Download Report

Transcript Network Layer - 中華大學-Chung Hua University

The Network Layer





Design Issues
Routing Algorithms
Congestion Control
Internetworking
Example Network Layer Protocols
Computer Networks Fall 2002
Page 1
Goals of the Network Layer


The network layer is concerned with getting
packets from the source all the way to the
destination
the network layer must



know the topology of the communication subnet
choose route to avoid overloading some of the
communication lines and routers while leaving
others idle
deal with problems when the source and
destination are in different networks
Computer Networks Fall 2002
Page 2
Services Provided to the
Transport Layer

Connectionless (unreliable) services



each packet must carry the full destination
address
no packet ordering and flow control should be
done
Connection-oriented (reliable) services




a network layer process on the sending site must set up a
connection to its peer on the receiving side
when a connection is set up, two processes can enter a
negotiation about service parameters
packets are delivered in sequence
flow control is provided automatically
Computer Networks Fall 2002
Page 3
International Organization of the
Network Layer

virtual circuit
a route from the source to the destination
is chosen as part of the connection setup
 primarily for connection-oriented service


datagrams
each packet sent is routed independently
of its predecessors
 for connection-oriented and connectionless
services

Computer Networks Fall 2002
Page 4
Datagram Vs. Virtual Circuit
Issue
Circuit Setup
Addressing
Datagram
Not needed
Each packet contains the full
source and destination address
State
Subnet does not hold state
information
information
Routing
Each packet is routed
independently
Effect of router None, except for packets lost
failures
during the crash
Congestion
Difficult
control
Computer Networks Fall 2002
Virtual Circuit (VC)
Required
Each packet contains a short
VC number
Each VC requires subnet table
space
Route chosen when a VC is set
up; all packets follow this route
All VCs that passed through the
failed router are terminated
Easy if enough buffers can be
allocated in advance for each
VC
Page 5
Combinations of Services and
Subnet Structures
Services provided
by Transport layer
Connection-oriented
Connectionless
Services provided
to Transport layer
Connection-oriented
Connectionless
Subnet Structures
Virtual Circuit
Datagram
ATM AAL1
over ATM
Computer Networks Fall 2002
UDP
Over
IP
Over
ATM
TCP
over
IP
UDP
over
IP
Page 6
Routing


Packets are often routed from the
source to the destination hop by hop.
Two networks are connected by at least
a router. The network is defined from
the point of view of the network layer.
Computer Networks Fall 2002
Page 7
Types of Routing

Static Routing (Nonadaptive Routing)


Dynamic Routing (Adaptive Routing)


Routes to destinations are predetermined and are
not dependent on the current state (traffic,
topology etc.) of the network.
Routes being learned via exchange of routing
information to reflect changes in the topology and
traffic.
Default Routing:

Traffic to destinations that are unknown to the
router is sent to a default “outlet”.
Computer Networks Fall 2002
Page 8
The Optimality Principle

If router J is on the optimal path from router
I to router K, then the optimal path from J to
K also falls along the same route.


the set of optimal routes from all sources to a
destination form a tree, called a sink tree, rooted
at the destination.
r2
J
I r1
K
The goal of all routing algorithms is to
discover and use the sink trees for all routers.
Computer Networks Fall 2002
Page 9
Sink Tree
Computer Networks Fall 2002
Page 10
Routing Algorithms

Static Routing Algorithms




Dynamic Routing Algorithms






Shortest Path Routing
Flooding
Flow-Based Routing
Distance Vector Routing
Link State Routing
Hierarchical Routing
Routing for Mobile Hosts
Broadcast Routing
Multicast Routing
Computer Networks Fall 2002
Page 11
Shortest Path Routing



Find the shortest path between a given
pair of routers.
Cost of a link may be a function of the
distance, bandwidth, average traffic,
communication cost, mean queue
length, delay, etc.
The Dijkstra’s algorithm is used.
Computer Networks Fall 2002
Page 12
Dijkstra’s Algorithm
Computer Networks Fall 2002
Page 13
Flooding


Every incoming packet is sent out on every
outgoing line except the one it arrived on.
Vast numbers of duplicate packets are
generated.
M
I

Application:


J
K
L
Concurrent updates of all distributed databases
Always choose the shortest path
Computer Networks Fall 2002
Page 14
Flow-Based Routing


For a given line, if the capacity and
average flow are known in advance, it is
possible to compute the mean packet
delay on that line from queuing theory.
The routing problem then reduces to
finding a routing algorithm that
produces the minimum average delay
for the subnet.
Computer Networks Fall 2002
Page 15
Example
Computer Networks Fall 2002
Page 16
Analysis
Computer Networks Fall 2002
Page 17
Distance Vector Routing



RIP, the distributed Bellman-Ford routing
algorithm, the Ford-Fulkerson algorithm
Each router maintains a routing table giving
the best known distance to each destination
and which line to use to get there.
These tables are updated by exchanging
information with the neighbors.
Computer Networks Fall 2002
Page 18
Computer Networks Fall 2002
Page 19
Update Routing Table
Computer Networks Fall 2002
Page 20
Distance Vector

Each node maintains a set of triples





(Destination, Cost, NextHop)
Exchange updates directly connected neighbors
 periodically (on the order of several seconds)
 whenever table changes (called triggered update)
Each update is a list of pairs:
 (Destination, Cost)
Update local table if receive a “better” route
 smaller cost
 came from next-hop
Refresh existing routes; delete if they time out
Computer Networks Fall 2002
Page 21
Example : router B
B
C
A
D
E
F
Computer Networks Fall 2002
G
Destination Cost NextHop
A
1
A
C
1
C
D
2
C
E
2
A
F
2
A
G
3
A
Page 22
Distance Vector Routing

Metric used to measure the “distance”
number of hops
 time delay
 queue length


Drawback
Count-to-infinity problem
 it reacts rapidly to good news, but leisurely
to bad news.

Computer Networks Fall 2002
Page 23
Count-to-Infinity Problem
A B C D E
   
1   
1
1
1
2
2
2
 
3 
3 4
down initially and
come up later
Good News
Computer Networks Fall 2002
A B C D E
Initially
After 1 exchange
After 2 exchanges
After 3 exchanges
After 4 exchanges
After 5 exchanges
After 6 exchanges
alive initially and
down later
1
3
3
5
5
7
7
2
2
4
4
6
6
8
3
3
3
5
5
7
7
4
4
4
4
6
6
8
   
Bad News
Page 24
Split Horizon Hack



Try to solve the count-to-infinity problem
the distance to X is not reported on the line
that packets for X are sent on (actually, it is
reported as infinity)
In many cases, the bad news propagates one
hop per exchange
2
infinity
A
infinity
Computer Networks Fall 2002
B
1
C
Page 25
B thinks it can reach D through
A with a cost of 2
2
Infinity
Computer Networks Fall 2002
infinity
Page 26
Link State Routing

Each route must
1.Discover its neighbors and learn their network
addresses.
2.Measure the delay or cost to each of its neighbors.
3.Construct a packet telling all it has just learned.
4.Send this packet to all other routers.
5.Compute the shortest path to every other router.

Strategy

send to all nodes (not just neighbors) information
about directly connected links (not entire routing
table)
Computer Networks Fall 2002
Page 27
Computer Networks Fall 2002
Page 28
Learning About the Neighbors


Send a special HELLO packet on each
point-to-point line
the router on the other end is expected
to send back a reply telling who it is
I
L
HELLO
J
I am J
K
Computer Networks Fall 2002
Page 29
Measuring Line Cost


Send an ECHO packet over a line
the other side is required to send back
ECHO immediately


the round-trip delay can be measured
if the load is taken into account
results in better performance
 the routing table may be oscillate wildly

Computer Networks Fall 2002
Page 30
Traffic may oscillate between the
two links
Computer Networks Fall 2002
Page 31
Building Link State Packets
B
2
C
4
3
A
D
1
6
5
7
E
8
F
(a)
Computer Networks Fall 2002
A
Seq.
Age
B 4
E 5
Link
B
Seq.
Age
A 4
C 2
F 6
State
C
Seq.
Age
B 2
D 3
E 1
D
Seq.
Age
C 3
F 7
Packets
E
F
Seq.
Seq.
Age
Age
A 5 B 6
C 1 D 7
F 8 E 8
(b)
Page 32
Distributing Link State Packets

Use flooding
sequence number is used to determine
among new, duplicate, or obsolete packets
 three problems




sequence number may wrap around
a crash router will lose track of its sequence
number when it restarts
a corrupted bit in sequence number may cause
disaster
Computer Networks Fall 2002
Page 33
The Use of ‘Age’ Field




Include in each packet
decremented once per second
when the age hits zero, the information
from that router is discarded
also decremented by each router during
the initial flooding process

no packet can get lost and live for an
indefinite period of time
Computer Networks Fall 2002
Page 34
Reducing Flooding Costs

When a link state packet comes in


it is put in a holding area to wait a short while
when another packet from the source comes in



duplicate: discarded
different: the older one is thrown out
all link state packets are acknowledged
M
I
J
K
Computer Networks Fall 2002
L
Page 35
The LSP packets are to being
processed
Computer Networks Fall 2002
Page 36
Computing the New Route

Once a router has accumulated a full
set of link state packets


it can construct the entire subnet graph by
locally running Dijkstra’s algorithm
for a subnet with n routers, each of
which has k neighbors, the memory
required to store the input data is
proportional to kn.
Computer Networks Fall 2002
Page 37
Hierarchical Routing

When hierarchical routing is used, the
routers are divided into regions
each router knows all the details about
how to route packets to destinations within
its own region
 each router knows nothing about the
internal structure of other regions.

Computer Networks Fall 2002
Page 38
Hierarchical Routing
Region 1
Region 2
A
B
C
D
B
C
A
B C
A
A
B
B
C
Region 3
Region 4
Computer Networks Fall 2002
D
A
Region 5
Dest.
1A
1B
1C
2A
2B
2C
2D
3A
3B
4A
4B
4C
5A
5B
5C
5D
Line
---1B
1C
1B
1B
1B
1B
1C
1C
1C
1C
1C
1C
1C
1B
1C
Hops
--1
1
2
3
3
4
3
2
3
4
4
4
5
5
5
Dest.
1A
1B
1C
2
3
4
5
Line
---1B
1C
1B
1C
1C
1C
Hops
--1
1
2
2
3
4
Hierarchical
table for 1A
Full table for 1A
Page 39
Optimal Hierarchical Number

Kamoun and Kleinrock
N routers
 lnN hierarchical number
 e lnN entries for each router
 Increasing average length of routing path
but the affection is acceptable

Computer Networks Fall 2002
Page 40
Routing for Mobile Hosts




Each mobile node is assumed to have a permanent
home location that never changes.
Each area has one or more foreign agents, which
keep track of all mobile nodes visiting the area.
In addition, each area has a home agent, which keep
track of nodes whose home is in the area, but who
are currently visiting another area.
When a new node enters an area, it must register
itself with a foreign agent there. Then the mobile
node will register either directly with its home agent,
or through the foreign agent which forwards the
registration to the home agent.
Computer Networks Fall 2002
Page 41
Routing for Mobile Hosts
Home
Foreign
Foreign
Computer Networks Fall 2002
Page 42
Registration operation in Mobile
IP
Computer Networks Fall 2002
Page 43
Routing for Mobile Hosts

Datagrams sent to the mobile node are
intercepted by its home agent, then
 tunneled by the home agent towards the
mobile node,
 received at the tunnel foreign agent, and
 finally delivered to the mobile node.

Computer Networks Fall 2002
Page 44
Tunneling Operation in Mobile IP
Computer Networks Fall 2002
Page 45
Routing for Mobile Hosts
1. Packet is sent to the
mobile host’s home
3. Sender is given foreign
agent’s address
2. Packet is tunneled to
the foreign agent
4. Subsequent packets
are tunneled to the
foreign agent
Computer Networks Fall 2002
Page 46
Broadcast Routing





To simply send a distinct packet to each
destination
Flooding
Multidestination Routing
Spanning Tree Routing
Reverse Path Forwarding
Computer Networks Fall 2002
Page 47
Multidestination Routing



Each packet contains a list of desired
destinations.
When a packet arrives, the router checks all
the destinations to determine the set of
output lines for forwarding the packet. An
output line is selected if it is the best route to
at least one of the destinations.
The router generates a new copy of the
packet for selected output line, with a set of
destinations that are to use the line.
Computer Networks Fall 2002
Page 48
Spanning Tree Routing



Assume each router has knowledge of a
spanning tree (e.q. a sink tree) in the
network.
Each router copies an incoming
broadcast packet onto all the spanning
tree lines except the one it arrives on.
Use minimum number of packets.
Computer Networks Fall 2002
Page 49
Reverse Path Forwarding
Without knowing any spanning tree
if a packet arrives at the line that is
normally used for sending packets to
the source of the broadcast

the router forwards copies of it onto all lines
except the one it arrived on.
otherwise
the packet is discarded
Computer Networks Fall 2002
Page 50
RPF check (1)




A packet received through interface I, from S
(source) to G (multicast group) -packet (S,G)
A router looks into the routing table to find an
interface used to send packet to S, I(parent).
If I != I (parent), I is a wrong interface to
(S, G).
if I = I(parent), I is a correct interface to
receive (S, G).
Computer Networks Fall 2002
Page 51
RPF Check (2)



If the RPF check succeeds, the datagram is
forwarded to all interfaces except I.
If the RPF check fails, the datagram is
typically silently discarded.
Packet is never forwarded back out the RPF
interface.
Computer Networks Fall 2002
Page 52
Reverse Path Forwarding: An
Example
I
B
C
A
F
F
H
N
L
M
Preferred link
Computer Networks Fall 2002
H
J
N
G
I
E
K
D
J
O
A D E K G O M O
E C G
D N K
H B
L
L
B
Page 53
Multicasting


Send a message to all the other members of
the group
group management




create and destroy groups
for processes to join and leave groups
routers knows which of their hosts belong to
which group
routers tell their neighbors, so the
information propagates through the subnet
Computer Networks Fall 2002
Page 54
Multicast Routing




Each router computes a spanning tree
covering all other routers in the subnet.
When a multicast packet for a group arrives,
the first router examines its spanning tree
and prunes it, removing all lines that do not
lead to hosts in the group.
Multicast packets are forwarded only along
the pruned tree.
mn trees is needed with n groups, each with
an average of m members.
Computer Networks Fall 2002
Page 55
Example
Computer Networks Fall 2002
Page 56
Core-based Tree for Multicast
Routing



A single spanning tree,called core-based tree,
for a group is computed, with the root (core)
near the middle of the group.
A host first sends a multicasting message to
the core, which then does the multicasting
along the spanning tree.
The tree is not optimal. However only n trees
need to be stored.
Computer Networks Fall 2002
Page 57
Computer Networks Fall 2002
Page 58
Congestion

When too many packets are present in (a
part of) a subnet, performance degrades.
This situation is called congestion.
Packet delivered
Maximun carrying
capacity of subnet
Perfect
Desirable
Congested
Packet sent
Computer Networks Fall 2002
Page 59
Congestion Control

goal


make sure the subnet is able to carry the
offered traffic
Congestion causes
bursty data
 insufficient memory
 slow processor
 low-bandwidth line

Computer Networks Fall 2002
Page 60
Flow Control vs. Congestion
Control

Congestion control
Make sure the subnet is able to carry the
offered traffic
 It is a global issue, involving the behavior
of all the hosts, all the routers, and etc.


Flow Control

Relate to the point-to-point traffic between
a given sender and a given receiver.
Computer Networks Fall 2002
Page 61
Flow Control vs. Congestion
Control
Super
Computer
Flow
Control
1000 Gbps
PC
1 Gbps
1 Mbps
Congestion
Control
1000
100 Kbps
1000
Computer Networks Fall 2002
Page 62
General Principles

Open Loop


make sure congestion does not occur in the first
place
Deciding when to accept new traffic, deciding
when to discard packets and which ones, …


Make decision without regard to the current state of the
network
Closed Loop



monitor the system to detect congestion (where
and when)
pass this information to places where action can
be taken
adjust system operation to correct the problem
Computer Networks Fall 2002
Page 63
Congestion Control Algorithm
Taxonomy (closed loop)

explicit feedback


Packets are sent back from the point of
congestion to warn the source.
implicit feedback

The source deduces the existence of
congestion by making local observations,
such as the acknowledgement time.
Computer Networks Fall 2002
Page 64
Policies that Affect Congestion
Computer Networks Fall 2002
Page 65
Congestion Prevention Policies





Virtual circuit versus datagram
 Most algorithms work only with virtual circuit.
Packet queuing and service policy
 input queuing versus output queuing
 round robin, priority-based, random, ...
Packet discarded policy
 which packet is dropped when there is no space
Routing algorithm
 Load sharing
Packet lifetime management
Computer Networks Fall 2002
Page 66
Traffic Shaping/Policing


Congestion would be less common if
traffic is less bursty
traffic shaping


force packets to be transmitted at a more
predictable rate
traffic policing

monitor a traffic flow
Computer Networks Fall 2002
Page 67
Leaky Bucket Algorithm
packets
Water drips
out of the
hole at a
constant rate.
interface
implementing
the leaky
bucket
algorithm
unregulated
flow
The bucket
holds
packets.
regulated
flow
Network
Computer Networks Fall 2002
Page 68
Token Bucket Algorithm
Computer Networks Fall 2002
Page 69
Properties of Token Bucket



allows saving up permission to send
large bursts later
throws away token when the bucket fills
up but never discards packets
C: token bucket capacity; :token
arrival rate; S: burst length; M: maximal
output rate

C+  S=MS
Computer Networks Fall 2002
Page 70
Leaky Bucket
Computer Networks Fall 2002
Page 71
Token Bucket
Computer Networks Fall 2002
Page 72
Flow Specification


An agreement on the traffic pattern
the source gives the flow specification to the
subnet for approval
Computer Networks Fall 2002
Page 73
Congestion Control in Virtual
Circuit Subnets

Admission control



once congestion has been signaled, no
more virtual circuits are set up until the
problem has gone away
carefully route all new virtual circuits
around problem areas
negotiate an agreement between the
host and subnet when a virtual circuit is
set up
Computer Networks Fall 2002
Page 74
Computer Networks Fall 2002
Page 75
Choke Packets
1
2
3
Choke
Heavy
flow
6
5
4
7
Flow is reduced.
Computer Networks Fall 2002
Page 76
Hop-by-Hop Choke Packets
1
2
3
Choke
Heavy
flow
To provide quick
relief at the point
of congestion at
the price of using
up more buffers
upstream.
Computer Networks Fall 2002
5
4
Flow is reduced.
Page 77
Load Shedding


when routers are being inundated by
packets that they can not handle, they
just throw them away.
Packet discarding policy
Wine: Old is better than new.
 Milk: New is better than old.
 Priority Control

Computer Networks Fall 2002
Page 78
Jitter Control


The jitter is the amount of variation in the
end-to-end packet transit time.
The jitter can be bounded by computing the
expected transit time for each hop along the
path.

When a packet arrives at a router, the router
checks to see how much the packet is behind or
ahead of its schedule. This information is stored in
the packet and updated at each hop. If the packet
is ahead of schedule, it may be held just enough
to get it back on schedule. If it is behind schedule,
the router tries to get it out the door quickly.
Computer Networks Fall 2002
Page 79
Congestion Control for
Multicasting


Multicast flows from multiple sources to
multiple destinations (cable television)
if it is the sender that reserves bandwidth



each sender should track membership changes
regenerate the spanning tree at each change
RSVP (Resource reSerVation Protocol)

it is the receiver that reserves bandwidth
Computer Networks Fall 2002
Page 80
RSVP (Resource reSerVation
Protocol)




allows multiple senders to transmit
multiple groups of receivers.
permits individual receivers to switch
channels freely.
optimizes bandwidth use while at the
same time eliminating congestion.
uses multicast routing using spanning
trees
Computer Networks Fall 2002
Page 81
Multicast Spanning Trees
Multicast spanning
tree for host 1
Senders
1
3
4
2
1
5
3
4
Multicast spanning
tree for host 2
2
1
5
3
2
4
5
Receivers
Computer Networks Fall 2002
Page 82
Bandwidth Reservation
Senders
1
Senders
2
1
2
Bandwidth
reserved
for source 1
3
Senders
1
2
Bandwidth
reserved
for source 2
4
5
Receivers
Computer Networks Fall 2002
3
4
5
Bandwidth
reserved
for source 1
3
4
5
Receivers
Page 83
RSVP (Resource reSerVation
Protocol)


When making a reservation, a receiver
can (optionally) specify one or more
sources that it wants to receive from.
It can also specify whether these
choices are fixed for the duration of the
reservation, or whether the receiver
wants to keep open the option of
changing sources later.
Computer Networks Fall 2002
Page 84
RSVP (Resource reSerVation
Protocol)


Two receivers are only set up to share a
path if they both agree not to change
sources later on.
Once a receiver has reserved bandwidth,
it can switch to another source and
keep that portion of the existing path
that is valid for the new source.
Computer Networks Fall 2002
Page 85
Internetworking
802.5 LAN
DECnet
R
802.3 LAN
R
X.25
R
802.4 LAN
B
R
SNA
Computer Networks Fall 2002
Page 86
Internetworking
7
Application
6
Presentation
5
Session
4
Transport
Application Protocol
Presentation Protocol
Session Protocol
Transport Protocol
Application
Presentation PPDU
Session
SPDU
Transport
TPDU
Network
Packet
Frame
3
Network
Internal Subnet Protocol
Network
Network
2
Data Link
Data Link
Data Link
Data Link
1
Physical
Physical
Physical
Physical
Layer
Host A
Router
Router
Host B
Computer Networks Fall 2002
APDU
Bit
Page 87
Internetworking Devices

Layer 1: Repeater or Amplifier


Layer 2: (Multi-protocol) Bridge



Store-and-forward device
Headers at layer 2 are translated if necessary.
Layer 3: (Multi-protocol) Router


To amplify or regenerate signals
Headers at layer 3 (and layer 2) are translated if
necessary.
Layer 4~7: Transport/Application Gateway
Computer Networks Fall 2002
Page 88
Devices on the Market






Repeater, Hub
Bridge
(Multi-protocol) Router, Layer 3 Switch
Layer 4 Switch
Gateway with interfaces of distinct layer
protocols
Bridge/Router (or called B-Router)
Computer Networks Fall 2002
Page 89
How Networks Differ

Service offered


Protocol


IP, IPX, CLNP, AppleTalk, DECnet, etc.
Addressing


Connection-oriented versus Connectionless
Flat (802) versus hierarchical (IP, PDN, PSTN,
ISDN, etc.)
Multicasting/Broadcasting

Present or absent
Computer Networks Fall 2002
Page 90
How Networks Differ (Cont.)

Packet size


Quality of service


Present or absent
Error handling


Every network has its own maximum
Reliable, ordered, and unordered delivery
Flow control

Sliding window, rate control, others, or none
Computer Networks Fall 2002
Page 91
How Networks Differ (Cont.)

Congestion control


Security


Privacy rules, encryption, etc.
Parameters


Leaky bucket, choke packets, etc.
Different timeouts, flow specifications, etc.
Accounting

By connection time, by packet, by byte, or not at
all
Computer Networks Fall 2002
Page 92
Concatenated Virtual Circuit
SNA
1
Multiprotocol
Router
M
X.25
Router
ATM
M
OSI
M
Host
M
2
Computer Networks Fall 2002
Page 93
Connectionless Interworking
M
1
M
M
M
2
Computer Networks Fall 2002
Page 94
Tunneling
The same type
of network
Using encapsulation of IP packets
Ethernet
R
Ethernet frame
IP
Ethernet header
Computer Networks Fall 2002
Ethernet
WAN
R
WAN packet
IP
WAN packet header
Ethernet frame
IP
Ethernet header
Page 95
Internetwork Routing


interior gateway protocol: within each
network
exterior gateway protocol: between networks
B
A
2
B
C
Gateway/
Router
A
1
3
C
D
D
E
Network
4
Computer Networks Fall 2002
F
5
E
F
Page 96
Autonomous System (AS)


An autonomous system is a set of
routers having a single routing policy,
running under a single technical
administration.
Each AS is independent of all the others.
Computer Networks Fall 2002
Page 97
Fragmentation and Reassembly


Each network imposes some maximum
size on its packets
When a large packet wants to travel
through a network whose maximum
packet size is too small
allow gateway to break packets up into
fragments
 fragments are reassembled into packet
latter

Computer Networks Fall 2002
Page 98
Transparent and Nontransparent
Fragmentation
Network 1
Network 2
Packet
G1
G2
G3
G4
G2
G1 fragments
a large packet
reassembles
the fragments
G3 fragments
again
G4
reassembles
again
(a)
Packet
G1
G1 fragments
a large packet
G2
G3
G4
The fragments are not reassembled
until the final destination (a host) is reached
(b)
Computer Networks Fall 2002
Page 99
Elementary Fragmentation
Number of the first elementary fragment in this packet
Packet
number
End of
packet bit
27
0
1
A
B
1 byte
C
D
E
F
G
H
I
J
Header
(a)
27
0
0
A
B
C
D
E
F
G
H
27
Header
8
1
I
J
Header
(b)
27
0
0
A
B
C
Header
D
E
27
5
Header
0
F
G
H
27
8
1
I
J
Header
(c)
Computer Networks Fall 2002
Page 100
Firewalls


Packet filter router is a router equipped with
some extra functionality that allows every
incoming or outgoing packet to be inspected.
Application gateway (e.g.a mail gateway)
may examine headers and/or contents of
messages.
Computer Networks Fall 2002
Application
Gateway
Packet
Filtering
Router
Outside
Inside
Packet
Filtering
Router
Page 101
Internet Network Layer Protocol




The IP (Internal Protocol) Protocol
IP Addressing
Subnets
Internet Control Protocols



The Internet Control Message Protocol (ICMP)
The Address Resolution Protocol (ARP)
The Reverse Address Resolution Protocol (RARP)
Computer Networks Fall 2002
Page 102
Internet Network Layer Protocol






The Interior Gateway Routing Protocol:
Open Shortest Path First (OSPF)
The Exterior Gateway Routing Protocol:
Border Gateway Protocol (BGP)
Internet Multicasting
Mobile IP
Classless InterDomain Routing (CIDR)
IPv6
Computer Networks Fall 2002
Page 103
The IP Header
0
Version
4
8
IHL
16
Type of service
24
31 bit
Total length
DM
F F
Identification
Time to live
19
Protocol
Fragment offset
Header checksum
Source address
Destination address
Options (0 or more words)
Computer Networks Fall 2002
Page 104
The IP Protocol


Version: The current protocol version is 4.
IP Header length (IHL): measured in 32-bit
words


for example, without options, its value is 5.
Type of service





Precedence (3 bits): 0 (normal precedence) ~ 7
(network control)
Delay (1 bit): low delay
Throughput (1 bit): high throughput
Reliability (1 bit): high reliability
unused (2 bits)
Computer Networks Fall 2002
Page 105
The IP Protocol



Total length: measured in octets, including
the length of the header and data
Identification: datagram identifier
Flags




unused (1 bit)
DF (1 bit): don’t fragment
MF (1 bit): more fragment
Fragment offset: the offset of this fragment in
the original datagram, measured in units of 8
octets
Computer Networks Fall 2002
Page 106
The IP Protocol







Time to live (TTL): packet lifetime, measured
in seconds (hops, in practice)
Protocol: protocol type (e.g., TCP, UDP, ...),
RFC 170
Header checksum
Source IP address
Destination IP address
Options
Padding: to make the header extend to an
exact multiple of 32 bits, containing 0
Computer Networks Fall 2002
Page 107
IP Options

Security


Strict source routing


to give a list of routers not to be missed
Record route


to give the complete path to be followed
Loose source routing


to specify how secret the datagram is
to make each router append its IP address
Timestamp

to make each router append its address and
timestamp
Computer Networks Fall 2002
Page 108
IP Option Code
Computer Networks Fall 2002
Page 109
IP Option Code

Copy (1 bit):



Class (2 bits)





0: the option will only be copied into the first
fragment and not to all fragments
1: the option should be copied into all fragments
0:
1:
2:
3:
datagram or network control
reserved
debugging and measurement
reserved
Number (5 bits)
Computer Networks Fall 2002
Page 110
Computer Networks Fall 2002
Page 111
IP Addressing




32 bits long, represented in dotted
decimal notation, like 192.41.6.20
Network number + Host number
Network numbers are assigned by the
NIC (Network Information Center) to
avoid conflicts.
All the hosts in a network must have
the same network number.
Computer Networks Fall 2002
Page 112
IP Addresses
1
2
3 Range of host
Class 01234567890123456789012345678901 addresses
A
0Network
B
10
C
110
D
1110
E
Host
Network
11110
Computer Networks Fall 2002
1.0.0.0 to
127.255.255.255
128.0.0.0 to
191.255.255.255
Host
Network
Host
192.0.0.0 to
223.255.255.255
Multicast address
224.0.0.0 to
239.255.255.255
Reserved for future use
240.0.0.0 to
247.255.255.255
Page 113
Special IP Addresses
00000000000000000000000000000000 This host
00
00
Host
11111111111111111111111111111111
Network
127
Computer Networks Fall 2002
A host on this network
Broadcast on the
local network
11
11 Broadcast on a
distant network
(anything)
Loopback
Page 114
Network Growth Problem

Problem

Immense administrative overhead



Every time a new network is installed the system
administrator has to contact NIC to get a new network
number.
Then this number must be announced worldwide.
Solution: To minimize network numbers by
sharing one network number among multiple
physical networks
Computer Networks Fall 2002
Page 115
Subnet Addressing
•ack like a single network to the outside world
•split into several parts for internal use
Computer Networks Fall 2002
Page 116
Subnets
A Class B Network
IP address
Subnet mask

Network
11
Host Part
Subnet
11 11
11 00
Host
00
The standard does not restrict subnet masks
to select contiguous bits of the address.
Computer Networks Fall 2002
Page 117
How Router Processes IP Packets
network0
A
network1
B
M
(network0, 0)
(network1, 0)
IP A
IP B
...
...
(this-net, host0) IP M
(this-net, host1) IP N
...
...
N
(default router)
(this-net, subnet, 0)
(this-net, this-sub, host1)
Computer Networks Fall 2002
IP X
IP Y
When subnetting
is introduced
Page 118
The Internet Control Message
Protocol (ICMP)

ICMP allows routers to send error or control
messages to other routers or hosts; ICMP
provides communication between the
Internet Protocol software on one machine
and the Internet Protocol software on another.
Computer Networks Fall 2002
Page 119
ICMP
Computer Networks Fall 2002
Page 120
The Internet Control Message
Protocol (ICMP)



RFC 792
Each ICMP message has its own format.
Example: Echo request or reply
Type=8: request, Type=0: reply
 Code=0

IP header
Type Code
Checksum
Identifier Sequence number
Optional data
Computer Networks Fall 2002
Page 121
The Address Resolution Protocol
(ARP RFC 826)




To map an IP address onto data link layer
address, such as Ethernet.
An IP host runs the ARP protocol to inquiry
the unknown data link layer address of a
destination IP address before a datagram is
sent.
The ARP of a host may maintain a cache to
record known IP address and DLL address
pairs.
A machine may broadcast its own mapping
when it boots by using ARP.
Computer Networks Fall 2002
Page 122
Example: ARP
Computer Networks Fall 2002
Page 123
The Reverse Address Resolution
Protocol (RARP)




RFC 903
Allow a newly-booted (diskless) workstation
(with a DLL address) to discover its IP
address (by broadcasting )
Need a RARP server on each network
Bootp, RFCs 951, 1048, and 1084

Use UDP messages which are forwarded over
routers to find the file server that holds the
mapping
Computer Networks Fall 2002
Page 124
The Interior Gateway Routing
Protocol


A Routing Protocol within an autonomous
system (AS).
Internet interior gateway protocol



Original: a distance vector protocol, Routing
Information Protocol (RIP), based on the BellmanFord algorithm
Successor (1979): a link state protocol
Now (1990): Open Shortest Path First (OSPF), RFC
1247 (ver. 1) and RFC 1583 (ver. 2).
Computer Networks Fall 2002
Page 125
Objectives of OSPF








published in the open literature
to support a variety of distance metrics:
distance, delay, ...
a dynamic algorithm
to support routing based on type of service
load balancing
support for hierarchical systems
security
tunneling
Computer Networks Fall 2002
Page 126
Graph Representation of an AS

OSPF computes the shortest path from
every router to every other router.
router
A B C
WAN
LAN
A B C
Computer Networks Fall 2002
Each arc is assigned a cost
Page 127
Areas and Backbone Areas

An AS can be divided into numbered areas




an area is a network or a set of continuous
networks (a generalization of a subnet)
areas do not overlap
Within an area, each router has the same link
state databases and runs the same shortest path
algorithm
backbone area (area 0)

all areas within an AS are connected to the
backbone, possibly by tunnels
Computer Networks Fall 2002
Page 128
Classes of Routers
Computer Networks Fall 2002
Page 129
Open Shortest Path First (OSPF)

Type of service routing: multiple graphs
one labeled with the costs when delay is
the metric
 one labeled with the costs when
throughput is the metric
 one labeled with the costs when reliability
is the metric


Three kinds of routes: intra-area, interarea and inter-AS.
Computer Networks Fall 2002
Page 130
OSPF Messages
Message type
Description
Hello
Used to discover who the neighbors are
Link state update
Provides the sender’s costs to its neighbors
Link state ack
Acknowledges link state update
Database description Announces which updates the sender has
Link state request
Computer Networks Fall 2002
Requests information from the partner
Page 131
OSPF Messages


When a router boots, it sends HELLO
messages on all of its point-to-point lines and
multicasts then on LANs to the group
consisting of all the other routers.
During normal operation, each router
periodically floods LINK STATE UPDATE
messages to each of its adjacent routers.
Routers also send these messages when a
line goes up or down or its cost changes.
Computer Networks Fall 2002
Page 132
OSPF Messages

DATABASE DESCRIPTION messages
give the sequence numbers of all the
link state entries currently held by the
sender. By comparing its own values
with those of the sender, the receiver
can determine who has the most recent
values. These messages are used when
a line a brought up.
Computer Networks Fall 2002
Page 133
The Exterior Gateway Routing
Protocol

A Routing Protocol between ASes


The main goal of an interior gateway protocol is to
route efficiently, while the exterior gateway
protocols have to worry about “politics”.
Border Gateway Protocol (BGP)



described in RFC 1654
BGP1 in 1989, current version BGP4 in 1993.
fundamentally a distance vector protocol.
Computer Networks Fall 2002
Page 134
Policies

Political, security, or economic
considerations
No transit traffic through certain ASes.
 Never put Iraq on a router starting at the
Pentagon.
 Only transit Albania if there is no
alternative to the destination.
 Traffic starting or ending at IBM should not
transit Microsoft.

Computer Networks Fall 2002
Page 135
Border Gateway Protocol (BGP)

Each BGP keeps track of the exact path
used to each destination
C
B
D
A
G
F
E
I
Computer Networks Fall 2002
Information F receives
from its neighbors about D
From B: “I use BCD”
H From G: “I use GCD”
From I: “I use IFGCD”
From E: “I use EFGCD”
J
Page 136
Border Gateway Protocol (BGP)



After all the paths come in from the
neighbors, the best can be determined.
Since each router keeps the exact
routes used, the count-to-infinite
problem can be easily solved.
BGPs uses TCP as its transport protocol
(port 179) for reliable transmission.
Computer Networks Fall 2002
Page 137
How BGP Solves The Count-toInfinity Problem
C
B
D
A
G
F
E
I
Computer Networks Fall 2002
J
Information F receives
from its neighbors about D
From B: “I use BCD”
Nothing from G
H
From I: “I use IFGCD”
From E: “I use EFGCD”
F chooses “FBCD” as its
new route
Page 138
Internet Multicasting


IP supports multicasting using class D addresses.
Permanent addresses and temporary addresses.

Permanent addresses







224.0.0.1
224.0.0.2
224.0.0.5
224.0.0.6
all
all
all
all
systems on a LAN
routers on a LAN
OSPF routers on a LAN
designated routers on a LAN
A multicast router uses the IGMP (Internet Group
Management Protocol) to group hosts the groups
their processes currently belong to.
IGMP in RFC 1112.
Multicast routing uses spanning trees.
Computer Networks Fall 2002
Page 139
IGMP (Internet Group
Management Protocol)
Query
1, 3
1, 2
Multicast
router
3
Hardware Multicast
Response
Multicast
router
1, 2
1, 3
Computer Networks Fall 2002
3
Page 140
Mobile IP

Problems with host mobility in Internet


IP address implies host location
Major goals of Mobile IP





Mobile host can use its home IP address anywhere.
Software changes to the fixed hosts were not
permitted
changes to the router software and tables were
not permitted
most packets for mobile hosts should not make
detours on the way
no overhead should be incurred when at home
Computer Networks Fall 2002
Page 141
How to Handle Mobility
Sender
Home agent
Foreign agent
Mobile host
register
Packet for
mobile host
He is here
care-of-address
(tunneling)
care-of-address
Computer Networks Fall 2002
Packet for
mobile host
Page 142
Gratuitous ARP
Router at
home’s
LAN
Home agent
Packet for
mobile host
Packet for
mobile host
gratuitous ARP
(about to
move)
ARP Query
ARP Response
Packet for
mobile host
Computer Networks Fall 2002
Mobile Host
(tunneling)
Page 143
IP Addressing Problems


32-bit IP address space is not enough
Organizing the address space by classes
wastes millions of them


a class B address is far too large for most
organizations
the routing table explosion

every router in the Internet would need a
table with half a million entries, if that
much class C networks are in use
Computer Networks Fall 2002
Page 144
Classless InterDomain Routing
(CIDR)



To solve the IP address depletion problem
and the routing table explosion problem
RFC 1519
The basic idea behind CIDR is to allocate the
remaining class C networks in variable- sized
blocks
192.0.0.0
Computer Networks Fall 2002
223.255.255.255
Page 145
Example



X University needs 2048 addresses and is
assigned the addresses 194.24.0.0 through
194.24.7.255, along with mask 255.255.248.0.
Y University needs 4096 addresses and is
assigned the addresses 194.24.16.0 through
194.24.31.255, along with mask
255.255.240.0.
Z University needs 1024 addresses and is
assigned the addresses 194.24.8.0 through
194.24.11.255, along with mask
255.255.252.0.
Computer Networks Fall 2002
Page 146
Example

Routing table with entries




base address: 194.24.0.0, mask: 255.255.248.0
base address: 194.24.16.0, mask: 255.255.240.0
base address: 194.24.8.0, mask: 255.255.252.0
Destination address with 194.24.17.4
matching the second entry, so the packet is
sent to the Y router.
Computer Networks Fall 2002
Page 147
Classless InterDomain Routing
(CIDR)

The world was partitioned into zones, each given a
portion of the class C address space:







Addresses 194.0.0.0 to
Addresses 196.0.0.0 to
Addresses 198.0.0.0 to
Addresses 200.0.0.0 to
South America
Addresses 202.0.0.0 to
Addresses 204.0.0.0 to
Addresses 208.0.0.0 to
use
Computer Networks Fall 2002
195.255.255.255 for Europe
197.255.255.255 for Others
199.255.255.255 for North America
201.255.255.255 for Central and
203.255.255.255 for Asia and Pacific
207.255.255.255 for Others
223.255.255.255 reserved for future
Page 148
IP Address Allocation





Class A address allocation is restricted.
Class B address are also restricted .They will be
allocated only if the need for them is justified.
Class C addresses are allocated with a contiguous
block of addresses which consists of several
contiguous class C addresses.Class C addresses are
being distributed to ISPs so that the allocation could
last at least two years.
If a subscriber has a requirement for more than 4096
IP address, a Class B network number may be
allocated.
Organizations are encouraged to use Variable Length
Subnet Mask for efficient use of address space.
Computer Networks Fall 2002
Page 149
IPv6






A modified combined version of Deering
and Francis proposals. SIPP (Simple
Internet Protocol Plus)
Longer addresses
Simplification of headers
Support for options
Security and authentication
Type of services
Computer Networks Fall 2002
Page 150
The IPv6 Header
0
4
8
Version Priority
Payload length
16
24
Flow label
Next header
31
Hop limit
Source address
(16 bytes)
Destination address
(16 bytes)
Computer Networks Fall 2002
Page 151
The IPv6 Protocol


Version: 6
Priority



0~7: for transmission possibly slowed down in
case of congestion
8~15: for real time traffic with constant sending
rate
suggestion



1: news
4: FTP
6: Telnet
Computer Networks Fall 2002
Page 152
The IPv6 Protocol
Flow label: for setting up a pseudo
connection with particular properties and
requirements
 Payload length: information bytes following
the 40 byte header
 Next header: specify which of the (currently)
six extension headers, if any, follows the
header. If the header is the last IP header,
the Next header specifies the transport
protocol handler.
 Hop limit: for limiting packet lifetime
Computer Networks Fall 2002

Page 153
IPv6 Address Expression

Written as eight groups of four hexadecimal
digits with colons between groups
8000:0000:0000:0000:0123:4567:89AB:CDEF

optimizations
8000::123:4567:89AB:CDEF

IPv4 addresses
::192.31.20.46
Computer Networks Fall 2002
Page 154