You are on page 1of 271

Titular curs: Ioan Ungurean

ioanu@eed.usv.ro
CAP I – Recapitulare
vers 1.0

1
Cum se face notarea ?
 NF = 50%NE + 40%NL + 10%PC
 Unde
 NF – nota finală,
 NE – nota la examen,
 NL – nota la laborator,
 PC – prezenţa la curs.
Bibliografie
• Computer Networking: A Top-Down Approach Featuring the
Internet, James F. Kurose and Keith W. Ross, Addison
Wesley, ISBN-13: 978-0-321-49770-3
 Vasile GĂITAN Reţele de calculatoare. Note de curs 2006
 Andrew S. Tanenbaum Reţele de calculatoare, Ediţia a patra,
Editura BYBLOS 2003, ISBN 973-0-03000-6
 Richard Stevens TCP/IP Ilustrated, Volume 1. The protocols,
Editura ADDISON WESLEY
 IBM – Adolfo Rodriguez, John Gatrell, John KARAS, Roland
Peschke, TCP/IP Tutorial and Technical Overview, August 2001
 Douglas E. COMER Internetworking with TCP/IP, Vol I, Priciples,
Protocols, and Architecture, Ediţia a patra, Prentice Hall, ISBN 0-13-
018380-6, 2000.
 www.cisco.com
Cartea de referinţă

A note on the use of these ppt slides: Computer


We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you see the animations; and can add, modify, Networking: A
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lot of work on our part. In return for use, we only Top Down
ask the following:
 If you use these slides (e.g., in a class) that you mention their source Approach
(after all, we’d like people to use our book!)
 If you post any slides on a www site, that you note that they are adapted
6th edition
from (or perhaps identical to) our slides, and note our copyright of this Jim Kurose, Keith Ross
material. Addison-Wesley
Thanks and enjoy! JFK/KWR March 2012
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Introduction 1-4
Computer Networking: A Top Down Approach ,
4th edition.
Jim Kurose, Keith Ross
Addison-Wesley, July 2007.
Reference Book:
Computer Networks by
Andrew Tanenbaum, 3rd
edition.
Reference Book:
Internetworking with
TCP/IP Vol. I:
Principles, Protocols,
and Architecture
by Douglas Comer
4th Edition
Reference Book:
TCP/IP Illustrated,
Volume 1: The
Protocols (The Addison-
Wesley Professional
Computing Series)
by W. Richard Stevens
Structura cursului
 Cursul este organizat pe 4 capitole astfel:
1. RECAPITULARE
2. REŢELE FĂRĂ FIR
3. REŢELE MULTIMEDIA
4. Securitatea reţelelor
5. MANAGEMENTUL REŢELELOR
Chapter 1
Introduction

A note on the use of these ppt slides: Computer


We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you see the animations; and can add, modify, Networking: A
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lot of work on our part. In return for use, we only Top Down
ask the following:
 If you use these slides (e.g., in a class) that you mention their source Approach
(after all, we’d like people to use our book!)
 If you post any slides on a www site, that you note that they are adapted
6th edition
from (or perhaps identical to) our slides, and note our copyright of this Jim Kurose, Keith Ross
material. Addison-Wesley
Thanks and enjoy! JFK/KWR March 2012
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Introduction 1-10
Structura cursului (cont.)
La nivelul fiecărui capitol, acolo unde este cazul, se
prezintă:
 Elemente teoretice generale ale nivelului
respectiv;
 OPŢIONAL, Implementarea pentru modelul OSI;
 Implementarea pentru modelul TCP/IP;
 Dispozitivele fizice de interconectare a
segmentelor de reţea sau a reţelelor.
Chapter 1: Introduction
Our goal: Overview:
 get “feel” and  what’s the Internet?
terminology  what’s a protocol?
 more depth, detail
later in course  network edge; hosts, access net,
 approach: physical media
 use Internet as
 network core: packet/circuit
example switching, Internet structure
 performance: loss, delay,
throughput
 security
 protocol layers, service models
 history
Chapter 1: roadmap
1.1 What is the Internet?
1.2 Network edge
 end systems, access networks, links
1.3 Network core
 circuit switching, packet switching, network structure
1.4 Delay, loss and throughput in packet-switched
networks
1.5 Protocol layers, service models
1.6 Networks under attack: security
1.7 History
What’s the Internet: “nuts and bolts” view

PC  millions of connected Mobile network


server computing devices: Global ISP
wireless
hosts = end systems
laptop
cellular
 running network
Home network
handheld apps
Regional ISP
 communication links
access  fiber, copper, radio,
points
wired
satellite Institutional network
links  transmission rate =
bandwidth
router
 routers: forward
packets (chunks of
data)
“Cool” internet appliances

Web-enabled toaster +
weather forecaster

IP picture frame
http://www.ceiva.com/

World’s smallest web server


http://www-ccs.cs.umass.edu/~shri/iPic.html Internet phones
What’s the Internet: “nuts and bolts”
view
Mobile network
 protocols control sending,
receiving of msgs Global ISP
 e.g., TCP, IP, HTTP, Skype,
Ethernet
Home network
 Internet: “network of
Regional ISP
networks”
 loosely hierarchical
 public Internet versus Institutional network
private intranet
 Internet standards
 RFC: Request for comments
 IETF: Internet Engineering
Task Force
What’s the Internet: a service view

 communication infrastructure
enables distributed
applications:
 Web, VoIP, email, games,
e-commerce, file sharing
 communication services
provided to apps:
 reliable data delivery from
source to destination
 “best effort” (unreliable)
data delivery
What’s a protocol?
human protocols: network protocols:
 “what’s the time?”  machines rather than

 “I have a question” humans


 introductions  all communication
activity in Internet
governed by protocols
… specific msgs sent
… specific actions taken protocols define format, order
when msgs received, of msgs sent and received
or other events among network entities,
and actions taken on msg
transmission, receipt
What’s a protocol?

a human protocol and a computer network protocol:

Hi
TCP connection
request
Hi
TCP connection
Got the response
time? Get http://www.awl.com/kurose-ross
2:00
<file>
time

Q: Other human protocols?


Chapter 1: roadmap

1.1 What is the Internet?


1.2 Network edge
 end systems, access networks, links
1.3 Network core
 circuit switching, packet switching, network structure
1.4 Delay, loss and throughput in packet-switched
networks
1.5 Protocol layers, service models
1.6 Networks under attack: security
1.7 History
A closer look at network structure:
 network edge:
applications and
hosts
 access networks,
physical media:
wired, wireless
communication links
 network core:
 interconnected routers
 network of networks
The network edge:

 end systems (hosts):


 run application programs
 e.g. Web, email
peer-peer
 at “edge of network”
 client/server model
 client host requests, receives
service from always-on server
client/server
 e.g. Web browser/server;
email client/server
 peer-peer model:
 minimal (or no) use of
dedicated servers
 e.g. Skype, BitTorrent
Access networks and physical media
Q: How to connect end
systems to edge router?
 residential access nets

 institutional access
networks (school,
company)
 mobile access networks

Keep in mind:
 bandwidth (bits per
second) of access
network?
 shared or dedicated?
Residential access: point to point
access
 Dialup via modem
 up to 56Kbps direct access to
router (often less)
 Can’t surf and phone at same
time: can’t be “always on”

 DSL: digital subscriber line


 deployment: telephone company (typically)

 up to 1 Mbps upstream (today typically < 256 kbps)

 up to 8 Mbps downstream (today typically < 1 Mbps)

 dedicated physical line to telephone central office


Clarificări - Upstream, downstream
 Another use of the word refers to the speed at which data can be
transferred from the client to the server (uploading).
 This differs greatly from downstream not only in theory and usage, but also
in that upstream speeds are usually at a premium.
 Whereas downstream is important to the average home user for purposes
of downloading content, uploads are used mainly for web server
applications and similar processes where the sending of data is critical.
 ADSL and Cable modems are asymmetric, thereby rendering the upstream
speed to be much lower than that of its downstream.
 Symmetric connections such as SDSL and T1, however, offer identical
upstream and downstream speeds.

 In information technology, downstream refers to the transfer speed


(usually that of an internet connection) by which data can be sent from the
server to the client. The process by which downstream is utilized is known
as downloading.
Residential access: cable modems

 HFC: hybrid fiber coax


 asymmetric: up to 30Mbps downstream, 2
Mbps upstream
 network of cable and fiber attaches homes to ISP
router
 homes share access to router
 deployment: available via cable TV companies
Residential access: cable modems

Diagram: http://www.cabledatacomnews.com/cmic/diagram.html
Cable Network Architecture: Overview

Typically 500 to 5,000 homes

cable headend

home
cable distribution
network (simplified)
Cable Network Architecture: Overview
server(s)

cable headend

home
cable distribution
network
Cable Network Architecture: Overview

cable headend

home
cable distribution
network (simplified)
Cable Network Architecture: Overview

FDM (more shortly):


C
O
V V V V V V N
I I I I I I D D T
D D D D D D A A R
E E E E E E T T O
O O O O O O A A L

1 2 3 4 5 6 7 8 9

Channels

cable headend

home
cable distribution
network
Company access: local area networks

 company/univ local area


network (LAN) connects end
system to edge router
 Ethernet:
 10 Mbs, 100Mbps,
1Gbps, 10Gbps
Ethernet
 modern configuration:
end systems connect
into Ethernet switch
 LANs: chapter 5
Wireless access networks
 shared wireless access network
connects end system to router
 via base station aka (also known
as) “access point”
router
 wireless LANs:
 802.11b/g (WiFi): 11 or 54 base
Mbps station
 wider-area wireless access
 provided by telco operator
 ~1Mbps over cellular system
(EVDO Evolution-Data
mobile
Optimized, HSDPA – idh-Speed
Downlink)
hosts
 next up (?): WiMAX (10’s Mbps)
over wide area - IEEE 802.16
Home networks

Typical home network components:


 DSL or cable modem

 router/firewall/NAT

 Ethernet

 wireless access

point
wireless
to/from laptops
cable router/
cable
modem firewall
headend
wireless
access
Ethernet point
Physical Media
Twisted Pair (TP)
 Bit: propagates between  two insulated copper
transmitter/rcvr pairs wires
 physical link: what lies  Category 3: traditional
between transmitter & phone wires, 10 Mbps
receiver Ethernet
 guided media:
 Category 5:
100Mbps Ethernet
 signals propagate in solid
media: copper, fiber, coax
 unguided media:
 signals propagate freely, e.g.,
radio
Physical Media: coax, fiber
Fiber optic cable:
Coaxial cable:  glass fiber carrying light pulses,
 two concentric copper each pulse a bit
conductors  high-speed operation:
 bidirectional  high-speed point-to-point
 baseband: transmission (e.g., 10’s-100’s
Gps)
 single channel on cable
 legacy Ethernet
 low error rate: repeaters spaced
far apart ; immune to
 broadband: electromagnetic noise
 multiple channels on
cable
 HFC
Physical media: radio
Radio link types:
 signal carried in  terrestrial microwave
electromagnetic  e.g. up to 45 Mbps channels
spectrum  LAN (e.g., Wifi)
 11Mbps, 54 Mbps
 no physical “wire”  wide-area (e.g., cellular)
 bidirectional  3G cellular: ~ 1 Mbps
 satellite
 propagation environment  Kbps to 45Mbps channel (or multiple smaller
channels)
effects:  270 msec end-end delay
 reflection  geosynchronous versus low altitude
 obstruction by objects
 interference
Chapter 1: roadmap
1.1 What is the Internet?
1.2 Network edge
 end systems, access networks, links
1.3 Network core
 circuit switching, packet switching, network structure
1.4 Delay, loss and throughput in packet-switched
networks
1.5 Protocol layers, service models
1.6 Networks under attack: security
1.7 History
The Network Core
 mesh of interconnected
routers
 the fundamental question:
how is data transferred
through net?
 circuit switching:
dedicated circuit per call:
telephone net
 packet-switching: data
sent thru net in discrete
“chunks”
Network Core: Circuit Switching

End-end resources
reserved for “call”
 link bandwidth, switch
capacity
 dedicated resources: no
sharing
 circuit-like (guaranteed)
performance
 call setup required
Network Core: Circuit Switching

network resources (e.g.,  dividing link bandwidth


bandwidth) divided into “pieces”
into “pieces”  frequency division
 pieces allocated to calls  time division
 resource piece idle if not
used by owning call (no
sharing)
Circuit Switching: FDM and TDM

Example:
FDM
4 users

frequency

time
TDM

frequency

time
Numerical example
 How long does it take to send a file of 640,000
bits from host A to host B over a circuit-switched
network?
 All links are 1.536 Mbps
 Each link uses TDM with 24 slots/sec
 500 msec to establish end-to-end circuit

Let’s work it out!


Network Core: Packet Switching

each end-end data stream resource contention:


divided into packets  aggregate resource
 user A, B packets share demand can exceed
network resources amount available
 each packet uses full link  congestion: packets
bandwidth queue, wait for link use
 resources used as needed  store and forward:
packets move one hop
at a time
Bandwidth division into “pieces”  Node receives complete
Dedicated allocation packet before forwarding
Resource reservation
Packet Switching: Statistical
Multiplexing
100 Mb/s
A Ethernet statistical multiplexing C

1.5 Mb/s
B
queue of packets
waiting for output
link

D E

Sequence of A & B packets does not have fixed pattern,


bandwidth shared on demand  statistical multiplexing.
TDM: each host gets same slot in revolving TDM frame.
Packet-switching: store-and-forward

L
R R R

 takes L/R seconds to Example:


transmit (push out)  L = 7.5 Mbits
packet of L bits on to
 R = 1.5 Mbps
link at R bps
 transmission delay = 15
 store and forward:
entire packet must sec
arrive at router before it
can be transmitted on
next link
 delay = 3L/R (assuming more on delay shortly …
zero propagation delay)
Packet switching versus circuit
switching
Packet switching allows more users to use network!
 1 Mb/s link
 each user:
 100 kb/s when “active”
 active 10% of time
N users
 circuit-switching: 1 Mbps link
 10 users
 packet switching:
 with 35 users, Q: how did we get value 0.0004?
probability > 10 active
at same time is less than
.0004
Packet switching versus circuit
switching
Is packet switching a “slam dunk winner?”
 great for bursty data
 resource sharing

 simpler, no call setup

 excessive congestion: packet delay and loss


 protocols needed for reliable data transfer, congestion control

 Q: How to provide circuit-like behavior?


 bandwidth guarantees needed for audio/video apps

 still an unsolved problem (chapter 7)

Q: human analogies of reserved resources (circuit


switching) versus on-demand allocation (packet-switching)?
Internet structure: network of
networks
 roughly hierarchical
 at center: “tier-1” ISPs (e.g., Verizon, Sprint, AT&T, Cable
and Wireless), national/international coverage
 treat each other as equals

Tier-1
providers
Tier 1 ISP
interconnect
(peer)
privately
Tier 1 ISP Tier 1 ISP
Tier-1 ISP: e.g., Sprint
POP: point-of-presence

to/from backbone

peering
… …
.

to/from customers
Internet structure: network of
networks
 “Tier-2” ISPs: smaller (often regional) ISPs
 Connect to one or more tier-1 ISPs, possibly other tier-2 ISPs

Tier-2 ISPs
Tier-2 ISP pays Tier-2 ISP also peer
Tier-2 ISP privately with
tier-1 ISP for
connectivity to Tier 1 ISP each other.
rest of Internet
 tier-2 ISP is
customer of
tier-1 provider Tier 1 ISP Tier 1 ISP Tier-2 ISP

Tier-2 ISP Tier-2 ISP


Internet structure: network of
networks
 “Tier-3” ISPs and local ISPs
 last hop (“access”) network (closest to end systems)

local
ISP Tier 3 local
local local
ISP ISP
ISP ISP
Local and tier- Tier-2 ISP Tier-2 ISP
3 ISPs are
customers of Tier 1 ISP
higher tier
ISPs
connecting
them to rest
Tier 1 ISP Tier 1 ISP Tier-2 ISP
of Internet
local
Tier-2 ISP Tier-2 ISP
ISP
local local local
ISP ISP ISP
Internet structure: network of
networks
 a packet passes through many networks!

local
ISP Tier 3 local
local local
ISP ISP
ISP ISP
Tier-2 ISP Tier-2 ISP

Tier 1 ISP

Tier 1 ISP Tier 1 ISP Tier-2 ISP


local
Tier-2 ISP Tier-2 ISP
ISP
local local local
ISP ISP ISP
Chapter 1: roadmap
1.1 What is the Internet?
1.2 Network edge
 end systems, access networks, links
1.3 Network core
 circuit switching, packet switching, network structure
1.4 Delay, loss and throughput in packet-switched
networks
1.5 Protocol layers, service models
1.6 Networks under attack: security
1.7 History
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
Four sources of packet delay
 1. nodal processing:  2. queueing
 check bit errors  time waiting at output
 determine output link link for transmission
 depends on congestion
level of router

transmission
A propagation

B
nodal
processing queueing
Delay in packet-switched networks
3. Transmission delay: 4. Propagation delay:
 R=link bandwidth (bps)  d = length of physical link

 L=packet length (bits)  s = propagation speed in

 time to send bits into medium (~2x108 m/sec)


link = L/R  propagation delay = d/s

Note: s and R are very


different quantities!
transmission
A propagation

B
nodal
processing queueing
Caravan analogy
100 km 100 km
ten-car toll toll
caravan booth booth
 cars “propagate” at  Time to “push” entire
100 km/hr caravan through toll booth
 toll booth takes 12 sec to onto highway = 12*10 =
service car (transmission 120 sec
time)  Time for last car to
 car~bit; caravan ~ packet propagate from 1st to 2nd
 Q: How long until caravan is toll both:
lined up before 2nd toll 100km/(100km/hr)= 1 hr
booth?  A: 62 minutes
Caravan analogy (more)
100 km 100 km
ten-car toll toll
caravan booth booth
 Yes! After 7 min, 1st car at
 Cars now “propagate” at 2nd booth and 3 cars still at
1000 km/hr 1st booth.
 Toll booth now takes 1  1st bit of packet can arrive at
min to service a car 2nd router before packet is
 Q: Will cars arrive to 2nd fully transmitted at 1st
booth before all cars router!
serviced at 1st booth?  See Ethernet applet at AWL
Web site
Nodal delay

d nodal  d proc  d queue  d trans  d prop

 dproc = processing delay


 typically a few microsecs or less
 dqueue = queuing delay
 depends on congestion
 dtrans = transmission delay
 = L/R, significant for low-speed links
 dprop = propagation delay
 a few microsecs to hundreds of msecs
Queueing delay (revisited)

 R=link bandwidth (bps)


 L=packet length (bits)
 a=average packet arrival
rate
traffic intensity = La/R

 La/R ~ 0: average queueing delay small


 La/R -> 1: delays become large
 La/R > 1: more “work” arriving than can be
serviced, average delay infinite!
“Real” Internet delays and routes
 What do “real” Internet delay & loss look like?
 Traceroute program: provides delay measurement from
source to router along end-end Internet path towards
destination. For all i:
 sends three packets that will reach router i on path towards
destination
 router i will return packets to sender
 sender times interval between transmission and reply.

3 probes 3 probes

3 probes
“Real” Internet delays and routes
traceroute: gaia.cs.umass.edu to www.eurecom.fr
Three delay measurements from
gaia.cs.umass.edu to cs-gw.cs.umass.edu
1 cs-gw (128.119.240.254) 1 ms 1 ms 2 ms
2 border1-rt-fa5-1-0.gw.umass.edu (128.119.3.145) 1 ms 1 ms 2 ms
3 cht-vbns.gw.umass.edu (128.119.3.130) 6 ms 5 ms 5 ms
4 jn1-at1-0-0-19.wor.vbns.net (204.147.132.129) 16 ms 11 ms 13 ms
5 jn1-so7-0-0-0.wae.vbns.net (204.147.136.136) 21 ms 18 ms 18 ms
6 abilene-vbns.abilene.ucaid.edu (198.32.11.9) 22 ms 18 ms 22 ms
7 nycm-wash.abilene.ucaid.edu (198.32.8.46) 22 ms 22 ms 22 ms trans-oceanic
8 62.40.103.253 (62.40.103.253) 104 ms 109 ms 106 ms
9 de2-1.de1.de.geant.net (62.40.96.129) 109 ms 102 ms 104 ms link
10 de.fr1.fr.geant.net (62.40.96.50) 113 ms 121 ms 114 ms
11 renater-gw.fr1.fr.geant.net (62.40.103.54) 112 ms 114 ms 112 ms
12 nio-n2.cssi.renater.fr (193.51.206.13) 111 ms 114 ms 116 ms
13 nice.cssi.renater.fr (195.220.98.102) 123 ms 125 ms 124 ms
14 r3t2-nice.cssi.renater.fr (195.220.98.110) 126 ms 126 ms 124 ms
15 eurecom-valbonne.r3t2.ft.net (193.48.50.54) 135 ms 128 ms 133 ms
16 194.214.211.25 (194.214.211.25) 126 ms 128 ms 126 ms
17 * * *
18 * * * * means no response (probe lost, router not replying)
19 fantasia.eurecom.fr (193.55.113.142) 132 ms 128 ms 136 ms
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 previous
node, by source end system, or not at all
buffer
(waiting area) packet being transmitted
A

B
packet arriving to
full buffer is lost
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

server,
server sendswith link
bits pipe capacity
that can carry link that
pipe capacity
can carry
file of
(fluid) F bits
into pipe fluid at rate
Rs bits/sec Rfluid at rate
c bits/sec
to send to client Rs bits/sec) Rc bits/sec)
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
Throughput: Internet scenario

Rs
 per-connection end- Rs Rs
end throughput:
min(Rc,Rs,R/10) R
 in practice: Rc or Rs is
Rc Rc
often bottleneck
Rc

10 connections (fairly) share


backbone bottleneck link R bits/sec
Chapter 1: roadmap
1.1 What is the Internet?
1.2 Network edge
 end systems, access networks, links
1.3 Network core
 circuit switching, packet switching, network structure
1.4 Delay, loss and throughput in packet-switched
networks
1.5 Protocol layers, service models
1.6 Networks under attack: security
1.7 History
Protocol “Layers”

Networks are complex!


 many “pieces”:

 hosts Question:
 routers Is there any hope of organizing
structure of network?
 links of various
media Or at least our discussion of
 applications networks?
 protocols
 hardware,
software
Organization of air travel

ticket (purchase) ticket (complain)

baggage (check) baggage (claim)

gates (load) gates (unload)

runway takeoff runway landing

airplane routing airplane routing


airplane routing

 a series of steps
Layering of airline functionality

ticket (purchase) ticket (complain) ticket

baggage (check) baggage (claim baggage

gates (load) gates (unload) gate

runway (takeoff) runway (land) takeoff/landing

airplane routing airplane routing airplane routing airplane routing airplane routing

departure intermediate air-traffic arrival


airport control centers airport

Layers: each layer implements a service


 via its own internal-layer actions
 relying on services provided by layer below
Why layering?

Dealing with complex systems:


 explicit structure allows identification, relationship of
complex system’s pieces
 layered reference model for discussion
 modularization eases maintenance, updating of system
 change of implementation of layer’s service
transparent to rest of system
 e.g., change in gate procedure doesn’t affect
rest of system
 layering considered harmful?
Layered communication system

N+1 Layer protocol


N+1 layer N+1 layer
Layer N+1 entity entity
Interface between
layers N+1 and N
N Layer protocol
N layer N layer
Layer N entity entity
Interface between
layers N and N-1
N-1 Layer protocol
Layer N-1 N-1 layer N-1 layer
entity entity

Entities from the same layers - peers


A layer
 In telecommunications networks and open system
architecture:
 a group of related functions that are performed in a
given level in a hierarchy of groups of related functions.

 In object-oriented design:
 a group of classes that have the same set of (link-time)
module dependences to other modules, i.e. a collection
of reusable components that are available for reuse in
similar circumstances.

http://en.wikipedia.org/wiki/Layer
Why layering?

Application
layer

Physical
layer

optical fiber coax air


Each new application has to be re-implemented for
every network technology
Benefit of layering
Solution to the problem:
introduce an intermediate layer that provides a
common abstraction for various network technologies
Application
layer

Intermediate layer

Physical
layer
optical fiber coax air
Disadvantages of layering
 Are there any?

 YES!
 Inefficiency of the software
 Transport layer – might be very inefficient if not
aware of the lower layers
What is a protocol?
A protocol is an agreement between the communicating parties on
how the communication is to proceed
“A protocol defines format & the order of messages exchanged as
well as the actions taken on the transmission/reception of a
message.” (Kurose, Ross)
Analogy: politician meeting, PhD defense ceremony
A protocol is a set of rules that specify
 the format of the messages exchanged
 a number of different protocol states and what messages are
allowed to be sent in each state;
 these states determine, among others, the order of the messages,
timing constraints and other non-functional properties, if any
 Example: HTTP, FTP, TCP…
Example: Protocol stacks
Peer protocol
Layered network architecture and
services
 Layer N uses services of layer N-1- service user
 Layer N-1 provides services to layer N- service provider
 From the example: service = post delivery

 Service: a contractually specified overall functionality


(semantics) of an object
 Service quality: non-functional properties of a service
(e.g. speed, reliability, ...)
 Service interface: actions (“primitives”) and
responses that make the service available; these
responses can be autonomous (“events”)
Network services
Services provided by different layers
• Unconfirmed (Best effort) service: no feedback if delivery occurs

Post
sender receiver
Request
Network Indicate
delivery delivery

• Confirmed (Acknowledged) service:


sender gets a confirmation (acknowledgment) of delivery
Request Indicate
delivery delivery
Post
sender receiver
Network
Indicate ACK Request ACK
delivery delivery
Network services (cnt’d)

 Unreliable services
 No guaranteed delivery (no acknowledgments)
 An example: a basic service of datagram networks

 Reliable services
 Guaranteed delivery
 Implementation of this service through combination of
timers, acknowledgment and retransmission
 An example: FTP, E-mail

 Why would anyone use an unreliable service?


Connection-oriented services
 Establish connection
 Use connection
 Release connection

 Protocol Data Units (PDUs) are delivered in-sequence of transmission


without duplication
 Implementation of this service:
 Virtual-circuit packet switched network
 In datagram networks, a connection-oriented service can be
accomplished by end systems with sequence numbers,
retransmission, and other mechanisms
Example: Service of TCP protocol,
Frame relay – for connecting LANs
X.25 – Typically across telephone lines
Connectionless service
Example: Postal system
 No guarantee of in-sequence delivery. Losses are possible.

 Implementation of the service

 default service for datagram communication

 inefficient to implement in circuit-switching networks and


virtual circuit packet switching networks
Example: services of both the IP and UDP protocol

Question: What applications can work with connectionless


service?
 Connection-oriented service typically provided by the layer
above
Synchronous

 Service with fixed delays and known error rate

 Implementation of the service:


 This service is the “native service” of a circuit-switched
network
 Very difficult to implement in a packet-switched network

 Example: Telephony and Television


Quality of service
 Some services must guarantee bounds to one of the
following performance parameters
 End-to-end delay (mean or maximum)
 Delay variations (delay jitter)
 Throughput
 Loss-rate
 Implementation of the service
 In a packet switched network, requires algorithms for
admission control, traffic conditioning and packet scheduling
Example: Multimedia applications require QoS guarantees
Service types
Service primitives
Usually system calls
“..A service is a set of primitives (operations) that a
layer provides to the layer above it…” (Tanenbaum)

Service defines what operations are to be performed


but says nothing how they are performed

N+1 Layer protocol


N+1 layer N+1 layer
entity entity
Request Indicate
delivery delivery
N layer N layer
entity entity
Example: primitives for connection-
oriented service
Service access points
A point at which a designated service may be obtained
 The term for the component of a network address which identifies the
individual application on a host which is sending or receiving a packet
 TCP/IP's equivalent term is “port"
 Different SAPs distinguish between different services or applications on a
host, e.g. e-mail, FTP, HTTP. ..(from FELDOC)

Service user
N+1 Layer protocol
N+1 layer N+1 layer
entity entity Service user

SAP
Service N layer N layer Service
provider entity entity provider
Analogy
Question
Define service, service access point and quality of
service at the gasoline station

Answer
Service: fuel distribution, car-washing
Service Access Point: Fuel machine, washing room
Quality of service: Vary
Data exchange
N Layer
N layer
peer-to-peer protocol N layer
Service
user entity entity

Protocol Data Unit


N PDU N Layer PDU N PDU
SAP

Service N-1 layer N-1 layer


entity entity
Service Data Unit
provider
N-1 Header N SDU

N-1 Layer PDU Encapsulation


Compare service & protocol

Service used by layer k

Service – what a layer does


Interface between different layers – how to access service
Protocol – set of rules; packets between the same layers
- how the service is implemented (even more than this)
Issues, to be resolved by the layers
 Larger bandwidth at lower cost
 Error correction
 Flow control
 Addressing
 Multiplexing
 Naming
 Congestion control
 Mobility
 Routing
 Fragmentation
 Security
 ....
Layering: Design Issues

 Identify senders/receivers?
 Addressing
 Unreliable physical communication medium?
 Error detection
 Error control
 Message reordering
 Sender can swamp the receiver?
 Flow control
 Multiplexing/Demultiplexing
Internet protocol stack
 application: supporting network
applications
application
 FTP, SMTP, HTTP
 transport: process-process data transfer transport
 TCP, UDP
 network: routing of datagrams from network
source to destination
 IP, routing protocols link
 link: data transfer between neighboring
network elements physical
 PPP, Ethernet
 physical: bits “on the wire”
source
message M application Encapsulation
segment Ht M transport
datagram Hn Ht M network
frame Hl Hn Ht M link
physical
link
physical

switch

destination Hn Ht M network
M application
Hl Hn Ht M link Hn Ht M
Ht M transport physical
Hn Ht M network
Hl Hn Ht M link router
physical
Protocol layering and data

Each layer takes data from above


 adds header information to create new data unit

 passes new data unit to layer below

source destination
M application application M message
Ht M transport transport Ht M segment
Hn Ht M network network Hn Ht M datagram
Hl Hn Ht M link link Hl Hn Ht M frame
physical physical
ISO/OSI reference model

 presentation: allow applications to


interpret meaning of data, e.g., application
encryption, compression, machine-
presentation
specific conventions
 session: synchronization, session
checkpointing, recovery of data transport
exchange
network
 Internet stack “missing” these layers!
link
 these services, if needed, must
be implemented in application physical
 needed?
Application A Application B

Application Application
Layer Layer

Presentation Presentation
Layer Layer

Session Session
Layer Layer

Transport Transport
Layer Communication Network Layer

Network Network Network Network


Layer Layer Layer Layer

Data Link Data Link Data Link Data Link


Layer Layer Layer Layer

Physical Physical Physical Physical


Layer Layer Layer Layer
Copyright ©2000 The McGraw Hill Companies

Electrical and/or Optical Signals


Leon-Garcia & Widjaja: Communication Networks Figure 2.6
OSI Reference Model (cnt’d)

Node (router)

Network Network
Data Link Data Link
End node Physical Physical
(host)
Application
Presentation
Network
Session Network
Data Link Application
Transport Data Link
Physical Presentation
Network Physical
Session
Data Link
Transport
Physical
Network
Hosts have all 7 layers Data Link
Nodes in the subnet have only the lower 3 Physical
OSI versus TCP/IP

The TCP/IP reference model.


Comparing different models
 TCP/IP ‘model’
 named after the dominating protocols
 model constructed after the fact
 host-to-network
 not really a layer; just get IP packets across
 OSI model
 well-discussed, before designing protocols
 OSI protocol stack
 not widely used
OSI versus TCP/IP

DCC 6th Ed., W. Stallings Figure 1.11


Some stacks and the OSI model
Model in the book…(cnt’d)

Application

Transport
Network

Data link

Physical
Physical layer
physical
connection

Transporting bits from one end node to the next


- type of the transmission media (twisted-pair, coax, optical fiber, air)
- bit representation (voltage levels of logical values)

- data rate (speed)

- synchronization of bits (time synchronization)


Physical layer

QUESTION

Define the service and the protocol in the Physical layer

ANSWER

Service: moving inf. between two systems on the same link

Protocol: coding scheme, duration of bit, voltage levels


Data Link layer
logical
connection

Transporting frames from one end node to the next one

- framing - physical addressing


- flow control - error control
- access control (broadcast networks)
Data Link layer
- hop-to-hop delivery-
Data Link layer
- example-
Data Link layer

QUESTION

Define the service and protocol in the Data Link layer

ANSWER
Service: attach frame separator; send data between peers
arbitrates the access on the common media, flow control

Protocol: MACA, CSMA/CD, Bluetooth…


Network layer
Not a message
 End-to-End packet delivery
 From the original source to a destination

 Needed when 2 devices are attached to different


networks
 What is the network definition here?
 Main duties:
1. Logical addressing
2. Routing
3. Switching
4. Congestion control and QoS
Source to destination delivery

Data Link

Network
layer
Network layer
- example -

Network layer addresses

Data Link layer addresses


Network layer
QUESTION

Define the service and the protocol in the Network layer

ANSWER
Service: packet delivery to the destination; fragmentation;
reassembly (what)

Protocol: global addressing; construct routing tables;


packet reassembly/fragmentation (how)
A reminder

Application

Transport
Network

Data link

Physical
Transport layer
 Process-to-Process delivery of the entire message
 From the original source to a destination

 Needed when several processes (running


programs) active at the same time
 Main tasks:
 Port addressing
 Segmentation and reassembly
 Congestion control
 Flow control
 Error control
Transport layer
Transport layer
-an example of a reliable delivery -
Transport layer
-example 2 -

port addresses

network addresses

physical address
Transport layer

QUESTION

Define the service and protocol in the Transport layer

ANSWER

Service: in-order, error free, flow & congestion controlled


end-to-end connection

Protocol: implements reliability and flow & congestion control


Application layer
 Enables user to access the network
 Provides services to a user
 E-mail
 Remote file access and transfer (Telnet, FTP)
 Access to WWW (HTTP)
Summary of layers and protocols

 Low-level protocols define the electrical and physical


standards to be observed, bit- and byte-ordering and the
transmission and error detection and correction of the
bit stream

 High-level protocols deal with the data formatting,


including the syntax of messages, the terminal to
computer dialogue, character sets, sequencing of
messages
Chapter One - Introduction to Computer
Networks And Data Communications
Chapter 1: roadmap
1.1 What is the Internet?
1.2 Network edge
 end systems, access networks, links
1.3 Network core
 circuit switching, packet switching, network structure
1.4 Delay, loss and throughput in packet-switched
networks
1.5 Protocol layers, service models
1.6 Networks under attack: security
1.7 History
Network Security
 The field of network security is about:
 how bad guys can attack computer networks
 how we can defend networks against attacks
 how to design architectures that are immune to
attacks
 Internet not originally designed with (much)
security in mind
 original vision: “a group of mutually trusting
users attached to a transparent network” 
 Internet protocol designers playing “catch-up”
 Security considerations in all layers!
Bad guys can put malware into
hosts via Internet
 Malware can get in host from a virus, worm, or trojan
horse.

 Spyware malware can record keystrokes, web sites visited,


upload info to collection site.

 Infected host can be enrolled in a botnet, used for spam


and DDoS attacks.

 Malware is often self-replicating: from an infected host,


seeks entry into other hosts
Clarificări – spyware, malware,
botnet
 Spyware - computer technology that is designed to
secretly gather information about a user (e.g. for an
Internet advertising company).
 Malware - software that acts on computer files without
the knowledge of the user, general name for computer
viruses ).
 Botnet is a jargon term for a collection of software
 robots, or bots, which run autonomously and
automatically. They run on groups of "zombie"
computers controlled remotely by crackers. This can also
refer to the network of computers using 
distributed computing software.
Bad guys can put malware into
hosts via Internet
 Trojan horse  Worm:
 Hidden part of some  infection by passively
otherwise useful software receiving object that gets
 Today often on a Web itself executed
page (Active-X, plugin)  self- replicating: propagates
 Virus to other hosts, users
 infection by receiving Sapphire Worm: aggregate scans/sec
in first 5 minutes of outbreak (CAIDA, UWisc data)
object (e.g., e-mail
attachment), actively
executing
 self-replicating:
propagate itself to other
hosts, users
Bad guys can attack servers and
network infrastructure
 Denial of service (DoS): attackers make resources
(server, bandwidth) unavailable to legitimate traffic by
overwhelming resource with bogus traffic
1. select target
2. break into hosts around
the network (see botnet)

3. send packets toward


target from target
compromised hosts
The bad guys can sniff packets

Packet sniffing:
 broadcast media (shared Ethernet, wireless)
 promiscuous network interface reads/records all packets (e.g.,
including passwords!) passing by

A C

src:B dest:A payload


B
 Wireshark software used for end-of-chapter
labs is a (free) packet-sniffer
The bad guys can use false source
addresses
 IP spoofing: send packet with false source address
A C

src:B dest:A payload

B
The bad guys can record and
playback
 record-and-playback: sniff sensitive info (e.g., password),
and use later
 password holder is that user from system point of view

C
A

src:B dest:A user: B; password: foo

B
Network Security
 more throughout this course
 chapter 8: focus on security
 crypographic techniques: obvious uses and
not so obvious uses
Chapter 1: roadmap
1.1 What is the Internet?
1.2 Network edge
 end systems, access networks, links
1.3 Network core
 circuit switching, packet switching, network structure
1.4 Delay, loss and throughput in packet-switched
networks
1.5 Protocol layers, service models
1.6 Networks under attack: security
1.7 History
Internet History
1961-1972: Early packet-switching principles

 1961: Kleinrock - queueing


 1972:
theory shows effectiveness of  ARPAnet public demonstration
packet-switching  NCP (Network Control Protocol)
 1964: Baran - packet- first host-host protocol
switching in military nets  first e-mail program
 1967: ARPAnet conceived by
Advanced Research Projects
 ARPAnet has 15 nodes
Agency
 1969: first ARPAnet node
operational
Internet History
1972-1980: Internetworking, new and proprietary nets

 1970: ALOHAnet satellite


network in Hawaii Cerf and Kahn’s internetworking
principles:
 1974: Cerf and Kahn -
architecture for interconnecting
 minimalism, autonomy - no
networks internal changes required
to interconnect networks
 1976: Ethernet at Xerox PARC  best effort service model
 ate70’s: proprietary
architectures: DECnet, SNA,
 stateless routers
XNA  decentralized control
 late 70’s: switching fixed length define today’s Internet architecture
packets (ATM precursor)
 1979: ARPAnet has 200 nodes
Internet History
1980-1990: new protocols, a proliferation of networks

 1983: deployment of  new national networks:


TCP/IP Csnet, BITnet, NSFnet,
 1982: smtp e-mail Minitel
protocol defined  100,000 hosts connected
 1983: DNS defined for to confederation of
name-to-IP-address networks
translation
 1985: ftp protocol defined
 1988: TCP congestion
control
Internet History
1990, 2000’s: commercialization, the Web, new apps

 Early 1990’s: ARPAnet Late 1990’s – 2000’s:


decommissioned  more killer apps: instant
 1991: NSF lifts restrictions on messaging, P2P file sharing
commercial use of NSFnet  network security to forefront
(decommissioned, 1995)
 est. 50 million host, 100
 early 1990s: Web
million+ users
 hypertext [Bush 1945,  backbone links running at
Nelson 1960’s] Gbps
 HTML, HTTP: Berners-Lee
 1994: Mosaic, later Netscape
 late 1990’s:
commercialization of the Web
Internet History

2007:
 ~500 million hosts

 Voice, Video over IP

 P2P applications: BitTorrent


(file sharing) Skype (VoIP),
PPLive (video)
 more applications: YouTube,
gaming
 wireless, mobility
Introduction: Summary

Covered a “ton” of material!


You now have:
 Internet overview
 context, overview,
 what’s a protocol?
“feel” of networking
 network edge, core, access  more depth, detail to
network follow!
 packet-switching versus
circuit-switching
 Internet structure
 performance: loss, delay,
throughput
 layering, service models
 security
 history
Chapter 5
Link Layer

A note on the use of these ppt slides: Computer


We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you see the animations; and can add, modify, Networking: A
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lot of work on our part. In return for use, we only Top Down
ask the following:
 If you use these slides (e.g., in a class) that you mention their source Approach
(after all, we’d like people to use our book!)
 If you post any slides on a www site, that you note that they are adapted
6th edition
from (or perhaps identical to) our slides, and note our copyright of this Jim Kurose, Keith Ross
material. Addison-Wesley
Thanks and enjoy! JFK/KWR March 2012
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Link Layer 5-144
Chapter 5: The Data Link Layer
Our goals:
 understand principles behind data link layer
services:
 error detection, correction
 sharing a broadcast channel: multiple access
 link layer addressing
 reliable data transfer, flow control: done!
 instantiation and implementation of various link
layer technologies
Link Layer
 5.1 Introduction and
 5.6 Link-layer switches
services  5.7 PPP
 5.2 Error detection and  5.8 Link virtualization:
correction ATM, MPLS
 5.3Multiple access
protocols
 5.4 Link-layer Addressing
 5.5 Ethernet
Link Layer: Introduction
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
Link layer: context
transportation analogy
 datagram transferred by
 trip from Princeton to Lausanne
different link protocols
 limo: Princeton to JFK
over different links:
 plane: JFK to Geneva
 e.g., Ethernet on first link,
 train: Geneva to Lausanne
frame relay on
intermediate links, 802.11  tourist = datagram
on last link  transport segment =
 each link protocol communication link
provides different services  transportation mode = link
 e.g., may or may not layer protocol
provide rdt over link  travel agent = routing
algorithm
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
 Q: why both link-level and end-end reliability?
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
Where is the link layer implemented?
 in each and every host
 link layer implemented in
“adaptor” (aka network host schematic

interface card NIC) application


transport
 Ethernet card, PCMCI network
link
cpu memory

card, 802.11 card


 implements link, physical host
bus
layer link
controller (e.g., PCI)
physical
 attaches into host’s physical
transmission
system buses
 combination of hardware, network adapter
card
software, firmware
Adaptors Communicating

datagram datagram

controller controller

sending host receiving host


datagram

frame

 sending side:  receiving side


 encapsulates datagram in  looks for errors, rdt, flow
frame control, etc
 adds error checking bits,
 extracts datagram, passes to
rdt, flow control, etc. upper layer at receiving side
Link Layer
 5.1 Introduction and
 5.6 Link-layer switches
services  5.7 PPP
 5.2 Error detection and  5.8 Link Virtualization:
correction ATM, MPLS
 5.3Multiple access
protocols
 5.4 Link-Layer Addressing
 5.5 Ethernet
MAC Addresses and ARP
 32-bit IP address:
 network-layer address
 used to get datagram to destination IP subnet
 MAC (or LAN or physical or Ethernet)
address:
 function: get frame from one interface to another
physically-connected interface (same network)
 48 bit MAC address (for most LANs)
 burned in NIC ROM, also sometimes software settable
LAN Addresses and ARP
Each adapter on LAN has unique LAN address

1A-2F-BB-76-09-AD Broadcast address =


FF-FF-FF-FF-FF-FF

LAN
(wired or = adapter
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98
LAN Address (more)
 MAC address allocation administered by IEEE
 manufacturer buys portion of MAC address space (to
assure uniqueness)
 analogy:
(a) MAC address: like Social Security Number
(b) IP address: like postal address
 MAC flat address ➜ portability
 can move LAN card from one LAN to another
 IP hierarchical address NOT portable
 address depends on IP subnet to which node is attached
ARP: Address Resolution Protocol

Question: how to determine  Each IP node (host,


MAC address of B router) on LAN has ARP
knowing B’s IP address? table
 ARP table: IP/MAC
137.196.7.78
address mappings for
1A-2F-BB-76-09-AD
some LAN nodes
137.196.7.23 < IP address; MAC address; TTL>
137.196.7.14
 TTL (Time To Live):
LAN time after which address
71-65-F7-2B-08-53
58-23-D7-FA-20-B0 mapping will be
forgotten (typically 20
0C-C4-11-6F-E3-98 min)
137.196.7.88
ARP protocol: Same LAN (network)
 A wants to send datagram to
B, and B’s MAC address not in
A’s ARP table.
 A caches (saves) IP-to-MAC
address pair in its ARP table
 A broadcasts ARP query
until information becomes old
packet, containing B's IP
(times out)
address
 dest MAC address = FF-
 soft state: information
FF-FF-FF-FF-FF that times out (goes
away) unless refreshed
 all machines on LAN
receive ARP query  ARP is “plug-and-play”:
 B receives ARP packet, replies  nodes create their ARP
to A with its (B's) MAC address tables without
 frame sent to A’s MAC
intervention from net
address (unicast) administrator
Addressing: routing to another LAN
walkthrough: send datagram from A to B via R
assume A knows B’s IP address
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F

A E6-E9-00-17-BB-4B
222.222.222.221
1A-23-F9-CD-06-9B
111.111.111.111

222.222.222.220 222.222.222.222
111.111.111.110
B
111.111.111.112
R 49-BD-D2-C7-56-2A
CC-49-DE-D0-AB-7D

 two ARP tables in router R, one for each IP network


(LAN)
 A creates IP datagram with source A, destination B
 A uses ARP to get R’s MAC address for 111.111.111.110
 A creates link-layer frame with R's MAC address as dest, frame
contains A-to-B IP datagram
This is a really important
 A’s NIC sends frame example – make sure you
 R’s NIC receives frame understand!
 R removes IP datagram from Ethernet frame, sees its destined to
B
 R uses ARP to get B’s MAC address
 R creates frame containing A-to-B IP datagram sends to B
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F

A
E6-E9-00-17-BB-4B
222.222.222.221
1A-23-F9-CD-06-9B
111.111.111.111

222.222.222.220 222.222.222.222
111.111.111.110 B
111.111.111.112
R 49-BD-D2-C7-56-2A

CC-49-DE-D0-AB-7D
Link Layer
 5.1 Introduction and
 5.6 Link-layer switches
services  5.7 PPP
 5.2 Error detection and  5.8 Link Virtualization:
correction ATM and MPLS
 5.3Multiple access
protocols
 5.4 Link-Layer Addressing
 5.5 Ethernet
Ethernet
“dominant” wired LAN technology:
 cheap $20 for NIC

 first widely used LAN technology

 simpler, cheaper than token LANs and ATM

 kept up with speed race: 10 Mbps – 10 Gbps

Metcalfe’s Ethernet
sketch
Star topology
 bus topology popular through mid 90s
 all nodes in same collision domain (can collide with each
other)
 today: star topology prevails
 active switch in center
 each “spoke” runs a (separate) Ethernet protocol (nodes
do not collide with each other)

switch

bus: coaxial cable star


Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other


network layer protocol packet) in Ethernet frame

Preamble:
 7 bytes with pattern 10101010 followed by one byte
with pattern 10101011
 used to synchronize receiver, sender clock rates
Ethernet Frame Structure (more)
 Addresses: 6 bytes
 if adapter receives frame with matching destination
address, or with broadcast address (eg ARP packet), it
passes data in frame to network layer protocol
 otherwise, adapter discards frame
 Type: indicates higher layer protocol (mostly IP but
others possible, e.g., Novell IPX, AppleTalk)
 CRC: checked at receiver, if error is detected, frame
is dropped
Ethernet: Unreliable, connectionless
 connectionless: No handshaking between sending and
receiving NICs
 unreliable: receiving NIC doesn’t send acks or nacks to
sending NIC
 stream of datagrams passed to network layer can have
gaps (missing datagrams)
 gaps will be filled if app is using TCP
 otherwise, app will see gaps
 Ethernet’s MAC protocol: unslotted CSMA/CD
Ethernet CSMA/CD algorithm
1. NIC receives datagram from 4. If NIC detects another
network layer, creates frame transmission while
2. If NIC senses channel idle, transmitting, aborts and
starts frame transmission If sends jam signal
NIC senses channel busy, 5. After aborting, NIC enters
waits until channel idle, then exponential backoff: after
transmits mth collision, NIC chooses K
3. If NIC transmits entire frame at random from
without detecting another {0,1,2,…,2m-1}. NIC waits
transmission, NIC is done K·512 bit times, returns to
with frame ! Step 2
Ethernet’s CSMA/CD (more)
Jam Signal: make sure all other Exponential Backoff:
transmitters are aware of  Goal: adapt retransmission
collision; 48 bits attempts to estimated current
Bit time: .1 microsec for 10 load
Mbps Ethernet ;  heavy load: random wait
for K=1023, wait time is will be longer
about 50 msec
 first collision: choose K from
{0,1}; delay is K· 512 bit
transmission times
See/interact with Java  after second collision: choose K
applet on AWL Web site: from {0,1,2,3}…
highly recommended !  after ten collisions, choose K
from {0,1,2,3,4,…,1023}
CSMA/CD efficiency
 Tprop = max prop delay between 2 nodes in LAN
 ttrans = time to transmit max-size frame

 efficiency goes to 1
 as tprop goes to 0
 as ttrans goes to infinity
1
efficiency 
better performance than ALOHA: and simple, cheap, decentralized !

1  5t prop /ttrans
802.3 Ethernet Standards: Link & Physical Layers
 many different Ethernet standards
 common MAC protocol and frame format
 different speeds: 2 Mbps, 10 Mbps, 100 Mbps,
1Gbps, 10G bps
 different physical layer media: fiber, cable

MAC protocol
application and frame format
transport
network 100BASE-TX 100BASE-T2 100BASE-FX
link 100BASE-T4 100BASE-SX 100BASE-BX
physical

copper (twister fiber physical layer


pair) physical layer
Chapter 4
Network Layer

A note on the use of these ppt slides: Computer


We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you see the animations; and can add, modify, Networking: A
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lot of work on our part. In return for use, we only Top Down
ask the following:
 If you use these slides (e.g., in a class) that you mention their source Approach
(after all, we’d like people to use our book!)
 If you post any slides on a www site, that you note that they are adapted
6th edition
from (or perhaps identical to) our slides, and note our copyright of this Jim Kurose, Keith Ross
material. Addison-Wesley
Thanks and enjoy! JFK/KWR March 2012
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Network Layer 4-171
Chapter 4: Network Layer
Chapter goals:
 understand principles behind network layer
services:
 network layer service models
 forwarding versus routing
 how a router works
 routing (path selection)
 dealing with scale
 advanced topics: IPv6, mobility
 instantiation, implementation in the Internet
Chapter 4: Network Layer
 4. 1 Introduction  4.5 Routing algorithms
 4.2 Virtual circuit and  Link state
datagram networks  Distance Vector
 4.3 What’s inside a router  Hierarchical routing
 4.4 IP: Internet Protocol  4.6 Routing in the
 Datagram format Internet
 IPv4 addressing
 RIP
 OSPF
 ICMP
 BGP
 IPv6
 4.7 Broadcast and
multicast routing
Network layer End system H1

 transport segment from sending to receiving host application


 on sending side encapsulates segments into transport
datagrams network
data link
 on rcving side, delivers segments to transport layer physical
 network layer protocols in every host, router network network
data link data link
 router examines header fields in all IP datagrams network
physical physical
passing through it data link
physical network network
data link data link
physical physical

network network
data link data link
physical physical
network
data link H2
physical
application
network transport
data link network
network
physical data link
network data link
physical
data link physical
physical
Two Key Network-Layer Functions
 forwarding: move analogy:
packets from router’s
input to appropriate
 routing: process of
router output planning trip from
source to dest
 routing: determine
route taken by packets
 forwarding: process of
from source to dest. getting through single
interchange
 routing algorithms
Interplay between routing and forwarding

routing algorithm

local forwarding table


header value output link
0100 3
0101 2
0111 2
1001 1

value in arriving
packet’s header
0111 1

3 2
Connection setup
 3rd important function in some network architectures:
 ATM, frame relay, X.25
 before datagrams flow, two end hosts and intervening
routers establish virtual connection
 routers get involved
 network vs transport layer connection service:
 network: between two hosts (may also involve
intervening routers in case of VCs)
 transport: between two processes
Network service model
Q: What service model for “channel” transporting
datagrams from sender to receiver?
Example services for Example services for a flow of
individual datagrams: datagrams:
 guaranteed delivery  in-order datagram delivery

 guaranteed delivery  guaranteed minimum bandwidth

with less than 40 msec to flow


delay  restrictions on changes in inter-
packet spacing
 security service – using a secret
key known only by a source and
destination host. Encrypt /
decrypt payload.
 Internet / only one service - best
effort service
Network layer service models:
Guarantees ?
Network Service Congestion
Architecture Model Bandwidth Loss Order Timing feedback

Internet best effort none no no no no (inferred


via loss)
ATM CBR constant yes yes yes no
rate congestion
ATM VBR guaranteed yes yes yes no
rate congestion
ATM ABR guaranteed no yes no yes
minimum
ATM UBR none no yes no no
Chapter 4: Network Layer
 4. 1 Introduction  4.5 Routing algorithms
 4.2 Virtual circuit and  Link state
datagram networks  Distance Vector
 4.3 What’s inside a router  Hierarchical routing
 4.4 IP: Internet Protocol  4.6 Routing in the
 Datagram format Internet
 IPv4 addressing
 RIP
 OSPF
 ICMP
 BGP
 IPv6
 4.7 Broadcast and
multicast routing
IP datagram format
IP protocol version 32 bits
number total datagram
header length type of length (bytes)
ver head. length
(4bytes) len service for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper header
remaining hops live layer checksum
(decremented at
32 bit source IP address
each router)
32 bit destination IP address
upper layer protocol
to deliver payload to Options (if any) E.g. timestamp,
record route
how much overhead data taken, specify
with TCP? (variable length, list of routers
 20 bytes of TCP typically a TCP to visit.
 20 bytes of IP
or UDP segment)
 = 40 bytes + app
layer overhead
Antetul - IP
IP Fragmentation & Reassembly
 network links have MTU
(max.transfer size) - largest
possible link-level frame.
 different link types, fragmentation:
different MTUs in: one large datagram
out: 3 smaller datagrams
 large IP datagram divided
(“fragmented”) within net
 one datagram becomes
several datagrams reassembly
 “reassembled” only at
final destination
 IP header bits used to
identify, order related
fragments
IP Fragmentation and Reassembly
length ID fragflag offset
Example =4000 =x =0 =0
 4000 byte datagram
One large datagram becomes
 MTU = 1500 bytes several smaller datagrams

length ID fragflag offset


=1500 =x =1 =0
1480 bytes in
data field length ID fragflag offset
=1500 =x =1 =185
offset =
1480/8 length ID fragflag offset
=1040 =x =0 =370
Chapter 4: Network Layer
 4. 1 Introduction  4.5 Routing algorithms
 4.2 Virtual circuit and  Link state
datagram networks  Distance Vector
 4.3 What’s inside a router  Hierarchical routing
 4.4 IP: Internet Protocol  4.6 Routing in the
 Datagram format Internet
 IPv4 addressing
 RIP
 OSPF
 ICMP
 BGP
 IPv6
 4.7 Broadcast and
multicast routing
IP Addressing: introduction
223.1.1.1
 IP address: 32-bit
identifier for host, 223.1.2.1
223.1.1.2
router interface 223.1.1.4 223.1.2.9
 interface: connection
223.1.2.2
between host/router 223.1.1.3 223.1.3.27
and physical link
 router’s typically have
multiple interfaces 223.1.3.1 223.1.3.2
 host typically has one
interface
 IP addresses associated
with each interface 223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1
Adresarea IP (1)
Adrese IP rezervate
 Componentele adreselor care au toţi biţii pe 1 sau pe 0 au semnificaţii
speciale astfel:
 Toţi biţii pe 0:
 adresă cu toţi biţii pe 0 într-o porţiune corespunzătoare numărului
gazdei este interpretată ca această (this) gazdă (Adresa IP cu
<host address> = 0).
 adresă cu toţi biţii pe 0 într-o porţiune corespunzătoare numărului
reţelei este interpretată ca această (this)reţea (Adresa IP cu
<network address>=0). Atunci când o gazdă doreşte să comunice în
reţea dar nu cunoaşte adresa reţelei poate să trimită un pachet cu
<network address>=0. Celelalte gazde din reţea interpretează adresa ca
fiind această reţea. Replica lor conţine adresa corectă a reţelei pe care
emiţătorul o poate memora pentru utilizări viitoare.
 Toţi biţii pe 1:
 adresă cu toţi biţii pe 1 este interpretată ca toate reţelele sau ca toate
gazdele. De exemplu adresa 128.2.255.255 înseamnă toate gazdele de
pe reţeaua 128.2 (adrese din clasa B).
 Bucla închisă (loopback). Reţeaua de clasă A 127.0.0.0 este utilizată
pentru reţele în buclă închisă. Adresele de la această reţea sunt asignate
interfeţelor care procesează datele în cadrul sistemului local. Aceste
interfeţe în buclă închisă nu au acces la reţeaua fizică.
Chapter 3
Transport Layer

A note on the use of these ppt slides: Computer


We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you see the animations; and can add, modify, Networking: A
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lot of work on our part. In return for use, we only Top Down
ask the following:
 If you use these slides (e.g., in a class) that you mention their source Approach
(after all, we’d like people to use our book!)
 If you post any slides on a www site, that you note that they are adapted
6th edition
from (or perhaps identical to) our slides, and note our copyright of this Jim Kurose, Keith Ross
material. Addison-Wesley
Thanks and enjoy! JFK/KWR March 2012
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
3-192
Transport Layer
Chapter 3: Transport Layer
Our goals:
 understand principles  learn about transport layer
behind transport layer protocols in the Internet:
services:  UDP: connectionless
 multiplexing/demultip transport
lexing  TCP: connection-oriented
 reliable data transfer transport
 flow control  TCP congestion control
 congestion control
Chapter 3 outline
 3.1 Transport-layer
 3.5 Connection-oriented
services transport: TCP
 segment structure
 3.2 Multiplexing and
demultiplexing
 reliable data transfer
 flow control
 3.3 Connectionless
transport: UDP
 connection management
 3.4 Principles of reliable
 3.6 Principles of
data transfer congestion control
 3.7 TCP congestion
control
Transport services and protocols application
transport
 provide logical communication network
data link
between app processes physical

running on different hosts

lo
gi
ca
transport protocols run in end

le

nd
systems

-e
nd
 send side: breaks app

tr
a
ns
messages into segments,

po
rt
passes to network layer
application
 rcv side: reassembles transport
network
segments into messages, data link
physical

passes to app layer


 more than one transport
protocol available to apps
 Internet: TCP and UDP
Transport vs. network layer
Household analogy:
 network layer: logical
communication between 12 kids sending letters to
hosts 12 kids
 processes = kids
 transport layer: logical
 app messages = letters
communication between
processes in envelopes
 relies on, enhances,  hosts = houses

network layer services  transport protocol =


Ann and Bill
 network-layer protocol
= postal service
Internet transport-layer protocols
 reliable, in-order delivery application
transport
network
(TCP) data link
physical
network
 congestion control data link

lo
network
physical

gi
data link

ca
 flow control physical

le
nd
 connection setup

-e
nd
network

unreliable, unordered

tr
data link

a
physicalnetwork

ns
delivery: UDP data link

po
physical

rt
network
 no-frills extension of data link
physical network
application
transport
“best-effort” IP data link
physical
network
data link
 services not available: physical

 delay guarantees
 bandwidth guarantees
Chapter 3 outline
 3.1 Transport-layer
 3.5 Connection-oriented
services transport: TCP
 segment structure
 3.2 Multiplexing and
demultiplexing
 reliable data transfer
 flow control
 3.3 Connectionless
transport: UDP
 connection management
 3.4 Principles of reliable
 3.6 Principles of
data transfer congestion control
 3.7 TCP congestion
control
UDP: User Datagram Protocol [RFC 768]
 “no frills,” “bare bones”
Internet transport protocol Why is there a UDP?
 “best effort” service, UDP  no connection establishment
segments may be:
(which can add delay)
 lost  simple: no connection state
 delivered out of order to at sender, receiver
app  small segment header
 connectionless:  no congestion control: UDP
 no handshaking between can blast away as fast as
UDP sender, receiver desired
 each UDP segment
handled independently of
others
UDP: more
 often used for streaming
multimedia apps 32 bits

 loss tolerant Length, in source port # dest port #


 rate sensitive bytes of UDP length checksum
segment,
 other UDP uses including
header
 DNS
 SNMP
Application
 reliable transfer over UDP: data
add reliability at application (message)
layer
 application-specific
error recovery! UDP segment format
UDP checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment

Sender: Receiver:
 treat segment contents as
 compute checksum of received
sequence of 16-bit integers segment
 check if computed checksum
 checksum: addition (1’s
equals checksum field value:
complement sum) of
segment contents  NO - error detected
 sender puts checksum value  YES - no error detected.
into UDP checksum field But maybe errors
nonetheless? More later ….
Chapter 3 outline
 3.1 Transport-layer
 3.5 Connection-oriented
services transport: TCP
 segment structure
 3.2 Multiplexing and
demultiplexing
 reliable data transfer
 flow control
 3.3 Connectionless
transport: UDP
 connection management
 3.4 Principles of reliable
 3.6 Principles of
data transfer congestion control
 3.7 TCP congestion
control
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
 reliable, in-order byte
 MSS: maximum segment
steam: size
 no “message  connection-oriented:
boundaries”
 handshaking (exchange of
 pipelined: control msgs) init’s
 TCP congestion and flow sender, receiver state
control set window size before data exchange
 send & receive buffers  flow controlled:
a p p lic a t io n a p p lic a t io n
socket
w r ite s d a ta re a d s d a ta
socket
 sender will not overwhelm
door
TC P
s e n d b u ffe r
TC P
r e c e iv e b u f f e r
door
receiver
segm ent
TCP segment structure
32 bits
URG: urgent data counting
(generally not used) source port # dest port #
by bytes
sequence number of data
ACK: ACK #
valid acknowledgement number (not segments!)
head not
PSH: push data now len used
UA P R S F Receive window
(generally not used) # bytes
checksum Urg data pnter
rcvr willing
RST, SYN, FIN: to accept
Options (variable length)
connection estab
(setup, teardown
commands)
application
Internet data
checksum (variable length)
(as in UDP)
TCP seq. #’s and ACKs
Seq. #’s:
Host A Host B
 byte stream
“number” of first byte User Seq=4
2, ACK=
types
in segment’s data 79, da
t a = ‘C
‘C’ ’
ACKs: host ACKs
receipt of
 seq # of next byte = ‘C’ ‘C’, echoes
data
expected from other 9 , ACK
= 43 ,
back ‘C’
=7
side Seq

 cumulative ACK host ACKs


Q: how receiver handles out- receipt Seq=4
of echoed 3, ACK
of-order segments =80
‘C’
 A: TCP spec doesn’t
say, - up to
implementor time
simple telnet scenario
TCP Round Trip Time and Timeout
Q: how to set TCP Q: how to estimate RTT?
timeout value?  SampleRTT: measured time from
 longer than RTT segment transmission until ACK
 but RTT varies
receipt
 too short: premature
 ignore retransmissions
timeout  SampleRTT will vary, want
estimated RTT “smoother”
 unnecessary
retransmissions  average several recent
 too long: slow reaction measurements, not just
to segment loss current SampleRTT
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
Example RTT estimation:
RTT: gaia.cs.umass.edu to fantasia.eurecom.fr

350

300

250
RTT (milliseconds)

200

150

100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)

SampleRTT Estimated RTT


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


Chapter 3 outline
 3.1 Transport-layer
 3.5 Connection-oriented
services transport: TCP
 segment structure
 3.2 Multiplexing and
demultiplexing
 reliable data transfer
 flow control
 3.3 Connectionless
transport: UDP
 connection management
 3.4 Principles of reliable
 3.6 Principles of
data transfer congestion control
 3.7 TCP congestion
control
TCP reliable data transfer
 TCP creates rdt service  Retransmissions are
on top of IP’s unreliable triggered by:
service  timeout events
 Pipelined segments  duplicate acks
 Cumulative acks  Initially consider
 TCP uses single simplified TCP sender:
retransmission timer  ignore duplicate acks
 ignore flow control,
congestion control
TCP sender events:
data rcvd from app: timeout:
 Create segment with seq  retransmit segment that

# caused timeout
 seq # is byte-stream  restart timer

number of first data byte Ack rcvd:


in segment  If acknowledges
 start timer if not already previously unacked
running (think of timer segments
as for oldest unacked  update what is known to
segment) be acked
 expiration interval:  start timer if there are

TimeOutInterval outstanding segments


NextSeqNum = InitialSeqNum
SendBase = InitialSeqNum

loop (forever) { TCP


switch(event)
sender
event: data received from application above (simplified)
create TCP segment with sequence number NextSeqNum
if (timer currently not running)
start timer
pass segment to IP
Comment:
NextSeqNum = NextSeqNum + length(data)
• SendBase-1: last

event: timer timeout cumulatively


retransmit not-yet-acknowledged segment with ack’ed byte
smallest sequence number Example:
start timer • SendBase-1 = 71;
y= 73, so the rcvr
event: ACK received, with ACK field value of y wants 73+ ;
if (y > SendBase) {
y > SendBase, so
SendBase = y
if (there are currently not-yet-acknowledged segments)
that new data is
start timer acked
}

} /* end of loop forever */


TCP: retransmission scenarios
Host A Host B Host A Host B

Seq=9 Seq=9
2, 8 b 2, 8 b y te
y te s d a s data
ta Seq=

Seq=92 timeout
1 00, 2
0 by t
es da
timeout

t a
=100
ACK 0
10
X CK=
A AC K = 120
loss
Seq=9 Seq=9
2, 8 b
2, 8 b
y t es da Sendbase y t es da
ta
ta
= 100

Seq=92 timeout
SendBase
= 120 = 120
0 K
=10 AC
ACK

SendBase
= 100 SendBase
= 120 premature timeout
time time
lost ACK scenario
TCP retransmission scenarios (more)
Host A Host B

Seq=9
2, 8 byte
s data

=100
timeout

Seq=1 A CK
00, 20
bytes
data
X
loss

SendBase C K =120
A
= 120

time
Cumulative ACK scenario
TCP ACK generation [RFC 1122, RFC 2581]

Event at Receiver TCP Receiver action


Arrival of in-order segment with Delayed ACK. Wait up to 500ms
expected seq #. All data up to for next segment. If no next segment,
expected seq # already ACKed send ACK

Arrival of in-order segment with Immediately send single cumulative


expected seq #. One other ACK, ACKing both in-order segments
segment has ACK pending

Arrival of out-of-order segment Immediately send duplicate ACK,


higher-than-expect seq. # . indicating seq. # of next expected byte
Gap detected

Arrival of segment that Immediate send ACK, provided that


partially or completely fills gap segment starts at lower end of gap
Fast Retransmit
 Time-out period often
 If sender receives 3 ACKs
relatively long: for the same data, it
supposes that segment
 long delay before
resending lost packet after ACKed data was
lost:
 Detect lost segments via
 fast retransmit: resend
duplicate ACKs.
segment before timer
 Sender often sends many expires
segments back-to-back
 If segment is lost, there
will likely be many
duplicate ACKs.
Host A Host B

X
timeout

resen
d 2 nd s
egme
nt

time

Figure 3.37 Resending a segment after triple duplicate ACK


Fast retransmit algorithm:
event: ACK received, with ACK field value of y
if (y > SendBase) {
SendBase = y
if (there are currently not-yet-acknowledged segments)
start timer
}
else {
increment count of dup ACKs received for y
if (count of dup ACKs received for y = 3) {
resend segment with sequence number y
}

a duplicate ACK for fast retransmit


already ACKed segment
Chapter 3 outline
 3.1 Transport-layer
 3.5 Connection-oriented
services transport: TCP
 segment structure
 3.2 Multiplexing and
demultiplexing
 reliable data transfer
 flow control
 3.3 Connectionless
transport: UDP
 connection management
 3.4 Principles of reliable
 3.6 Principles of
data transfer congestion control
 3.7 TCP congestion
control
TCP Flow Control flow control
sender won’t overflow
 receive side of TCP receiver’s buffer by
connection has a receive transmitting too
much,
buffer:
too fast

 speed-matching service:
matching the send rate
to the receiving app’s
drain rate
 app process may be
slow at reading from
buffer
TCP Flow control: how it works
 Rcvr advertises spare
room by including value
of RcvWindow in
segments
 Sender limits unACKed
(Suppose TCP receiver discards data to RcvWindow
out-of-order segments)  guarantees receive
 spare room in buffer buffer doesn’t overflow
= RcvWindow
= RcvBuffer-[LastByteRcvd -
LastByteRead]
Chapter 3 outline
 3.1 Transport-layer
 3.5 Connection-oriented
services transport: TCP
 segment structure
 3.2 Multiplexing and
demultiplexing
 reliable data transfer
 flow control
 3.3 Connectionless
transport: UDP
 connection management
 3.4 Principles of reliable
 3.6 Principles of
data transfer congestion control
 3.7 TCP congestion
control
TCP Connection Management
Recall: TCP sender, receiver Three way handshake:
establish “connection” before
exchanging data segments Step 1: client host sends TCP SYN
 initialize TCP variables: segment to server
 seq. #s
 specifies initial seq #
 buffers, flow control info
 no data
(e.g. RcvWindow) Step 2: server host receives SYN,
 client: connection initiator replies with SYNACK segment
Socket clientSocket = new  server allocates buffers
Socket("hostname","port
number");
 specifies server initial seq.
#
 server: contacted by client
Socket connectionSocket = Step 3: client receives SYNACK,
welcomeSocket.accept(); replies with ACK segment, which
may contain data
TCP Connection Management (cont.)

client server
Closing a connection:
close
client closes socket: FIN
clientSocket.close();

Step 1: client end system sends ACK


close
TCP FIN control segment to server
FIN
Step 2: server receives FIN, replies
with ACK. Closes connection,

timed wait
ACK
sends FIN.

closed
TCP Connection Management (cont.)

client server
Step 3: client receives FIN, replies
with ACK. closing
FIN
 Enters “timed wait” - will
respond with ACK to received
FINs ACK
closing
Step 4: server, receives ACK. FIN
Connection closed.

timed wait
Note: with small modification, can ACK

handle simultaneous FINs. closed

closed
TCP Connection Management (cont)

TCP server
lifecycle

TCP client
lifecycle
Chapter 3 outline
 3.1 Transport-layer
 3.5 Connection-oriented
services transport: TCP
 segment structure
 3.2 Multiplexing and
demultiplexing
 reliable data transfer
 flow control
 3.3 Connectionless
transport: UDP
 connection management
 3.4 Principles of reliable
 3.6 Principles of
data transfer congestion control
 3.7 TCP congestion
control
Principles of Congestion Control

Congestion:
 informally: “too many sources sending too much data
too fast for network to handle”
 different from flow control!
 manifestations:
 lost packets (buffer overflow at routers)
 long delays (queueing in router buffers)
 a top-10 problem!
Causes/costs of congestion: scenario 1
Host A
in : original data out
 two senders, two
receivers
Host B unlimited shared
 one router, infinite output link buffers

buffers
 no retransmission

 large delays
when congested
 maximum
achievable
throughput
Causes/costs of congestion: scenario 2
 one router, finite buffers
 sender retransmission of lost packet

Host A
in : original data out

'in : original data, plus


retransmitted data

Host B finite shared output link


buffers
Causes/costs of congestion: scenario 2
 always:  =  (goodput)
in out
 “perfect” retransmission only when loss:  > out
in
 retransmission of delayed (not lost) packet makes  larger (than
in
perfect case) for same out
R/2 R/2 R/2

R/3
out

out
out

R/4

R/2 R/2 R/2


in in in

a. b. c.
“costs” of congestion:
 more work (retrans) for given “goodput”

 unneeded retransmissions: link carries multiple copies of pkt


Causes/costs of congestion: scenario 3
 four senders
Q: what happens as 
 multihop paths in
and  increase ?
 timeout/retransmit in
Host A out
in : original data
'in : original data, plus
retransmitted data

finite shared output link buffers

Host B
Causes/costs of congestion: scenario 3
Host A 
out

Host B

Another “cost” of congestion:


 when packet dropped, any “upstream transmission capacity used for
that packet was wasted!
Approaches towards congestion control
Two broad approaches towards congestion control:

End-end congestion control: Network-assisted congestion


 no explicit feedback from control:
network  routers provide feedback to
 congestion inferred from end- end systems
system observed loss, delay  single bit indicating
 approach taken by TCP congestion (SNA, DECbit,
TCP/IP ECN, ATM)
 explicit rate sender
should send at
Case study: ATM ABR congestion control

ABR: available bit rate: RM (resource management)


cells:
 “elastic service”
 sent by sender, interspersed with
 if sender’s path data cells
“underloaded”:  bits in RM cell set by switches
 sender should use (“network-assisted”)
available bandwidth  NI bit: no increase in rate
 if sender’s path congested: (mild congestion)
 sender throttled to  CI bit: congestion indication
minimum guaranteed  RM cells returned to sender by
rate receiver, with bits intact
Case study: ATM ABR congestion control

 two-byte ER (explicit rate) field in RM cell


 congested switch may lower ER value in cell
 sender’ send rate thus maximum supportable rate on path
 EFCI bit in data cells: set to 1 in congested switch
 if data cell preceding RM cell has EFCI set, sender sets CI
bit in returned RM cell
Chapter 3 outline
 3.1 Transport-layer
 3.5 Connection-oriented
services transport: TCP
 segment structure
 3.2 Multiplexing and
demultiplexing
 reliable data transfer
 flow control
 3.3 Connectionless
transport: UDP
 connection management
 3.4 Principles of reliable
 3.6 Principles of
data transfer congestion control
 3.7 TCP congestion
control
TCP congestion control: additive increase, multiplicative
decrease
 Approach: increase transmission rate (window size), probing for usable bandwidth, until
loss occurs
 additive increase: increase CongWin by 1 MSS every RTT until loss detected
 multiplicative decrease: cut CongWin in half after loss

c o n g e s tio n
w in d o w
congestion window size

2 4 K b y te s

Saw tooth
behavior: probing
1 6 K b y te s

for bandwidth
8 K b y te s

time
tim e
TCP Congestion Control: details
 sender limits transmission: How does sender perceive
LastByteSent-LastByteAcked congestion?
 CongWin  loss event = timeout or 3

 Roughly, duplicate acks


 TCP sender reduces rate
CongWin
rate = Bytes/sec (CongWin) after loss
RTT
event
 CongWin is dynamic, function of
three mechanisms:
perceived network congestion  AIMD
 slow start
 conservative after
timeout events
TCP Slow Start
 When connection begins,  When connection begins,
CongWin = 1 MSS increase rate
 Example: MSS = 500 exponentially fast until
bytes & RTT = 200 msec first loss event
 initial rate = 20 kbps
 available bandwidth may
be >> MSS/RTT
 desirable to quickly ramp
up to respectable rate
TCP Slow Start (more)
 When connection begins, Host A Host B
increase rate exponentially one segm
ent
until first loss event:

RTT
 double CongWin every two segm
RTT ents

 done by incrementing
CongWin for every ACK four segm
ents
received
 Summary: initial rate is
slow but ramps up
exponentially fast
time
Refinement: inferring loss
 After 3 dup ACKs:
 CongWin is cut in half
 window then grows linearly Philosophy:
 But after timeout event:
 CongWin instead set to 1 MSS;  3 dup ACKs indicates
 window then grows exponentially network capable of
 to a threshold, then grows linearly delivering some segments
 timeout indicates a
“more alarming”
congestion scenario
Refinement
Q: When should the
exponential increase
switch to linear?
A: When CongWin gets to
1/2 of its value before
timeout.

Implementation:
 Variable Threshold
 At loss event, Threshold is set
to 1/2 of CongWin just before
loss event
Summary: TCP Congestion Control
 When CongWin is below Threshold, sender in
slow-start phase, window grows exponentially.
 When CongWin is above Threshold, sender is in
congestion-avoidance phase, window grows linearly.
 When a triple duplicate ACK occurs, Threshold set
to CongWin/2 and CongWin set to Threshold.
 When timeout occurs, Threshold set to
CongWin/2 and CongWin is set to 1 MSS.
TCP sender congestion control
State Event TCP Sender Action Commentary
Slow Start ACK receipt CongWin = CongWin + MSS, Resulting in a doubling of
(SS) for previously If (CongWin > Threshold) CongWin every RTT
unacked set state to “Congestion
data Avoidance”
Congestion ACK receipt CongWin = CongWin+MSS * Additive increase, resulting
Avoidance for previously (MSS/CongWin) in increase of CongWin by
(CA) unacked 1 MSS every RTT
data
SS or CA Loss event Threshold = CongWin/2, Fast recovery,
detected by CongWin = Threshold, implementing multiplicative
triple Set state to “Congestion decrease. CongWin will not
duplicate Avoidance” drop below 1 MSS.
ACK
SS or CA Timeout Threshold = CongWin/2, Enter slow start
CongWin = 1 MSS,
Set state to “Slow Start”
SS or CA Duplicate Increment duplicate ACK count CongWin and Threshold
ACK for segment being acked not changed
TCP throughput
 What’s the average throughout of TCP as a
function of window size and RTT?
 Ignore slow start
 Let W be the window size when loss occurs.
 When window is W, throughput is W/RTT
 Just after loss, window drops to W/2,
throughput to W/2RTT.
 Average throughout: .75 W/RTT
TCP Futures: TCP over “long, fat pipes”

 Example: 1500 byte segments, 100ms RTT, want 10


Gbps throughput
 Requires window size W = 83,333 in-flight segments
 Throughput in terms of loss rate:

1.22  MSS
RTT L
 ➜ L = 2·10-10 Wow
 New versions of TCP for high-speed
TCP Fairness
Fairness goal: if K TCP sessions share same bottleneck
link of bandwidth R, each should have average rate
of R/K

TCP connection 1

bottleneck
TCP
router
connection 2
capacity R
Why is TCP fair?
Two competing sessions:
 Additive increase gives slope of 1, as throughout increases
 multiplicative decrease decreases throughput proportionally

R equal bandwidth share


Connection 2 throughput

loss: decrease window by factor of 2


congestion avoidance: additive increase
loss: decrease window by factor of 2
congestion avoidance: additive increase

Connection 1 throughput R
Fairness (more)
Fairness and UDP Fairness and parallel TCP
 Multimedia apps often
connections
 nothing prevents app from
do not use TCP
 do not want rate opening parallel
throttled by congestion connections between 2
control hosts.
 Instead use UDP:  Web browsers do this

 pump audio/video at  Example: link of rate R


constant rate, tolerate supporting 9 connections;
packet loss  new app asks for 1 TCP,
 Research area: TCP gets rate R/10
friendly  new app asks for 11 TCPs,
gets R/2 !
Chapter 3: Summary
 principles behind transport layer
services:
 multiplexing, demultiplexing
 reliable data transfer
 flow control
 congestion control
Next:
 instantiation and implementation
 leaving the network
in the Internet
 UDP “edge” (application,
transport layers)
 TCP
 into the network
“core”
Chapter 2
Application Layer

A note on the use of these ppt slides:


We’re making these slides freely available to all (faculty, students, readers).
Computer
They’re in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs.
Networking: A
They obviously represent a lot of work on our part. In return for use, we only
ask the following:
Top Down
 If you use these slides (e.g., in a class) that you mention their source
(after all, we’d like people to use our book!)
Approach
 If you post any slides on a www site, that you note that they are adapted
6th edition
from (or perhaps identical to) our slides, and note our copyright of this Jim Kurose, Keith Ross
material. Addison-Wesley
Thanks and enjoy! JFK/KWR
March 2012
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
2-253
Application Layer
Chapter 2: Application layer
 2.1 Principles of network
 2.6 P2P applications
applications  2.7 Socket programming
 2.2 Web and HTTP with TCP
 2.3 FTP
 2.8 Socket programming
with UDP
 2.4 Electronic Mail
 SMTP, POP3, IMAP
 2.5 DNS
Chapter 2: Application Layer
Our goals:  learn about protocols
 conceptual, by examining popular
implementation application-level
aspects of network protocols
application protocols  HTTP
 transport-layer  FTP
service models  SMTP / POP3 / IMAP
 client-server  DNS
paradigm  programming network
applications
 peer-to-peer
paradigm  socket API
Some network apps
 e-mail  voice over IP
 web  real-time video
 instant messaging conferencing
 remote login  grid computing

 P2P file sharing

 multi-user network
games 

 streaming stored video


clips
Creating a network app
application
transport
write programs that network
data link
 run on (different) end physical

systems
 communicate over network
 e.g., web server software
communicates with
browser software
No need to write software for application
transport
network
network-core devices data link
physical
application
transport
 Network-core devices do network
data link
not run user applications physical

 applications on end
systems allows for rapid
app development,
propagation
Chapter 2: Application layer
 2.1 Principles of network
 2.6 P2P applications
applications  2.7 Socket programming
 2.2 Web and HTTP with TCP
 2.3 FTP
 2.8 Socket programming
with UDP
 2.4 Electronic Mail
 2.9 Building a Web server
 SMTP, POP3, IMAP
 2.5 DNS
Application architectures
 Client-server
 Peer-to-peer (P2P)
 Hybrid of client-server and P2P
Client-server architecture
server:
 always-on host
 permanent IP address
 server farms for scaling
clients:
 communicate with server
client/server
 may be intermittently
connected
 may have dynamic IP
addresses
 do not communicate directly
with each other
Pure P2P architecture
 no always-on server
 arbitrary end systems
directly communicate peer-peer
 peers are intermittently
connected and change IP
addresses

Highly scalable but difficult to


manage
Hybrid of client-server and P2P
Skype
 voice-over-IP P2P application
 centralized server: finding address of remote
party:
 client-client connection: direct (not through
server)
Instant messaging
 chatting between two users is P2P
 centralized service: client presence
detection/location
 user registers its IP address with central
server when it comes online
 user contacts central server to find IP
addresses of buddies
Processes communicating
Process: program running Client process: process
within a host. that initiates
 within same host, two communication
processes communicate Server process: process
using inter-process that waits to be
communication (defined contacted
by OS).
 processes in different  Note: applications with
hosts communicate by P2P architectures have
exchanging messages client processes & server
processes
Sockets
host or host or
 process sends/receives server server
messages to/from its socket
controlled by
 socket analogous to door app developer
process process
 sending process shoves
message out door socket socket
 sending process relies on TCP with
Internet
TCP with
buffers, buffers,
transport infrastructure on variables variables
other side of door which
brings message to socket at
controlled
receiving process by OS

 API: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later)
Addressing processes
 to receive messages,
process must have
identifier
 host device has unique 32-
bit IP address
 Q: does IP address of
host suffice for identifying
the process?
Addressing processes
 to receive messages,  identifier includes both IP
process must have address and port numbers
identifier associated with process on
 host device has unique host.
32-bit IP address  Example port numbers:
 Q: does IP address of  HTTP server: 80
host on which process  Mail server: 25
runs suffice for identifying  to send HTTP message to
the process? gaia.cs.umass.edu web
 A: No, many server:
processes can be  IP address: 128.119.245.12
running on same host  Port number: 80
 more shortly…
App-layer protocol defines
 Types of messages Public-domain protocols:
exchanged,  defined in RFCs
 e.g., request, response  allows for
 Message syntax: interoperability
 what fields in messages &  e.g., HTTP, SMTP
how fields are delineated
Proprietary protocols:
 Message semantics
 e.g., Skype
 meaning of information in
fields
 Rules for when and how
processes send & respond to
messages
What transport service does an app need?
Data loss Throughput
 some apps (e.g., audio) can  some apps (e.g., multimedia)
tolerate some loss require minimum amount of
 other apps (e.g., file throughput to be “effective”
transfer, telnet) require  other apps (“elastic apps”)
100% reliable data transfer make use of whatever
throughput they get
Timing Security
 some apps (e.g.,  Encryption, data integrity, …
Internet telephony,
interactive games)
require low delay to be
“effective”
Transport service requirements of common apps

Application Data loss Throughput Time Sensitive

file transfer no loss elastic no


e-mail no loss elastic no
Web documents no loss elastic no
real-time audio/video loss-tolerant audio: 5kbps-1Mbps yes, 100’s msec
video:10kbps-5Mbps
stored audio/video loss-tolerant same as above yes, few secs
interactive games loss-tolerant few kbps up yes, 100’s msec
instant messaging no loss elastic yes and no
Internet transport protocols services
UDP service:
TCP service:
unreliable data transfer
 connection-oriented: setup
between sending and
required between client and
receiving process
server processes
 does not provide:
 reliable transport between
connection setup,
sending and receiving process
reliability, flow control,
 flow control: sender won’t congestion control, timing,
overwhelm receiver throughput guarantee, or
 congestion control: throttle security
sender when network overloaded
 does not provide: timing, Q: why bother? Why is there
minimum throughput guarantees,
a UDP?
security
Internet apps: application, transport protocols
Application Underlying
Application layer protocol transport protocol

e-mail SMTP [RFC 2821] TCP


remote terminal access Telnet [RFC 854] TCP
Web HTTP [RFC 2616] TCP
file transfer FTP [RFC 959] TCP
streaming multimedia HTTP (eg Youtube), TCP or UDP
RTP [RFC 1889]
Internet telephony SIP, RTP, proprietary
(e.g., Skype) typically UDP

You might also like