Você está na página 1de 200

Computer Networks

Network Layer

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -1
Chapter 4: Network Layer

Chapter goals: Overview:


 understanding principles  network layer services
behind network layer  routing principles: path
services: selection
 routing (path selection)  hierarchical routing
 dealing with scale
 IP
 how a router works
 Internet routing protocols
 advanced topics: IPv6,
reliable transfer
mobility
 intra-domain
 instantiation and
 inter-domain
implementation in the
Internet  what’s inside a router?
 IPv6
 mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -2
Chapter 4 Outline

4.1 Introduction and Network Service Models


4.2 Routing Principles
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
4.5 Routing in the Internet
4.6 What’s Inside a Router
4.7 IPv6
4.8 Multicast Routing
4.9 Mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -3
Network Layer Functions

 transport packet from application


transport
sending to receiving hosts network
data link network
 network layer protocols in physical
network
data link
physical network

every host, router data link


physical
data link
physical
network
data link
three important functions: physical
network

 path determination: route


data link
physical

taken by packets from source network


network
data link
to dest. (Routing Algorithms) data link
physical
physical

 forwarding: move packets


network
data link
physical
from router’s input to
appropriate router output application
transport
network
 call setup: some network data link
physical
architectures require router
call setup along path before
data flows
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -4
Network Service Model

Q: What service model for


“channel” transporting
packets from sender to The most important
receiver? abstraction provided
by network layer:
Services
 guaranteed bandwidth? virtual circuit
 preservation of inter-packet or
timing (no jitter)? datagram?
 loss-free delivery?
 in-order delivery?
 congestion feedback to
sender?

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -5
Virtual circuits

“source-to-destination path behaves much like


telephone circuit”
 performance-wise
 network actions along source-to-destination path

 call setup, teardown for each call before data can flow
 each packet carries VC identifier (not destination host ID)
 every router on source-destination path maintains “state”
for each passing connection
 transport-layer connection only involved two end systems
 Link and router resources (bandwidth, buffers) may be
allocated to VC
 to get circuit-like performance.
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -6
Virtual Circuits: Signaling Protocols

 used to setup, maintain teardown VC


 used in ATM, frame-relay, X.25
 not used in today’s Internet
6. Receive data
application
3. Accept call
transport
2. Incoming call network
data link
5. Data flow begins physical
4. Call connected
application 1. Initiate call
transport
network
data link
physical

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -7
Datagram networks: the Internet model

 no call setup at network layer


 routers: no state about end-to-end connections
 no network-level concept of “connection”
 packets forwarded using destination host address
 packets between same source-destination
pair may take different paths 2. Receive Data application
transport
network
data link
physical

application 1. Send Data


transport
network
data link
physical

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -8
Network Layer Service Models:

Guarantees ? Congestion
Network Service
Architecture Model Bandwidth Loss Order Timing feedback

Internet best effort none no no no no (inferred


via loss)
ATM CBR constant yes yes yes no
UBR: Unspecified bit rate

rate congestion
ABR: Available bit rate
CBR: Constant bit rate
VBR: Variable bit rate

ATM VBR guaranteed yes yes yes no


rate congestion
ATM ABR guaranteed no yes no yes
minimum
ATM UBR none no yes no no

 Internet model being extended: Integrated services,


Differentiated Services
 Chapter 6

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4 -9
QoS Factors
 Timing
 Connection Establishment Delay

 End-To-End Delay

 Connection Establishment Failure Probability


 Throughput or Bandwidth Guarantee
 Ordering Preservation
 Congestion Indication (Control)
 Bit-Error rate or Packet-Loss Rate Control
 Protection
 Priority
 Resilience (Return Back to Normal Operation).

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-10
Service Clases

 Guaranteed Quality of Service


 Predictive Quality of Service
 Best Effort Quality of Service

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-11
Guaranteed QoS

 Specified through QoS parameter values


 deterministic
 statistical
 Single value - average (threshold, target)
 Pair of values - interval
 Triple of values – max., mean, min.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-12
Predictable Service

 Parameter bounds based on history, that is, past


network behavior.
 Parameter values are measured, and certain
statistical analyses may be carried out

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-13
Best Effort Services

 No guarantees of quality, no QoS parameter values


 UDP/IP
 Partial guarantees, some QoS parameter values
are given.
 TCP/IP

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-14
Datagram or VC Network: why?

Internet ATM
 data exchange among  evolved from telephony
computers  human conversation:
 “elastic” service, no strict  strict timing, reliability
timing req. requirements
 “smart” end systems  need for guaranteed
(computers) service
 can adapt, perform  “dumb” end systems
control, error recovery
 telephones
 simple inside “network”,
 complexity inside
complexity at “edge”
network
 many link types
 different characteristics

 uniform service is
difficult

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-15
Active Queue Management (AQM)

 Performance Degradation in current TCP


Congestion Control
 Multiple packet loss
 Low link utilization
 Congestion collapse

 The role of the router (i.e., network)


 Control congestion effectively with a network
 Allocate bandwidth fairly

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-16
Buffering in IP routers

Router Internet Router

Network
Interface

 Buffer size  Dropping packets


 Space for bursts of  When?
packets  What?
 Latency
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-17
FIFO Queueing in the Router
(Drop Tail)

Network
Interface

 Single queue maintained

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-18
FIFO Queueing in the Router
(Drop Tail)

Network
Interface

 Single queue maintained


 Dequeue from head

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-19
FIFO Queueing in the Router
(Drop Tail)

Network
Interface

 Single queue maintained


 Dequeue from head
 Enqueue at tail

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-20
FIFO Queueing in the Router
(Drop Tail)

Network
Interface

 Single queue maintained


 Dequeue from head
 Enqueue at tail
 When full
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-21
FIFO Queueing in the Router
(Drop Tail)

Network
Interface

 Single queue maintained


 Dequeue from head
 Enqueue at tail
 When full drop arriving packet (drop-tail)
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-22
Active Queue Management

 Goals:

 Better congestion notification for responsive flows


(i.e. TCP)

 Maintain shorter queues

 Fairness in drops (proportional)

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-23
RED Operation

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-24
Active Queue Management
Random Early Detection (RED)

Max Queue Size Drop probability


Average queue length
Forced drop
Max Threshold
Probabilistic drops
Min Threshold
No drops
Time

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-25
Chapter 4 Outline

4.1 Introduction and Network Service Models


4.2 Routing Principles
 Link state routing
 Distance vector routing
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
4.5 Routing in the Internet
4.6 What’s Inside a Router
4.7 IPv6
4.8 Multicast Routing
4.9 Mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-26
Routing

Routing protocol
Goal: determine “good” path 5
(sequence of routers) thru 3 C
network from source to dest. B
2 5
A 3 1
2 F
Graph abstraction for
1 2
routing algorithms: D E
1
 graph nodes are Abstract model of a network
routers
 graph edges are  “good” path:
physical links  typically means minimum
 link cost: delay, $ cost, cost path
or congestion level  other definitions possible
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-27
Routing Algorithm Classifications

1. Global: 1. Static:
 all routers have complete  routes update slowly
topology, link cost info
over time
 “link state” algorithms

2. Decentralized: 2. Dynamic:
 router knows physically-  routes update more
connected neighbors, link quickly
costs to neighbors  periodic update
 iterative process of
 in response to link
computation, exchange of
info with neighbors cost changes
 “distance vector” algorithms

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-28
A Link-
Link-State Routing Algorithm

Dijkstra’s algorithm (global)


 net topology, link costs known to all
nodes
 accomplished via “link state
broadcast”
 all nodes have same information

 computes least cost paths from one


node (‘source”) to all other nodes
 gives routing table for that node

 iterative: after k iterations, know least


cost path to k destinations.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-29
Notation:
5 5
 N: set of nodes whose 3 C
B
least cost path 2 5
definitively known A 23
3 1 F
c(i,j): link cost from node 1 2
i to j. cost infinite if D E
1
not direct neighbors
Example: N: A, B, C, D, E, F
 p(v): nodes along path
from source to v C(A,C)=5; C(C,A)=5
C(B,D)=2; C(D,B)=3
 D(v): current value of

cost of path from
source to destination Source=A
p(F): A-D-E-F
v. D(F)=4
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-30
Dijsktra’s Algorithm
v
n = number of nodes (except the source)

1 Initialization:
2 N = {A} D(v) c(w,v)
3 for all nodes v
4 if v adjacent to A
w
5 then D(v) = c(A,v)
6 else D(v) = infinity A
7 D(w)
8 Loop
9 find w not in N such that D(w) is a minimum
10 add w to N
n(n+1)/2) 11 update D(v) for all v adjacent to w and not in N:
times 12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-31
Dijkstra’s Algorithm: example

computes least cost paths from node A to all other nodes

Step start N D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F)


0 A 2,A-B 5,A-C 1,A-D infinity infinity
1 AD 2,A-B 4,A-D-C 1,A-D 2,A-D-E infinity
2 ADE 2,A-B 3,A-D-E-C 1,A-D 2,A-D-E 4,A-D-E-F
3 ADEB 2,A-B 3,A-D-E-C 1,A-D 2,A-D-E 4,A-D-E-F
4 ADEBC 2,A-B 3,A-D-E-C 1,A-D 2,A-D-E 4,A-D-E-F
5 ADEBCF 2,A-B 3,A-D-E-C 1,A-D 2,A-D-E 4,A-D-E-F

5
D(v): Distance (cost) of A to v. 3
P(v): nodes along path fromA to v. B C
2 5
A 3 1
2 F
1 2
D E
1
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-32
Dijkstra’s Algorithm: discussion1

Algorithm complexity: Suppose there are n nodes, except source

 First iteration: Search through all n nodes to determine the node,


w, not in N that has the minimum cost.
 Second iteration: Check n - 1 nodes to determine minimum cost.
 Third iteration: n - 2 nodes, and so on.
 Total number of nodes searched: n(n + 1)/2
 The implementation of the link state algorithm has worst-case
complexity of order n squared: O(n2).

 A more sophisticated implementation of this algorithm, using a


data structure known as a heap, can find the minimum in line 9 in
logarithmic rather than linear time, thus reducing the complexity:
O( nlog(n) )

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-33
Dijkstra’s Algorithm: discussion2

Oscillations possibility:
 Suppose link costs are equal to
the load carried on the link, or A
1
the delay that experienced. D 1+e
B
0 0
 Link costs are not symmetric, 1 0 e
C
c(A,B) equals c(B,A) only if the 1
load on both directions on the e
AB link is the same. Fig. a- Initial routing

 Nodes B and D originates a unit


of traffic destined for A.
 Node C originates e unit for A.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-34
Discussion2 (cont.)

… oscillations possible: 1
A
 Algorithm is run: C D 1+e
B
determines (Fig. a) the 0
0 0
1 C e
clockwise path to A has a cost 1
of 1, while the
counterclockwise path to A e
Fig. a- Initial routing
has a cost of 1 + e. Hence C ’s
least-cost path to A is now
clockwise. A
2+e 0
 Similarly, B determines that D B
its new least-cost path to A is 1+e 1
0 0
also clockwise, resulting in 1 C 1
costs shown in Fig. b. e
Fig. b- B, C find better
path to A is clockwise
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-35
Discussion2 (cont.)

A
… oscillations possible: 0 2+e
D B
0 0
 When algorithm is run next, 1 1 C 1+e
1
nodes B, C, and D all detect a e
zero-cost path to A in the Fig. c- B, C, D find better
path to A is counterclockwise
counterclockwise direction,
and all route their traffic to A
the counterclockwise routes. 2+e 0
D B
 The next time the LS 1+e 1
algorithm is run, B, C, and D all 1 0 0
C 1
then route their traffic to the
e
clockwise routes. Fig. d- B, C, D find better
path to A is clockwise
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-36
Dijkstra’s Algorithm: discussion2

To prevent such oscillations:


 Solution1 :link costs not depend on the amount of traffic carried ,an
unacceptable solution since one goal of routing is to avoid highly congested
(for example, high-delay) links.

 Solution2 :all routers do not run the LS algorithm at the same time
(a reasonable solution).
 Routers run the LS algorithm with the same periodicity, the
execution instance of the algorithm would not be the same at
each node.
 Researchers have noted: Routers in the Internet can self-
synchronize among themselves. That is, even though they
initially execute the algorithm with the same period but at
different instants of time, the algorithm execution instance can
eventually become, and remain, synchronized at the routers.
 Avoid such self-synchronization: Introduce randomization into
the period between execution instants of the algorithm at each
node.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-37
Distance Vector Routing Algorithm
(Decentralized)

Iterative:
Distance Table data structure
 continues until no
nodes exchange info.  each node has its own:
 self-terminating: no row for each possible destination
“signal” to stop column for each directly-
attached neighbor to node
Asynchronous:
 example: in node X, for dest. Y
 nodes need not
via neighbor Z: DX(Y,Z)
exchange info/iterate
in lock step!
X Z
distributed: D (Y,Z) = c(X,Z) + minw {D (Y,w)}
 each node
distance from X to Y, via Z as next hop
communicates only with
directly-attached
neighbors
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-38
Distance Table: example
neighbor: j
1 C
B A B D
7
8 2
A A 1 14 5

destination: i
1 E D B 7 8 5
source 2 C 6 9 4
E’s neighbor A D 4 11 2
B’s neighbor E
Distance table: D(i, j)
B
D (A,C)
C E
D (A,B)=
D
B B
E c(E,B) = c(E,B) + minw{D (A,w)}
… = 8 + 6 = 14

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-39
Distance table gives routing table

cost to destination via


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

A 1 14 5 A A,1

B 7 8 5 B D,5

C 6 9 4 C D,4

D 4 11 2 D D,4

Distance table Routing table


of node E

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-40
Distance Vector Routing: overview

Iterative, asynchronous:
each local iteration caused
Each node:
by: wait for (change in local link
 local link cost change cost or message from
 message from neighbor: its neighbor)
least cost path change
from neighbor
Distributed: recompute distance table
 each node notifies
neighbors only when its
least cost path to any if least cost path to any
destination changes destination has changed,
 neighbors then notify notify neighbors
their neighbors if
necessary
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-41
Distance Vector Algorithm:
* Y

DX (*,v) v
At node: X w
1 Initialization: DX (y,w)
X’s adjacents
destinations X
2 for all adjacent nodes v:
3 DX (*,v) = ∞ /* the * means "for all desstinations" */
4 DX (v,v) = c(X,v)

5 for all destinations, y


6 send minW DX (y,w) to each neighbor /* w over all
X's neighbors */

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-42
Distance Vector Algorithm (cont.):
8 loop
9 wait ( until I see a link cost change to neighbor v
10 or until I receive update from neighbor v )
11
12 if ( c(X,v) changes by d )
13 /* change cost to all dest's via neighbor v by d */
14 /* note: d could be positive or negative */
15 for all destinations y: DX (y,v) = DX (y,v) + d
16
17 else if (update received from v for destination Y)
18 /* shortest path from V to some Y has changed */
19 /* V has sent a new value for its minW DV (Y,w) */
20 /* call this received new value is "newval" */
21 for the single destination y: DX (Y,v) = c(X,v) + newval
22
23 if we have a new minW DX(Y,w) for any destination Y
24 send new value of minW DX(Y,w) to all neighbors
25
26 forever
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-43
Distance Vector Algorithm: example

Node X’s table

Y Node Y’s table


2 1
X Z
7

Node Z’s table


new minimum

time
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-44
Distance Vector Algorithm: example

4
1 X dose not sends
3 DX(Y,Y) to Y and Z.
Y
2 1
X sends new 4
DX(Y,Z) to Y and Z
X Z 2 2
7
X learns this term from Y

X Y
1 D (Z,Y) = c(X,Y) + minw {D (Z,w)}
= 2+1 = 3

X learns this term from Z

X Z
D (Y,Z) = c(X,Z) + minw{D (Y,w)}
1 = 7+1 = 8

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-45
Distance Vector: link cost changes
Link cost changes:
 t0:Y detects local link cost change.  t2: Y receives Z’s update and
updates distance table (line 15). then updates its table, DY (X,X)
least cost path DY (X,X) changes, not changed, terminate.
notify neighbors (lines 23,24).
 t1: Z receives Y’s update and
then updates its table.

1 Y
4 1
X Z
50

algorithm
terminates

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-46
Distance Vector: link cost changes

Link cost changes:


 Routing loop: in order to 60 Y
get to X, Y routes through 4 1
Z, and Z routes through Y. X Z
 “count to infinity” problem! 50

Y Y Y
algorithm
continues
on!

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-47
Poisoned reverse solution: “count to infinity” problem!

If Z routes through Y to get to X :


60 Y
 Z tells Y its (Z’s) distance to X is 1
4
infinite (so Y won’t route to X via Z)
X Z
 will this completely solve count to 50
infinity problem?
algorithm
terminates

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-48
Comparison of LS and DV algorithms
Message complexity Robustness: what happens
 LS: with n nodes, E links, if router malfunctions?
O(nE) msgs sent each LS:
 DV: exchange between  Node (router) can
neighbors only advertise incorrect link
 convergence time varies cost
Speed of Convergence  each node computes only
its own table: robustness
 LS: O(n2) algorithm requires
O(nE) msgs DV:
 may have oscillations  DV node can advertise
 DV: convergence time varies incorrect least-cost
paths
 may be routing loops
 each node’s table used by
 count-to-infinity problem
others
 error propagate thru
network
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-49
Chapter 4 Outline

4.1 Introduction and Network Service Models


4.2 Routing Principles
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
4.5 Routing in the Internet
4.6 What’s Inside a Router
4.7 IPv6
4.8 Multicast Routing
4.9 Mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-50
Hierarchical Routing

The routing study thus far was idealized


 all routers identical
 network “flat”
… not true in practice
scale: with 200 million administrative
destinations (hosts):
 can’t store all dest’s in routing
autonomy:
tables (memory limitation)!  internet = network of
 routing table exchange would networks
leave no bandwidth left for  each network admin may
sending data packets! want to control routing in its
 DV algorithm that iterated own network
among large number of
routers never converge!
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-51
Hierarchical Routing

 aggregate routers into gateway routers


regions, “autonomous  special routers in AS
systems” (AS)  run intra-AS routing
 routers in same AS run protocol with all other
routers in AS
same routing protocol
 also responsible for
 “intra-AS” routing
routing to destinations
protocol
outside AS
 routers in different AS
 run inter-AS routing
can run different intra-
protocol with other
AS routing protocol
gateway routers

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-52
Intra--AS and Inter-
Intra Inter-AS routing
C.b
B.a Gateways:
A.a •perform inter-AS
b A.c c routing amongst
a themselves
a
b •perform intra-AS
C a
d B routers with other
c routers in their
A b
AS
▪Routers in an AS
Intra-AS
Intra- Inter-AS
Inter- have information
Routing Routing
Inter/intra-AS Algorithm Algorithm
about routing paths
routing in within that AS.
gateway A.c
Routing Table

DL DL DL
PHL PHL PHL
To/from A.b To/from B.a and A.a
To/from A.d
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-53
Intra--AS and Inter-
Intra Inter-AS routing

C.b
B.a
A.a
Host2
b A.c c
a a
b
C a B
d Intra-AS routing
c
A b within AS B
Intra-AS routing
Host1 within AS A

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-54
Chapter 4 outline

4.1 Introduction and Network Service Models


4.2 Routing Principles
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
 4.4.1 IPv4 addressing
 4.4.2 Moving a datagram from source to destination
 4.4.3 Datagram format
 4.4.4 IP fragmentation
 4.4.5 ICMP: Internet Control Message Protocol
 4.4.6 DHCP: Dynamic Host Configuration Protocol
 4.4.7 NAT: Network Address Translation
4.5 Routing in the Internet
4.6 What’s Inside a Router
4.7 IPv6
4.8 Multicast Routing
4.9 Mobility
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-55
The Internet Network layer
Host, Router network-layer-functions:
Transport layer: TCP, UDP

Routing protocols IP protocol

Network layer
•path selection •addressing conventions
•RIP, OSPF, BGP •datagram format
•packet handling conventions

forwarding ICMP protocol


table •error reporting
•router “signaling”

Link layer
physical layer

ICMP: Internet Control Message Protocol, RFC792

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-56
Internet Routing Protocol
 Intra-AS: administrator responsible for choice of
routing algorithm within network
 Also known as Interior Gateway Protocols (IGP)
 Most common Intra-AS routing protocols:
 RIP: Routing Information Protocol (RFCs1058,2453)
– It is a distance vector protocol.
– Routing updates are exchanged between neighbors app. Every 30sec.

 OSPF: Open Shortest Path First (RFC2328) (Open Spec.)


 IGRP: Interior Gateway Routing Protocol (Cisco proprietary)
– These are link-state protocol that uses flooding of link information and a
Dijkstra least-cost path algorithm.

 Inter-AS: unique standard for inter-AS routing:


BGP (RFC1771)

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-57
IP Addressing: Introduction

223.1.1.1
 IP address: 32-bit
identifier for host, 223.1.2.1
223.1.1.2
router interface 223.1.1.4 223.1.2.9
 interface: connection 223.1.2.2
between host/router 223.1.1.3 223.1.3.27

and physical link


 router’s typically have
multiple interfaces 223.1.3.1 223.1.3.2
 host may have multiple
interfaces
 IP addresses
associated with each 223.1.1.1 = 11011111 00000001 00000001 00000001
interface
223 1 1 1

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-58
IP Addressing
223.1.1.1
 IP address:
 network part (high 223.1.2.1
223.1.1.2
order bits) 223.1.1.4 223.1.2.9
 host part (low order
bits) 223.1.2.2
223.1.1.3 223.1.3.27
 What’s a network ?
LAN
(from IP address
perspective) 223.1.3.1 223.1.3.2
 device interfaces with
same network part of
IP address
 can physically reach
network consisting of 3 IP networks
each other without
intervening router

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-59
223.1.1.2
IP Addressing
How to find the 223.1.1.1 223.1.1.4

networks?
223.1.1.3
 Detach each
interface from 223.1.9.2 223.1.7.0
router, host
 create “islands of
isolated networks 223.1.9.1 223.1.7.1
223.1.8.1 223.1.8.0

223.1.2.6 223.1.3.27
Interconnected
system consisting 223.1.2.1 223.1.2.2 223.1.3.1 223.1.3.2
of six networks.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-60
Getting a datagram from source to dest.

forwarding table in A
Dest. Net. Next Router Nhops
223.1.1 1
IP datagram: 223.1.2 223.1.1.4 2
223.1.3 223.1.1.4 2
misc source dest
data
fields IP addr IP addr
A 223.1.1.1

 datagram remains 223.1.2.1


unchanged, as it travels 223.1.1.2
223.1.1.4 223.1.2.9
source to destination
 addr fields of interest B
223.1.3.27 223.1.2.2 E
here 223.1.1.3

223.1.3.1 223.1.3.2

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-61
Getting a datagram from source to dest.

forwarding table in A
misc Dest. Net. Next Router Nhops
data
fields 223.1.1.1 223.1.1.3
223.1.1 1
223.1.2 223.1.1.4 2
Starting at A, send IP
223.1.3 223.1.1.4 2
datagram addressed to B:
 look up net. address of B in
A 223.1.1.1
forwarding table
223.1.2.1
 find B is on same net. as A 223.1.1.2
223.1.1.4 223.1.2.9
 link layer will send datagram
directly to B inside link-layer B
frame 223.1.3.27 223.1.2.2 E
223.1.1.3
 B and A are directly
223.1.3.1 223.1.3.2
connected

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-62
Getting a datagram from source to dest.

forwarding table in A
misc Dest. Net. Next Router Nhops
data
fields 223.1.1.1 223.1.2.3
223.1.1 1
223.1.2 223.1.1.4 2
Starting at A, dest. E:
223.1.3 223.1.1.4 2
 look up network address of E
in forwarding table
A 223.1.1.1
 E on different network
223.1.2.1
 A, E not directly attached 223.1.1.2
223.1.1.4 223.1.2.9
 routing table: next hop
router to E is 223.1.1.4 B
223.1.3.27 223.1.2.2 E
 link layer sends datagram to
223.1.1.3
router 223.1.1.4 inside link-
223.1.3.1 223.1.3.2
layer frame
 datagram arrives at 223.1.1.4
 continued…..
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-63
Getting a datagram from source to dest.

forwarding table in router


misc Dest. Net Router Nhops Interface
data
fields 223.1.1.1 223.1.2.3
223.1.1 - 1 223.1.1.4
Arriving at 223.1.4, 223.1.2 - 1 223.1.2.9
223.1.3 - 1 223.1.3.27
destined for 223.1.2.2
 look up network address of E
A 223.1.1.1
in router’s forwarding table
223.1.2.1
 E on same network as router’s 223.1.1.2
interface 223.1.2.9 223.1.1.4 223.1.2.9

 router, E directly attached B


223.1.3.27 223.1.2.2 E
 link layer sends datagram to 223.1.1.3
223.1.2.2 inside link-layer
223.1.3.1 223.1.3.2
frame via interface 223.1.2.9
 datagram arrives at 223.1.2.2
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-64
Private or Non-
Non-Routable addresses

 Some addresses are reserved for use on local


networks that are not connected to the Internet
 Routers do not consider these addresses to be valid
Internet addresses, and will not route a packet to any
of them
 These addresses may be used on private internets not
directly connected to the Internet.
 10.0.0.0/8 10.0.0.0 to 10.255.255.255
 172.16.0.0/12 172.16.0.0 to 172.31.255.255
 192.168.0.0/16 192.168.0.0 to 192.168.255.255

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-65
IP Addresses: Class-
Class-full
given notion of “network”, let’s re-examine IP addresses:
“class-full” addressing:

class format range


1.0.0.0 to
A 0 network host 127.255.255.255
128.0.0.0 to
B 10 network host
191.255.255.255
192.0.0.0 to
C 110 network host
223.255.255.255
224.0.0.0 to
D 1110 multicast address
239.255.255.255
240.0.0.0 to
E 1111 reserved
255.255.255.255
32 bits
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-66
Class--full Summary
Class
The Class System
Number of Decimal Number of
Address Number of Number of
Application Network Address Possible
Class Host Bits Networks
Bits Range Host
Large
Class A 8 bits 24 bits 1 - 126 126 16,777,214
Networks
Medium-
Class B 16 bits 16 bits 128 - 191 65,534 65,534
sized
Small
Class C 24 bits 8 bits 192 - 223 2,097,152 254
Networks

Class D and E
12.5%

Class C
12.5% Class A
50%
Class B
25%

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-67
Address depletion

 In 1991 IAB identified 3 dangers


 Running out of class B addresses
 Increase in nets has resulted in routing table explosion
 Increase in net/hosts exhausting 32 bit address space
 Four strategies to address
 Creative address space allocation {RFC 2050}
 Private addresses {RFC 1918}, Network Address
Translation (NAT) {RFC 1631}
 Classless InterDomain Routing (CIDR) {RFC 1519}
 IP version 6 (IPv6) {RFC 1883}

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-68
Creative IP address allocation

 Class A addresses 64 – 127 reserved


 Handle on individual basis
 Class B only assigned given a demonstrated need
 Class C
 divided up into 8 blocks allocated to regional authorities
 208-223 remains unassigned and unallocated
 Three main registries handle assignments
 APNIC – Asia & Pacific www.apnic.net
 ARIN – N. & S. America, Caribbean & sub-Saharan Africa
www.arin.net
 RIPE – Europe and surrounding areas www.ripe.net

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-69
Private IP Addresses

 IP addresses that are not globally unique, but used


exclusively in an organization
 Three ranges:
 10.0.0.0 - 10.255.255.255 a single class A net
 172.16.0.0 - 172.31.255.255 16 contiguous class Bs
 192.168.0.0 – 192.168.255.255 256 contiguous class Cs
 Connectivity provided by Network Address
Translator (NAT)
 translates outgoing private IP address to Internet IP
address, and a return Internet IP address to a private
address
 Only for TCP/UDP packets

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-70
Special Purpose IP Addresses

 Several Addresses within the classes are


reserved for special use.
 0.0.0.0 :Source IP Addr. Just after Boot
 network part of dest. Addr.= 0 :Source and
Destination are in same network.
 Dest. Addr.=255.255.255.255 :Broadcast in
Sender’s network.
 host part of Dest.=111… : Broadcast in
destination network.
 Dest. Addr. = 127.anything : Loop Back

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-71
Special Purpose Addresses-
Addresses-List
Address Block Present Use Reference
0.0.0.0/8 "This" Network [RFC1700, page 4]
10.0.0.0/8 Private-Use Networks [RFC1918]
14.0.0.0/8 Public-Data Networks [RFC1700, page 181]
24.0.0.0/8 Cable Television Networks
39.0.0.0/8 Reserved, subject to allocation [RFC1797]
127.0.0.0/8 Loop back [RFC1700, page 5]
128.0.0.0/16 Reserved but subject to allocation
169.254.0.0/16 Link Local –
172.16.0.0/12 Private-Use Networks [RFC1918]
191.255.0.0/16 Reserved but subject to allocation –
192.0.0.0/24 Reserved but subject to allocation –
192.0.2.0/24 Test-Net
192.88.99.0/24 6to4 Relay Anycast [RFC3068]
192.168.0.0/16 Private-Use Networks [RFC1918]
198.18.0.0/15 Network Interconnect Device Benchmark Testing [RFC2544]
223.255.255.0/24 Reserved but subject to allocation –
224.0.0.0/4 Multicast [RFC3171]
240.0.0.0/4 Reserved for Future Use [RFC1700]

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-72
Class Inter Domain Routing
(CIDR)

 Many organization have > 256 computers


but few have more than several thousand
 Instead of giving class B (16384 nets) give
sufficient contiguous class C addresses to
satisfy needs
 < 256 addresses assign 1 class C
 …
 < 8192 addresses assign 32 contiguous Class C
nets

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-73
IP addressing: CIDR

 Classful addressing:
 inefficient use of address space, address space exhaustion
 e.g., class B net allocated enough addresses for 65K hosts,
even if only 2K hosts in that network
 CIDR: Classless Inter Domain Routing (RFC1519)
 network portion of address of arbitrary length
 address format: a.b.c.d/x, where x is # bits in network
portion of address

network host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-74
Bit Masks and Subnet Masks

In a production environment this prefix typically


varies in length from 8 to 30 bits

/8 = 255.0.0.0 /16 = 255.255.0.0 /24 = 255.255.255.0


/9 = 255.128.0.0 /17 = 255.255.128.0 /25 = 255.255.255.128
/10 = 255.192.0.0 /18 = 255.255.192.0 /26 = 255.255.255.192
/11 = 255.224.0.0 /19 = 255.255.224.0 /27 = 255.255.255.224
/12 = 255.240.0.0 /20 = 255.255.240.0 /28 = 255.255.255.240
/13 = 255.248.0.0 /21 = 255.255.248.0 /29 = 255.255.255.248
/14 = 255.252.0.0 /22 = 255.255.252.0 /30 = 255.255.255.252
/15 = 255.254.0.0 /23 = 255.255.254.0 /31 = not usable
/32 = not usable

/30 yields two usable hosts and is used for WAN connections

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-75
Prefix Equivalents
Network Prefix Equivalent Number of Class Addresses Number of Hosts

/27 1/8th of a Class C 32

/26 1/4th of a Class C 64


/25 1/2 of a Class C 128
/24 1 Class C 256
/23 2 Class C 512

/22 4 Class C 1,024


/21 8 Class C 2,048
/20 16 Class C 4,096
/19 32 Class C 8,192

/18 64 Class C 16,384


/17 128 Class C 32,768
/16 256 Class C or 1 Class B 65,536
/15 512 Class C or 2 Class B 131,072

/14 1,024 Class C or 4 Class B 262,144


/13 2048 Class C or 8 Class B 524,288
/12 4096 Class C or 16 Class B 1,048,576
/11 8192 Class C or 32 Class B 2,097,152

/10 16384 Class C or 64 Class B 4,194,304


/9 32768 Class C or 128 Class B 8,388,608
/8 65,536 Class C or 256 Class B or 1 Class A 16,777,216

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-76
Protocols

Class-full Routing Protocols Classless Routing Protocol


RIP version1 RIP version2
IGPR EIGPR
EGP OSPF
BGP3 BGP4
IS-IS

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-77
Examples

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-78
IP addresses: how to get one?

Q: How does host get IP address?

 IP addr. is configures into host by admin. in a file


 Wintel: control-panel->network->configuration-
>tcp/ip->properties
 UNIX: /etc/rc.config

 DHCP: Dynamic Host Configuration Protocol (RFC2131):


dynamically get address from as server
 “plug-and-play”

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-79
Subnetting (Extended Network Prefix)

Q: How an organization gets network part of IP addr?


A: It gets allocated portion of its ISP’s address
space.

The ISP have been allocated the address block

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23


Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
... ….. …. ….
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

The ISP divides the block into 8 smaller addr.


blocks (subnets) and gives them to 8
organization.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-80
Hierarchical addressing: route aggregation

Hierarchical addressing allows efficient


advertisement of routing information:

Organization 0 route aggregation or


200.23.16.0/23 route summarization.
Organization 1 “Send me anything
200.23.18.0/23 with addresses
beginning
Organization 2 ISP1 200.23.16.0/20”
200.23.20.0/23 .
. 200.23.16.0/20
. . Internet
.
Organization 7 .
200.23.30.0/23
ISP2 “Send me anything
199.31.0.0/16 with addresses
beginning
199.31.0.0/16”

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-81
Hierarchical addressing: more specific routes
ISP2 has a more specific route to Organization 1
The routers in Internet use a longest prefix matching rule, and route
toward ISP2, as it advertises the longest (more specific) address prefix
that matches the destination address.

Organization 0
200.23.16.0/23
“Send me anything
with addresses
beginning
Organization 2 200.23.16.0 /20”
200.23.20.0/23 . ISP1 20 bits
.
. .
. Internet
Organization 7 .
200.23.30.0/23

“Send me anything
ISP2
Organization 1 with addresses
beginning 199.31.0.0/16
200.23.18.0/23 or 200.23.18.0 /23”
23 bits

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-82
Subnet Mask-
Mask-1

 A subnet mask is applied to the host bits to


determine how the network is subnetted,
 e.g. if the host is: 137.138.28.228, and the subnet mask
is 255.255.255.0 then the right hand 8 bits are for the
host (255 is decimal for all bits set in an octet)
 Host addresses of all bits set or no bits set,
indicate a broadcast, i.e. the packet is sent to all
hosts.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-83
Subnet Mask-
Mask-2

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20


ISP’s subnet mask 11111111 11111111 11110000 00000000 255.255.240.0

Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23


Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23
Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23
... ….. …. ….
Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23
Or’s subnet mask 11111111 11111111 11111110 00000000 255.255.254.0

Network part of an IP address= subnet mask & IP address

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-84
IP addressing: ICANN

Q: How does an ISP get block of addresses?

A: ICANN: Internet Corporation for Assigned


Names and Numbers
 allocates addresses

 manages DNS

 assigns domain names, resolves disputes

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-85
CIDR: Subneting Example

 You are assigned the CIDR address 200.32.108.0 /22 and


 you must support the network shown in the diagram.
 Create an addressing scheme that will meet the diagram
requirements.
100 computers

300 computers 100 computers

100 computers

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-86
CIDR: Subneting Example
(Questions)

 Given the CIDR address 200.32.108.0 /22


 How many Class C networks do we have? 3 classes
 How many host addresses do we have? 4x254 addresses
 What is the largest LAN requirement? 300 addresses

 Host required - 300, 100, 100, 100, and 3 WAN links

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-87
0 0

200.32.108.0 200.32. 110.0

255 255
0 0

200.32. 109.0 200.32. 111.0

255 255

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-88
0 0

200.32.108.0
200.32. 110.0

200.32.108.0 /23
0
300 hosts 255
0
255

200.32. 109.0

200.32. 111.0

255 255

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-89
0 0 128

200.32.110.128 /25
200.32.110.0 /25

100 hosts
100 hosts
200.32.108.0 200.32. 110.0

200.32.108.0 /23
0
300 hosts 255
0
127 255

200.32. 109.0
200.32. 111.0

255 255

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-90
0 0 128

200.32.110.128 /25
200.32.110.0 /25

100 hosts
100 hosts
200.32.108.0 200.32. 110.0

200.32.108.0 /23
300 hosts 255
0
127 255
0 128

200.32.111.0 /25
100 hosts
200.32. 109.0 200.32. 111.0

255 127 255

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-91
0 0 128

200.32.110.128 /25
200.32.110.0 /25

100 hosts
100 hosts
200.32.108.0 200.32. 110.0

200.32.108.0 /23
300 hosts 255
0
127 255
0 128

200.32.111.0 /25
100 hosts
191
200.32. 109.0 192 224 200.32. 111.0

239
240 248
243 251 WAN links
244 252 /30
255 127 223 247 255

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-92
CIDR: Subneting Example
(Results)
Given the CIDR address 200.32.108.0 /22

200.32.111.0 /25
1/2 Class C

100 computers

200.32.111.240 /30
200.32.111.248 /30

200.32.111.244 /30
300 computers

100 computers
200.32.108.0 /23 100 computers
2 Class C’s 200.32.110.128 /25
200.32.110.0 /25 1/2 Class C
1/2 Class C
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-93
Supernetting Example-
Example-1
 Company XYZ needs to address 400 hosts.
 Its ISP gives them two contiguous Class C addresses:
 207.21.54.0/24
 207.21.55.0/24
 Company XYZ can use a prefix of 207.21.54.0 /23 to supernet these two
contiguous networks. (Yielding 510 hosts)
 207.21.54.0 /23
 207.21.54.0/24
 207.21.55.0/24

23 bits in common

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-94
Supernetting Example-
Example-2
addressing authority of ISP,include XYZ,
be advertized to Internet as a single supernt

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-95
CIDR and the Provider
example of route aggregation

advertising address: a.b.c.d/x

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-96
IP datagram format
IP protocol version 32 bits
Number[4bits]
total datagram
header length head. “type” of
ver length length (bytes)
(bytes)[4bits] len service
fragment fragmentation/
“type” of data: Priority [3bits] 16-bit identifier flags
Delay[1bit]
offset Reassembly/
time to upper Checksum: 1’s add of
Throughput[1bit] DF, MF Flags
Reliability[1bit] live layer 16bits words in header
upper layer
32 bit source IP address
max number protocol
remaining hops 32 bit destination IP address to deliver
(decremented at payload to
each router) Options (if any) (rfc 1700)
1 :ICMP
data 6 :TCP
how much overhead (variable length, 17 :UDP
with TCP?
typically a TCP
 20 bytes of TCP e.g. timestamp,
or UDP segment)
 20 bytes of IP record route
 = 40 bytes + app
taken, specify
A packet is unique in Internet by: list of routers
layer overhead Id + S. IP Add + D. IP Add + Upper L. to visit.
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-97
IP Fragmentation & Reassembly

 network links have MTU


(max.transfer size) - largest
possible link-level frame.
 different link types, fragmentation:
different MTUs in: one large datagram
 large IP datagram divided out: 3 smaller datagrams
(“fragmented”) within net
 one datagram becomes
several datagrams
reassembly
 “reassembled” only at final
destination
 IP header bits used to
identify, order related
fragments

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-98
IP Fragmentation and Reassembly
data
20 Byte 0……….3979
length ID fragflag offset
Example =4000 =x =0 =0
4000 Bytes
 4000 byte
datagram
0……….1479
 MTU = 1500 bytes
length ID fragflag offset
=1500 =x =1 =0

1480…2959
One large datagram becomes length ID fragflag offset
3 smaller datagrams. =1500 =x =1 =1480

length ID fragflag offset


=1040 =x =0 =2960

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-99
ICMP:: Internet Control Message Protocol
ICMP
 Network managers or users identify network problems.
 One of the most frequently used debugging tools invokes the
ICMP echo request and echo reply messages.

 A host or router sends an ICMP echo request message to a


specified destination.

 The command users invoke to send ICMP echo requests is


named ping. Sophisticated versions of ping send a series of
ICMP echo requests, capture responses, and provide
statistics about datagram loss. They allow the user to
specify the length of the data being sent and the interval
between requests. Less sophisticated versions merely send
one ICMP echo request and await a reply.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-100
ICMP (Cont.)
 Any machine that receives an echo request formulates an
echo reply and returns it to the original sender. The request
contains an optional data area; the reply contains a copy of
the data sent in the request. The echo request and
associated reply can be used to test whether a destination is
reachable and responding. Because both the request and
reply travel in IP datagrams, successful receipt of a reply
verifies that major pieces of the transport system work.
 First, IP software on the source computer must route
the datagram.
 Second, intermediate routers between the source and
destination must be operating and must route the
datagram correctly.
 Third, the destination machine must be running (at least
it must respond to interrupts), and both ICMP and IP
software must be working.
 Finally, all routers along the return path must have
correct routes.
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-101
ICMP (Cont.)
 The Internet Control Message Protocol 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.

 When a datagram causes an error, ICMP can only report the error
condition back to the original source of the datagram; the source must
relate the error to an individual application program or take other
action to correct the problem.

 Each ICMP message has its own format. They all begin with the same
three fields:
 an 8-bit TYPE field that identifies the message,

 an 8-bit CODE field that provides further information about the


message type,
 a 16-bit CHECKSUM field (ICMP uses the same additive checksum
algorithm as IP, but the ICMP checksum only covers the ICMP
message).
 In addition, ICMP messages that report errors always include the
header and first 64 data bits of the datagram causing the problem.
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-102
ICMP: TYPE, CODE
Type Code description
0 0 echo reply (ping)
3 0 dest. network unreachable
3 1 dest host unreachable
3 2 dest protocol unreachable
3 3 dest port unreachable
3 6 dest network unknown
3 7 dest host unknown
4 0 source quench (congestion
control - not used)
8 0 echo request (ping)
9 0 route advertisement
10 0 router discovery
11 0 TTL expired
12 0 bad IP header
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-103
ICMP’s Message Format: an example

ICMP echo request or reply message format.

OPTIONAL DATA is a variable length field that contains data to be returned to the
sender. An echo reply always returns exactly the same data as was received in the
request. IDENTIFIER and SEQUENCE NUMBER are used by the sender to match
replies to requests. The value of the TYPE field specifies whether the message is a
request (8) or a reply (0).

The ICMP message is encapsulated in an IP datagram, which is further


encapsulated in a frame for transmission. To identify ICMP, the datagram
protocol field contains the value 1.
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-104
DHCP:: Dynamic Host Configuration Protocol
DHCP

Goal: allow host to dynamically obtain its IP address


from network server when it joins network
Can renew its lease on address in use
Allows reuse of addresses (only hold address while connected
an “on”
Support for mobile users who want to join network (more
shortly)
DHCP overview:
 host broadcasts “DHCP discover” msg

 DHCP server responds with “DHCP offer” msg

 host requests IP address: “DHCP request” msg

 DHCP server sends address: “DHCP ack” msg


analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-105
DHCP client-
client-server scenario

DHCP
server
223.1.2.1
A 223.1.1.1

223.1.1.2
223.1.1.4 223.1.2.9

B
223.1.3.27 223.1.2.2 arriving DHCP
223.1.1.3 E client needs
address in this
223.1.3.1 223.1.3.2
network

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-106
DHCP client-
client-server scenario
arriving
DHCP server: 223.1.2.5 client
DHCP discover
src : 0.0.0.0, 68
dest.: 255.255.255.255,67
yiaddr: 0.0.0.0
transaction ID: 654

DHCP offer
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
transaction ID: 654
Lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
yiaddrr: 223.1.2.4
transaction ID: 655
Lifetime: 3600 secs

DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255, 68
yiaddrr: 223.1.2.4
time transaction ID: 655
Lifetime: 3600 secs

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-107
NAT: Network Address Translation

rest of local network


Internet (e.g., home network)
10.0.0/24 10.0.0.1

10.0.0.4
10.0.0.2

138.76.29.7

10.0.0.3

All datagrams leaving local Datagrams with source or


network have same single source destination in this network
NAT IP address: 138.76.29.7, have 10.0.0/24 address for
different source port numbers source, destination (as usual)

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-108
NAT: Network Address Translation

 Motivation: local network uses just one IP address as


far as outside word is concerned:
 no need to be allocated range of addresses from ISP:
- just one IP address is used for all devices
 can change addresses of devices in local network
without notifying outside world
 can change ISP without changing addresses of
devices in local network
 devices inside local net not explicitly addressable,
visible by outside world (a security plus).

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-109
NAT: Network Address Translation

Implementation: NAT router must:

 outgoing datagrams: replace (source IP address, port


#) of every outgoing datagram to (NAT IP address,
new port #)
. . . remote clients/servers will respond using (NAT
IP address, new port #) as destination addr.

 remember (in NAT translation table) every (source


IP address, port #) to (NAT IP address, new port #)
translation pair

 incoming datagrams: replace (NAT IP address, new


port #) in dest fields of every incoming datagram
with corresponding (source IP address, port #)
stored in NAT table
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-110
NAT: Network Address Translation

NAT translation table


2: NAT router 1: host 10.0.0.1
WAN side addr LAN side addr
changes datagram sends datagram to
138.76.29.7, 5001 10.0.0.1, 3345 128.119.40, 80
source addr from
…… ……
10.0.0.1, 3345 to
138.76.29.7, 5001, S: 10.0.0.1, 3345
updates table D: 128.119.40.186, 80
10.0.0.1
1
S: 138.76.29.7, 5001
2 D: 128.119.40.186, 80 10.0.0.4
10.0.0.2
138.76.29.7 S: 128.119.40.186, 80
D: 10.0.0.1, 3345
4
S: 128.119.40.186, 80
D: 138.76.29.7, 5001 3 10.0.0.3
4: NAT router
3: Reply arrives changes datagram
dest. address: dest addr from
138.76.29.7, 5001 138.76.29.7, 5001 to 10.0.0.1, 3345

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-111
NAT: Network Address Translation

 16-bit port-number field:


 60,000 simultaneous connections with a single
LAN-side address!
 NAT is controversial:
 routers should only process up to layer 3
 violates end-to-end argument
 NAT possibility must be taken into account by app
designers, eg, P2P applications
 address shortage should instead be solved by
IPv6

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-112
Chapter 4 Outline

4.1 Introduction and Network Service Models


4.2 Routing Principles
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
4.5 Routing in the Internet
 4.5.1 Intra-AS routing: RIP and OSPF

 4.5.2 Inter-AS routing: BGP

4.6 What’s Inside a Router?


4.7 IPv6
4.8 Multicast Routing
4.9 Mobility
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-113
Routing in the Internet
(RC1812) Requirements for IP Version 4 Routers

 The Global Internet consists of Autonomous Systems


(AS) interconnected with each other:
 Stub AS: small corporation: one connection to other AS’s
 Multihomed AS: large corporation (no transit): multiple
connections to other AS’s
 Transit AS: provider, hooking many AS’s together

 Two-level routing:
 Intra-AS: administrator responsible for choice of routing
algorithm within network
 Inter-AS: unique standard for inter-AS routing:
BGP(RFC1771)

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-114
Internet AS Hierarchy

Intra-AS border (exterior gateway) routers

C.b
B.a

C A.a
b A.c c
a
a
b
a
A d B
c
b

Inter-AS (interior gateway) routers


analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-115
Intra--AS Routing
Intra

 Also known as Interior Gateway Protocols (IGP)


 Most common Intra-AS routing protocols:

 RIP: Routing Information Protocol


 OSPF: Open Shortest Path First

 IGRP: Interior Gateway Routing Protocol (Cisco


proprietary)

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-116
RIP ( Routing Information Protocol)

 Distance vector algorithm


 Included in BSD-UNIX Distribution in 1982
 Distance metric: # of hops (max = 15 hops)
 Can you guess why?

 Distance vectors: exchanged among neighbors every


30 sec via Response Message (also called
advertisement)
 Each advertisement: list of up to 25 destination nets
within AS

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-117
RIP: Example

z
w x y
A D B

C
Destination Network Next Router Num. of hops to dest.
w A 2
y B 2
z B 7
x -- 1
…. …. ....
Routing table in D

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-118
RIP: Example
Dest Next hops
w - - Advertisement
x - - from A to D
z C 4
…. … ...
z
w x y
A D B

Destination Network Next Router Num. of hops to dest.


w A 2
y B 2
z B A 7 5
x -- 1
…. …. ....
analoui@iust.ac.ir
Jamali@iust.ac.ir Routing table in D IUST-Network
Network LayerLayer 4-119
RIP: Link Failure and Recovery

If no advertisement heard after 180 sec -->


neighbor/link declared dead
 routes via neighbor invalidated

 new advertisements sent to neighbors

 neighbors in turn send out new advertisements (if


tables changed)
 link failure info quickly propagates to entire net

 poison reverse used to prevent ping-pong loops


(infinite distance = 16 hops)

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-120
RIP Table processing

 RIP routing tables managed by application-level


process called route-d (daemon)
 advertisements sent in UDP packets, periodically
repeated
routed routed

Transprt Transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
physical physical

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-121
RIP Table example (continued)

Router: giroflee.eurocom.fr
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
127.0.0.1 127.0.0.1 UH 0 26492 lo0
192.168.2. 192.168.2.5 U 2 13 fa0
193.55.114. 193.55.114.6 U 3 58503 le0
192.168.3. 192.168.3.5 U 2 25 qaa0
224.0.0.0 193.55.114.6 U 3 0 le0
default 193.55.114.129 UG 0 143454

 Three attached class C networks (LANs)


 Router only knows routes to attached LANs
 Default router used to “go up”
 Route multicast address: 224.0.0.0
 Loopback interface (for debugging)
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-122
OSPF (Open Shortest Path First)

 “open”: publicly available


 Uses Link State algorithm
 LS packet dissemination
 Topology map at each node
 Route computation using Dijkstra’s algorithm

 OSPF advertisement carries one entry per neighbor


router
 Advertisements disseminated to entire AS (via
flooding)
 Carried in OSPF messages directly over IP (rather than TCP
or UDP

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-123
OSPF “advanced” features (not in RIP)

 Security: all OSPF messages authenticated (to


prevent malicious intrusion)
 Multiple same-cost paths allowed (only one path in
RIP)
 For each link, multiple cost metrics for different
TOS (e.g., satellite link cost set “low” for best effort;
high for real time)
 Integrated uni- and multicast support:
 Multicast OSPF (MOSPF) uses same topology data
base as OSPF
 Hierarchical OSPF in large domains.
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-124
Hierarchical OSPF

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-125
Hierarchical OSPF

 Two-level hierarchy: local area, backbone.


 Link-state advertisements only in area

 each nodes has detailed area topology; only know


direction (shortest path) to nets in other areas.
 Area border routers: “summarize” distances to nets
in own area, advertise to other Area Border routers.
 Backbone routers: run OSPF routing limited to
backbone.
 Boundary routers: connect to other AS’s.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-126
Inter--AS routing in the Internet: BGP
Inter

R4
R5 BGP
R3 AS3
(OSPF intra-AS
AS1 AS2 routing)
(RIP intra-AS routing) (OSPF
BGP intra-AS
routing)
R1 R2

Figure 4.5.2-new2: BGP use for inter-domain routing

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-127
Internet inter-
inter-AS routing: BGP

 BGP (Border Gateway Protocol): the de facto


standard
 Path Vector protocol:
 similar to Distance Vector protocol

 each Border Gateway broadcast to neighbors


(peers) entire path (i.e., sequence of AS’s) to
destination
 BGP routes to networks (ASs), not individual
hosts
 E.g., Gateway X may send its path to dest. Z:

Path (X,Z) = X,Y1,Y2,Y3,…,Z


analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-128
Internet inter-
inter-AS routing: BGP

Suppose: gateway X send its path to peer gateway W


 W may or may not select path offered by X
 cost, policy (don’t route via competitors AS), loop
prevention reasons.
 If W selects path advertised by X, then:
Path (W,Z) = w, Path (X,Z)
 Note: X can control incoming traffic by controlling it
route advertisements to peers:
 e.g., don’t want to route traffic to Z -> don’t
advertise any routes to Z

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-129
BGP: controlling who routes to you

B provider
legend:
X network
W A
customer
C network

Figure 4.5- BGPnew : a simple BGP scenario

 A,B,C are provider networks


 X,W,Y are customer (of provider networks)
 X is dual-homed: attached to two networks
 X does not want to route from B via X to C

 .. so X will not advertise to B a route to C

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-130
BGP: controlling who routes to you

B provider
legend:
X network
W A
customer
C network

 A advertises to B the path AW


 B advertises to W the path BAW
 Should B advertise to C the path BAW?
 No way! B gets no “revenue” for routing CBAW since neither
W nor C are B’s customers
 B wants to force C to route to w via A
 B wants to route only to/from its customers!
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-131
BGP operation

Q: What does a BGP router do?


 Receiving and filtering route advertisements from
directly attached neighbor(s).
 Route selection.
 To route to destination X, which path )of
several advertised) will be taken?
 Sending route advertisements to neighbors.

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-132
BGP messages

 BGP messages exchanged using TCP.


 BGP messages:
 OPEN: opens TCP connection to peer and
authenticates sender
 UPDATE: advertises new path (or withdraws old)

 KEEPALIVE keeps connection alive in absence of


UPDATES; also ACKs OPEN request
 NOTIFICATION: reports errors in previous msg;
also used to close connection

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-133
Why different Intra-
Intra- and Inter-
Inter-AS routing ?

Policy:
 Inter-AS: admin wants control over how its traffic
routed, who routes through its net.
 Intra-AS: single admin, so no policy decisions needed
Scale:
 hierarchical routing saves table size, reduced update
traffic
Performance:
 Intra-AS: can focus on performance
 Inter-AS: policy may dominate over performance

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-134
Chapter 4 Outline

4.1 Introduction and Network Service Models


4.2 Routing Principles
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
4.5 Routing in the Internet
4.6 What’s Inside a Router?
4.7 IPv6
4.8 Multicast Routing
4.9 Mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-135
Router Architecture Overview

Two key router functions:


 run routing algorithms/protocol (RIP, OSPF, BGP)
 switching datagrams from incoming to outgoing link

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-136
Input Port Functions

Physical layer:
bit-level reception

Data link layer: Decentralized switching:


e.g., Ethernet  given datagram dest., lookup output port
see chapter 5 using routing table in input port memory
 goal: complete input port processing at
‘line speed’
 queuing: if datagrams arrive faster than
forwarding rate into switch fabric

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-137
Input Port Queuing

 Fabric slower that input ports combined -> queueing


may occur at input queues
 Head-of-the-Line (HOL) blocking: queued datagram
at front of queue prevents others in queue from
moving forward
 queueing delay and loss due to input buffer overflow!

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-138
Three Types of Switching Fabrics

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-139
Switching Via Memory
First generation routers:
 packet copied by system’s (single) CPU
 speed limited by memory bandwidth (2 bus
crossings per datagram)
Input Memory Output
Port Port

System Bus

Modern routers:
 input port processor performs lookup, copy into
memory
 Cisco Catalyst 8500
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network Layer
Network Layer 4-140
Switching Via a Bus

 datagram from input port memory


to output port memory via a shared
bus
 bus contention: switching speed
limited by bus bandwidth
 1 Gbps bus, Cisco 1900: sufficient
speed for access and enterprise
routers (not regional or backbone)

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-141
Switching Via An Interconnection Network

 overcome bus bandwidth limitations


 Banyan networks, other interconnection nets
initially developed to connect processors in
multiprocessor
 Advanced design: fragmenting datagram into fixed
length cells, switch cells through the fabric.
 Cisco 12000: switches Gbps through the
interconnection network

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-142
Output Ports

 Buffering required when datagrams arrive from


fabric faster than the transmission rate
 Scheduling discipline chooses among queued
datagrams for transmission

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-143
Output port queuing

 buffering when arrival rate via switch exceeds


output line speed
 queueing (delay) and loss due to output port
buffer overflow!
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-144
Chapter 4 Outline

4.1 Introduction and Network Service Models


4.2 Routing Principles
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
4.5 Routing in the Internet
4.6 What’s Inside a Router?
4.7 IPv6
4.8 Multicast Routing
4.9 Mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-145
IPv6

 Initial motivation: 32-bit address space


completely allocated by 2008.
 Additional motivation:
 header format helps speed processing/forwarding
 header changes to facilitate QoS
 new “anycast” address: route to “best” of several
replicated servers
 IPv6 datagram format:
 fixed-length 40 byte header
 no fragmentation allowed

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-146
IPv6 Header (Cont)

Priority: identify priority among datagrams in flow


Flow Label: identify datagrams in same “flow.”
(concept of“flow” not well defined).
Next header: identify upper layer protocol for data

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-147
Other Changes from IPv4

 Checksum: removed entirely to reduce


processing time at each hop
 Options: allowed, but outside of header,
indicated by “Next Header” field
 ICMPv6: new version of ICMP
 additional message types, e.g. “Packet Too Big”
 multicast group management functions

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-148
Transition From IPv4 To IPv6

 Not all routers can be upgraded simultaneous


 no “flag days”
 How will the network operate with mixed IPv4 and
IPv6 routers?
 Two proposed approaches:
 Dual Stack: some routers with dual stack (v6, v4)
can “translate” between formats
 Tunneling: IPv6 carried as payload in IPv4
datagram among IPv4 routers

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-149
Dual Stack Approach

A B C D E F

IPv6 IPv6 IPv4 IPv4 IPv6 IPv6

Flow: X Src:A Src:A Flow: ??


Src: A Dest: F Dest: F Src: A
Dest: F Dest: F

data data data data

A-to-B: B-to-C: B-to-C: B-to-C:


IPv6 IPv4 IPv4 IPv6

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-150
Tunneling--Analogy
Tunneling
A B E F
Logical view: tunnel

IPv6 IPv6 IPv6 IPv6

Analogy:

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-151
Tunneling--Physical View
Tunneling
A B E F
Logical view: tunnel

IPv6 IPv6 IPv6 IPv6

A B C D E F
Physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6

Flow: X Src:B Src:B Flow: X


Src: A Dest: E Dest: E Src: A
Dest: F Dest: F
Flow: X Flow: X
Src: A Src: A
data Dest: F Dest: F data

data data

A-to-B: B-to-C: B-to-C: E-to-F:


IPv6 IPv6 inside IPv6 inside IPv6
IPv4 IPv4
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-152
RFC2474: Differentiated Services Field (DS
RFC2474:
Field) in the IPv4 and IPv6 Headers
 Differentiated services are intended to enable deployment
of scalable service discrimination in the Internet.
 Architecture is separated into two major components, one of
which is fairly well-understood and the other of which is
just beginning to be understood.

 Decision is made to separate the forwarding and routing


components (as in original design of Internet).
 Packet forwarding is the relatively simple task that needs to
be performed on a per-packet basis as quickly as possible.
 Forwarding uses the packet header to find an entry in a
routing table that determines the packet's output interface.

 Routing sets the entries in that table and may need to


reflect a range of transit and other policies as well as to
keep track of route failures.
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-153
RFC2474 (cont)
 Routing tables are maintained as a background process to
the forwarding task. Further, routing is the more complex
task and it has continued to evolve over the past 20 years.
 Analogously, the differentiated services architecture
contains two main components.
 One is the fairly well-understood behavior in the forwarding
path and the other is the more complex and still emerging
background policy and allocation component that configures
parameters used in the forwarding path.
 The forwarding path behaviors include the differential
treatment an individual packet receives, as implemented by
queue service disciplines and/or queue management
disciplines.
 These per-hop behaviors are useful and required in network
nodes to deliver differentiated treatment of packets no
matter how we construct end-to-end or intra-domain
services.
 Focus is on the general semantics of the behaviors rather
than the specific mechanisms used to implement them since
these behaviors will evolve less rapidly than the mechanisms.
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-154
Chapter 4 roadmap

4.1 Introduction and Network Service Models


4.2 Routing Principles
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
4.5 Routing in the Internet
4.6 What’s Inside a Router?
4.7 IPv6
4.8 Multicast Routing
4.9 Mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-155
Multicast: one sender to many receivers

 Multicast: act of sending datagram to multiple


receivers with single “transmit” operation
 analogy: one teacher to many students

 Question: how to achieve multicast

Multicast via unicast


 source sends N
unicast datagrams,
one addressed to
each of N receivers
routers multicast receiver (red)
forward unicast
not a multicast receiver (red)
datagrams
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-156
Multicast: one sender to many receivers

 Multicast: act of sending datagram to multiple


receivers with single “transmit” operation
 analogy: one teacher to many students

 Question: how to achieve multicast

Network multicast
 Router actively
participate in multicast,
making copies of packets
as needed and
forwarding towards
Multicast
routers (red) duplicate and
multicast receivers
forward multicast datagrams
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-157
Multicast: one sender to many receivers

 Multicast: act of sending datagram to multiple


receivers with single “transmit” operation
 analogy: one teacher to many students

 Question: how to achieve multicast

Application-layer
multicast
 end systems involved in
multicast copy and
forward unicast
datagrams among
themselves
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-158
Internet Multicast Service Model

128.59.16.12

128.119.40.186

multicast 128.34.108.63
group
226.17.30.197
128.34.108.60

multicast group concept: use of indirection


 hosts addresses IP datagram to multicast group

 routers forward multicast datagrams to hosts that


have “joined” that multicast group
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-159
Multicast groups

 class D Internet addresses reserved for multicast:

 host group semantics:


o anyone can “join” (receive) multicast group
o anyone can send to multicast group
o no network-layer identification to hosts of
members
 needed: infrastructure to deliver mcast-addressed
datagrams to all hosts that have joined that multicast
group

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-160
Joining a multicast group: two-
two-step process

 local: host informs local mcast router of desire to join


group: IGMP (Internet Group Management Protocol)
 wide area: local router interacts with other routers to
receive mcast datagram flow
 many protocols (e.g., DVMRP, MOSPF, PIM)

IGMP
IGMP

wide-area
multicast
routing

analoui@iust.ac.ir
IGMP
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-161
IGMP: Internet Group Management Protocol

 host: sends IGMP report when application joins


mcast group
 IP_ADD_MEMBERSHIP socket option

 host need not explicitly “unjoin” group when


leaving
 router: sends IGMP query at regular intervals
 host belonging to a mcast group must reply to
query

query report

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-162
IGMP
IGMP version 1 IGMP v2: additions
 router: Host include
Membership Query  group-specific Query
msg broadcast on LAN  Leave Group msg
to all hosts  last host replying to Query
 host: Host can send explicit Leave
Membership Report Group msg
msg to indicate group  router performs group-
specific query to see if any
membership
hosts left in group
 randomized delay
 RFC 2236
before responding
 implicit leave via no IGMP v3: under development
reply to Query as Internet draft
 RFC 1112
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-163
Multicast Routing: Problem Statement

 Goal: find a tree (or trees) connecting


routers having local mcast group members
 tree: not all paths between routers used
 source-based: different tree from each sender to rcvrs
 shared-tree: same tree used by all group members

Shared tree Source-based trees


analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-164
Approaches for building multicast trees

Approaches:
 source-based tree: one tree per source
 shortest path trees
 reverse path forwarding
 group-shared tree: group uses one tree
 minimal spanning (Steiner)
 center-based trees

…we first look at basic approaches, then specific


protocols adopting these approaches

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-165
Shortest Path Tree

 mcast forwarding tree: tree of shortest


path routes from source to all receivers
 Dijkstra’s algorithm

S: source LEGEND
R1 2
1 R4 router with attached
group member
R2 5
router with no attached
3 4
R5 group member
R3 6 i link used for forwarding,
R6 R7 i indicates order link
added by algorithm

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-166
Reverse Path Forwarding

 rely on router’s knowledge of unicast


shortest path from it to sender
 each router has simple forwarding behavior:

if (mcast datagram received on incoming link


on shortest path back to center)
then flood datagram onto all outgoing links
else ignore datagram

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-167
Reverse Path Forwarding: example

S: source
LEGEND
R1
R4 router with attached
group member
R2
router with no attached
R5 group member
R3 datagram will be
R6 R7 forwarded
datagram will not be
forwarded

• result is a source-specific reverse SPT


– may be a bad choice with asymmetric links

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-168
Reverse Path Forwarding: pruning

 forwarding tree contains subtrees with no mcast


group members
 no need to forward datagrams down subtree

 “prune” msgs sent upstream by router with no


downstream group members

S: source LEGEND

R1 router with attached


R4
group member

R2 router with no attached


P group member
P
R5 prune message
R3 P links with multicast
R6 R7 forwarding

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-169
Shared--Tree: Steiner Tree
Shared

 Steiner Tree: minimum cost tree


connecting all routers with attached group
members
 problem is NP-complete
 excellent heuristics exists
 not used in practice:
 computational complexity
 information about entire network needed
 monolithic: rerun whenever a router needs to
join/leave
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-170
Center--based trees
Center

 single delivery tree shared by all


 one router identified as “center” of tree
 to join:
 edge router sends unicast join-msg addressed
to center router
 join-msg “processed” by intermediate routers
and forwarded towards center
 join-msg either hits existing tree branch for
this center, or arrives at center
 path taken by join-msg becomes new branch of
tree for this router
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-171
Center--based trees: an example
Center

Suppose R6 chosen as center:

LEGEND

R1 router with attached


R4
3 group member

R2 router with no attached


2 group member
1
R5 path order in which join
messages generated
R3
1 R6 R7

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-172
Internet Multicasting Routing: DVMRP

 DVMRP: distance vector multicast routing


protocol, RFC1075
 flood and prune: reverse path forwarding,
source-based tree
 RPF tree based on DVMRP’s own routing tables
constructed by communicating DVMRP routers
 no assumptions about underlying unicast
 initial datagram to mcast group flooded
everywhere via RPF
 routers not wanting group: send upstream prune
msgs
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-173
DVMRP: continued…

 soft state: DVMRP router periodically (1 min.)


“forgets” branches are pruned:
 mcast data again flows down unpruned branch
 downstream router: reprune or else continue to
receive data
 routers can quickly regraft to tree
 following IGMP join at leaf
 odds and ends
 commonly implemented in commercial routers
 Mbone routing done using DVMRP

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-174
Tunneling

Q: How to connect “islands” of multicast


routers in a “sea” of unicast routers?

physical topology logical topology

 mcast datagram encapsulated inside “normal” (non-multicast-


addressed) datagram
 normal IP datagram sent thru “tunnel” via regular IP unicast to
receiving mcast router
 receiving mcast router unencapsulates to get mcast datagram

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-175
PIM: Protocol Independent Multicast

 not dependent on any specific underlying unicast


routing algorithm (works with all)
 two different multicast distribution scenarios :

Dense: Sparse:
 group members  # networks with group
densely packed, in members small wrt #
“close” proximity. interconnected networks
 bandwidth more  group members “widely
plentiful dispersed”
 bandwidth not plentiful

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-176
Consequences of Sparse-
Sparse-Dense Dichotomy:

Dense Sparse:
 group membership by  no membership until
routers assumed until routers explicitly join
routers explicitly prune  receiver- driven
 data-driven construction construction of mcast
on mcast tree (e.g., RPF) tree (e.g., center-based)
 bandwidth and non-  bandwidth and non-group-
group-router processing router processing
profligate conservative

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-177
PIM-- Dense Mode
PIM

flood-and-prune RPF, similar to DVMRP but


 underlying unicast protocol provides RPF info
for incoming datagram
 less complicated (less efficient) downstream
flood than DVMRP reduces reliance on
underlying routing algorithm
 has protocol mechanism for router to detect it
is a leaf-node router

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-178
PIM - Sparse Mode

 center-based approach
 router sends join msg
to rendezvous point R1
R4
(RP) join
 intermediate routers R2
join
update state and
forward join R5
join
 after joining via RP, R3 R7
router can switch to R6

source-specific tree all data multicast rendezvous


 increased performance: from rendezvous point
less concentration, point
shorter paths
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-179
PIM - Sparse Mode

sender(s):
 unicast data to RP,
which distributes down R1
R4
RP-rooted tree join

 RP can extend mcast R2


join
tree upstream to R5
source join
R3 R7
 RP can send stop msg R6
if no attached
all data multicast rendezvous
receivers from rendezvous point
 “no one is listening!” point

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-180
Chapter 4 roadmap

4.1 Introduction and Network Service Models


4.2 Routing Principles
4.3 Hierarchical Routing
4.4 The Internet (IP) Protocol
4.5 Routing in the Internet
4.6 What’s Inside a Router?
4.7 IPv6
4.8 Multicast Routing
4.9 Mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-181
What is mobility?

 spectrum of mobility, from the network perspective:

no mobility high mobility

mobile user, using mobile user, mobile user, passing


same access point connecting/ through multiple
disconnecting access point while
from network maintaining ongoing
using DHCP. connections (like cell
phone)

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-182
Mobility: Vocabulary

home network: permanent home agent: entity that will


“home” of mobile perform mobility functions on
(e.g., 128.119.40/24)
behalf of mobile, when mobile
is remote

wide area
network
Permanent address:
address in home
network, can always be
used to reach mobile
e.g., 128.119.40.186 correspondent

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-183
Mobility: more vocabulary

visited network: network


Permanent address: remains in which mobile currently
constant (e.g., 128.119.40.186) resides (e.g., 79.129.13/24)

Care-of-address: address
in visited network.
(e.g., 79,129.13.2)

wide area
network

home agent: entity in


visited network that
performs mobility
correspondent: wants functions on behalf
to communicate with of mobile.
mobile
analoui@iust.ac.ir IUST-Network
Jamali@iust.ac.ir Network LayerLayer 4-184
How do you contact a mobile friend:

Consider friend frequently changing I wonder where


addresses, how do you find her? Ali moved to?
 search all phone
books?
 call her parents?
 expect her to let you
know where he/she is?

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-185
Mobility: approaches

 Let routing handle it: routers advertise permanent


address of mobile-nodes-in-residence via usual
routing table exchange.
 routing tables indicate where each mobile located

 no changes to end-systems

 Let end-systems handle it:


 indirect routing: communication from
correspondent to mobile goes through home
agent, then forwarded to remote
 direct routing: correspondent gets foreign
address of mobile, sends directly to mobile

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-186
Mobility: approaches

 Let routing handle it: routers advertise permanent


address of mobile-nodes-in-residence
not via usual
scalable
routing table exchange.
to millions of
 routing tables indicate
mobiles where each mobile located
 no changes to end-systems

 let end-systems handle it:


 indirect routing: communication from
correspondent to mobile goes through home
agent, then forwarded to remote
 direct routing: correspondent gets foreign
address of mobile, sends directly to mobile

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-187
Mobility: registration

visited network
home network

1
2
wide area
network
mobile contacts
foreign agent contacts home foreign agent on
agent home: “this mobile is entering visited
resident in my network” network

End result:
 Foreign agent knows about mobile
 Home agent knows location of mobile
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-188
Mobility via Indirect Routing

foreign agent
receives packets,
home agent intercepts forwards to mobile
packets, forwards to visited
foreign agent network
home
network
3
wide area
network
2
1
correspondent 4
addresses packets
mobile replies
using home address
directly to
of mobile
correspondent

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-189
Indirect Routing: comments

 Mobile uses two addresses:


 permanent address: used by correspondent (hence
mobile location is transparent to correspondent)
 care-of-address: used by home agent to forward
datagrams to mobile
 foreign agent functions may be done by mobile itself
 triangle routing: correspondent-home-network-
mobile
 inefficient when

correspondent, mobile
are in same network

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-190
Forwarding datagrams to remote mobile

foreign-agent-to-mobile packet
packet sent by home agent to foreign dest: 128.119.40.186
agent: a packet within a packet

dest: 79.129.13.2 dest: 128.119.40.186

Permanent address:
128.119.40.186

Care-of address:
79.129.13.2
dest: 128.119.40.186
packet sent by
correspondent

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-191
Indirect Routing: moving between networks

 suppose mobile user moves to another


network
 registers with new foreign agent
 new foreign agent registers with home agent
 home agent update care-of-address for mobile
 packets continue to be forwarded to mobile (but
with new care-of-address)
 Mobility, changing foreign networks
transparent: on going connections can be
maintained!

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-192
Mobility via Direct Routing

foreign agent
receives packets,
correspondent forwards forwards to mobile
to foreign agent visited
network
home
network 4
wide area
2 network
3
correspondent 1 4
requests, receives
mobile replies
foreign address of
directly to
mobile
correspondent

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-193
Mobility via Direct Routing: comments

 overcome triangle routing problem


 non-transparent to correspondent:
correspondent must get care-of-address
from home agent
 What happens if mobile changes networks?

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-194
Mobile IP

 RFC 3220
 has many features we’ve seen:
 home agents, foreign agents, foreign-agent
registration, care-of-addresses, encapsulation
(packet-within-a-packet)
 three components to standard:
 agent discovery
 registration with home agent
 indirect routing of datagrams

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-195
Mobile IP: agent discovery

 agent advertisement: foreign/home agents advertise


service by broadcasting ICMP messages (typefield = 9)
0 8 16 24

type = 9 code = 0 checksum


=9
H,F bits: home standard
and/or foreign agent router address ICMP fields

R bit: registration
required type = 16 length sequence #
RBHFMGV
registration lifetime reserved
bits mobility agent
advertisement
0 or more care-of- extension

addresses
analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-196
Mobile IP: registration example

visited network: 79.129.13/24


home agent foreign agent
HA: 128.119.40.7 COA: 79.129.13.2 ICMP agent adv. Mobile agent
COA: 79.129.13.2 MA: 128.119.40.186
….

registration req.
registration req.
COA: 79.129.13.2
COA: 79.129.13.2 HA: 128.119.40.7
HA: 128.119.40.7 MA: 128.119.40.186
MA: 128.119.40.186 Lifetime: 9999
Lifetime: 9999 identification:714
identification: 714 ….
encapsulation format
….

registration reply
time HA: 128.119.40.7
registration reply
MA: 128.119.40.186
Lifetime: 4999 HA: 128.119.40.7
Identification: 714 MA: 128.119.40.18 6
encapsulation format Lifetime: 4999
…. Identification: 714
….

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-197
Network Layer: summary

What we’ve covered:


 network layer services
 routing principles: link state and
distance vector
 hierarchical routing
 IP
 Internet routing protocols RIP,
OSPF, BGP
 what’s inside a router?
 IPv6
 mobility

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-198
HW4

 3, 4a, 4f, 5, 9

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-199
Home Work4
‫ 
ز از
رم ب‬
.
 ‫ را‬Computer Networking 3edition
21, 22a, 22f, 23, 26
‫ ار"ل‬jamali@iust.ac.ir ‫"! درا  درس‬# 
, Subject: HW4 ”Student ID Number”.

., ‫ دي 
اه‬6 %&'( )‫ 
در *ر‬
. * power point  ‫"! د را‬# 

analoui@iust.ac.ir
Jamali@iust.ac.ir IUST-Network
Network LayerLayer 4-200

Você também pode gostar