You are on page 1of 367

BITS Pilani

Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Computer Networks Introduction

Instructor
Vishal Gupta
Contact Information
vishalgupta@pilani.bits-pilani.ac.in

Course web page: elearn.bits-pilani.ac.in


Course web page
Courseware

COMPUTER NETWORKS

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Flipped-Classroom Teaching Pedagogy


Flipped Classroom Pedagogy:

To improve upon the teaching pedagogy, the course will be


offered using flipped classroom.

It is a form of blended learning in which students will learn


new content, online, by watching video lectures, and what
used to be homework (assigned problems) will now be done
during class with instructor offering more personalized
guidance and interaction with students, instead of lecturing.

COMPUTER NETWORKS
3

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Content: Recorded lecture 1.1


Recorded Lecture 1.1 covers:

Why you should study Computer Networks


Syllabus
Labs
Uses of Computer Networks
Network Components (Links, Interfaces, Switches)
Network Topologies (Bus, star, Tree, Single ring, Dual ring,
Mesh)
Physical layer components (Hub, Repeater)
Link Layer components (Bridge)
Internet Structure

COMPUTER NETWORKS
4

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Layered Network Architecture


Following two types of Layered Network architectures
exist in the Literature:
1. OSI Model
2. TCP/IP Model

COMPUTER NETWORKS
5

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Layered Architecture

The OSI model is composed of seven layers ;


Physical (layer1), Data link (layer2), Network (layer3)
Transport (layer4), Session (layer5), Presentation
(layer6)
Application (layer7)

Layer
Designer identified which networking functions had
related uses and collected those functions into discrete
groups that became the layers.
The OSI model allows complete interoperability between
otherwise incompatible systems.
The Each layer uses the services of the layer
immediately below it.
COMPUTER NETWORKS

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

OSI Model

COMPUTER NETWORKS
7

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Peer-to-peer Processes

Layer x on one machine communicates with


layer x on another machine - called Peer-to-Peer
Processes.
Interfaces between Layers
Each interface defines what information and services a
layer must provide for the layer above it.
Well defined interfaces and layer functions provide
modularity to a network

Organizations of the layers


Network support layers : Layers 1, 2, 3
User support layer : Layer 5, 6, 7
It allows interoperability among unrelated software
systems

Transport layer (Layer 4) : links the two subgroups


COMPUTER NETWORKS

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Peer-to-peer Processes (contd)

Figure 2.3 The interaction between layers in the OSI mode

11/5/16

COMPUTER NETWORKS

Peer-to-peer Processes (contd)


Figure 2.4 An exchange using the OSI model

The data portion of a packet at level N-1 carries


the whole packet from level N. The concept is
called encapsulation.

11/5/16

COMPUTER NETWORKS

10

OSI and TCP/IP Protocol Stack


OSI Model

TCP/IP Hierarchy

Protocols

7th
Application Layer
6th
Presentation Layer

Application Layer

5th
Session Layer
4th
Transport Layer

Transport
Layer

3rd
Network Layer

Network Layer

2nd
Link Layer
1st
Physical Layer

11

Link Layer

Link Layer
: includes device driver and network interface
card
Network Layer
: handles the movement of packets, i.e.
Routing
COMPUTER NETWORKS
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956
11/5/16
Transport
Layer : provides a reliable
flow of data between two

How do loss and delay


occur?
packets queue in router buffers

packet arrival rate to link exceeds output link


capacity
packets queue, wait for turn
packet being transmitted (delay)

B
packets queueing (delay)
free (available) buffers: arriving packets
dropped (loss) if no free buffers
Introduction 1-12

Four sources of packet


delay
transmission

propagation
B

nodal
processing

queueing

dnodal = dproc + dqueue + dtrans + dprop

dproc: nodal processing


check bit errors
determine output link
typically < msec

dqueue: queueing delay

time waiting at output link


for transmission
depends on congestion level
of router
Introduction 1-13

Four sources of packet


delay
transmission

propagation
B

nodal
processing

queueing

dnodal = dproc + dqueue + dtrans + dprop


dtrans: transmission delay:

dprop: propagation delay:

L: packet length (bits)


R: link bandwidth (bps)
dtrans = L/R

d: length of physical link


s: propagation speed in
medium (~2x108 m/sec)
dprop = d/s

dtrans and dprop


very different

Introduction 1-14

Caravan analogy
100 km
ten-car
caravan

toll
booth

cars propagate at
100 km/hr
toll booth takes 12 sec to
service car (transmission
time)
car~bit; caravan ~ packet
Q: How long until caravan
is lined up before 2nd toll
booth?

100 km
toll
booth
time to push entire
caravan through toll
booth onto highway =
12*10 = 120 sec
time for last car to
propagate from 1st to
2nd toll both: 100km/
(100km/hr)= 1 hr
A: 62 minutes
Introduction 1-15

Caravan analogy (more)


100 km
ten-car
caravan

toll
booth

100 km
toll
booth

cars now propagate at 1000 km/hr


toll booth now takes 1 min to service a car
Q: Will cars arrive to 2nd booth before all cars
serviced at 1st booth?
A: Yes! After 7 min, 1st car arrives at second booth; three
cars still at 1st booth.
1st bit of packet can arrive at 2nd router before packet is
fully transmitted at 1st router! (see Ethernet applet at
AWL Web site
Introduction 1-16

Packet loss
queue

(aka buffer) preceding link in


buffer has finite capacity
packet arriving to full queue dropped
(aka lost)
lost packet may be retransmitted by
buffer
previous node,
by
source
end
system,
packet being
transmitted
(waiting
area)
A
or not at all
B

packet arriving to
full buffer is lost
BITS Pilani, Deemed to be University under Section Introduction
3 of UGC Act,1-17
1956

Throughput
throughput:

rate (bits/time unit) at


which bits transferred between
sender/receiver
instantaneous: rate at given point in
time
average: rate over longer period of
time

link
capacity
that
can carry
server,
server
sendswith
bits pipe
fluid
at rate
file of
F bits
(fluid)
into
pipe
Rs bits/sec
to send to client
Rs bits/sec)

link that
capacity
pipe
can carry
at rate
Rfluid
c bits/sec
Rc bits/sec)

BITS Pilani, Deemed to be University under Section Introduction


3 of UGC Act,1-18
1956

Throughput (more)
Rs

< Rc What is average end-end throughput?


Rs bits/sec

Rc bits/sec

Rs > Rc What is average end-end throughput?


Rs bits/sec

Rc bits/sec

bottleneck link
link on end-end path that constrains end-end throughput
BITS Pilani, Deemed to be University under Section Introduction
3 of UGC Act,1-19
1956

Questions ?
What are different types of delays in Packet Switched Networks ?
Processing Delay
Queuing Delay
Transmission Delay
Propagation Delay

COMPUTER NETWORKS
20

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Question
Consider an application that transmits data at a steady rate
(for example, the sender generates an N-bit unit of data every
k time units, where k is small and fixed). Also, when such an
application starts, it will continue running for a relatively long
period of time. With respect to this, discuss on following:
a) Would a packet switched network of a circuit switched
network be more appropriate for this application? Why?
b) Suppose that a packet switched network is used and the only
traffic in this network comes from such application as
described above. Furthermore, assume that the sum of the
application data rates is less that the capacities of each and
every link. Is some form of congestion control needed? Why?
COMPUTER NETWORKS
21

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agenda: Based on RL 2.1


1. Delay, Loss, and Throughput

How do loss and delay


occur?
packets queue in router buffers

packet arrival rate to link exceeds output link


capacity
packets queue, wait for turn
packet being transmitted (delay)

B
packets queueing (delay)
free (available) buffers: arriving packets
dropped (loss) if no free buffers
Introduction 1-23

Four sources of packet


delay
transmission

propagation
B

nodal
processing

queueing

dnodal = dproc + dqueue + dtrans + dprop

dproc: nodal processing


check bit errors
determine output link
typically < msec

dqueue: queueing delay

time waiting at output link


for transmission
depends on congestion level
of router
Introduction 1-24

Four sources of packet


delay
transmission

propagation
B

nodal
processing

queueing

dnodal = dproc + dqueue + dtrans + dprop


dtrans: transmission delay:

dprop: propagation delay:

L: packet length (bits)


R: link bandwidth (bps)
dtrans = L/R

d: length of physical link


s: propagation speed in
medium (~2x108 m/sec)
dprop = d/s

dtrans and dprop


very different

Introduction 1-25

Caravan analogy
100 km
ten-car
caravan

toll
booth

cars propagate at
100 km/hr
toll booth takes 12 sec to
service car (transmission
time)
car~bit; caravan ~ packet
Q: How long until caravan
is lined up before 2nd toll
booth?

100 km
toll
booth
time to push entire
caravan through toll
booth onto highway =
12*10 = 120 sec
time for last car to
propagate from 1st to
2nd toll both: 100km/
(100km/hr)= 1 hr
A: 62 minutes
Introduction 1-26

Caravan analogy (more)


100 km
ten-car
caravan

toll
booth

100 km
toll
booth

cars now propagate at 1000 km/hr


toll booth now takes 1 min to service a car
Q: Will cars arrive to 2nd booth before all cars
serviced at 1st booth?
A: Yes! After 7 min, 1st car arrives at second booth; three
cars still at 1st booth.
1st bit of packet can arrive at 2nd router before packet is
fully transmitted at 1st router!
Introduction 1-27

Queueing delay

R: link bandwidth (bps)


L: packet length each packet
(bits)
a: average packet arrival rate
La/R: Traffic Intensity

Theoretically:
La/R > 1: more work arriving than can be serviced, average delay
infinite!
La/R < 1: Nature of arriving traffic impact queuing delay.
Ideally, traffic intensity = 1
Introduction 1-28

Questions ?
Q.
Out of four types of delays, which one can vary from packet to
packet ??

COMPUTER NETWORKS
29

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Packet loss
queue

(aka buffer) preceding link in


buffer has finite capacity
packet arriving to full queue dropped
(aka lost)
lost packet may be retransmitted by
buffer
previous node,
by
source
end
system,
packet being
transmitted
(waiting
area)
A
or not at all
B

packet arriving to
full buffer is lost
BITS Pilani, Deemed to be University under Section Introduction
3 of UGC Act,1-30
1956

Throughput
throughput:

rate (bits/time unit) at


which bits transferred between
sender/receiver
instantaneous: rate at given point in
time
average: rate over longer period of
time

link
capacity
that
can carry
server,
server
sendswith
bits pipe
fluid
at rate
file of
F bits
(fluid)
into
pipe
Rs bits/sec
to send to client
Rs bits/sec)

link that
capacity
pipe
can carry
at rate
Rfluid
c bits/sec
Rc bits/sec)

BITS Pilani, Deemed to be University under Section Introduction


3 of UGC Act,1-31
1956

Throughput (more)
Rs

< Rc What is average end-end throughput?


Rs bits/sec

Rc bits/sec

Rs > Rc What is average end-end throughput?


Rs bits/sec

Rc bits/sec

Time to transfer a large file of F bits from S to C (ignoring


allbottleneck
delays) =link
F / min (Rs, Rc)
link on end-end path that constrains end-end throughput
BITS Pilani, Deemed to be University under Section Introduction
3 of UGC Act,1-32
1956

Throughput: Internet scenario


per-connection

end-end
throughput:
min(Rc,Rs,R/10)
in

practice: Rc
or Rs is often
bottleneck

Rs
Rs

Rs
R

Rc

Rc
Rc

10 connections (fairly) share


backbone bottleneck link R bits/sec
BITS Pilani, Deemed to be University under Section Introduction
3 of UGC Act,1-33
1956

Questions ?
Q. How long does it take a packet of length 1000 bytes to
propagate over a link of distance 2500 Km, propagation speed
2.5x108 m/s, and transmission rate 2 Mbps ? Ignore queuing
and processing delay here.
Propagation delay = (2500 x 1000) / (2.5 x 108) sec = 0.01 sec
Transmission delay = L / R = (1000 x 8) / (2x106) sec = ?

COMPUTER NETWORKS
34

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Questions ?
Consider two hosts, A and B, connected by a single link
of rate R bps. Suppose that the two hosts are
separated by m meters, and suppose the propagation
speed along the link is s meters/sec. Host A is to send a
packet of size L bits to Host B.
Express the propagation delay dprop in terms of m and s.
Determine the transmission time of packet, d trans, in terms of L
and R.
Ignoring processing and queuing delays, obtain an expression for
the end-to-end delay.
Suppose Host A begins to transmit the packet at time t = 0. At
time t = dtrans, where is the last bit of the packet?
Suppose dprop is greater than dtrans. At time t = dtrans, where is the
first bit of the packet?
Suppose s = 2.5 x 108, L = 100 bits, and R = 28 kbps. Find the
distance m so that dprop equals dtrans.
COMPUTER NETWORKS

35

11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agenda: Based on RL 2.1


1. Application Layer Protocols

WWW
HTTP

Creating a network application


Write programs that
run on different end
systems and
communicate over a
network.
e.g., Web: Web server
software communicates
with browser software

applicatio
n
transport
network
data link
physical

little software written for


devices in network core
network core devices do
not run user application
code
application on end
systems allows for rapid
app development,
propagation
37

11/5/16

COMPUTER NETWORKS

applicatio
n
transport
network
data link
physical

applicatio
n
transport
network
data link
physical

Source: J.F Kurose and K.W. Ross, Third


Edition
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Client Server and P2P paradigm

What is Client Server paradigm ?


Advantages
Disadvantages
Examples

What is P2P paradigm ?


Advantages
Disadvantages
Examples

38

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Process to Process Communication


process sends/receives
messages to/from its
socket
socket analogous to door
sending process shoves
message out door
sending process relies on
transport infrastructure on
other side of door which
brings message to socket
at receiving process

host or
server

host or
server

process

controlled by
app developer

process
socket

socket
TCP with
buffers,
variables

Internet

TCP with
buffers,
variables

controlled
by OS

API: (1) choice of transport protocol; (2) ability to fix a few


parameters (lots more on this later)
39

11/5/16

COMPUTER NETWORKS

Source: J.F Kurose and K.W. Ross, Third


Edition
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Internet transport protocols services

40

TCP service:

UDP service:

connection-oriented: setup
required between client and
server processes
reliable transport between
sending and receiving process
flow control: sender wont
overwhelm receiver
congestion control: throttle
sender when network
overloaded
does not provide: timing,
minimum bandwidth
guarantees

11/5/16

COMPUTER NETWORKS

unreliable data transfer


between sending and
receiving process
does not provide:
connection setup,
reliability, flow control,
congestion control,
timing, or bandwidth
guarantee

Q: why bother? Why is


there a UDP?
Source: J.F Kurose and K.W. Ross, Third
Edition
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Transport service requirements of common apps

Data loss

Bandwidth

Time Sensitive

file transfer
e-mail
Web documents
real-time audio/video

no loss
no loss
no loss
loss-tolerant

no
no
no
yes, 100s msec

stored audio/video
interactive games
instant messaging

loss-tolerant
loss-tolerant
no loss

elastic
elastic
elastic
audio: 5kbps-1Mbps
video:10kbps-5Mbps
same as above
few kbps up
elastic

Application

41

11/5/16

COMPUTER NETWORKS

yes, few secs


yes, 100s msec
yes and no

Source: J.F Kurose and K.W. Ross, Third


Edition
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

App-layer protocol defines


types of messages
exchanged,
e.g., request, response

message syntax:
what fields in
messages & how fields
are delineated

message semantics
meaning of information
in fields

rules for when and


how processes send &
respond to messages

public-domain
protocols:
defined in RFCs
allows for
interoperability
e.g., HTTP, SMTP
proprietary protocols:
e.g., Skype

Application 2-42

WWW and HTTP


HTTP: hypertext
transfer protocol

43

Webs application layer


protocol
client/server model
client: browser that
requests, receives,
displays Web objects
server: Web server
sends objects in
response to requests

11/5/16

COMPUTER NETWORKS

HT
TP
req
ue
PC running HTT
st
Pr
Explorer
esp
ons
e

t
es
u
eq
e Server
r
P
ns
T
o
p
running
HT
es
r
Apache Web
TP
T
H
server

Mac running
Navigator
Source: J.F Kurose and K.W. Ross, Third
Edition
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

HTTP

Web page consists of: ?????


What is a URL ??
_____________ implement client side of HTTP ??
_____________ implement server side of HTTP ??
HTTP uses ____________ underlying Transport layer protocol ??
HTTP is a stateless protocol. What does it mean ??
What is non-persistant and persistant HTTP ??

When a user request a web page that consists of some text


and two images. For this page, the client will send one request
message and receive three response messages. True/False.
Two distinct web pages can be sent over the same persistent
connection. True/False.
The date header in the HTTP request message indicates when
the object in the response was last modified. True/False.

44

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Non-Persistent HTTP: Response time


definition of RTT: time for
a small packet to
travel from client to
server and back.
response time:
one RTT to initiate TCP
connection
one RTT for HTTP
request and first few
bytes of HTTP
response to return
file transmission time
total = 2RTT+transmit
time

initiate TCP
connection
RTT
request
file
RTT
file
received
time

time to
transmit
file

time

Application 2-45

Persistent HTTP
non-persistent HTTP issues:
requires 2 RTTs per object
OS overhead for each TCP
connection
browsers often open
parallel TCP connections
to fetch referenced
objects

persistent HTTP
server leaves connection
open after sending
response
subsequent HTTP
messages between
same client/server sent
over open connection
client sends requests as
soon as it encounters a
referenced object
as little as one RTT for all
the referenced objects

Application 2-46

HTTP request message


two types of HTTP messages: request,
response
HTTP request message:
carriage return character

ASCII (human-readable format)


line-feed character
request line
(GET, POST,
GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n

User-Agent: Firefox/3.6.10\r\n
headerAccept: text/html,application/xhtml+xml\r\n
Accept-Language: en-us,en;q=0.5\r\n
linesAccept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
carriage return, Keep-Alive: 115\r\n
line feed at start Connection: keep-alive\r\n
\r\n

of line indicates
end of header lines

BITS Pilani, Deemed to be University under Section Application


3 of UGC Act,2-47
1956

HTTP request message: general format


request
line
header
lines

body

BITS Pilani, Deemed to be University under Section Application


3 of UGC Act,2-48
1956

Uploading form input


POST method:
web page often
includes form input

input is uploaded to
server in entity body
URL method:
uses GET method
input is uploaded in
URL field of request
line: www.somesite.com/animalsearch?monkeys&banana

Application 2-49

Method types
HTTP/1.0
GET
POST
HEAD
asks server to leave
requested object out of
response

HTTP/1.1
GET, POST, HEAD
PUT
uploads file in entity
body to path specified
in URL field

DELETE
deletes file specified in
the URL field

Application 2-50

HTTP response message


status line
(protocol
status code
status phrase)

header
lines

data, e.g.,
requested
HTML file

HTTP/1.1 200 OK\r\n


Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-88591\r\n
\r\n
data data data data data ...

BITS Pilani, Deemed to be University under Section Application


3 of UGC Act,2-51
1956

User-server state: cookies


example:
many Web sites use
Susan always access
cookies
Internet from PC
four components:
visits specific e1) cookie header line of
commerce site for first
HTTP response
time
message
2) cookie header line in
when initial HTTP
HTTP request message
requests arrives at
3) cookie file kept on
site, site creates:
users host, managed
unique ID
by users browser
entry in backend
4) back-end database at
Web site
database for ID
Application 2-52

Cookies: keeping state (cont.)


client
ebay 8734

cookie file
ebay 8734
amazon 1678

server
usual http request
msg
usual http response

Amazon server
creates ID
Set-cookie: 1678 1678 for user create

entry

usual http request


msg
one week later:
ebay 8734
amazon 1678

cookie: 1678

usual http response


msg
usual http request
msg

cookie: 1678

usual http response


msg

cookiespecific
action

access

access

backend
database

cookiespecific
action
Application 2-53

Cookies (continued)
aside

what cookies can


bring:
authorization
shopping carts
recommendations
user session state
how(Web
to keepe-mail)
state:

cookies and privacy:


cookies permit sites to learn
a lot about you
you may supply name and
e-mail to sites

protocol endpoints: maintain state at


sender/receiver over multiple transactions
cookies: http messages carry state

Application 2-54

Web caches (proxy server)


Goal: satisfy client request without involving origin server

user sets browser:


Web accesses via
cache
browser sends all
HTTP requests to
cache
object in cache:
cache returns object
else cache requests
object from origin
server, then returns
object to client

origin
server

Proxy
HT
st
TP
req server reque
H
ue
se
TP
client TTP
st
n
T
o
H
res
esp
r
pon
se
TTP
H
st
e
u
eq
r
se
n
P
T
po
s
HT
e
Pr
T
HT
client

origin
server

Application 2-55

More about Web caching


cache acts as both
client and server
typically cache is
installed by ISP
(university, company,
residential ISP)

why Web caching?


reduce response time
for client request
reduce traffic on an
institutions access
link.
Internet dense with
caches: enables
poor content
providers to
effectively deliver
content (but so does
P2P file sharing)
Application 2-56

Caching example
origin
servers

assumptions

average object size =


100,000 bits
avg. request rate from
institutions browsers to
origin servers = 15/sec
delay from institutional
router to any origin server
and back to router = 2 sec

consequences

public
Internet

1.5 Mbps
access link
institutional
network

10 Mbps LAN

utilization on LAN = 15%


utilization on access link =
100%
total delay = Internet delay +
access delay + LAN delay
= 2 sec + minutes +
milliseconds

institutional
cache

Application 2-57

Caching example (cont)


possible solution
increase bandwidth of
access link to, say, 10 Mbps
consequence
utilization on LAN = 15%
utilization on access link =
15%
Total delay = Internet
delay + access delay + LAN
delay
= 2 sec + msecs + msecs
often a costly upgrade

origin
servers
public
Internet

10 Mbps
access link
institutional
network

10 Mbps LAN

institutional
cache

Application 2-58

Caching example (cont)


origin
servers

possible solution:

install cache

consequence

public
Internet

suppose hit rate is 0.4

40% requests will be


satisfied almost
immediately
60% requests satisfied by
origin server

utilization of access link


reduced to 60%, resulting
in negligible delays (say
10 msec)
total avg delay =
Internet delay + access
delay + LAN delay = .
6*(2.01) secs + .
4*milliseconds < 1.4 secs

1.5 Mbps
access link
institutional
network

10 Mbps LAN

institutional
cache

Application 2-59

Conditional GET

Goal: dont send object if


cache has up-to-date
cached version
cache: specify date of
cached copy in HTTP
request
If-modified-since:
<date>

server: response
contains no object if
cached copy is up-todate:
HTTP/1.0 304 Not
Modified

server

cache
HTTP request msg
If-modified-since: <date>

HTTP response
HTTP/1.0
304 Not Modified

object
not
modified
before
<date>

HTTP request msg


If-modified-since: <date>

HTTP response
HTTP/1.0 200 OK

<data>

object
modified
after
<date>
Application 2-60

61

What is the use of cookies ??


What is the difference between web caching and proxy
server ??
Conditional Get.

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Application Layer Protocols
1.
2.
3.

FTP
SMTP
DNS

FTP: the file transfer protocol


file transfer

FTP
FTP
user
client
interface
user
at host

63

11/5/16

local file
system

FTP
server
remote file
system

transfer file to/from remote host


client/server model
client: side that initiates transfer (either to/from
remote)
server: remote host
ftp: RFC 959
ftp server: port 21
COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

FTP: separate control, data connections

64

FTP client contacts FTP server


at port 21, specifying TCP as
transport protocol
Client obtains authorization
over control connection
Client browses remote
directory by sending
commands over control
connection.
When server receives file
transfer command, server
opens 2nd TCP connection (for
file) to client
After transferring one file,
server closes data connection.

11/5/16

COMPUTER NETWORKS

TCP control
connection
port 21

FTP
client

TCP data connection


port 20

FTP
server

Server opens another TCP


data connection to transfer
another file.
Control connection: out of
band
FTP server maintains
state: current directory,
earlier authentication

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

FTP: Review

65

HTTP uses ________ number of TCP connections and FTP uses


_______
FTP is a stateless protocol. T/F

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Electronic Mail

outgoing
message queue
user mailbox

user
agent

Three major components:


user agents
mail servers
simple mail transfer
protocol: SMTP

mail
server

user
agent

SMTP

User Agent
a.k.a. mail reader
composing, editing, reading
mail messages
e.g., Eudora, Outlook, elm,
Netscape Messenger
outgoing, incoming
messages stored on server

SMTP

mail
server

user
agent

SMTP
user
agent

mail
server
user
agent
user
agent

2: Application Layer

66

Electronic Mail: mail servers


user
agent

Mail Servers

mailbox contains
incoming messages for
user
message queue of
outgoing (to be sent) mail
messages
SMTP protocol between
mail servers to send email
messages
client: sending mail
server
server: receiving
mail server

mail
server

user
agent

SMTP
SMTP

mail
server

user
agent

SMTP
user
agent

mail
server

2: Application Layer

user
agent
user
agent
67

Electronic Mail: SMTP [RFC 2821]

uses TCP to reliably transfer email message from


client to server, port 25
direct transfer: sending server to receiving server
three phases of transfer
handshaking (greeting)
transfer of messages
closure
command/response interaction
commands: ASCII text
response: status code and phrase

messages must be in 7-bit ASCII

2: Application Layer

68

Scenario: Alice sends message to Bob

1
user
agent

69

11/5/16

mail
server
3

COMPUTER NETWORKS

mail
server
4

user
agent

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Sample SMTP interaction


S:
C:
S:
C:
S:
C:
S:
C:
S:
C:
C:
C:
S:
C:
S:

70

220 hamburger.edu
HELO crepes.fr
250 Hello crepes.fr, pleased to meet you
MAIL FROM: <alice@crepes.fr>
250 alice@crepes.fr... Sender ok
RCPT TO: <bob@hamburger.edu>
250 bob@hamburger.edu ... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Do you like ketchup?
How about pickles?
.
250 Message accepted for delivery
QUIT
221 hamburger.edu closing connection

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mail access protocols


access
protocol

user
agent
senders mail
server

user
agent

receivers mail
server

SMTP: delivery/storage to receivers server


Mail access protocol: retrieval from server
POP: Post Office Protocol [RFC 1939]

authorization (agent <-->server) and download


IMAP: Internet Mail Access Protocol [RFC 1730]

more features (more complex)


manipulation of stored msgs on server
HTTP: Hotmail , Yahoo! Mail, etc.

71

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

SMTP: Review
Name some GUI user agents ?
SMTP restricts the body of mails of 7-bit ASCII. T/F ?
Can recipients local PC act as a mail server for
himself ?
Can senders user agent send mail directly to the
recipient without sending it to its corresponding
mail server ?
Can recipient use SMTP to pull messages from its
mail server ?
Take an example of GMAIL. Where are the user
agent, mail server, and SMTP in it ??

72

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Application Layer Protocols
1.

DNS Protocol

DNS: Domain Name System


People: many
identifiers:

Domain Name System:

SSN, name, passport #

Internet hosts, routers:


IP address (32 bit) used for addressing
datagrams
name, e.g.,
ww.yahoo.com - used
by humans

Q: map between IP
addresses and
name ?
74

11/5/16

COMPUTER NETWORKS

distributed database
implemented in hierarchy of
many name servers
application-layer protocol
host, routers, name servers
to communicate to resolve
names (address/name
translation)
note: core Internet
function, implemented
as application-layer
protocol
complexity at networks
edge

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

DNS
DNS services
Hostname to IP
address translation
Host aliasing
Canonical and alias
names

Mail server aliasing


Load distribution
Replicated Web
servers: set of IP
addresses for one
canonical name

75

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Distributed, Hierarchical Database


Root DNS Servers

com DNS servers


yahoo.com
amazon.com
DNS servers DNS servers

org DNS servers


pbs.org
DNS servers

edu DNS servers


poly.edu
umass.edu
DNS serversDNS servers

Client wants IP for www.amazon.com; 1st approx:


Client queries a root server to find com DNS
server
Client queries com DNS server to get
amazon.com DNS server
Client queries amazon.com DNS server to get
IP address for www.amazon.com
76

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Local Name Server


Does not strictly belong to hierarchy
Each ISP (residential ISP, company,
university) has one.
Also called default name server

When a host makes a DNS query,


query is sent to its local DNS server
Acts as a proxy, forwards query into
hierarchy.

77

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Example
Host at cis.poly.edu
wants IP address
for
gaia.cs.umass.edu

root DNS server

3
4

TLD DNS server

5
local DNS server
dns.poly.edu

requesting host

authoritative DNS server


dns.cs.umass.edu

cis.poly.edu
gaia.cs.umass.edu
78

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

DNS: caching and updating records


once (any) name server learns mapping, it
caches mapping

cache entries timeout (disappear)


after some time
TLD servers typically cached in local
name servers
Thus root name servers not often
visited
update/notify mechanisms under design by
IETF
RFC 2136

79

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

DNS records
DNS: distributed db storing resource records (RR)
RR format: (name, value, type, ttl)
Type=A

name is hostname
value is IP address

Type=NS

Type=CNAME

name is alias name for some


canonical (the real) name
www.ibm.com is really
servereast.backup2.ibm.com

value is canonical name


name is domain (e.g.
foo.com)
value is hostname of Type=MX
value is name of
authoritative name
server for this domain
mailserver associated with
name

80

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

DNS protocol, messages


DNS protocol : query and reply messages, both with same message format

msg header

identification: 16 bit #
for query, reply to
query uses same #
flags:
query or reply
recursion desired
recursion available
reply is authoritative

81

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

DNS review

82

What is the difference between Recursive Query and Iterative


Query ?

Suppose within your web browser you click on a link to obtain a


web page. The IP address of the associated URL is not cached in
your local host, so a DNS look up is necessary to obtain the IP
address. Suppose that n DNS servers are visited before your
host receives the IP address from DNS; the successive visits
incur an RTT of RTT1 . RTTn. Further suppose that the web
page associated with the link contains exactly one object,
consisting of a small amount of HTML text. Let RTT 0 denote the
RTT between the local host and the server containing the
object. Assuming zero transmission time of the object, how
much time elapses from when the client clicks on the link until
the client receives the object ?
11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

DNS review

83

For the same problem in the previous slide, suppose the HTML
file references three very small objects on the same server.
Neglecting transmission times, how much time elapses with:
Non persistent HTTP with no parallel TCP connections ?
Non persistent HTTP with parallel TCP connections ?
Persistent HTTP with pipelining ?

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Transport Layer
1.
2.

Multiplexing and De-multiplexing


UDP

Note: Some of the slides are taken from Kurose and Ross, 3rd edition.

Transport services and


protocols
network
data link
physical

g
lo

network
data link
physical

al
ic

d
en
-e

network
data link
physical

nd
tr

network
data link
physical

o
sp
an

network
data link
physical

rt

provide logical
applicatio
n
communication between
transport
network
app processes running on
data link
physical
different hosts
transport protocols run in
end systems
send side: breaks app
messages into
segments, passes to
network layer
rcv side: reassembles
segments into
messages, passes to
app layer
more than one transport
protocol available to apps
11/5/16
COMPUTER NETWORKS
Internet: TCP and UDP

applicatio
n
transport
network
data link
physical

Transport vs. network layer


network layer: logical
communication
between hosts
transport layer: logical
communication
between processes
relies on, enhances,
network layer services

11/5/16

Household analogy:
12 kids sending letters
to 12 kids
processes = kids
app messages =
letters in envelopes
hosts = houses
transport protocol =
Ann and Bill
network-layer protocol
= postal service

COMPUTER NETWORKS

Internet transport-layer
protocols
reliable, in-order
delivery (TCP)

d
en

network
data link
physical

rt

COMPUTER NETWORKS

network
data link
physical

o
sp
an

delay guarantees
bandwidth guarantees

tr

services not available:

network
data link
physical

nd

no-frills extension of
best-effort IP

-e

unreliable, unordered
delivery: UDP

11/5/16

network
data link
physical

al
ic

congestion control
flow control
connection setup

network
data link
physical

g
lo

applicatio
n
transport
network
data link
physical

applicatio
n
transport
network
data link
physical

Multiplexing/demultiplexin
g Multiplexing at send host:
Demultiplexing at rcv host:

gathering data from multiple


sockets, enveloping data with
header (later used for
demultiplexing)

delivering received segments


to correct socket
= socket

= process
P4 application

application P3

P1
P1
application

transport

transport

transport

network

network

network

link

link

physical

physical

host 1
11/5/16

P2

link

host 2
COMPUTER NETWORKS

physical

host 3

How demultiplexing works

host receives IP datagrams


each datagram has source IP
address, destination IP address
each datagram carries 1
transport-layer segment
each segment has source,
destination port number
host uses IP addresses & port
numbers to direct segment to
appropriate socket

32 bits
source port #

dest port #

other header fields

application
data
(message)

TCP/UDP segment format


11/5/16

COMPUTER NETWORKS

Connectionless
demultiplexing
Create sockets with port
numbers:

When host receives


UDP segment:
checks destination port
number in segment
directs UDP segment to
socket with that port
number

DatagramSocket mySocket1 = new


DatagramSocket(12534);
DatagramSocket mySocket2 = new
DatagramSocket(12535);

UDP socket identified by


two-tuple:
(dest IP address, dest port number)

11/5/16

IP datagrams with
different source IP
addresses and/or
source port numbers
directed to same
socket

COMPUTER NETWORKS

Connectionless demux
(cont)
DatagramSocket serverSocket = new DatagramSocket(6428);
P2

P1
P1

P3

SP: 6428
DP: 9157

client
IP: A

SP: 9157
DP: 6428

SP: 6428
DP: 5775

server
IP: C

SP: 5775
DP: 6428

Client
IP:B

SP provides return address


COMPUTER NETWORKS
11/5/16

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Connection-oriented demux
TCP socket identified
by 4-tuple:

source IP address
source port number
dest IP address
dest port number

recv host uses all four


values to direct
segment to
appropriate socket

11/5/16

Server host may


support many
simultaneous TCP
sockets:
each socket identified
by its own 4-tuple

Web servers have


different sockets for
each connecting client
non-persistent HTTP will
have different socket for
each request

COMPUTER NETWORKS

Connection-oriented demux
(cont)
P1

P4

P5

P2

P6

P1
P3

SP: 5775
DP: 80
S-IP: B
D-IP:C

client
IP: A

11/5/16

SP: 9157
DP: 80
S-IP: A
D-IP:C

server
IP: C

SP: 9157
DP: 80
S-IP: B
D-IP:C

Client
IP:B

COMPUTER NETWORKS
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Connection-oriented demux:
Threaded Web Server
P1

P2

P4

P1
P3

SP: 5775
DP: 80
S-IP: B
D-IP:C

client
IP: A

11/5/16

SP: 9157
DP: 80
S-IP: A
D-IP:C

server
IP: C

SP: 9157
DP: 80
S-IP: B
D-IP:C

Client
IP:B

COMPUTER NETWORKS
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Chapter 3 outline
3.1 Transport-layer
services
3.2 Multiplexing and
demultiplexing
3.3 Connectionless
transport: UDP
3.4 Principles of
reliable data transfer

11/5/16

3.5 Connectionoriented transport:


TCP

segment structure
reliable data transfer
flow control
connection
management

3.6 Principles of
congestion control
3.7 TCP congestion
control

COMPUTER NETWORKS

UDP: User Datagram Protocol

[RFC

768]

no frills, bare bones


Internet transport
Why is there a UDP?
protocol
no connection
best effort service, UDP
establishment (which can
segments may be:
add delay)
lost
simple: no connection
delivered out of order
state at sender, receiver
to app
small segment header
connectionless:
no congestion control:
no handshaking
UDP can blast away as
between UDP sender,
fast as desired
receiver
each UDP segment
handled
independently of
11/5/16 others
COMPUTER NETWORKS

UDP: more

often used for streaming


multimedia apps
loss tolerant
Length, in
rate sensitive
bytes of UDP

other UDP uses

DNS
SNMP
reliable transfer over
UDP: add reliability at
application layer
application-specific
error recovery!

11/5/16

32 bits
source port #

dest port #

length

checksum

segment,
including
header

COMPUTER NETWORKS

Application
data
(message)

UDP segment format

UDP checksum
Goal: detect errors (e.g., flipped bits) in
transmitted segment
Receiver:
compute checksum of
Sender:

treat segment contents


as sequence of 16-bit
integers
checksum: addition (1s
complement sum) of
segment contents
sender puts checksum
value into UDP
checksum field

11/5/16

received segment
check if computed
checksum equals
checksum field value:
NO - error detected
YES - no error detected.
But maybe errors
nonetheless? More later
.

COMPUTER NETWORKS

Questions ??

Transport layer protocols are implemented in the end systems


and not in network routers. T/F ?
IP protocol is by default an unreliable delivery protocol. T/F ?
UDP de-multiplexing is based on __________ fields.
TCP de-multiplexing is based on __________ fields.
Consider a TCP connection between Host A and Host B.
Suppose that the TCP segments travelling from Host A to Host
B have source port number x and destination port number y.
What are the source and destination port numbers for the
segments travelling from Host B to Host A ?

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Questions ??

Suppose Client A initiates a Telnet session with server S. At


about the same time, Client B also initiates a Telnet session
with Server S. Provide possible source and destination port
numbers for:
[Note: Telnet connects with port number 23]

The segments sent from A to S.


The segments sent from B to S.
The segments sent from S to A.
The segments sent from S to B.
If A and B are different hosts, is it possible that the source post number in
the segments from A to S is the same as that from B to S.
How about if they are the same host ?

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Principals of Reliable Data Transfer
Note: Some of the slides are taken from Kurose and Ross, 3rd
edition.

Principles of Reliable data transfer

important in app., transport, link layers


top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer


protocol (rdt)

Transport Layer

3-102

Principles of Reliable data transfer

important in app., transport, link layers


top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer


protocol (rdt)

Transport Layer

3-103

Principles of Reliable data transfer

important in app., transport, link layers


top-10 list of important networking topics!

characteristics of unreliable channel will determine complexity of reliable data transfer


protocol (rdt)

Transport Layer

3-104

Reliable data transfer: getting started


rdt_send(): called from above,
(e.g., by app.). Passed data to
deliver to receiver upper layer

deliver_data(): called
by rdt to deliver data to
upper

send
side

udt_send(): called by rdt,


to transfer packet over
unreliable channel to
receiver

receive
side

rdt_rcv(): called when packet


arrives on rcv-side of channel
Transport Layer

3-105

Reliable data transfer: getting started


Well:
incrementally develop sender, receiver
sides of reliable data transfer protocol (rdt)
consider only unidirectional data transfer
but control info will flow on both directions!

use finite state machines (FSM) to specify


sender, receiver

event causing state transition


actions taken on state transition

state: when in this


state next state
uniquely
determined by
next event

state
1

event
actions

Transport Layer

state
2

3-106

Rdt1.0:

reliable transfer over a reliable channel

underlying channel perfectly reliable


no bit errors
no loss of packets

separate FSMs for sender, receiver:


sender sends data into underlying channel
receiver read data from underlying channel

Wait for
call from
above

rdt_send(data)
packet =
make_pkt(data)
udt_send(packet)

Wait for
call from
below

sender

rdt_rcv(packet)
extract (packet,data)
deliver_data(data)

receiver
Transport Layer

3-107

Rdt2.0: channel with bit errors


underlying channel may flip bits in packet
checksum to detect bit errors

the question: how to recover from errors:


acknowledgements (ACKs): receiver explicitly tells
sender that pkt received OK
negative acknowledgements (NAKs): receiver
explicitly tells sender that pkt had errors
sender retransmits pkt on receipt of NAK

new mechanisms in rdt2.0 (beyond rdt1.0):


error detection
receiver feedback: control msgs (ACK,NAK) rcvr>sender

Transport Layer

3-108

rdt2.0: FSM specification


rdt_send(data)
snkpkt = make_pkt(data,
checksum)
udt_send(sndpkt)
Wait for
call from
above

Wait for
ACK or
NAK

receiver
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
udt_send(sndp
kt)

rdt_rcv(rcvpkt) &&
corrupt(rcvpkt)
udt_send(NAK)
Wait for
call from
below

rdt_rcv(rcvpkt) && isACK(rcvpkt)

sender

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
Transport Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

rdt2.0: operation with no errors


rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for
Wait for
call from
above

ACK or
NAK

udt_send(sndp
kt)

rdt_rcv(rcvpkt) && isACK(rcvpkt)

rdt_rcv(rcvpkt) &&
corrupt(rcvpkt)
udt_send(NAK)
Wait for
call from
below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
Transport Layer

3-110

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

rdt2.0: error scenario


rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for
Wait for
call from
above

ACK or
NAK

udt_send(sndp
kt)

rdt_rcv(rcvpkt) && isACK(rcvpkt)

rdt_rcv(rcvpkt) &&
corrupt(rcvpkt)
udt_send(NAK)
Wait for
call from
below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
Transport Layer

3-111

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

rdt2.0 has a fatal flaw!


What happens if
ACK/NAK corrupted?

sender doesnt know what


happened at receiver!
cant just retransmit:
possible duplicate

Handling duplicates:

sender retransmits
current pkt if ACK/NAK
garbled
sender adds sequence
number to each pkt
receiver discards
(doesnt deliver up)
duplicate pkt
stop and wait
Sender sends one packet,
then waits for receiver
response

Transport Layer

3-112

rdt2.1: sender, handles garbled


ACK/NAKs
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
Wait for
Wait for
isNAK(rcvpkt) )
ACK or
call 0 from
udt_send(sndpkt)
NAK 0
above
rdt_rcv(rcvpkt)
&&
notcorrupt(rcvpkt)
&& isACK(rcvpkt)

rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
isNAK(rcvpkt) )
udt_send(sndpk
t)

Wait for
ACK or
NAK 1

rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt)
&& isACK(rcvpkt)

Wait for
call 1 from
above

rdt_send(data)
sndpkt = make_pkt(1, data,
checksum)
udt_send(sndpkt)
Transport Layer

3-113

rdt2.1: receiver, handles garbled


ACK/NAKs
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq0(rcvpkt)

rdt_rcv(rcvpkt) && (corrupt(rcvpkt)

extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) && (corrupt(rcvpkt)

sndpkt = make_pkt(NAK, chksum)


udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
not corrupt(rcvpkt) &&
has_seq1(rcvpkt)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)

sndpkt = make_pkt(NAK, chksum)


udt_send(sndpkt)
Wait for
0 from
below

Wait for
1 from
below

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)


&& has_seq1(rcvpkt)

rdt_rcv(rcvpkt) &&
not corrupt(rcvpkt) &&
has_seq0(rcvpkt)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)

extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
Transport Layer

3-114

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

rdt2.1: discussion
Sender:
seq # added to pkt
two seq. #s (0,1) will
suffice. Why?
must check if received
ACK/NAK corrupted
twice as many states
state must remember
whether current pkt
has 0 or 1 seq. #

Receiver:
must check if received
packet is duplicate
state indicates whether
0 or 1 is expected pkt
seq #

note: receiver can not


know if its last
ACK/NAK received OK
at sender

Transport Layer

3-115

rdt2.2: a NAK-free protocol


same functionality as rdt2.1, using ACKs only
instead of NAK, receiver sends ACK for last pkt
received OK
receiver must explicitly include seq # of pkt being
ACKed

duplicate ACK at sender results in same action


as NAK: retransmit current pkt

Transport Layer

3-116

rdt2.2: sender, receiver fragments


rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
Wait for
call 0 from
above

rdt_rcv(rcvpkt) &&
(corrupt(rcvpkt) ||
has_seq1(rcvpkt))
udt_send(sndpkt)

3-

Wait for
0 from
below

Wait for
ACK
0

sender FSM
fragment

receiver FSM
fragment

( corrupt(rcvpkt) ||
isACK(rcvpkt,1) )
udt_send(sndpkt)
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt)
&& isACK(rcvpkt,0)

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)


&& has_seq1(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = Transport
make_pkt(ACK1,
chksum)
Layer
udt_send(sndpkt)
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

rdt3.0: channels with errors and loss


New assumption:
underlying channel
can also lose packets
(data or ACKs)
checksum, seq. #,
ACKs, retransmissions
will be of help, but not
enough

Approach: sender waits


reasonable amount
of time for ACK

retransmits if no ACK
received in this time
if pkt (or ACK) just delayed
(not lost):
retransmission will be
duplicate, but use of
seq. #s already handles
this
receiver must specify
seq # of pkt being
ACKed
requires countdown timer

Transport Layer

3-118

rdt3.0 sender
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt)
start_timer

rdt_rcv(rcvpkt)

rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt)
&& isACK(rcvpkt,1)

rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
isACK(rcvpkt,0) )

timeout
udt_send(sndpkt)
start_timer
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt)
&& isACK(rcvpkt,0)
stop_timer

stop_timer
timeout
udt_send(sndpkt)
start_timer

Wait
for
ACK0

Wait for
call 0from
above

rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
isACK(rcvpkt,1) )

Wait
for
ACK1

Wait for
call 1 from
above

rdt_rcv(rcvpkt)

rdt_send(data)
sndpkt = make_pkt(1, data, checksum)
udt_send(sndpkt)
start_timer

Transport Layer

3-119

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

rdt3.0 in action

Transport Layer

3-120

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

rdt3.0 in action

Transport Layer

3-121

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Performance of rdt3.0
rdt3.0 works, but performance stinks
example: 1 Gbps link, 15 ms e-e prop. delay, 1KB
packet:
Ttransmi = L (packet length in bits) = 8kb/pkt
= 8 microsec
R (transmission rate, bps) 10**9 b/sec
t

sender

: utilization fraction of time sender busy sending

sender

L/R
RTT + L / R

.008
30.008

= 0.00027

microsec
onds

1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps


link
network protocol limits use of physical resources!
Transport Layer

3-122

rdt3.0: stop-and-wait operation


sender
first packet bit transmitted, t =
0
last packet bit transmitted, t =
L/R
RTT

receive
r

first packet bit arrives


last packet bit arrives, send
ACK

ACK arrives, send next


packet, t = RTT + L / R

3-

You should see video lectures RL 3-1 and RL 32 for the following ideas:
Selective Repeat
Go Back N
Sliding Window
Transport Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. TCP Segments

TCP: Overview

RFCs: 793, 1122, 1323,

2018, 2581

point-to-point:

full duplex data:

one sender, one


receiver

bi-directional data flow


in same connection
MSS: maximum
segment size

reliable, in-order byte


steam:
no message
boundaries

connection-oriented:
handshaking
(exchange of control
msgs) inits sender,
receiver state before
data exchange

pipelined:
TCP congestion and
flow control set window
size
socket
door

send & receive


buffers
a p p lic a t io n
w r ite s d a ta

a p p lic a t io n
re a d s d a ta

TCP
s e n d b u ffe r

TC P
r e c e iv e b u f f e r

flow controlled:

socket
door

segm ent

Transport Layer

sender will not


overwhelm receiver
3-125

TCP segment structure


32 bits
URG: urgent data
(generally not used)
ACK: ACK #
valid
PSH: push data now
(generally not used)
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
Internet
checksum
(as in UDP)

source port #

dest port #

sequence number
acknowledgement
head
not
number
UAP R S F Receive window
len

used

checksum

Urg data pnter

Options (variable length)

counting
by bytes
of data
(not segments!)
# bytes
rcvr willing
to accept

application
data
(variable length)

Transport Layer

3-126

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

TCP seq. #s and ACKs


Seq. #s:
byte stream
number of first
byte in segments
data
ACKs:
seq # of next byte
expected from
other side
cumulative ACK
Q: how receiver handles
out-of-order segments
A: TCP spec doesnt
say, - up to
implementor

Host B

Host A
User
types
C

Seq=4
2, AC
K=7

9, dat
a

= C

= C
a
t
a
d
=43,
K
C
A
79,
Seq=

host ACKs
receipt
of echoed
C

Seq=4

3, ACK

host ACKs
receipt of
C, echoes
back C

=80

time
simple telnet scenario
Transport Layer

3-127

TCP reliable data transfer


TCP creates rdt service
on top of IPs
unreliable service
Pipelined segments
Cumulative acks
TCP uses single
retransmission timer

Retransmissions are
triggered by:
timeout events
duplicate acks

Initially consider
simplified TCP sender:
ignore duplicate acks
ignore flow control,
congestion control

Transport Layer

3-128

TCP sender events:


data rcvd from app:
Create segment with
seq #
seq # is byte-stream
number of first data
byte in segment
start timer if not
already running (think
of timer as for oldest
unacked segment)
expiration interval:
TimeOutInterval

timeout:
retransmit segment
that caused timeout
restart timer
Ack rcvd:
If acknowledges
previously unacked
segments
update what is known
to be acked
start timer if there are
outstanding segments

Transport Layer

3-129

NextSeqNum = InitialSeqNum
SendBase = InitialSeqNum
loop (forever) {
switch(event)

TCP
sender
(simplified)

event: data received from application above


create TCP segment with sequence number NextSeqNum
if (timer currently not running)
start timer
Comment:
pass segment to IP
SendBase-1: last
NextSeqNum = NextSeqNum + length(data)
cumulatively
acked byte
event: timer timeout
Example:
retransmit not-yet-acknowledged segment with
SendBase-1 = 71;
smallest sequence number
y= 73, so the rcvr
start timer
wants 73+ ;
y > SendBase, so
event: ACK received, with ACK field value of y
that new data is
if (y > SendBase) {
acked
SendBase = y
if (there are currently not-yet-acknowledged segments)
start timer
Transport Layer
3-130
}

TCP: retransmission scenarios


Host A

Seq=92 timeout

bytes

data

=100
K
C
A

loss
Seq=9
2,

8 byte

s data

=100
K
C
A

SendBase
= 100

Sendbase
= 100
SendBase
= 120

SendBase
= 120
time
lost ACK scenario

Transport Layer

Host B

Seq=9
2, 8
Seq=
1

00, 2

bytes

0 byt

data

es da
t

0
10
=
K
120
=
C
K
A AC

Seq=9
2,

Seq=92 timeout

timeout

Seq=9
2, 8

time

Host A

Host B

8 byte

AC

s data

20
1
=
K

premature timeout
3-131

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

TCP retransmission scenarios


(more)
Host A

Host B

timeout

Seq=9
2, 8

SendBase
= 120

Seq=1

bytes

data

=100
K
C
A
00, 20
bytes
data

loss
=120
K
C
A

time
Cumulative ACK scenario
Transport Layer

3-132

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

1.

2.

3.

4.
5.

13

True / False
Host A is sending Host B a large file over a TCP connection.
Assume Host B has no data to send to Host A. Host B will not
send acknowledgements to Host A because Host B cannot
piggyback the acknowledgement on data.
Suppose host A is sending a large file to Host B over a TCP
connection. The number of unacknowledged bytes that A sends
cannot exceed the size of the receive buffer.
Suppose host A is sending a large file to Host B over a TCP
connection. If the sequence number for a segment of this
connection is m, then the sequence number for the subsequent
segment will necessarily be m+1.
The TCP segment has a field in its header for RcvWindow.
Suppose Host A sends over a TCP connection to Host B one
segment with sequence number 38 and 4 bytes of data. In this
same segment the acknowledgement number is necessarily 42.
11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. Suppose Host A sends two TCP segments back to back to Host


B over a TCP connection. The first segment has sequence
number 90; the second has sequence number 110.
a) How much data is in the first segment.
b) Suppose that first segment is lost but the second segment
arrives at B. In the acknowledgement that Host B sends to
Host A, what will be the acknowledgement number.

13

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

TCP segment structure


32 bits
URG: urgent data
(generally not used)
ACK: ACK #
valid
PSH: push data now
(generally not used)
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
Internet
checksum
(as in UDP)

source port #

dest port #

sequence number
acknowledgement
head
not
number
UAP R S F Receive window
len

used

checksum

Urg data pnter

Options (variable length)

counting
by bytes
of data
(not segments!)
# bytes
rcvr willing
to accept

application
data
(variable length)

Transport Layer

3-135

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

TCP Flow Control

flow control
sender wont
overflow
receivers buffer by
transmitting too
much,
too fast

receive side of TCP


connection has a
receive buffer:

app process may be

slow at reading from


buffer

speed-matching
service: matching
the send rate to the
receiving apps drain
rate

Transport Layer

3-136

TCP Flow control: how it


works
Rcvr advertises spare
room by including
value of RcvWindow in
segments
(Suppose TCP receiver discards
Sender limits
out-of-order segments)
unACKed data to
spare room in buffer
RcvWindow
= RcvWindow
Q.Specify RcvWindow in terms of
LastByteRcvd, LastByteRead

guarantees receive
buffer doesnt
overflow

= RcvBuffer-[LastByteRcvd LastByteRead]
Transport Layer

3-137

Q. Suppose that Host Bs receive buffer becomes full so that


RcvWindow = 0. After advertising RcvWindow = 0 to Host A,
also suppose that B has nothing to send to A. Now, as the
application process at B empties the buffer, TCP does not
send new segments with new RcvWindow values to Host A.
There fore Host A is never informed that some space is
created at Host B and it can send more data. Therefore Host A
is blocked
To solve this problem, Host A continues to send segments one
data byte when Bs receive window is zero. These segments
will be acknowledged by the receiver.

13

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

way
TCP ConnectionThree
Management
handshake:

Recall: TCP sender,

receiver establish
connection before
exchanging data
segments
initialize TCP variables:
seq. #s
buffers, flow control
info (e.g. RcvWindow)
client: connection
initiator
Socket clientSocket = new
Socket("hostname","port
number");

server: contacted by
client
Socket connectionSocket =
welcomeSocket.accept();

Step 1: client host sends TCP


SYN segment to server
specifies initial seq #
no data
Step 2: server host receives
SYN, replies with SYNACK
segment
server allocates buffers
specifies server initial
seq. #
Step 3: client receives
SYNACK, replies with ACK
segment, which may
contain data

Transport Layer

3-139

TCP Connection Management (cont.)


Closing a connection:

client
close

client closes socket:


clientSocket.close();

server
FIN

Step 1: client end system


sends TCP FIN control
segment to server

FIN

timed wait

Step 2: server receives FIN,


replies with ACK. Closes
connection, sends FIN.

close

AC K

A CK

closed

Transport Layer

3-140

TCP Connection Management (cont.)


Step 3: client receives FIN,

client

replies with ACK.


Enters timed wait - will
respond with ACK to
received FINs

closing

Step 4: server, receives ACK.

FIN

closing

AC K

Connection closed.

timed wait

FIN

Note: with small modification,


can handle simultaneous
FINs.

server

A CK

closed

closed

Transport Layer

3-141

TCP Connection Management


(cont)

TCP server
lifecycle
TCP client
lifecycle

Transport Layer

3-142

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. What happens when a host receives a TCP segment whose


port numbers or source IP address do not match with any
ongoing sockets on the host ?

14

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

TCP segment structure


32 bits
URG: urgent data
(generally not used)
ACK: ACK #
valid
PSH: push data now
(generally not used)
RST, SYN, FIN:
connection estab
(setup, teardown
commands)
Internet
checksum
(as in UDP)

source port #

dest port #

sequence number
acknowledgement
head
not
number
UAP R S F Receive window
len

used

checksum

Urg data pnter

Options (variable length)

counting
by bytes
of data
(not segments!)
# bytes
rcvr willing
to accept

application
data
(variable length)

Transport Layer

3-144

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

way
TCP ConnectionThree
Management
handshake:

Recall: TCP sender,

receiver establish
connection before
exchanging data
segments
initialize TCP variables:
seq. #s
buffers, flow control
info (e.g. RcvWindow)

Step 1: client host sends TCP


SYN segment to server
specifies initial seq #
no data
Step 2: server host receives
SYN, replies with SYNACK
segment
server allocates buffers
specifies server initial
seq. #
Step 3: client receives
SYNACK, replies with ACK
segment, which may
contain data

Transport Layer

3-145

TCP Connection Management (cont.)


Closing a connection:

client
close

client closes socket:


clientSocket.close();

server
FIN

Step 1: client end system


sends TCP FIN control
segment to server

FIN

timed wait

Step 2: server receives FIN,


replies with ACK. Closes
connection, sends FIN.

close

AC K

A CK

closed

Transport Layer

3-146

TCP Connection Management (cont.)


Step 3: client receives FIN,

client

replies with ACK.


Enters timed wait - will
respond with ACK to
received FINs

closing

Step 4: server, receives ACK.

FIN

closing

AC K

Connection closed.

timed wait

FIN

Note: with small modification,


can handle simultaneous
FINs.

server

A CK

closed

closed

Transport Layer

3-147

TCP Connection Management


(cont)

TCP server
lifecycle
TCP client
lifecycle

Transport Layer

3-148

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. What happens when a host receives a TCP segment whose


port numbers or source IP address do not match with any
ongoing sockets on the host ?

14

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

TCP Round Trip Time and


Timeout
Q: how to set TCP
timeout value?

longer than RTT


but RTT varies

Q: how to estimate RTT?

too short:
premature timeout

unnecessary
retransmissions
too long:
slow reaction to
segment loss

SampleRTT: measured time


from segment transmission
until ACK receipt
ignore retransmissions
SampleRTT will vary, want
estimated RTT smoother
average several recent
measurements, not just
current SampleRTT

Transport Layer

3-150

TCP Round Trip Time and


Timeout
EstimatedRTT = (1- )*EstimatedRTT + *SampleRTT
Exponential weighted moving average
influence of past sample decreases exponentially

fast
typical value: = 0.125 [RFC 2988]

Transport Layer

3-151

Example RTT estimation:

3-

Transport Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

TCP Round Trip Time and


Timeout
Setting the timeout

EstimtedRTT plus safety margin


large variation in EstimatedRTT -> larger safety margin

first estimate of how much SampleRTT deviates from EstimatedRTT:

DevRTT = (1-)*DevRTT +
*|SampleRTT-EstimatedRTT|
(typically, = 0.25)
Then set timeout interval:
TimeoutInterval = EstimatedRTT + 4*DevRTT
Transport Layer

3-153

1. Suppose that the last SampleRTT in a TCP connection is


equal to 1 sec. Then the current value of TimeOutInterval for
the connection will necessarily be >= 1 sec.

15

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. Consider the TCP process for estimating RTT. Suppose that


= 0.1. Let SampleRTT1 be the most recent sample RTT, let
SampleRTT2 be the next most recent sample RTT, and so on.
a) For a given TCP connection, suppose four acknowledgements
have been returned with corresponding sample RTTs
SampleRTT4,
SampleRTT3,
SampleRTT2,
SampleRTT1.
Express estimated RTT in terms of four sample RTTs.

15

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

15

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. Generalize your formula for n sample RTTs:

15

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. For the previous formula, let n approach infinity. Comment on why


this averaging procedure is called an exponential moving average?

15

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Computer Networks
IS ZC467
Vishal Gupta
BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Department of Computer Science and Information


Systems
Birla Institute of Technology and Science
Pilani Campus, Pilani

Network layer
transport segment from
sending to receiving host
on sending side
encapsulates segments
into datagrams
on rcving side, delivers
segments to transport
layer
network layer protocols in
every host, router
Router examines header
fields in all IP datagrams
passing through it

applicatio
n
transport
network
data link
physical

Network Layer

network
data link
physical

network
data link
physical
network
data link
physical

network
data link
physical

network
data link
physical

network
data link
physical

network
data link
physical
network
data link
physical

applicatio
n
transport
network
data link
physical

4-160

Two Key Network-Layer Functions


forwarding: move
packets from routers
input to appropriate
router output
routing: determine
route taken by
packets from source
to dest.

analogy:
routing: process of

planning trip from


source to dest
forwarding: process

of getting through
single interchange

routing algorithms

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Interplay between routing and forwarding


routing algorithm

local forwarding table


header value output link
0100
0101
0111
1001

3
2
2
1

value in arriving
packets header
0111

1
3 2

Network Layer

4-162

Chapter 4: Network Layer


4. 1 Introduction
4.2 Virtual circuit and
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol

Datagram format
IPv4 addressing
ICMP
IPv6

4.5 Routing algorithms


Link state
Distance Vector
Hierarchical routing

4.6 Routing in the


Internet
RIP
OSPF
BGP

4.7 Broadcast and


multicast routing
Network Layer

4-163

Network layer connection and


connection-less service
datagram network provides networklayer connectionless service
VC network provides network-layer
connection service
analogous to the transport-layer
services, but:

4-

service: host-to-host
no choice: network provides one or the
other
implementation:
in Layer
network core
Network

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Virtual circuits
source-to-dest path behaves much like
telephone circuit
performance-wise
network actions along source-to-dest path

call setup, teardown for each call before data can flow
each packet carries VC identifier (not destination host
address)
every router on source-dest path maintains state for
each passing connection
link, router resources (bandwidth, buffers) may be
allocated to VC (dedicated resources = predictable
service)
Network Layer

4-165

VC implementation
a VC consists of:
1. path from source to destination
2. VC numbers, one number for each link along
path
3. entries in forwarding tables in routers along
path

packet belonging to VC carries VC


number (rather than dest address)
VC number can be changed on each link.
. New VC number comes from forwarding table
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

ForwardingVC number
table
1

Forwarding table in
northwest router:

oming interface

22

12

interface
number

Incoming VC #

12
63
7
97

32

Outgoing interface
3
1
2
3

Outgoing V
22
18
17
87

Routers maintain connection state information!


Network Layer

4-167

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Datagram networks
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-dest pair may take
different paths
applicatio
n
transport
network 1. Send data
data link
physical

applicatio
n
2. Receive data transport
network
data link
physical
Network Layer

4-168

Forwarding table
DestinationAddressRangeLinkInterface
11001000000101110001000000000000
through0
11001000000101110001011111111111
11001000000101110001100000000000
through1
11001000000101110001100011111111

4
billion
possibl
e
entries

11001000000101110001100100000000
through2
11001000000101110001111111111111
otherwise3
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Longest prefix matching


PrefixMatchLinkInterface
1100100000010111000100
1100100000010111000110001
1100100000010111000112
otherwise3
Examples

4-

DA: 11001000 00010111 00010110 10100001

Which interface?

DA: 11001000 00010111 00011000 10101010

Which interface?

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Datagram or VC network: why?


Internet (datagram)

data exchange among


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

4-171

Chapter 4: Network Layer


4. 1 Introduction
4.2 Virtual circuit and
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol

Datagram format
IPv4 addressing
ICMP
IPv6

4.5 Routing algorithms


Link state
Distance Vector
Hierarchical routing

4.6 Routing in the


Internet
RIP
OSPF
BGP

4.7 Broadcast and


multicast routing
Network Layer

4-172

Router Architecture Overview


Two key router functions:
run routing algorithms/protocol (RIP, OSPF, BGP)
forwarding datagrams from incoming to outgoing link

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Input Port Functions

Physical layer:
bit-level reception
Data link layer:
e.g., Ethernet
see chapter 5

Decentralized switching:

4-

given datagram dest., lookup output


port using forwarding table in input
port memory
goal: complete input port processing
at line speed
queuing: if datagrams arrive faster
than forwarding rate into switch fabric
Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Output Ports

Buffering required when datagrams arrive from fabric faster than the
transmission rate
Scheduling discipline chooses among queued datagrams for transmission

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Output port queueing

buffering when arrival rate via switch exceeds output line


speed
queueing (delay) and loss due to output port buffer overflow!

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Input Port Queuing

Fabric slower than 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!

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

The Internet Network layer


Host, router network layer functions:
Transport layer: TCP, UDP

Network
layer

IP protocol
addressing conventions
datagram format
packet handling conventions

Routing protocols
path selection
RIP, OSPF, BGP

forwarding
table

ICMP protocol
error reporting
router
signaling

Link layer
physical layer

Network Layer

4-178

Computer Networks
BITS ZC481
Vishal Gupta
BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Department of Computer Science and Information


Systems
Birla Institute of Technology and Science
Pilani Campus, Pilani

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Routing Protocols
1.
2.
3.

NAT
ICMP
IPv6

NAT: Network Address Translation


rest of
Internet

local network
(e.g., home network)
10.0.0/24
10.0.0.4

10.0.0.1

10.0.0.2

138.76.29.7
10.0.0.3

Datagrams with source or


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

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

NAT: Network Address Translation


Motivation: local network uses just one IP address
as far as outside world is concerned:

4-

range of addresses not needed from ISP:


just one IP address 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). Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

NAT: Network Address Translation


NAT translation table
WAN side addr
LAN side addr

1: host 10.0.0.1
2: NAT router
sends datagram to
changes datagram
138.76.29.7, 5001 10.0.0.1, 3345
128.119.40.186, 80
source addr from

10.0.0.1, 3345 to
138.76.29.7, 5001,
S: 10.0.0.1, 3345
D: 128.119.40.186,
updates table
80

S: 138.76.29.7,
5001
D: 128.119.40.186,
80

138.76.29.7

S: 128.119.40.186,
80
D: 138.76.29.7,
Reply
arrives
5001

3:
dest. address:
138.76.29.7, 5001

10.0.0.1

10.0.0.4
S: 128.119.40.186,
80
D: 10.0.0.1, 3345

10.0.0.2

10.0.0.3
4: NAT router
changes datagram
dest addr from
138.76.29.7, 5001 to 10.0.0.1, 3345
Network Layer

4-184

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
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

ICMP: Internet Control Message


Protocol

used by hosts & routers to


communicate network-level
information
error reporting:
unreachable host,
network, port, protocol
echo request/reply (used
by ping)
network-layer above IP:
ICMP msgs carried in IP
datagrams
ICMP message: type, code
plus first 8 bytes of IP
datagram causing error

Type
0
3
3
3
3
3
3
4

Code
0
0
1
2
3
6
7
0

8
9
10
11
12

0
0
0
0
0

Network Layer

description
echo reply (ping)
dest. network unreachable
dest host unreachable
dest protocol unreachable
dest port unreachable
dest network unknown
dest host unknown
source quench (congestion
control - not used)
echo request (ping)
route advertisement
router discovery
TTL expired
bad IP header
4-186

Traceroute and ICMP

Source sends series of UDP


segments to dest
first has TTL =1
second has TTL=2, etc.
unlikely port number

When nth datagram arrives


to nth router:
router discards datagram
and sends to source an
ICMP message (type 11,
code 0)
ICMP message includes
name of router & IP
address

when ICMP message


arrives, source calculates
RTT
traceroute does this 3
times
Stopping criterion
UDP segment eventually
arrives at destination host
destination returns ICMP
port unreachable packet
(type 3, code 3)
when source gets this
ICMP, stops.

Network Layer

4-187

IPv6
Initial motivation: 32-bit address
space soon to be completely
allocated.
Additional motivation:
header format helps speed
processing/forwarding
header changes to facilitate QoS
IPv6 datagram format:
fixed-length 40 byte header
no fragmentation allowed
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

IPv6 Header (Cont)


Priority: identify priority among datagrams in flow
Flow Label: identify datagrams in same flow.
(concept offlow not well defined).
Next header: identify upper layer protocol for data
pri
ver
payload len

flow label
next hdr hop limit

source address
(128 bits)
destination address
(128 bits)
data
32 bits

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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?

Tunneling: IPv6 carried as payload in


IPv4 datagram among IPv4 routers

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Tunneling
Logical view:

Physical view:

4-

IPv6

IPv6

IPv6

IPv6

IPv6

IPv6

IPv6

IPv6

tunnel

IPv4

IPv4

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Tunneling
Logical view:

Physical view:

IPv6

IPv6

IPv6

IPv6

IPv4

Flow: X
Src: A
Dest: F
data

A-to-B:
IPv6
4-

IPv6

IPv6

IPv4

IPv6

IPv6

tunnel

Src:B
Dest: E

Src:B
Dest: E

Flow: X
Src: A
Dest: F

Flow: X
Src: A
Dest: F

data

data

B-to-C:
IPv6 inside
IPv4

Network Layer

B-to-C:
IPv6 inside
IPv4

Flow: X
Src: A
Dest: F
data

E-to-F:
IPv6

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Routing Protocols
1.
2.
3.

Link state
Distance Vector
Hierarchical

Interplay between routing, forwarding


routing algorithm

local forwarding table


header value output link
0100
0101
0111
1001

3
2
2
1

value in arriving
packets header
0111

1
3 2

Network Layer

4-195

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Graph abstraction
5
2

2
1

Graph: G = (N,E)

w
3

N = set of routers = { u, v, w, x, y, z }
E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), (x,y), (w,y), (w,z), (y,z) }
Remark: Graph abstraction is useful in other network contexts
Example: P2P, where N is set of peers and E is set of TCP connections
Network Layer

4-196

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Graph abstraction: costs


5
2

v
2

c(x,x) = cost of link (x,x)


3

w
3

- e.g., c(w,z) = 5
cost could always be 1, or
inversely related to bandwidth,
or inversely related to
congestion

Cost of path (x1, x2, x3,, xp) = c(x1,x2) + c(x2,x3) + + c(xp-1,xp)


Question: Whats the least-cost path between u and z ?

Routing algorithm: algorithm that finds least-cost path


Network Layer

4-197

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Routing Algorithm classification


Global or decentralized
information?

Static or dynamic?

Global:
all routers have complete
topology, link cost info
link state algorithms
Decentralized:
router knows physicallyconnected neighbors, link
costs to neighbors
iterative process of
computation, exchange of
info with neighbors
distance vector algorithms

Static:
routes change slowly
over time
Dynamic:
routes change more
quickly
periodic update
in response to link
cost changes

Network Layer

4-198

A Link-State Routing Algorithm


Dijkstras algorithm

Notation:
c(x,y): link cost from node

net topology, link costs


x to y; = if not direct
known to all nodes
neighbors
accomplished via link
D(v): current value of cost
state broadcast
of path from source to
all nodes have same
dest. v
info
p(v): predecessor node
computes least cost paths
along path from source to
from one node (source)
v
to all other nodes
N': set of nodes whose
gives forwarding table
least cost path definitively
for that node
known
iterative: after k iterations,
know least cost path to k
dest.s
Network Layer
4-199

Dijsktras Algorithm
1 Initialization:
2 N' = {u}
3 for all nodes v
4
if v adjacent to u
5
then D(v) = c(u,v)
6
else D(v) =
7
8 Loop
9 find w not in N' such that D(w) is a minimum
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
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'
Network Layer

4-200

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Dijkstras algorithm: example


Step
0
1
2
3
4
5

N'
u
ux
uxy
uxyv
uxyvw
uxyvwz

D(v),p(v) D(w),p(w)
2,u
5,u
2,u
4,x
2,u
3,y
3,y

D(x),p(x)
1,u

D(y),p(y)

2,x

D(z),p(z)

4,y
4,y
4,y

5
2

v
2

w
3

Network Layer

4-201

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Dijkstras algorithm: example (2)


Resulting shortest-path tree from u:

z
x

Resulting forwarding table in u:


destination

link

v
x

(u,v)
(u,x)

(u,x)

(u,x)

(u,x)
Network Layer

4-202

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Distance Vector Algorithm


Bellman-Ford Equation (dynamic
programming)
Define
dx(y) := cost of least-cost path from x to y
Then
dx(y) = min
{c(x,v) + dv(y) }
v
where min is taken over all neighbors v of x
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Bellman-Ford example
5
2

v
2

w
3

Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3


5

B-F equation says:

du(z) = min { c(u,v) + dv(z),


1
c(u,x) + dx(z),
c(u,w) + dw(z) }
= min {2 + 5,
1 + 3,
5 + 3} = 4
Node that achieves minimum is next
hop in shortest path forwarding table
1

Network Layer

4-204

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Network Layer
4. 1 Introduction
4.2 Virtual circuit and
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol

Datagram format
IPv4 addressing
ICMP
IPv6

4.5 Routing algorithms


Link state
Distance Vector
Hierarchical routing

4.6 Routing in the


Internet
RIP
OSPF
BGP

4.7 Broadcast and


multicast routing
Network Layer

4-205

Interconnected ASes
3c

3a
3b
AS3

1c
1a

1d

2c

2a

AS2

1b AS1

Intra-AS
Routing
algorithm

Inter-AS
Routing
algorithm

Forwarding
table

Network Layer

2b

Forwarding table is
configured by both
intra- and inter-AS
routing algorithm
Intra-AS sets entries
for internal dests
Inter-AS & Intra-As
sets entries for
external dests
4-206

Inter-AS tasks
Suppose router in
AS1 receives
datagram for which
dest is outside of
AS1
Router should forward
packet towards one of
the gateway routers,
but which one?

AS1 needs:
1. to learn which dests
are reachable
through AS2 and
which through AS3
2. to propagate this
reachability info to
all routers in AS1
Job of inter-AS routing!

3c

3a
3b
AS3

2a

1c
1a

1d

2c
AS2

2b

1b AS1
Network Layer

4-207

Example: Setting forwarding table in router


1d
Suppose AS1 learns (via inter-AS protocol) that
subnet x is reachable via AS3 (gateway 1c) but not
via AS2.
Inter-AS protocol propagates reachability info to all
internal routers.
Router 1d determines from intra-AS routing info
that its interface I is on the least cost path to 1c.
Puts in forwarding table entry (x,I).
3c

3a
3b
AS3

1c
1a

4-

2a

1d

2c
AS2

2b

1b AS1
Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Example: Choosing among multiple ASes


Now suppose AS1 learns from the inter-AS
protocol that subnet x is reachable from AS3
and from AS2.
To configure forwarding table, router 1d must
determine towards which gateway it should
forward packets for dest x.
This is also the job on inter-AS routing protocol!
3c
3b

3a
AS3

1c
1a

4-

2a

1d

2c
AS2

2b

1b AS1
Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Example: Choosing among multiple ASes


Now suppose AS1 learns from the inter-AS
protocol that subnet x is reachable from AS3
and from AS2.
To configure forwarding table, router 1d must
determine towards which gateway it should
forward packets for dest x.
This is also the job on inter-AS routing protocol!
Hot potato routing: send packet towards closest
of two routers.
Learn from inter-AS
protocol that subnet
x is reachable via
multiple gateways

4-

Use routing info


from intra-AS
protocol to
determine
costs of least-cost
paths to each
of the gateways

Hot potato routing:


Choose the
gateway
that has the
smallest least cost

Determine from
forwarding table the
interface I that leads
to least-cost gateway.
Enter (x,I) in
forwarding table

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Computer Networks
IS ZC467
Vishal Gupta
BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Department of Computer Science and Information


Systems
Birla Institute of Technology and Science
Pilani Campus, Pilani

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Routing in the Internet:
1.
2.
3.

RIP
OSPF
Border Gateway Protocol

Intra-AS Routing
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)

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RIP ( Routing Information Protocol)


Distance vector algorithm
Included in BSD-UNIX Distribution in 1982
Distance metric: # of hops (max = 15 hops)
From router A to subsets:
u

4-

destination hops
u
1
v
2
w
2
x
3
y
3
z
2

D
y

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RIP advertisements
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

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RIP: Example
z
w

C
Destination Network
dest.

4-

w
y
z
x

A
B
B
--

Next Router

Num. of hops to

2
2
7
1
....

Routing table in D
Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RIP: Example
Dest
Next hops
w 1
x 1
z C
4
.
...

Advertisement
from A to D

z
x

C
Destination Network
dest.

4-

w
y
z
x

A
B
BA
--

Next Router

Num. of hops to

2
2
75
1
....Network
Layer
Routing
table
in D

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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 pingpong loops (infinite distance = 16 hops)
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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
(UDP)
network
forwarding
(IP)
link

Transprt
(UDP)
forwarding
table

table

link

physical
4-

network
(IP)
physical

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Network Layer
4. 1 Introduction
4.2 Virtual circuit and
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol

Datagram format
IPv4 addressing
ICMP
IPv6

4.5 Routing algorithms


Link state
Distance Vector
Hierarchical routing

4.6 Routing in the


Internet
RIP
OSPF
BGP

4.7 Broadcast and


multicast routing
Network Layer

4-220

OSPF (Open Shortest Path First)


open: publicly available
Uses Link State algorithm
LS packet dissemination
Topology map at each node
Route computation using Dijkstras 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
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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.
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Hierarchical OSPF

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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 ASs.
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Network Layer
4. 1 Introduction
4.2 Virtual circuit and
datagram networks
4.3 Whats inside a
router
4.4 IP: Internet
Protocol

Datagram format
IPv4 addressing
ICMP
IPv6

4.5 Routing algorithms


Link state
Distance Vector
Hierarchical routing

4.6 Routing in the


Internet
RIP
OSPF
BGP

4.7 Broadcast and


multicast routing
Network Layer

4-225

Internet inter-AS routing: BGP


BGP (Border Gateway Protocol): the de
facto standard
BGP provides each AS a means to:
1.Obtain subnet reachability information from
neighboring ASs.
2.Propagate reachability information to all ASinternal routers.
3.Determine good routes to subnets based on
reachability information and policy.

allows subnet to advertise its existence to


rest of Internet: I am here
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BGP basics
Pairs of routers (BGP peers) exchange routing
info over semi-permanent TCP connections:
BGP sessions

BGP sessions need not correspond to physical links.

When AS2 advertises a prefix to AS1, AS2 is


promising it will forward any datagrams
destined to that prefix towards the prefix.
AS2 can aggregate prefixes in its advertisement
3c
3a
3b
AS3

2a
1c

1a
AS1 1d

2c
AS2

2b

1b
eBGP session
iBGP session

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Distributing reachability
info

With eBGP session between 3a and 1c, AS3 sends prefix


reachability info to AS1.
1c can then use iBGP do distribute this new prefix reach
info to all routers in AS1
1b can then re-advertise new reachability info to AS2
over 1b-to-2a eBGP session
When router learns of new prefix, creates entry for
prefix in its forwarding table.
3c
3a
3b
AS3

2a
1c

1a
AS1 1d

2c
AS2

2b

1b
eBGP session
iBGP session

4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Path attributes & BGP routes


When advertising a prefix, advert includes BGP
attributes.
prefix + attributes = route

Two important attributes:


AS-PATH: contains ASs through which prefix
advertisement has passed: AS 67 AS 17
NEXT-HOP: Indicates specific internal-AS router to nexthop AS. (There may be multiple links from current AS to
next-hop-AS.)

When gateway router receives route


advertisement, uses import policy to
accept/decline.
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BGP route selection


Router may learn about more than 1
route to some prefix. Router must
select route.
Elimination rules:

4-

1. Local preference value attribute: policy


decision
2. Shortest AS-PATH
3. Closest NEXT-HOP router: hot potato
routing
4. Additional criteria
Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Why different Intra- and 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
4-

Network Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Multiple Access Links and Protocols


Two types of links:
point-to-point
PPP for dial-up access
point-to-point link between Ethernet switch and host

broadcast (shared wire or medium)


Old-fashioned Ethernet
upstream HFC
802.11 wireless LAN

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Multiple Access protocols


single shared broadcast channel
two or more simultaneous transmissions by nodes:
interference
collision if node receives two or more signals at the same
time

multiple access protocol


distributed algorithm that determines how nodes
share channel, i.e., determine when node can
transmit
communication about channel sharing must use
channel itself!
no out-of-band channel for coordination
5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Ideal Multiple Access


Protocol
Broadcast channel of rate R bps
1. When one node wants to transmit, it can send at
rate R.
2. When M nodes want to transmit, each can send
at average rate R/M
3. Fully decentralized:
no special node to coordinate transmissions
no synchronization of clocks, slots

4. Simple

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

MAC Protocols: a taxonomy


Three broad classes:
Channel Partitioning
divide channel into smaller pieces (time slots,
frequency, code)
allocate piece to node for exclusive use

Random Access
channel not divided, allow collisions
recover from collisions

Taking turns
Nodes take turns, but nodes with more to send can
take longer turns

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Channel Partitioning MAC protocols:


TDMA
TDMA: time division multiple access

access to channel in "rounds"


each station gets fixed length slot (length = pkt trans time) in each round
unused slots go idle
example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle

TDM (Time Division Multiplexing): channel divided into N time slots,


one per user; inefficient with low duty cycle users and at light load.
FDM (Frequency Division Multiplexing): frequency subdivided.

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Channel Partitioning MAC protocols:


FDMA
FDMA: frequency division multiple access
channel spectrum divided into frequency bands
each station assigned fixed frequency band
unused transmission time in frequency bands go idle
example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6 idle

time

frequency bands

TDM (Time Division Multiplexing): channel divided into N time slots,


one per user; inefficient with low duty cycle users and at light load.
FDM (Frequency Division Multiplexing): frequency subdivided.

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Random Access Protocols


When node has packet to send
transmit at full channel data rate R.
no a priori coordination among nodes

two or more transmitting nodes collision,


random access MAC protocol specifies:
how to detect collisions
how to recover from collisions (e.g., via delayed
retransmissions)

Examples of random access MAC protocols:


slotted ALOHA
ALOHA
CSMA, CSMA/CD, CSMA/CA
5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

CSMA (Carrier Sense Multiple


Access)
CSMA: listen before transmit:
If channel sensed idle: transmit entire frame
If channel sensed busy, defer transmission

Human analogy: dont interrupt others!

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

CSMA collisions

spatial layout of nodes

collisions can still


occur:
propagation delay means
two nodes may not hear
each others transmission

collision:

entire packet
transmission
time wasted

note:

role of distance & propagation


delay in determining collision
probability

5: DataLink Layer

5-240

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

CSMA/CD (Collision
Detection)

CSMA/CD: carrier sensing, deferral as in CSMA


collisions detected within short time
colliding transmissions aborted, reducing
channel wastage

collision detection:
easy in wired LANs: measure signal strengths,
compare transmitted, received signals
difficult in wireless LANs: receiver shut off while
transmitting

human analogy: the polite conversationalist

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Hubs
Hubs are essentially physical-layer repeaters:

bits coming from one link go out all other links


at the same rate
no frame buffering
no CSMA/CD at hub: adapters detect collisions
provides net management functionality

twisted pair

hub

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Interconnecting with hubs


Backbone hub interconnects LAN segments
Extends max distance between nodes
But individual segment collision domains become one large
collision domain
Cant interconnect 10BaseT & 100BaseT
hub

hu
b

5-

hub

hub

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Switch
Link layer device

stores and forwards Ethernet frames


examines frame header and selectively forwards
frame based on MAC dest address
when frame is to be forwarded on segment,
uses CSMA/CD to access segment
transparent

hosts are unaware of presence of switches


plug-and-play, self-learning

switches do not need to be configured

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Forwarding
switch

1
2

hu
b

hub

hub

How do determine onto which LAN segment to


forward frame?
Looks like a routing problem...
5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Forwarding
switch

1
2

hu
b

hub

hub

How do determine onto which LAN segment to


forward frame?
Looks like a routing problem...
5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Self learning
A switch has a switch table
entry in switch table:

(MAC Address, Interface, Time Stamp)


stale entries in table dropped (TTL can be 60
min)
switch learns which hosts can be reached through which
interfaces

when frame received, switch learns location


of sender: incoming LAN segment
records sender/location pair in switch table

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Filtering/Forwarding
When switch receives a frame:
index switch table using MAC dest address
if entry found for destination
then{
if dest on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
}
else flood

forward on all but the interface


on which the frame arrived
5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Switch example
Suppose C sends frame to D
1
2

A
B
E
G

3
hub

hub

hu
b

address interface

switch

1
1
2
3

I
D

F
E

Switch receives frame from C


notes in bridge table that C is on interface 1
because D is not in table, switch forwards frame into
interfaces 2 and 3
frame received by D
5-

5: DataLink Layer

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Switch example
Suppose D replies back with frame to C.
address interface

switch

hub

hub

hu
b

I
D

F
E

A
B
E
G
C

1
1
2
3
1

Switch receives frame from from D


notes in bridge table that D is on interface 2
because C is in table, switch forwards frame only to
interface 1
frame received by C
5-

5: DataLink Layer

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Switch: traffic isolation


switch installation breaks subnet into LAN
segments
switch filters packets:

same-LAN-segment frames not usually


forwarded onto other LAN segments
segments become separate collision
switch
domains
collision
domain

hub

5-

hub

collision domain collision domain


5: DataLink Layer

hub

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Institutional network
mail server

to external
network

web server

router
switch

IP subnet

hu
b

hub

5: DataLink Layer

hub

5-252

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Switches vs. Routers


both store-and-forward devices
routers: network layer devices (examine network layer headers)
switches are link layer devices

routers maintain routing tables, implement routing algorithms


switches maintain switch tables, implement filtering, learning
algorithms

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Summary comparison

5: DataLink Layer

5-254

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Mobile IP

What is mobility?
spectrum of mobility, from the network
perspective:
no mobility

high mobility

mobile wireless user, mobile user,


using same access
connecting/
point
disconnecting
from network
using DHCP.

6-

6: Wireless and Mobile Networks

mobile user,
passing through
multiple access
point while
maintaining
ongoing
connections (like
cell phone)

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobility: Vocabulary
home network:
permanent home of
mobile
(e.g., 128.119.40/24)

home agent: entity that will


perform mobility functions
on behalf of mobile, when
mobile is remote

wide area
network

Permanent address:
address in home
network, can always
be used to reach
mobile

correspondent

e.g., 128.119.40.186
6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobility: more vocabulary


Permanent address:
remains constant (e.g.,
128.119.40.186)

visited network: network


in which mobile
currently resides (e.g.,
79.129.13/24)

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

6-

correspondent:
wants to
communicate with
mobile

home agent: entity


in visited network
that performs
mobility functions
on behalf of mobile.
6: Wireless and Mobile Networks
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

How do you contact a mobile friend:


Consider friend frequently
changing addresses, how do
findall
her?
you
search
phone
books?
call her parents?
expect her to let you
know where he/she
is?

I wonder where
Alice moved to?

6: Wireless and Mobile Networks

6-259

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
6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobility: approaches
Let routing handle it: routers advertise permanent address
of mobile-nodes-in-residence
via usual routing table
not
exchange.
scalable

millions where
of
routing tables to
indicate
each mobile
mobiles
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
6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobility: registration
visited network

home
network

1
2

wide area
network

foreign agent contacts home


agent home: this mobile is
resident in my network

mobile
contacts
foreign agent
on entering
visited network

End result:
Foreign agent knows about mobile
Home agent knows location of mobile
6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobility via Indirect Routing


home agent intercepts
packets, forwards to
foreign agent

foreign agent
receives packets,
forwards to mobile

home
network

visited
network

3
wide area
network

correspondent
addresses packets
using home address
of mobile

6-

mobile replies
directly to
correspondent
6: Wireless and Mobile Networks
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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
6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

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!

6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobility via Direct Routing


correspondent
forwards to foreign
agent

foreign agent
receives packets,
forwards to mobile

home
network

4
wide area
network

2
correspondent
requests, receives
foreign address of
mobile

6-

visited
network

3
4

mobile replies
directly to
correspondent
6: Wireless and Mobile Networks
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobility via Direct Routing: comments


overcome triangle routing problem
non-transparent to correspondent:
correspondent must get care-ofaddress from home agent
what if mobile changes visited
network?

6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Chapter 6 outline
6.1 Introduction
Wireless
6.2 Wireless links,
characteristics
CDMA

6.3 IEEE 802.11


wireless LANs (wi-fi)
6.4 Cellular Internet
Access
architecture
standards (e.g., GSM)

Mobility
6.5 Principles:
addressing and routing
to mobile users
6.6 Mobile IP
6.7 Handling mobility
in cellular networks
6.8 Mobility and
higher-layer protocols
6.9 Summary

6: Wireless and Mobile Networks

6-268

Mobile IP
RFC 3220
has many features weve seen:
home agents, foreign agents, foreignagent registration, care-of-addresses,
encapsulation (packet-within-a-packet)

three components to standard:


indirect routing of datagrams
agent discovery
registration with home agent
6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobile IP: indirect routing


packet sent by home agent to foreign
agent: a packet within a packet
dest: 79.129.13.2

foreign-agent-to-mobile
packet
dest: 128.119.40.186

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
6-

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Mobile IP: agent discovery


agent advertisement: foreign/home agents
advertise service by broadcasting ICMP
messages (typefield
=
9)
16
0
8
24
type = 9

H,F bits: home


and/or foreign
agent
R bit: registration
required

checksum
=9

code = 0
=9

standard
ICMP fields

router address

type = 16

length

sequence #

registration lifetime

RBHFMGV
bits

reserved

0 or more care-ofaddresses

mobility agent
advertisement
extension

6: Wireless and Mobile Networks

6-271

Mobile IP: registration


example
home agent
HA: 128.119.40.7

foreign agent
COA: 79.129.13.2

visited network: 79.129.13/24

ICMP agent adv.


COA: 79.129.13.2

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

Mobile agent
MA: 128.119.40.186

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

registration reply
time

6-

HA: 128.119.40.7
MA: 128.119.40.186
Lifetime: 4999
Identification: 714
encapsulation format
.

registration reply
HA: 128.119.40.7
MA: 128.119.40.186
Lifetime: 4999
Identification: 714
.

6: Wireless and Mobile Networks


BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Case Study

Case Study

27

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Link Layer
5.1 Introduction and
services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5.6 Hubs and switches


5.7 PPP
5.8 Link Virtualization:
ATM and MPLS

5: DataLink Layer

5-275

Link Layer: Introduction


link
Some terminology:

hosts and routers are nodes


communication channels
that connect adjacent nodes
along communication path
are links
wired links
wireless links
LANs

layer-2 packet is a frame,


encapsulates datagram

data-link layer has responsibility of


transferring datagram from one node
to adjacent node over a link
5: DataLink Layer

5-276

Link layer: context


Datagram transferred
by different link
protocols over different
links:
e.g., Ethernet on first
link, frame relay on
intermediate links,
802.11 on last link

Each link protocol


provides different
services
e.g., may or may not
provide rdt over link

transportation analogy

trip from Princeton to


Lausanne
limo: Princeton to JFK
plane: JFK to Geneva
train: Geneva to Lausanne

tourist = datagram
transport segment =
communication link
transportation mode =
link layer protocol
travel agent = routing
algorithm

5: DataLink Layer

5-277

Link Layer Services


Framing, link access:
encapsulate datagram into frame, adding header,
trailer
channel access if shared medium
MAC addresses used in frame headers to identify
source, dest

different from IP address!


Reliable delivery between adjacent nodes
we learned how to do this already (chapter 3)!
seldom used on low bit error link (fiber, some twisted
pair)
wireless links: high error rates

5-

Q: why both link-level and end-end


reliability?
5: DataLink Layer

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Link Layer Services (more)


Flow Control:
pacing between adjacent sending and receiving nodes

Error Detection:
errors caused by signal attenuation, noise.
receiver detects presence of errors:

signals sender for retransmission or drops frame


Error Correction:
receiver identifies and corrects bit error(s) without resorting to
retransmission

Half-duplex and full-duplex


with half duplex, nodes at both ends of link can transmit, but
not at same time
5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Adaptors Communicating
datagram

rcving
node

link layer protocol

sending
node

frame

frame
adapter

adapter

link layer implemented in receiving side


adaptor (aka NIC)
looks for errors, rdt, flow
Ethernet card, PCMCI card,
802.11 card

sending side:
encapsulates datagram in
a frame
adds error checking bits,
rdt, flow control, etc.

control, etc
extracts datagram,
passes to rcving node

adapter is semiautonomous
link & physical layers

5: DataLink Layer

5-280

Link Layer
5.1 Introduction and
services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5.6 Hubs and switches


5.7 PPP
5.8 Link Virtualization:
ATM

5: DataLink Layer

5-281

Error Detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header
fields
Error detection not 100% reliable!
protocol may miss some errors, but rarely
larger EDC field yields better detection and correction

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Parity Checking
Single Bit Parity:
Detect single bit
errors

Two Dimensional Bit Parity:


Detect and correct single bit errors

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Internet checksum
Goal: detect errors (e.g., flipped bits) in
transmitted segment (note: used at transport
layer only)
Receiver:
Sender:

treat segment contents


as sequence of 16-bit
integers
checksum: addition (1s
complement sum) of
segment contents
sender puts checksum
value into UDP
checksum field

compute checksum of
received segment
check if computed checksum
equals checksum field value:
NO - error detected
YES - no error detected.
But maybe errors
nonetheless? More later .

5: DataLink Layer

5-284

Checksumming: Cyclic Redundancy


Check
view data bits, D, as a binary number
choose r+1 bit pattern (generator), G
goal: choose r CRC bits, R, such that
<D,R> exactly divisible by G (modulo 2)
receiver knows G, divides <D,R> by G. If non-zero
remainder: error detected!
can detect all burst errors less than r+1 bits

widely used in practice (ATM, HDLC)

5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

CRC Example
Want:

D.2r XOR R =
nG
equivalently:

D.2r = nG XOR
R
equivalently:
if we divide D.2r by
G, want remainder
.2r
D
R R = remainder[
]
G
5-

5: DataLink Layer
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. If all the links in the internet were to provide reliable delivery


service, would
the TCP reliable delivery service be redundant? Why or why
not?

28

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. If all the links in the internet were to provide reliable delivery


service, would
the TCP reliable delivery service be redundant? Why or why
not?
Ans.
Although each link guarantees that an IP datagram sent over
the link will be received at the other end of the link without
errors, it is not guaranteed that IP datagrams will arrive at the
ultimate destination in the proper order. With IP, datagrams in
the same TCP connection can take different routes in the
network, and therefore arrive out of order. TCP is still needed
to provide the receiving end of the application the byte
stream in the correct order. Also, IP can lose packets due to
routing loops or equipment failures.
28

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Q. What are some of the possible services that a link layer


protocol can offer to the network layer? Which of these link
layer services have corresponding services in IP? In TCP?

28

11/5/16

COMPUTER NETWORKS

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Multimedia Networking

MM Networking Applications
Fundamental
characteristics:
Typically delay
sensitive

Classes of MM
applications:
end-to-end delay
1) Streaming stored audio
delay jitter
and video
But loss tolerant:
2) Streaming live audio
infrequent losses
and video
cause minor glitches
3) Real-time interactive
Antithesis of data,
audio
video
Jitterand
is the
variability
which are loss
of packet delays within
intolerant but delay
the same packet
tolerant.
stream
7: Multimedia
7-291
Networking

Streaming Stored
Multimedia
Streaming:
media stored at source
transmitted to client
streaming: client playout
begins before all data has
arrived

timing constraint for still-to-be


transmitted data: in time for playout

7: Multimedia

7-292
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Cumulative
data

Streaming Stored Multimedia:


What is it?

1. video
recorded

2. video
sent
network
delay

3. video received,
played out at client
time

streaming: at this time, client


playing out early part of video,
while server still sending later
part of video

7: Multimedia

7-293
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Streaming Stored Multimedia: Interactivity

VCR-like functionality: client can

pause, rewind, FF, push slider bar


10 sec initial delay OK
1-2 sec until command effect
OK
RTSP often used
timing
constraint for still-to-be
transmitted data: in time for playout
7: Multimedia

7-294
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Streaming Live Multimedia


Examples:
Internet radio talk show
Live sporting event
Streaming
playback buffer
playback can lag tens of seconds after transmission
still have timing constraint
Interactivity
fast forward impossible
rewind, pause possible!

7: Multimedia

7-295
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Interactive, Real-Time Multimedia

applications: IP telephony,

video conference, distributed


interactive worlds
end-end delay requirements:
audio: < 150 msec good, < 400 msec OK
includes application-level (packetization) and network delays
higher delays noticeable, impair interactivity

session initialization
how does callee advertise its IP address, port number, encoding
algorithms?

7: Multimedia

7-296
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Multimedia Over Todays


Internet
TCP/UDP/IP: best-effort service

no guarantees on delay, loss


?

But you said multimedia apps requires?


QoS and level of performance to be
?
? effective!
?

Todays Internet multimedia applications


use application-level techniques to mitigate
(as best possible) effects of delay, loss
7: Multimedia

7-297
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

How should the Internet evolve to better


support multimedia?
Integrated services
philosophy:
Fundamental changes in
Internet so that apps can
reserve end-to-end
bandwidth. Requires new,
complex software in hosts
& routers
Laissez-faire
no major changes
more bandwidth when
needed
content distribution,
application-layer multicast

Differentiated services
philosophy:
Fewer changes to
Internet infrastructure,
yet provide 1st and 2nd
class service.

Whats your opinion?

application layer
7: Multimedia
Networking

7-298

Streaming Stored
Multimedia
Application-level
streaming techniques
for making the best out
of best effort service:
client side buffering
use of UDP versus
TCP
multiple encodings
of multimedia

7: Multimedia
Networking

Media Player

7-299

jitter removal
decompression
error concealment
graphical user interface
w/ controls for
interactivity

Internet multimedia: simplest


approach

audio or video stored in file


files transferred as HTTP
object
received in entirety at client
then passed to player

audio, video not streamed:


no, pipelining, long delays until playout!
7: Multimedia

7-300
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Internet multimedia: streaming approach

browser GETs metafile


browser launches player, passing metafile
player contacts server
server streams audio/video to player
7: Multimedia

7-301
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Streaming from a streaming


server

This architecture allows for non-HTTP protocol


between server and media player
Can also use UDP instead of TCP.
7: Multimedia
Networking

7-302

constant bit
rate video
transmission

client video
reception

variable
network
delay

constant bit
rate video
playout at client

buffered
video

Cumulative
data

Streaming Multimedia: Client Buffering

time

client
playout
delay

Client-side buffering, playout delay compensate


for network-added delay, delay jitter
7: Multimedia

7-303
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

User Control of Streaming Media:


RTSP
HTTP
Does not target
multimedia content
No commands for fast
forward, etc.
RTSP: RFC 2326
Client-server application
layer protocol.
For user to control display:
rewind, fast forward,
pause, resume,
repositioning, etc

7: Multimedia
Networking

What it doesnt do:


does not define how
audio/video is
encapsulated for
streaming over network
does not restrict how
streamed media is
transported; it can be
transported over UDP or
TCP
does not specify how the
media player buffers
audio/video
7-304

RTSP: out of band control


FTP uses an out-of-band
control channel:
A file is transferred over
one TCP connection.
Control information
(directory changes, file
deletion, file renaming,
etc.) is sent over a
separate TCP connection.
The out-of-band and
in-band channels use
different port numbers.

7: Multimedia
Networking

RTSP messages are also


sent out-of-band:
RTSP control messages
use different port
numbers than the media
stream: out-of-band.
Port 554

7-305

The media stream is


considered in-band.

RTSP Example
Scenario:

metafile communicated to web browser


browser launches player
player sets up an RTSP control connection,
data connection to streaming server

7: Multimedia

7-306
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RTSP Operation

7: Multimedia

7-307
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Multimedia Networking

Interactive Multimedia: Internet Phone


Introduce Internet Phone by way of an example
speakers audio: alternating talk spurts, silent
periods.
64 kbps during talk spurt

pkts generated only during talk spurts


20 msec chunks at 8 Kbytes/sec: 160 bytes data

application-layer header added to each chunk.


Chunk+header encapsulated into UDP segment.
application sends UDP segment into socket every 20
msec during talkspurt.

7: Multimedia

7-309
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Internet Phone: Packet Loss and


Delay
network loss: IP datagram lost due to
network congestion (router buffer overflow)
delay loss: IP datagram arrives too late for
playout at receiver
delays: processing, queueing in network; endsystem (sender, receiver) delays
typical maximum tolerable delay: 400 ms

loss tolerance: depending on voice


encoding, losses concealed, packet loss
rates between 1% and 10% can be
tolerated.
7: Multimedia

7-310
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

constant bit
rate
transmission

client
reception

variable
network
delay
(jitter)

constant bit
rate playout
at client

buffered
data

Cumulative
data

Delay Jitter

time

client
playout
delay

Consider the end-to-end delays of two consecutive


packets: difference can be more or less than 20 msec

7: Multimedia

7-311
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Internet Phone: Fixed Playout


Delay
Receiver attempts to playout each
chunk exactly q msecs after chunk
was generated.
chunk has time stamp t: play out chunk at
t+q .
chunk arrives after t+q: data arrives too late
for playout, data lost

Tradeoff for q:
large q: less packet loss
small q: better interactive experience

7: Multimedia

7-312
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Fixed Playout Delay


Sender generates packets every 20 msec during talk spurt.

First packet received at time r


First playout schedule: begins at p
Second playout schedule: begins at p
p a c k e ts

lo s s

p a c k e ts
g e n e ra te d
p a c k e ts
r e c e iv e d

p la y o u t s c h e d u le
p'- r
p la y o u t s c h e d u le
p - r

tim e
7: Multimedia
Networking

r
p

7-313
p'

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Adaptive Playout Delay, I

Goal: minimize playout delay, keeping late loss rate low


Approach: adaptive playout delay adjustment:
Estimate network delay, adjust playout delay at beginning
of each talk spurt.
Silent periods compressed and elongated.
Chunks still played out every 20 msec during talk spurt.
t i timestamp of the ith packet

ri the time packet i is received by receiver


p i the time packet i is played at receiver
ri t i network delay for ith packet
d i estimate of average network delay after receiving ith packet

Dynamic estimate of average delay at receiver:

d i (1 u )d i 1 u ( ri ti )
where u is a fixed constant (e.g., u = .01).
7: Multimedia

7-314
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Adaptive playout delay II


Also useful to estimate the average deviation of the delay, vi :

vi (1 u )vi 1 u | ri ti d i |

The estimates di and vi are calculated for every received packet,


although they are only used at the beginning of a talk spurt.
For first packet in talk spurt, playout time is:

pi ti d i Kvi
where K is a positive constant.
Remaining packets in talkspurt are played out periodically

7: Multimedia
Networking

7-315
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Recovery from packet loss

Interleaving
chunks are broken
up into smaller units
for example, 4 5 msec units per
chunk
Packet contains small units from
different chunks
7: Multimedia
Networking

7-316

if packet is lost, still have


most of every chunk
has no redundancy
overhead
but adds to playout delay

7.1 Multimedia
Networking Applications
7.2 Streaming stored
audio and video
7.3 Real-time
Multimedia: Internet
Phone study
7.4 Protocols for RealTime Interactive
Applications
RTP,RTCP,SIP

7.5 Distributing
Multimedia: content
7: Multimedia
distribution networks
Networking

7-317

7.6 Beyond Best


Effort
7.7 Scheduling and
Policing
Mechanisms
7.8 Integrated
Services and
Differentiated
Services
7.9 RSVP

Real-Time Protocol (RTP)


RTP specifies a packet
structure for packets
carrying audio and
video data
RFC 1889.
RTP packet provides
payload type
identification
packet sequence
numbering
timestamping

7: Multimedia
Networking

RTP runs in the end


systems.
RTP packets are
encapsulated in UDP
segments
Interoperability: If two
Internet phone
applications run RTP,
then they may be able
to work together
7-318

RTP runs on top of UDP


RTP libraries provide a transport-layer interface
that extend UDP:
port numbers, IP addresses
payload type identification
packet sequence numbering
time-stamping

7: Multimedia
Networking

7-319
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RTP Example
Consider sending 64
kbps PCM-encoded
voice over RTP.
Application collects
the encoded data in
chunks, e.g., every
20 msec = 160 bytes
in a chunk.
The audio chunk
along with the RTP
header form the RTP
packet, which is
encapsulated into a
UDP segment.
7: Multimedia
Networking

RTP header indicates


type of audio encoding
in each packet
sender can change
encoding during a
conference.

RTP header also


contains sequence
numbers and
timestamps.

7-320

RTP and QoS


RTP does not provide any
mechanism to ensure timely delivery
of data or provide other quality of
service guarantees.
RTP encapsulation is only seen at the
end systems: it is not seen by
intermediate routers.
Routers providing best-effort service do
not make any special effort to ensure
that RTP packets arrive at the
7-321
7: Multimedia
destination in a timely matter.

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RTP Header

Payload Type (7 bits): Indicates type of encoding currently being


used. If sender changes encoding in middle of conference, sender
informs the receiver through this payload type field.

Payload
Payload
Payload
Payload
Payload
Payload

type
type
type
type
type
type

0: PCM mu-law, 64 kbps


3, GSM, 13 kbps
7, LPC, 2.4 kbps
26, Motion JPEG
31. H.261
33, MPEG2 video

Sequence Number (16 bits): Increments by one for each RTP packet
sent, and may be used to detect packet loss and to restore packet
sequence.
7: Multimedia
Networking

7-322
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RTP Header (2)


Timestamp field (32 bytes long). Reflects the sampling instant of the
first byte in the RTP data packet.

For audio, timestamp clock typically increments by


one for each sampling period (for example, each
125 usecs for a 8 KHz sampling clock)
if application generates chunks of 160 encoded
samples, then timestamp increases by 160 for
each RTP packet when source is active. Timestamp
clock continues to increase at constant rate when
source is inactive.
SSRC field (32 bits long). Identifies the source of the RTP stream. Each
stream in a RTP session should have a distinct SSRC.

7: Multimedia

7-323
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

SIP
Session Initiation Protocol
Comes from IETF
SIP long-term vision
All telephone calls and video conference calls
take place over the Internet
People are identified by names or e-mail
addresses, rather than by phone numbers.
You can reach the callee, no matter where the
callee roams, no matter what IP device the
callee is currently using.
7: Multimedia

7-324
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

SIP Services
Setting up a call
Provides mechanisms
for caller to let callee
know she wants to
establish a call
Provides mechanisms
so that caller and callee
can agree on media
type and encoding.
Provides mechanisms
to end call.

7: Multimedia
Networking

Determine current IP
address of callee.
Maps mnemonic
identifier to current IP
address

Call management
Add new media streams
during call
Change encoding
during call
Invite others
Transfer and hold calls
7-325

Setting up a call to a known IP address


Bob

A lic e

1 6 7 .1 8 0 .1 1 2 .2 4

1 9 3 .6 4 .2 1 0 .8 9

B o b 's
te r m in a l r in g s

Bobs 200 OK message


indicates his port
number, IP address &
preferred encoding
(GSM)

L a w a u d io
p o rt 3 8 0 6 0

G SM

tim e

7: Multimedia
Networking

Alices SIP invite


message indicates her
port number & IP
address. Indicates
encoding that Alice
prefers to receive (PCM
ulaw)

SIP messages can be


sent over TCP or UDP;
here sent over RTP/UDP.

p o rt 4 8 7 5 3

tim e

7-326

Default SIP port number

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Setting up a call (more)

Codec negotiation:
Suppose Bob doesnt
have PCM ulaw encoder.
Bob will instead reply
with 606 Not
Acceptable Reply and
list encoders he can
use.
Alice can then send a
new INVITE message,
advertising an
appropriate encoder.

7: Multimedia
Networking

7-327

Rejecting the call


Bob can reject with
replies busy,
gone, payment
required,
forbidden.
Media can be sent over
RTP or some other
protocol.

Example of SIP message


INVITE sip:bob@domain.com SIP/2.0
Via: SIP/2.0/UDP 167.180.112.24
From: sip:alice@hereway.com
To: sip:bob@domain.com
Call-ID: a2e3a@pigeon.hereway.com
Content-Type: application/sdp
Content-Length: 885
c=IN IP4 167.180.112.24
m=audio 38060 RTP/AVP 0
Notes:
HTTP message syntax
sdp = session description protocol
Call-ID is unique for every call.
7: Multimedia

Here we dont know

Bobs IP address.
Intermediate SIP
servers will be
necessary.
Alice sends and

receives SIP messages


using the SIP default
port number 506.
Alice specifies in Via:
header that SIP client
sends and receives
SIP messages over UDP

7-328
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Name translation and user locataion


Caller wants to call
callee, but only has
callees name or email address.
Need to get IP address
of callees current
host:
user moves around
DHCP protocol
user has different IP
devices (PC, PDA, car
device)
7: Multimedia
Networking

Result can be based


on:
time of day (work,
home)
caller (dont want boss
to call you at home)
status of callee (calls
sent to voicemail when
callee is already talking
to someone)

Service provided by SIP


servers:
SIP registrar server
SIP proxy server
7-329

SIP Registrar
When Bob starts SIP client, client sends SIP

REGISTER message to Bobs registrar server


(similar function needed by Instant Messaging)
Register Message:
REGISTER sip:domain.com SIP/2.0
Via: SIP/2.0/UDP 193.64.210.89
From: sip:bob@domain.com
To: sip:bob@domain.com
Expires: 3600

7: Multimedia

7-330
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

SIP Proxy
Alice sends invite message to her proxy server
contains address sip:bob@domain.com

Proxy responsible for routing SIP messages to


callee
possibly through multiple proxies.

Callee sends response back through the same set


of proxies.
Proxy returns SIP response message to Alice
contains Bobs IP address

Note: proxy is analogous to local DNS server


7: Multimedia

7-331
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Example

Caller jim@umass.edu
with places a
call to keith@upenn.edu

S IP r e g is tr a r
u p e n n .e d u
S IP
r e g is tr a r
e u r e c o m .fr

S IP p r o x y

u m a s s .e d u
(1) Jim sends INVITE
message to umass SIP
proxy. (2) Proxy forwards
1
request to upenn
8
registrar server.
(3) upenn server returns
redirect response,
S IP c lie n t
indicating that it should 2 1 7 . 1 2 3 . 5 6 . 8 9
try keith@eurecom.fr

7
6

S IP c lie n t
1 9 7 .8 7 .5 4 .2 1

(4) umass proxy sends INVITE to eurecom registrar. (5) eurecom


registrar forwards INVITE to 197.87.54.21, which is running keiths
SIP client. (6-8) SIP response sent back (9) media sent directly
between clients.
Note: also a SIP ack message, which is not shown.
7: Multimedia
Networking

7-332
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. Multimedia Networking

Content distribution networks


(CDNs)
Content replication
Challenging to stream large
files (e.g., video) from single
origin server in real time
Solution: replicate content at
hundreds of servers
throughout Internet
content downloaded to
CDN servers ahead of time
placing content close to
user avoids impairments
(loss, delay) of sending
content over long paths
CDN server typically in
edge/access network
7: Multimedia
Networking

7-334

origin server
in North America

CDN distribution node

CDN server
CDN server
in S. America CDN server
in Asia
in Europe

Content distribution networks


(CDNs)

origin server
in North America

Content replication

CDN (e.g., Akamai)


customer is the content
provider (e.g., CNN)
CDN replicates customers
content in CDN servers.
When provider updates
content, CDN updates
servers

CDN distribution node

CDN server
CDN server
in S. America CDN server
in Asia
in Europe
7: Multimedia
Networking

7-335

CDN example

HTTP request for


www.foo.com/sports/sports.html
1

Origin server
DNS query for www.cdn.com

CDNs authoritative
DNS server
HTTP request for
www.cdn.com/www.foo.com/sports/ruth.gif

Nearby
CDN server

origin server (www.foo.com)


distributes HTML
replaces:
http://www.foo.com/sports.ruth.gif

with
http://www.cdn.com/www.foo.com/sports/ruth.gif
7: Multimedia
Networking

7-336

CDN company
(cdn.com)
distributes gif files
uses its authoritative
DNS server to route
redirect requests

More about CDNs


routing requests
CDN creates a map, indicating distances
from leaf ISPs and CDN nodes
when query arrives at authoritative DNS
server:
server determines ISP from which query originates
uses map to determine best CDN server

CDN nodes create application-layer overlay


network

7: Multimedia
Networking

7-337

Improving QOS in IP
Networks
Thus far: making the best of best effort
Future: next generation Internet with QoS guarantees
RSVP: signaling for resource reservations
Differentiated Services: differential guarantees
Integrated Services: firm guarantees

simple model
for sharing and
congestion
studies:

7: Multimedia

7-338
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Principles for QOS


Guarantees

Example: 1MbpsI P phone, FTP share 1.5


Mbps link.
bursts of FTP can congest router, cause audio loss
want to give priority to audio over FTP

Principle 1
packet marking needed for router to
distinguish between different classes; and
new router policy to treat packets accordingly
7: Multimedia

7-339
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Principles for QOS Guarantees


(more)

what if applications misbehave (audio sends higher than


declared rate)
policing: force source adherence to bandwidth allocations

marking and policing at network edge:


similar to ATM UNI (User Network Interface)

Principle 2
provide protection (isolation) for one class from others
7: Multimedia

7-340
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Principles for QOS Guarantees


(more)
Allocating fixed (non-sharable) bandwidth to
flow: inefficient use of bandwidth if flows
doesnt use its allocation

Principle 3
While providing isolation, it is desirable to use
resources as efficiently as possible
7: Multimedia

7-341
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Principles for QOS Guarantees


(more)
Basic fact of life: can not support traffic
demands beyond link capacity

Principle 4
Call Admission: flow declares its needs, network may
block call (e.g., busy signal) if it cannot meet needs
7: Multimedia

7-342
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Summary of QoS
Principles

Lets next look at mechanisms for achieving this .


7: Multimedia

7-343
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

BITS Pilani
Pilani|Dubai|Goa|Hyderabad

Agend
a: 1. QoS

Summary of QoS
Principles

Lets next look at mechanisms for achieving this .


7: Multimedia

7-345
BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Scheduling And Policing


Mechanisms
scheduling: choose next packet to send on link
FIFO (first in first out) scheduling: send in order of arrival to queue
real-world example?
discard policy: if packet arrives to full queue: who to discard?
Tail drop: drop arriving packet
priority: drop/remove on priority basis
random: drop/remove randomly

7-346
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Scheduling Policies: more


Priority scheduling: transmit highest priority queued
packet
multiple classes, with different priorities
class may depend on marking or other header info, e.g. IP
source/dest, port numbers, etc..
Real world example?

7-347
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Scheduling Policies: still


more
round robin scheduling:
multiple classes
cyclically scan class queues, serving one from each class (if available)
real world example?

7-348
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Scheduling Policies: still


more

Weighted Fair Queuing:


generalized Round Robin
each class gets weighted amount
of service in each cycle
real-world example?

7-349
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Policing Mechanisms
Goal: limit traffic to not exceed declared parameters

Three common-used criteria:


(Long term) Average Rate: how many pkts can be sent per unit time
(in the long run)
crucial question: what is the interval length: 100 packets per sec or 6000
packets per min have same average!

Peak Rate: e.g., 6000 pkts per min. (ppm) avg.; 1500 ppm peak rate
(Max.) Burst Size: max. number of pkts sent consecutively (with no
intervening idle)

7-350
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Policing Mechanisms
Token Bucket: limit input to specified Burst Size and

Average Rate.

bucket can hold b tokens


tokens generated at rate r token/sec unless
bucket full
over interval of length t: number of packets
admitted less than or equal to (r t + b).
7-351
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

IETF Differentiated Services


want qualitative service classes
behaves like a wire
relative service distinction: Platinum, Gold, Silver

scalability: simple functions in network core, relatively


complex functions at edge routers (or hosts)
signaling, maintaining per-flow router state difficult with large
number of flows

dont define define service classes, provide functional


components to build service classes

7-352
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Diffserv Architecture
Edge router:

per-flow traffic
management

marks packets as in-profile


and out-profile

r marking
scheduling
b

..
.

Core router:

per class traffic management


buffering and scheduling
based on marking at edge
preference given to in-profile
packets
7-353
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Edge-router Packet Marking

profile: pre-negotiated rate A, bucket size B


packet marking at edge based on per-flow profile
Rate A
B
User packets

Possible usage of marking:

class-based marking: packets of different classes marked


differently
intra-class marking: conforming portion of flow marked
differently than non-conforming one

Multimedia Networking

7-354

Classification and
Conditioning

Packet is marked in the Type of Service


(TOS) in IPv4, and Traffic Class in IPv6
6 bits used for Differentiated Service Code
Point (DSCP) and determine PHB that the
packet will receive
2 bits are currently unused

7-355
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Classification and
Conditioning
may be desirable to limit traffic injection
rate of some class:
user declares traffic profile (e.g., rate,
burst size)
traffic metered, shaped if non-conforming

7-356
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Forwarding (PHB)
PHB result in a different observable
(measurable) forwarding performance
behavior
PHB does not specify what mechanisms to use
to ensure required PHB performance behavior
Examples:
Class A gets x% of outgoing link bandwidth over
time intervals of a specified length
Class A packets leave first before packets from
class B

7-357
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Forwarding (PHB)
PHBs being developed:

Expedited Forwarding: pkt departure


rate of a class equals or exceeds
specified rate
logical link with a minimum guaranteed
rate

Assured Forwarding: 4 classes of


traffic
each guaranteed minimum amount of
bandwidth
7-358
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Chapter 7 outline
7.1 multimedia
networking applications
7.2 streaming stored
audio and video
7.3 making the best out of
best effort service
7.4 protocols for real-time
interactive applications
RTP, RTCP, SIP

Multimedia Networking

7-359

7.5 providing multiple


classes of service
7.6 providing QoS
guarantees

Principles for QOS Guarantees


(more)
Basic fact of life: can not support traffic
demands beyond link capacity
1 Mbps
phone

1 Mbps
phone

R1

R2
1.5 Mbps link

Principle 4
Call Admission: flow declares its needs, network may
block call (e.g., busy signal) if it cannot meet needs
7-360
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

QoS guarantee scenario


Resource reservation
call setup, signaling (RSVP)
traffic, QoS declaration
per-element admission control

request/
reply
QoS-sensitive
scheduling (e.g.,
WFQ)
Multimedia Networking

7-361

IETF Integrated Services


architecture for providing QOS guarantees in IP
networks for individual application sessions
resource reservation: routers maintain state info (a
la VC) of allocated resources, QoS reqs
admit/deny new call setup requests:

Question: can newly arriving flow be admitted


with performance guarantees while not violated
QoS guarantees made to already admitted flows?

7-362
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Call Admission
Arriving session must :

declare its QOS requirement


R-spec: defines the QOS being requested

characterize traffic it will send into network


T-spec: defines traffic characteristics

signaling protocol: needed to carry R-spec and


T-spec to routers (where reservation is
required)
RSVP

7-363
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

Intserv QoS: Service models [rfc2211, rfc


2212]
Guaranteed service:

Controlled load service:

worst case traffic arrival:


leaky-bucket-policed source
simple (mathematically
provable) bound on delay
[Parekh 1992, Cruz 1988]
arriving
traffic

"a quality of service


closely approximating the
QoS that same flow would
receive from an unloaded
network element."

token rate, r
bucket size, b

WFQ

Multimedia Networking

per-flow
rate, R

D
= b/R
max
7-364

Signaling in the Internet


connectionless
(stateless)
forwarding by IP
routers

best effort
service

no network
signaling
protocols
in initial IP
design

New requirement: reserve resources along end-toend path (end system, routers) for QoS for
multimedia applications
RSVP: Resource Reservation Protocol [RFC 2205]
allow users to communicate requirements to
network in robust and efficient way. i.e., signaling !

earlier Internet Signaling protocol: ST-II [RFC 1819]


7-365
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RSVP: does not

specify how resources are to be reserved


rather: a mechanism for communicating needs

determine routes packets will take


thats the job of routing protocols
signaling decoupled from routing

interact with forwarding of packets


separation of control (signaling) and data
(forwarding) planes

7-366
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

RSVP: overview of operation


senders, receiver join a multicast group
done outside of RSVP
senders need not join group

sender-to-network signaling
path message: make sender presence known to routers
path teardown: delete senders path state from routers

receiver-to-network signaling
reservation message: reserve resources from sender(s) to
receiver
reservation teardown: remove receiver reservations

network-to-end-system signaling
path error
reservation error
7-367
Multimedia Networking

BITS Pilani, Deemed to be University under Section 3 of UGC Act, 1956

You might also like