Computer Networking
Computer Networking
(Autonomous)
Dundigal, Hyderabad - 500 043
COMPUTER NETWORKS
Prepared by:
Dr. Y Mohana Roopa
Mr. P Ravinder
Ms. N M Deepika
Ms. B Jaya Vijaya
1
Sensitivity: Public
UNIT-1
2
Sensitivity: Public
Introduction to Computer Networks
INTRODUCTION TO COMPUTER
NETWORKS
3
Sensitivity: Public
Introduction to Computer Networks
Computer Networks
Computer
network connects two
or more autonomous
computers.
The can be
computers located
geographically
anywhere.
4
Sensitivity: Public
Introduction to Computer Networks
5
Sensitivity: Public
Introduction to Computer Networks
Applications of Networks
Resource Sharing
Hardware (computing resources, disks, printers)
Software (application software)
Information Sharing
Easy accessibility from anywhere (files,
databases)
Search Capability (WWW)
Communication
Email
Message broadcast
Remote computing 6
Distributed processing (GRID Computing)
Sensitivity: Public
Introduction to Computer Networks
Network Topology
The network
topology defines
the
which way in
computers,
printers, and other
devices are connected.
A network topology
describes the layout of
the wire and devices as
well as the paths used
by data transmissions.
7
Sensitivity: Public
Introduction to Computer Networks
Bus Topology
Commonly referred to
as a linear bus, all the
devices on a bus
topology are connected
by one single cable.
8
Sensitivity: Public
Introduction to Computer Networks
Ring Topology
A frame travels around the ring,
stopping at each node. If a node
wants to transmit data, it adds the
data as well as the destination
address to the frame.
The frame then continues around
the ring until it finds the
destination node, which takes the
data out of the frame.
Single ring – All the devices on
the network share a single cable
Dual ring – The dual ring topology
allows data to be sent in both 10
Sensitivity: Public directions.
Introduction to Computer Networks
Mesh Topology
The mesh topology
connects all devices
(nodes) to each other
for redundancy and
fault tolerance.
It is used in WANs to
interconnect LANs and
for mission critical
networks like those
used by banks and
financial institutions.
Implementing the mesh
topology is expensive
and difficult. 11
Sensitivity: Public
Introduction to Computer Networks
Network Components
Physical Media
Interconnecting Devices
Computers
Networking Software
Applications
12
Sensitivity: Public
Introduction to Computer Networks
Networking Media
Networking media can
be defined simply as
the means by which
signals (data) are sent
from one computer to
another (either by cable
or wireless means).
13
Sensitivity: Public
Introduction to Computer Networks
Networking Devices
HUB, Switches, Routers,
Wireless Access Points,
Modems etc.
14
Sensitivity: Public
Introduction to Computer Networks
16
Sensitivity: Public
Introduction to Computer Networks
Applications
E-mail
Searchable Data (Web Sites)
E-Commerce
News Groups
Internet Telephony (VoIP)
Video Conferencing
Chat Groups
Instant Messengers
Internet Radio
17
Sensitivity: Public
Networking
Computer network
A collection of computing devices connected in
order to communicate and share resources
Connections between computing devices can be
physical using wires or cables or wireless using
radio waves or infrared signals
18
Sensitivity: Public
Networking
Node (host)
Any device on a network
Data transfer rate (bandwidth)
The speed with which data is moved from
one place to another on a network
19
Sensitivity: Public
Networking
Computer networks have opened up an
entire frontier in the world of computing
called the client/server model
20
Sensitivity: Public
Networking
Protocol
A set of rules that defines how data is formatted and
processed on a network
File server
A computer dedicated to storing and managing files for
network users
Web server
A computer dedicated to responding to requests for web
pages
P2P model
A decentralized approach that shares resources and
responsibilities among many “peer” computers
21
Sensitivity: Public
Types of Networks
Local-area network (LAN)
A network that connects a relatively small number
of machines in a relatively close geographical area
Ring topology connects all nodes in a closed
loop on which messages travel in one direction
Star topology centers around one node to
which all others are connected and through which all
messages are sent
Bus topology nodes are connected to a single
communication line that carries messages in both
directions
22
Sensitivity: Public
Types of Networks
Ethernet
The industry standard bus technology for
local-area networks
23
Sensitivity: Public
Types of Networks
Wide-area network (WAN)
A network that connects local-area networks over
a potentially large geographic distance
Metropolitan-area network (MAN)
The communication infrastructures that have been
developed in and around large cities
Gateway
One particular set up to handle all communication
going between that LAN and other networks
24
Sensitivity: Public
Types of Networks
25
Sensitivity: Public
Types of Networks
Internet
A wide area network that spans the planet
26
Sensitivity: Public
Internet Connections
Wireless network
A network in which devices communicate with
other nodes through a wireless access point
Bluetooth
A technology used for wireless communication
over short distances
27
Sensitivity: Public
Internet Connections
Internet backbone
A set of high-speed networks that carry Internet
traffic, provided by companies such as AT&T,
Verizon, GTE, British Telecom, and IBM
Internet service provider (ISP)
An organization providing access to the
Internet
28
Sensitivity: Public
Internet Connections
Various technologies available to connect a home
computer to the Internet
Phone modem converts computer data into an analog
audio signal for transfer over a telephone line, and then
a modem at the destination converts it back again into
data
Digital subscriber line (DSL) uses regular copper
phone lines to transfer digital data to and from the
phone company’s central office
Cable modem uses the same line that your cable TV
signals come in on to transfer the data back and forth
29
Sensitivity: Public
Internet Connections
Broadband
A connection in which transfer speeds are faster
than 768 kilobits per second
– DSL connections and cable modems are broadband
connections
– The speed for downloads (getting data from the
Internet to your home computer) may not be the same
as uploads (sending data from your home computer
to the Internet)
30
Sensitivity: Public
Packet Switching
Packet
A unit of data sent across a network
Router
A network device that directs a packet between networks
toward its final destination
Packet switching
Messages are divided into fixed-sized, numbered packets;
packets are individually routed to their destination, then
reassembled
31
Sensitivity: Public
Packet Switching
32
Sensitivity: Public
Open Systems
A logical progression...
Proprietary system
A system that uses technologies kept private by a
particular commercial vendor
Interoperability
The ability of software and hardware on multiple
machines and from multiple commercial vendors to
communicate
Open systems
Systems based on a common model of network
architecture and a suite of protocols used in its
implementation
33
Sensitivity: Public
Open Systems
Open Systems
Interconnection Reference
Model
A seven-layer logical break
down of network interaction to
facilitate communication
standards
Each layer deals with a
particular aspect of network
communication
34
Sensitivity: Public
Network Protocols
• Network protocols are layered such that
each one relies on the protocols that
underlie it
• Sometimes referred to as a protocol
stack
35
Sensitivity: Public
TCP/IP
Transmission Control Protocol (TCP)
Software that breaks messages into packets,
hands them off to the IP software for delivery, and
then orders and reassembles the packets at their
destination
Internet Protocol (IP)
Software that deals with the routing of packets
through the maze of interconnected networks to
their final destination
36
Sensitivity: Public
TCP/IP
User Datagram Protocol (UDP)
An alternative to TCP that is faster but less reliable
Ping
A program used to test whether a particular
network computer is active and reachable
Traceroute
A program that shows the route a packet takes
across the Internet
37
Sensitivity: Public
Traceroute in Action
38
Sensitivity: Public
High-Level Protocols
Other protocols build on TCP/IP protocol suite
Simple Mail Transfer Protocol (SMTP) used to specify
transfer of electronic mail
File Transfer Protocol (FTP) allows a user to transfer
files to and from another computer
Telnet used to log onto one computer from another
Hyper Text Transfer Protocol (http) allows exchange
of Web documents
40
Sensitivity: Public
MIME Types
MIME type
A standard for defining the format of files
that are included as email attachments or on
websites
41
Sensitivity: Public
Firewalls
Firewall
A gateway machine and its software that protects
a network by filtering the traffic it allows
Access control policy
A set of rules established by an organization that
specifies what types of network communication
are permitted and denied
43
Sensitivity: Public
Network Addresses
Hostname
A name made up of words separated by dots that
uniquely identifies a computer on the Internet
IP address
An address made up of four one-byte numeric
values separated by dots that uniquely identifies a
computer on the Internet
45
Sensitivity: Public
Network Addresses
IPv4
The last block was assigned in 2011
IPv6
32 bits organized into 4 groups of 8
FE80:0000:0000:0000:0202:B3FF:FE1E:8329
47
Sensitivity: Public
Domain Name System
Domain name system (DNS)
A distributed system for managing hostname
resolution
Domain name server
A computer that attempts to translate a hostname
into an IP address
Domain Squatting
Ransoming domain names
Should the tables containing hostname/IP mappings be
sorted or unsorted? Why?
48
Sensitivity: Public
Domain Name System
49
Sensitivity: Public
Domain Name System
Organizations based in countries other than the United
States use a top-level domain that corresponds to
their two-letter country codes
Have you
emailed
someone
in another
country?
50
Sensitivity: Public
Domain Name System
51
Sensitivity: Public
Who Controls the Internet?
Control of IP addresses and domain names
• Internet began as ARPANET, a project of the US
Dept. of Defense
• Control subcontracted to ICANN in 1998
•US gov’t to further reduce role as early as 2015
FCC proposal
• Would allow ISPs to provide “premium” access to
certain customers, perhaps by deliberately slowing
down data transfer for others
• Net neutrality - The principle that ISPs should deliver
data to everyone equally, as fast as the technology
allows
52
Sensitivity: Public
Cloud Computing
• Public clouds are accessible by any subscriber
• Private clouds are established for a specific group or
organization
• Community clouds are shared among two or more
organizations with the same needs
• Hybrid clouds are some combination of the others
53
Sensitivity: Public
Ethical Issues
Effects of Social Networking
What are some examples of popular social
networking sites?
Who uses social networking?
What are the benefits and the disadvantages of
using these social networking sites?
Do the benefits of social networking out weigh
the potential costs?
54
Sensitivity: Public
Brief History of Internet
55
Sensitivity: Public
Internet Impact
• Check weather
• Buy goods
• Play music
• Find the shortest route
• Give a lecture…
56
Sensitivity: Public
The Incredible Growth
80000000
70000000
60000000
50000000
40000000
30000000
20000000
10000000
0
Approximate Number of Computers on the Internet
57
Sensitivity: Public
Brief Internet History
• Batch Environment - 1950s
– No direct interaction between users and their
programs during execution
• Time Sharing - 1960s
58
Sensitivity: Public
Brief Internet History (cont.)
Time Sharing:
Dumb terminals connected to
a central computer system
59
Sensitivity: Public
Brief Internet History (cont.)
• Late 1960s: ARPANET
– ARPA (Advanced Research Projects Agency)
commissioned an experimental computer network
• 1970s:
– Distributed Processing: minicomputers;
• Communication between neighbor processors
and applications via networks
– Growth of ARPANET and Invention of Email
60
Sensitivity: Public
Brief Internet History (cont.)
• 1980s:
– WAN and LAN
– Prototype Internet
– TCP/IP:Allows different networks to
interconnect
61
Sensitivity: Public
A LAN Example
E
D
A
C
62
Sensitivity: Public
Internet: a network of networks
The Internet
63
Sensitivity: Public
Brief Internet History (cont.)
• 1990s: WWW
– HTTP and HTML
– Marc Andreessen: Mosaic (all-in-one solution)
– Commercial traffic allowed ECommerce
64
Sensitivity: Public
Networking Questions
• Over what medium?
• At what speed?
• How to address computers?
• Which path?
• How to handle (detect & recover) errors?
• What services?
• How to address documents?
• What data format?
65
Sensitivity: Public
Outline
• Introduction
• OSI Model
• TCP/IP Model
• IPv4 vs. IPv6
66
Sensitivity: Public
What is a Protocol?
• A standard that allows entities (i.e.
application programs) from
different systems to communicate
• Shared conventions for communicating
information
• Includes syntax, semantics, and timing
67
Sensitivity: Public
Standardized Protocol
Architectures
• Vendors like standards because they make their
products more marketable
• Customers like standards because they enable
products from different vendors to interoperate
• Two protocol standards are well-known:
– TCP/IP: widely implemented
– OSI: less used, still useful for
modeling/conceptualizing
68
Sensitivity: Public
Internet Standards
• Email related standards
– IMAP, POP, X.400, SMTP, CMC, MIME, binhex, uuencode
• Web related standards
– http, CGI, html/xml/vrml/sgml
• Internet directory standards
– X.500, LDAP
• Application standards
– http, FTP, telnet, gopher,
wais
• Videoconferencing standards
– H.320, H.323, Mpeg-1, Mpeg-2
69
Sensitivity: Public
*Telecommunication
Standards
Organizations
• International Telecommunications Union - Telecommunication
Standardization Sector (ITU-TSS). Formerly called the Consultative
Committee on International Telegraph and Telephone (CCITT)
• International Organization for Standards (ISO). Member of the ITU,
makes technical recommendations about data communications
interfaces.
• American National Standards Institute (ANSI)
• Institute of Electrical and Electronics Engineers (IEEE)
• Internet Engineering Task Force (IETF)
• Electronic Industries Association (EIA)
• National Institute of Standards and Technology (NIST)
• National Exchange Carriers Association (NECA)
• Corporation for Open Systems (COS)
• Electronic Data Interchange -(EDI) of Electronic Data Interchange
for Administration Commerce and Transport (EDIFACT).
70
Sensitivity: Public
*Internet Engineering Task
Force
A protocol proposed by a vendor
72
Sensitivity: Public
Why Study OSI?
• Still an excellent model for conceptualizing
and understanding protocol architectures
• Key points:
– Modular
– Hierarchical
– Boundaries between layers=interfaces
73
Sensitivity: Public
74
Sensitivity: Public
Headers and Data
75
Sensitivity: Public
OSI Lower Layers
• Physical – Layer 1
• Data Link – Layer 2
• Network – Layer 3
76
Sensitivity: Public
OSI Physical Layer
• Responsible for transmission of bits
• Always implemented through hardware
• Encompasses mechanical, electrical, and
functional interfaces
• e.g. RS-232
77
Sensitivity: Public
*Physical-layer Implementation
78
Sensitivity: Public
OSI Data Link Layer
• Responsible for error-free, reliable
transmission of data
• Flow control, error correction
• e.g. HDLC
79
Sensitivity: Public
OSI Data Link Layer
80
Sensitivity: Public
OSI Network Layer
• Responsible for routing of messages
through network
• Concerned with type of switching used
(circuit v. packet)
• Handles routing between networks, as well
as through packet-switching networks
81
Sensitivity: Public
Network Access Layer
• Concerned with exchange of data between
computer and network
• Includes addressing, routing, prioritizing,
etc
• Different networks require different software at
this layer
• Example: X.25 standard for network access
procedures on packet-switching networks
82
Sensitivity: Public
OSI Upper Layers
• Transport
• Session
• Presentation
• Application
83
Sensitivity: Public
OSI Transport Layer
• Isolates messages from lower and upper
layers
• Breaks down message size
• Monitors quality of communications
channel
• Selects most efficient communication
service necessary for a given transmission
84
Sensitivity: Public
Transport Layer
• Concerned with reliable transfer of
information between applications
• Independent of the nature of the
application
• Includes aspects like flow control and error
checking
85
Sensitivity: Public
OSI Session Layer
• Establishes logical connections between
systems
• Manages log-ons, password exchange,
log-offs
• Terminates connection at end of
session
86
Sensitivity: Public
OSI Presentation Layer
• Provides format and code conversion
services
• Examples
– File conversion from ASCII to EBDIC
– Invoking character sequences to generate
bold, italics, etc on a printer
87
Sensitivity: Public
OSI Application Layer
• Provides access to network for end-user
• User’s capabilities are determined by what
items are available on this layer
• Logic needed to support various
applications
• Each type of application (file transfer,
remote access) requires different software
on this layer
88
Sensitivity: Public
Application Viewpoint of a
Network
• Distributed data communications involves
three primary components:
– Networks
– Computers
– Applications
• Three corresponding layers
– Network access layer
– Transport layer
– Application layer
89
Sensitivity: Public
TCP/IP
• Transmission control Protocol/Internet Protocol
• Developed by DARPA
• No official protocol standard
• Can identify five layers
– Application
– Host-to-Host (transport)
– Internet
– Network Access
– Physical
90
Sensitivity: Public
An OSI View of TCP/IP
Internet Model OSI Model F-D’s Model
Application
(http, telnet, snmp, Application
smtp, nfs, layer
ftp)
Transport
(TCP, Network
UDP) layer
Internet (IPv4/IPv6)
(HDLC) Data Link layer
Network Access
Physical layer
Physical layer
91
Sensitivity: Public
Sender Receiver
Application Application
Layer HTTP Request Layer HTTP Request
Transpor Request
Transpor Request
TCP HTTP TCP HTTP
t Layer t Layer
Network Request
Network Request
IP TCP HTTP IP TCP HTTP
Layer Layer
Physical Physical
Layer Layer
92
Sensitivity: Public
TCP/IP Network Access Layer
• Exchange of data between end system and
network
• Address of host and destination
• Prioritization of transmission
• Software at this layer depends on network
(e.g.
X.25 vs. Ethernet)
• Segregation means that no other software
needs to be concerned about net
specifics
93
Sensitivity: Public
TCP/IP Internet Layer
• An Internet is an interconnection of two or more
networks
• Internet layer handles tasks similar to network
access layer, but between networks rather than
between nodes on a network
• Uses IP for addressing and routing across
networks
• Implemented in workstations and routers
94
Sensitivity: Public
TCP/IP Transport Layer
• Also called host-to-host layer
• Reliable exchange of data between
applications
• Uses TCP protocols for
transmission
95
Sensitivity: Public
TCP/IP Application Layer
• Logic needed to support variety of applications
• Separate module supports each type of
application (e.g. file transfer)
– FTP
– HTTP
– Telnet
– News
– SMTP
96
Sensitivity: Public
*TCP/IP
Application TELNET FTP SMTP DNS SNMP
Presentation DHCP
Session
RIP
IGMP ICMP
ARP
Data link
Ethernet Token Bus Token Ring FDDI
97
Physical
Sensitivity: Public
TCP & UDP
• Most TCP/IP applications use TCP for transport
layer
• TCP provides a connection (logical association)
between two entities to regulate flow check
errors
• UDP (User Datagram Protocol) does not
maintain a connection, and therefore does not
guarantee delivery, preserve sequences, or
protect against duplication
98
Sensitivity: Public
Internetworking
• Interconnected networks, usually implies
TCP/IP
• Can appear to users as a single large
network
• The global Internet is the largest example,
but intranets and extranets are also
examples
99
Sensitivity: Public
Internetworking
100
Sensitivity: Public
TCP Segment (TCP PDU)
• Source port (16 bits)
• Destination port (16 bits)
• Sequence number (32 bits)
• Acknowledgment number (32 bits)
• Data Offset (4 bits)
• Reserved (6 bits)
• Flags (6 bits) : URG, ACK, PSH, RST, SYN, FIN
• Window (16 bits)
• Checksum (16 bits)
• Urgent Pointer (16 bits)
• Options (variable)
The size of TCP header is 192 bits = 24 byes.
101
Sensitivity: Public
IPv4 and IPv6
• IP (IPv4) provides for 32-bit source and
destination addresses, using a 192-bit
header
• IPv6 (1996 standard) provides for 128-bit
addresses, using a 320-bit header.
• Migration to IPv6 will be a very slow
process
102
Sensitivity: Public
*History of IPng Effort
• By the Winter of 1992 the Internet community had developed four separate
proposals for IPng. These were "CNAT", "IP Encaps", "Nimrod", and
"Simple CLNP". By December 1992 three more proposals followed; "The P
Internet Protocol" (PIP), "The Simple Internet Protocol" (SIP) and "TP/IX". In
the Spring of 1992 the "Simple CLNP" evolved into "TCP and UDP with
Bigger Addresses" (TUBA) and "IP Encaps" evolved into "IP Address
Encapsulation" (IPAE).
• By the fall of 1993, IPAE merged with SIP while still maintaining the name
SIP. This group later merged with PIP and the resulting working group
called themselves "Simple Internet Protocol Plus" (SIPP). At about the
same time the TP/IX Working Group changed its name to "Common
Architecture for the Internet" (CATNIP).
• The IPng area directors made a recommendation for an IPng in July of
1994
[RFC 1752].
• The formal name of IPng is IPv6
103
Sensitivity: Public
Data and Signals
Sensitivity: Public 3C.o1p0y4right © The McGraw-Hill Companies, Inc. Permission required for reproduction or
3-4 TRANSMISSION IMPAIRMENT
Signals travel through transmission media, which are not perfect. The imperfection
causes signal impairment. This means that the signal at the beginning of the
medium is not the same as the signal at the end of the medium. What is sent is not
what is received. Three causes of impairment are attenuation, distortion, and noise.
Attenuation
Distortion
Noise
105
Sensitivity: Public
Figure 3.25 Causes of impairment
106
Sensitivity: Public
Attenuation
107
Sensitivity: Public
Measurement of Attenuation
dB = 10log10P2/P1
P1 - input signal
P2 - output signal
108
Sensitivity: Public
Figure 3.26 Attenuation
109
Sensitivity: Public
Example 3.26
Suppose a signal travels through a transmission medium and its power is reduced
to one-half. This means that P2 is (1/2)P1. In this case, the attenuation (loss of
power) can be calculated as
110
Sensitivity: Public
Example 3.27
A signal travels through an amplifier, and its power is increased 10 times. This
means that P2 = 10P1 . In this case, the amplification (gain of power) can be
calculated as
111
Sensitivity: Public
Example 3.28
One reason that engineers use the decibel to measure the changes in the strength
of a signal is that decibel numbers can be added (or subtracted) when we are
measuring several points (cascading) instead of just two. In Figure 3.27 a signal
travels from point 1 to point 4. In this case, the decibel value can be calculated as
112
Sensitivity: Public
Figure 3.27 Decibels for Example 3.28
113
Sensitivity: Public
Example 3.29
Sometimes the decibel is used to measure signal power in milliwatts. In this case,
it is referred to as dBm and is calculated as dBm = 10 log10 Pm , where Pm is the
power in milliwatts. Calculate the power of a signal with dBm = −30.
Solution
We can calculate the power in the signal as
114
Sensitivity: Public
Example 3.30
The loss in a cable is usually defined in decibels per kilometer (dB/km). If the
signal at the beginning of a cable with −0.3 dB/km has a power of 2 mW, what is
the power of the signal at 5 km?
Solution
The loss in the cable in decibels is 5 × (−0.3) = −1.5 dB. We can calculate the
power as
115
Sensitivity: Public
Distortion
• Means that the signal changes its form or
shape
• Distortion occurs in composite signals
• Each frequency component has its own
propagation speed traveling through a
medium.
• The different components therefore arrive
with different delays at the receiver.
• That means that the signals have different
phases at the receiver than they did at
the source.
116
Sensitivity: Public
Figure 3.28
Distortion
117
Sensitivity: Public
Noise
• There are different types of noise
– Thermal - random noise of electrons in the
wire creates an extra signal
– Induced - from motors and appliances,
devices act are transmitter antenna and
medium as receiving antenna.
– Crosstalk - same as above but between
two wires.
– Impulse - Spikes that result from power
lines, lighning, etc.
118
Sensitivity: Public
Figure 3.29 Noise
119
Sensitivity: Public
Signal to Noise Ratio (SNR)
120
Sensitivity: Public
Example 3.31
The power of a signal is 10 mW and the power of the noise is 1 μW; what are the
values of SNR and SNRdB ?
Solution
The values of SNR and SNRdB can be calculated as follows:
121
Sensitivity: Public
Example 3.32
122
Sensitivity: Public
Figure 3.30 Two cases of SNR: a high SNR and a low SNR
123
Sensitivity: Public
Transmission Media
124
Sensitivity: Public
Overview
• Guided - wire
• Unguided - wireless
• Characteristics and quality determined by
medium and signal
• For guided, the medium is more
important
• For unguided, the bandwidth produced by
the antenna is more important
• Key concerns are data rate and distance 125
Sensitivity: Public
Design Factors
• Bandwidth
– Higher bandwidth gives higher data rate
• Transmission impairments
– Attenuation
• Interference
• Number of receivers
– In guided media
– More receivers (multi-point) introduce more
attenuation
126
Sensitivity: Public
Electromagnetic Spectrum
127
Sensitivity: Public
Guided Transmission Media
• Twisted Pair
• Coaxial cable
• Optical fiber
128
Sensitivity: Public
Transmission Characteristics of
Guided Media
Frequency Typical Typical Repeater
Range Attenuation Delay Spacing
Twisted pair 0 to 3.5 kHz 0.2 dB/km @ 50 µs/km 2 km
(with loading) 1 kHz
129
Sensitivity: Public
Twisted Pair
130
Sensitivity: Public
Twisted Pair - Applications
• Most common medium
• Telephone network
– Between house and local exchange
(subscriber loop)
• Within buildings
– To private branch exchange (PBX)
• For local area networks (LAN)
– 10Mbps or 100Mbps
131
Sensitivity: Public
Twisted Pair - Pros and Cons
• Cheap
• Easy to work with
• Low data rate
• Short range
132
Sensitivity: Public
Twisted Pair - Transmission
Characteristics
• Analog
– Amplifiers every 5km to 6km
• Digital
– Use either analog or digital signals
– repeater every 2km or 3km
• Limited distance
• Limited bandwidth (1MHz)
• Limited data rate (100MHz)
• Susceptible to interference and noise 133
Sensitivity: Public
Near End Crosstalk
• Coupling of signal from one pair to another
• Coupling takes place when transmit signal
entering the link couples back to
receiving pair
• i.e. near transmitted signal is picked up by
near receiving pair
134
Sensitivity: Public
Unshielded and Shielded TP
• Unshielded Twisted Pair (UTP)
– Ordinary telephone wire
– Cheapest
– Easiest to install
– Suffers from external EM interference
• Shielded Twisted Pair (STP)
– Metal braid or sheathing that reduces
interference
– More expensive
Sensitivity: Public
– Harder to handle (thick, heavy) 135
UTP Categories
• Cat 3
– up to 16MHz
– Voice grade found in most offices
– Twist length of 7.5 cm to 10 cm
• Cat 4
– up to 20 MHz
• Cat 5
– up to 100MHz
– Commonly pre-installed in new office buildings
– Twist length 0.6 cm to 0.85 cm
• Cat 5E (Enhanced) –see tables
• Cat 6
• Cat 7
136
Sensitivity: Public
Comparison of Shielded and
Un s h i e ld e d
Atte nu atio n (dB per 100 m)
Frequency Category 3 Category 5 150-ohm Category 3 Category 5 150-ohm
(MHz) UTP UTP STP UTP UTP STP
Bandwidth 16 MHz 100 MHz 100 MHz 200 MHz 600 MHz
138
Sensitivity: Public
Coaxial Cable
139
Sensitivity: Public
Coaxial Cable Applications
• Most versatile medium
• Television distribution
– Ariel to TV
– Cable TV
• Long distance telephone transmission
– Can carry 10,000 voice calls simultaneously
– Being replaced by fiber optic
• Short distance computer systems links
• Local area networks 140
Sensitivity: Public
Coaxial Cable - Transmission
Characteristics
• Analog
– Amplifiers every few km
– Closer if higher frequency
– Up to 500MHz
• Digital
– Repeater every 1km
– Closer for higher data rates
141
Sensitivity: Public
Optical Fiber
142
Sensitivity: Public
Optical Fiber - Benefits
• Greater capacity
– Data rates of hundreds of Gbps
• Smaller size & weight
• Lower attenuation
• Electromagnetic isolation
• Greater repeater spacing
– 10s of km at least
143
Sensitivity: Public
Optical Fiber - Applications
• Long-haul trunks
• Metropolitan trunks
• Rural exchange trunks
• Subscriber loops
• LANs
144
Sensitivity: Public
Optical Fiber - Transmission
Characteristics
• Act as wave guide for 1014 to 1015 Hz
– Portions of infrared and visible spectrum
• Light Emitting Diode (LED)
– Cheaper
– Wider operating temp range
– Last longer
• Injection Laser Diode (ILD)
– More efficient
– Greater data rate 145
•
Sensitivity: Public
Optical Fiber Transmission
Modes
146
Sensitivity: Public
Frequency Utilization for Fiber
Wavelength (in
Applications
Frequency Band Fiber type Application
vacuum) range (THz)
range (nm) label
148
Sensitivity: Public
Wireless Transmission
Frequencies
• 2GHz to 40GHz
– Microwave
– Highly directional
– Point to point
– Satellite
• 30MHz to 1GHz
– Omnidirectional
– Broadcast radio
• 3 x 1011 to 2 x 1014
– Infrared 149
Sensitivity: Public – Local
UNIT II
INTRODUCTION TO DATA
LINK LAYER
150
Sensitivity: Public
Link layer
our goals:
• understand principles behind link layer
services:
– error detection, correction
– sharing a broadcast channel: multiple
access
– link layer addressing
– local area networks: Ethernet, VLANs
• instantiation, implementation of various
link layer technologies
151
Sensitivity: Public
Link layer, LANs: outline
1. introduction, services 6. LAN switches
2. error detection, 7. a day in the life of a
correction web request
3. multiple access
protocols
4. link-layer
addressing
5. Ethernet, LANs
152
Sensitivity: Public
Link layer: introduction
terminology:
• hosts and routers: nodes
• communication channels that global ISP
connect adjacent nodes along
communication path: links
– wired links
– wireless links
– LANs
• layer-2 packet: frame,
encapsulates datagram
154
Sensitivity: Public
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?
155
Sensitivity: Public
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
156
Sensitivity: Public
Where is the link layer
implemented?
• in each and every host
• link layer implemented in
“adaptor” (aka network
interface card NIC)
– Ethernet card, 802.11 application
transport
card network
link
cpu memory
– implements link,
physical layer host
bus
controller
• attaches into host’s link
(e.g., PCI)
physical
system buses physical
transmission
• combination of
hardware, network adapter
card
software, firmware
157
Sensitivity: Public
Adaptors communicating
datagram datagram
controller controller
frame
159
Sensitivity: Public
Error detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header
fields
otherwise
160
Sensitivity: Public
Parity checking
single bit parity: two-dimensional bit parity:
detect single bit detect and correct single bit errors
errors
161
Sensitivity: Public
Internet checksum (review)
goal: detect “errors” (e.g., flipped bits) in transmitted
packet (note: used at transport layer only)
sender: receiver:
• treat segment contents • compute checksum of
as sequence of 16-bit received segment
integers • check if computed
• checksum: addition checksum equals
(1’s complement sum) checksum field value:
of segment contents – NO - error
• sender puts checksum detected
value into UDP – YES - no error
checksum field detected. But maybe
errors nonetheless?
162
Sensitivity: Public
Cyclic redundancy check
• more powerful error-detection coding
• view data bits, D, as a binary number
• choose r+1 bit pattern (generator), G
• goal: choose r CRC bits, R, such that
– <D,R> exactly divisible by G (modulo 2)
– receiver knows G, divides <D,R> by G. If
non-zero remainder: error detected!
– can detect all burst errors less than r+1 bits
• widely used in practice (Ethernet, 802.11
WiFi, ATM)
163
Sensitivity: Public
CRC example
want:
D.2r XOR R = nG
equivalently:
D.2r = nG XOR R
equivalently:
if we divide D.2r
by G, want
remainder R to
satisfy:
D.2r
R= ]
remainder[ G
164
Sensitivity: Public
Cyclic Redundancy Check
(CRC)
Properties of Generator Polynomial
In general, it is possible to prove that the
following types of errors can be detected by a
G(x) with the stated properties
All single-bit errors, as long as the xk and x0 terms
have nonzero coefficients.
All double-bit errors, as long as G(x) has a factor
with at least three terms.
Any odd number of errors, as long as G(x) contains
the factor (x+1).
Any “burst” error (i.e., sequence of consecutive
error bits) for which the length of the burst is less
than k bits. (Most burst errors of larger than k bits
can also be detected.)
165
Sensitivity: Public
Cyclic Redundancy Check
(CRC)
Six generator polynomials that have become
international standards are:
CRC-8 = x8+x2+x+1
CRC-10 = x10+x9+x5+x4+x+1
CRC-12 = x12+x11+x3+x2+x+1
CRC-16 = x16+x15+x2+1
CRC-CCITT = x16+x12+x5+1
CRC-32 =
x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+
x+1
166
Sensitivity: Public
Link layer, LANs: outline
1. introduction, services 6. LAN switches
2. error detection, 7. a day in the life of a
correction web request
3. multiple access
protocols
4. link-layer
addressing
5. Ethernet, LANs
167
Sensitivity: Public
Multiple access links, protocols
two types of “links”:
• point-to-point
– PPP for dial-up access
– point-to-point link between Ethernet switch, host
169
Sensitivity: Public
An ideal multiple access protocol
given: broadcast channel of rate R bps
desiderata:
1.when one node wants to transmit, it can send
at rate R.
2.when M nodes want to transmit, each can
send at average rate R/M
3. fully decentralized:
• no special node to coordinate transmissions
• no synchronization of clocks, slots
4. simple
170
Sensitivity: Public
MAC protocols: taxonomy
three broad classes:
• channel partitioning
– divide channel into smaller “pieces” (time slots, frequency,
code)
– allocate piece to node for exclusive use
• random access
– channel not divided, allow collisions
– “recover” from collisions
• “taking turns”
– nodes take turns, but nodes with more to send can take
longer turns
171
Sensitivity: Public
Channel partitioning MAC protocols:
TDMA
TDMA: time division multiple access
• access to channel in "rounds"
• each station gets fixed length slot
(length = pkt trans time) in each round
• unused slots go idle
• example: 6-station LAN, 1,3,4 have pkt,
slots 2,5,6 idle
6-slot 6-slot
frame frame
1 3 4 1 3 4
172
Sensitivity: Public
Channel partitioning MAC protocols:
FDMA
FDMA: frequency division multiple access
• channel spectrum divided into frequency bands
• each station assigned fixed frequency band
• unused transmission time in frequency bands go idle
• example: 6-station LAN, 1,3,4 have pkt, frequency bands
2,5,6 idle
frequency bands
FDM cable
173
Sensitivity: Public
Random access protocols
• when node has packet to send
– transmit at full channel data rate R.
– no a priori coordination among nodes
• two or more transmitting nodes ➜
“collision”,
• random access MAC protocol specifies:
– how to detect collisions
– how to recover from collisions (e.g., via
delayed retransmissions)
• examples of random access MAC
protocols:
– slotted ALOHA
– ALOHA
– CSMA, CSMA/CD, CSMA/CA
174
Sensitivity: Public
Slotted ALOHA
assumptions: operation:
• all frames same size • when node obtains fresh
frame, transmits in next slot
• time divided into equal
– if no collision: node can
size slots (time to
send new frame in
transmit 1 frame) next slot
• nodes start to transmit – if collision: node
only slot beginning retransmits frame in
• nodes are each subsequent slot
synchronized with prob. p until
success
• if 2 or more nodes
transmit in slot, all nodes
detect collision 175
Sensitivity: Public
Slotted ALOHA
node 1 1 1 1 1
node 2 2 2 2
node 3 3 3 3
C E C S E C E S S
Pros: Cons:
• single active node can • collisions, wasting slots
continuously transmit at • idle slots
full rate of channel • nodes may be able to
• highly decentralized: detect collision in
only slots in nodes need less than time to
to be in sync transmit packet
• simple • clock synchronization
176
Sensitivity: Public
Slotted ALOHA: efficiency
!
• prob that given node has .3at7 best:
success in a slot = used for useful
p(1- p)N-1 channel
transmissions
• prob that any node has 37% of time!
a
177
success = Np(1-p)N-1
Sensitivity: Public
Pure (unslotted) ALOHA
• unslotted Aloha: simpler, no synchronization
• when frame first arrives
– transmit immediately
• collision probability increases:
– frame sent at t0 collides with other frames sent
in [t0-1,t0+1]
178
Sensitivity: Public
Pure ALOHA efficiency
P(success by given node) = P(node transmits) .
P(no other node transmits in [t0-1,t0] .
P(no other node transmits in [t0-1,t0]
= p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)
= 1/(2e) = .18
even worse than slotted Aloha!
179
Sensitivity: Public
CSMA (carrier sense multiple
access)
CSMA: listen before transmit:
if channel sensed idle: transmit entire frame
• if channel sensed busy, defer transmission
180
Sensitivity: Public
CSMA collisiospnatiasl layout of
nodes
• collisions can still
occur: propagation
delay means
two nodes may not
hear each other’s
transmission
• collision: entire packet
transmission time
wasted
– distance & propagation
delay play role in in
determining collision
probability
181
Sensitivity: Public
CSMA/CD (collision detection)
CSMA/CD: carrier sensing, deferral as in CSMA
– collisions detected within short time
– colliding transmissions aborted, reducing channel
wastage
• collision detection:
– easy in wired LANs: measure signal
strengths, compare transmitted, received
signals
– difficult in wireless LANs: received signal strength
overwhelmed by local transmission strength
• human analogy: the polite conversationalist
182
Sensitivity: Public
CSMA/CD (collision detection)
spatial layout of nodes
183
Sensitivity: Public
“Taking turns” MAC protocols
channel partitioning MAC protocols:
– share channel efficiently and fairly at high load
– inefficient at low load: delay in channel access,
1/N bandwidth allocated even if only 1 active
node!
random access MAC protocols
– efficient at low load: single node can fully utilize
channel
– high load: collision overhead
“taking turns” protocols
look for best of both worlds!
184
Sensitivity: Public
“Taking turns” MAC protocols
polling:
• master node “invites”
slave nodes to data
poll
transmit in turn
• typically used with master
data
“dumb” slave devices
• concerns:
– polling
slaves
overhead
– latency
– single point of
185
Sensitivity: Public failure (master)
“Taking turns” MAC protocols
token passing:
T
control token passed
from one node to
next sequentially.
token message (nothing
concerns: to send)
token overhead T
latency
single point of
failure (token)
data
186
Sensitivity: Public
Summary of MAC protocols
• channel partitioning, by time, frequency or code
– Time Division, Frequency Division
• random access (dynamic),
– ALOHA, S-ALOHA, CSMA, CSMA/CD
– carrier sensing: easy in some technologies
(wire), hard in others (wireless)
– CSMA/CD used in Ethernet
– CSMA/CA used in 802.11
• taking turns
– polling from central site, token passing
– bluetooth, FDDI, IBM token ring
187
Sensitivity: Public
Link layer, LANs: outline
1. introduction, services 6. LAN switches
2. error detection, 7. a day in the life of a
correction web request
3. multiple access
protocols
4. link-layer
addressing
5. Ethernet, LANs
188
Sensitivity: Public
MAC addresses and ARP
• 32-bit IP address:
network-layer address
datagram to destination used to get IP subnet
• MAC (or LAN or physical or Ethernet) address:
function: get frame from one interface to another
physically-connected interface (same network, in IP-
addressing sense)
48 bit MAC address (for most LANs) burned in NIC
ROM, also sometimes software settable
e.g.: 1A-2F-BB-76-09-AD
LAN
(wired or adapter
71-65-F7-2B-08-53 wireless)
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
190
Sensitivity: Public
LAN addresses (more)
• MAC address allocation administered by IEEE
• manufacturer buys portion of MAC address space
(to assure uniqueness)
• analogy:
– MAC address: like Social Security Number
– 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
191
Sensitivity: Public
ARP: address resolution protocol
Question: how to determine
MAC address of B • each IP node (host, router)
knowing B’s IP address? on LAN has ARP table
– IP/MAC address
137.196.7.78
mappings for some
1A-2F-BB-76-09-AD LAN nodes:
137.196.7.23 < IP address; MAC address;
137.196.7.14 TTL>
– TTL (Time To Live):
LAN
time after which
71-65-F7-2B-08-53
58-23-D7-FA-20-B0 address mapping
will be forgotten
0C-C4-11-6F-E3-98 (typically 20 min)
137.196.7.88
192
Sensitivity: Public
ARP protocol: same LAN
• A wants to send datagram
to B
– B’s MAC address not in • A caches (saves) IP-to-
A’s ARP table.
• A broadcasts ARP query MAC address pair in
packet, containing B's its ARP table until
IP address information becomes
– dest MAC address = FF-
FF-FF-FF-FF-FF old (times out)
– all machines on LAN – soft state: information
receive ARP query
that times out (goes
• B receives ARP packet, away) unless refreshed
replies to A with its
(B's) MAC address • ARP is “plug-and-
– frame sent to A’s MAC play”:
address (unicast)
– nodes create their ARP
tables without
administrator
intervention from net 193
Sensitivity: Public
Addressing: routing to another
LAN
walkthrough: send datagram from A to B via R
– focus on addressing - at both IP (datagram) and MAC layer (frame)
– assume A knows B’s IP address
– assume A knows IP address of first hop router, R (how?)
– assume A knows R’s MAC address (how?)
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP
Eth
Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
.11IP1
IP src: 1111 . d11e.s1t1: 1222.222.222.222
IP dest: 222.222.222.222
IP IP
Eth Eth
Phy Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP
Eth
Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
200
Sensitivity: Public
Ethernet
“dominant” wired LAN technology:
• cheap $20 for NIC
• first widely used LAN technology
• Developed in the mid-1970s by researchers at the Xerox
Palo Alto Research Centers (PARC)
• simpler, cheaper than token LANs and ATM
• kept up with speed race: 10 Mbps – 10 Gbps
Metcalfe’s Ethernet
sketch
201
Sensitivity: Public
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
Preamble:
• 7 bytes with pattern 10101010 followed by
one byte with pattern 10101011
• used to synchronize receiver,
sender clock rates
203
Sensitivity: Public
Ethernet frame structure (more)
• addresses: 6 bytes
– if adapter receives frame with matching
destination address, or with broadcast address
(e.g. 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
• Data: 46 to 1500 bytes (MTU: 1500B)
204
Sensitivity: Public
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
205
Sensitivity: Public
Ethernet CSMA/CD algorithm
1. NIC receives datagram 4. If NIC detects another
from network layer, transmission while
creates frame transmitting, aborts
and sends 48-bit jam
2. If NIC senses channel signal
idle, starts frame 5. After aborting, NIC enters
transmission If NIC exponential backoff: after
senses channel busy, mth collision, NIC
waits until channel idle, chooses K at random from
then transmits {0,1,2,…,2 m -1}. NIC waits
3. If NIC transmits entire K·512 bit times, returns
frame without detecting to Step 2
another transmission, NIC
is done with frame ! 206
Sensitivity: Public
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
• better performance than ALOHA: and simple, cheap, decentralized!
1
efficiency
1 5t prop /t trans
207
Sensitivity: Public
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-BX
physical 100BASE-T4 100BASE-SX
209
Sensitivity: Public
Ethernet switch
• link-layer device: takes an active role
– store, forward Ethernet frames
– examine incoming frame’s MAC address,
selectively forward frame to one-or-more
outgoing links when frame is to be forwarded
on segment, uses CSMA/CD to access
segment
• transparent
– hosts are unaware of presence of switches
• plug-and-play, self-learning
– switches do not need to be configured
210
Sensitivity: Public
Switch: multiple simultaneous
transmissions
• hosts have dedicated, direct A
connection to switch
• switches buffer packets C’ B
211
Sensitivity: Public
Switch table
• Q: how does switch know A
that A’ reachable via
interface 4, B’ reachable C’ B
via interface 5?
1 2
• A: each switch 6
switch
has a table, each entry: 5 4 3
– (MAC address of host,
interface to reach host, B’ C
time stamp)
• looks like a routing table!
• Q: how are entries A’
created, maintained in switch with six interfaces
switch table? (1,2,3,4,5,6)
– something like a routing
protocol?
212
Sensitivity: Public
Switch table
• Q: how does switch know A
that A’ reachable via
interface 4, B’ reachable C’ B
via interface 5?
1 2
• A: each switch 6
switch
has a table, each entry: 5 4 3
– (MAC address of host,
interface to reach host, B’ C
time stamp)
• looks like a routing table!
• Q: how are entries A’
created, maintained in switch with six interfaces
switch table? (1,2,3,4,5,6)
– something like a routing
protocol?
213
Sensitivity: Public
Switch: self-learning Source: A
Dest: A’
A A A’
• switch learns which hosts
C’ B
can be reached through
which interfaces 6 1 2
– when frame received, switch
“learns” location of 5 4 3
sender: incoming LAN
segment B’ C
– records sender/location pair
in switch table
A’
214
Sensitivity: Public
Switch: frame filtering/forwarding
When frame received:
A’
A A A’
• frame destination
unknownf:lood C’ B
destination A 6 1 2
location known: A A’
4
5 3
selective send A’
B’ C
A’
A
A’
MAC addr interface TTL
A 1 60 Switch table
A’ 4 60 (initially empty)
216
Sensitivity: Public
Interconnecting switches
• switches can be connected together
S4
S1
S3
A S2
F
D I
B C
G H
E
217
Sensitivity: Public
Self-learning multi-switch
example
Suppose C sends frame to I, I responds to C
S4
S1
S3
A S2
F
D I
B C
G H
E
218
Sensitivity: Public
Institutional network
mail server
to external
network
router web server
IP subnet
219
Sensitivity: Public
Switches vs. Routers
application
• both store-and-forward transport
datagram network
devices frame link
– routers: network-layer physical link frame
devices (examine physical
network-layer
headers) switch
– switches are link-layer
devices (examine network datagram
link- layer headers) link frame
• routers maintain routing physical
tables, implement application
routing algorithms transport
• switches maintain network
switch tables, link
implement filtering, physical
learning 220
Sensitivity: Public algorithms
Link layer, LANs: outline
1. introduction, services 6. LAN switches
2. error detection, 7. a day in the life of a
correction web request
3. multiple access
protocols
4. link-layer
addressing
5. Ethernet, LANs
221
Sensitivity: Public
Synthesis: a day in the life of a web request
• journey down protocol stack complete!
– application, transport, network, link
• putting-it-all-together: synthesis!
– goal: identify, review, understand protocols
(at all layers) involved in seemingly simple
scenario: requesting www page
– scenario: student attaches laptop to
campus network,
requests/receives
www.google.com
222
Sensitivity: Public
A day in the life: scenario
school network
68.80.2.0/24
web
page
223
Sensitivity: Public
A day in the life… connecting to the
Internet
DHCP DHCP • connecting laptop needs to
DHCP UDP get its own IP address, addr
DHCP IP
Eth
of first-hop router, addr of
DHCP
Phy DNS server: use DHCP
DHCP
DH CP request
encapsulated in UDP,
DHCP
DHCP
DHCP UDP
encapsulated in IP,
DHCP IP encapsulated in 802.3
DHCP Eth router Ethernet
Phy (runs DHCP) Ethernet frame broadcast
(dest: FFFFFFFFFFFF) on
LAN, received at router
running DHCP server
Ethernet demuxed to IP
demuxed, UDP demuxed
to DHCP
224
Sensitivity: Public
A day in the life… connecting to the
Internet
DHCP DHCP • DHCP server formulates
DHCP UDP DHCP ACK containing
DHCP IP client’s IP address, IP
DHCP Eth address of first-hop router
Phy for client, name & IP
address of DNS server
encapsulation at DHCP
router
IP datagram forwarded from
(runs DHCP) campus network into comcast
IP datagram containing network, routed (tables created
DNS query forwarded via by RIP, OSPF, IS-IS and/or
LAN switch from client BGP routing protocols) to DNS
to 1st hop router dseermveurx’ed to DNS server
DNS server replies to
client with IP address of 227
www.google.com
Sensitivity: Public
A day in the life…TCP connection carrying
HTTP
HTTP
HTTP
SYNACK
SY
N
TCP
SYNACK
SY IP
N
SSY
SYNACK Eth
YNN
Phy
to send HTTP
request, client first
opens TCP socket to
router web server
(runs DHCP)
SYNACK
SY TCP
TCP SYN segment (step 1 in
N
SY
SYNACK IP 3- way handshake) inter-
N
SYNACK
SY Eth domain routed to web server
N
Phy
web server responds with
web server TCP SYNACK (step 2 in 3-
64.233.169.105 way handshake)
TCP connection established!
228
Sensitivity: Public
A day in the life… HTTP request/reply
TTP
HHTTP HTTP web page finally (!!!)
HTTP
HTTP TCP displayed
HTTP
HTTP IP
HTTP
HTTP Eth
Phy
HTTP
router IP datagram containing
HTTP (runs DHCP) HTTP request routed to
TCP
HTTP
IP www.google.com
HTTP
HTTP
web server responds with
HTTP reply (containing
web page)
web
HTTP server
Eth
Phy
IP datagram containing
64.233.169.105
HTTP
reply routed back to client
229
Sensitivity: Public
Chapter 5: Summary
• principles behind data link layer services:
– error detection, correction
– sharing a broadcast channel: multiple access
– link layer addressing
• instantiation and implementation of various link
layer technologies
– Ethernet
– switched LANS
• synthesis: a day in the life of a web request
230
Sensitivity: Public
Chapter 5: let’s take a breath
• journey down protocol stack complete (except
PHY)
• solid understanding of networking principles,
practice
• … . . could stop here … . but lots of interesting
topics!
– wireless
– multimedia
– security
– network management
231
Sensitivity: Public
Error Detection
and
Correction
• Types of Errors
• Detection
• Correction
Sensitivity: Public
Basic concepts
Networks must be able to transfer data
from one device to another with complete
accuracy.
Data can be corrupted during
transmission.
For reliable communication, errors must be
detected and corrected.
Error detection and correction
are implemented either at the data link
layer or the transport layer of the OSI 233
model.
Sensitivity: Public
Types of Errors
234
Sensitivity: Public
Single-bit error
235
Sensitivity: Public
Single bit errors are the least likely
type of errors in serial data transmission
because the noise must have a very
short duration which is very rare.
However this kind of errors can happen
in parallel transmission.
Example:
If data is sent at 1Mbps then each bit
lasts only 1/1,000,000 sec. or 1 μs.
For a single-bit error to occur, the noise
must have a duration of only 1 μs,
which is very rare.
236
Sensitivity: Public
Burst error
237
Sensitivity: Public
238
Sensitivity: Public
The term burst error means that two or
more bits in the data unit have
changed from 1 to 0 or from 0 to 1.
239
Sensitivity: Public
Burst error is most likely to happen in
serial transmission since the duration of
noise is normally longer than the duration of
a bit.
The number of bits affected depends on the
data rate and duration of noise.
Example:
🢂If data is sent at rate = 1Kbps then a noise of
1/100 sec can affect 10 bits.(1/100*1000)
241
Sensitivity: Public
Redundancy
242
Sensitivity: Public
Four types of redundancy checks are used
in data communications
243
Sensitivity: Public
Vertical Redundancy Check
VRC
244
Sensitivity: Public
Performance
245
Sensitivity: Public
Longitudinal Redundancy Check
LRC
246
Sensitivity: Public
Performance
248
Sensitivity: Public
Cyclic Redundancy Check
CRC
249
Sensitivity: Public
Cyclic Redundancy Check
• Given a k-bit frame or message, the
transmitter generates an n-bit
sequence, known as a frame check
sequence (FCS), so that the resulting
frame, consisting of (k+n) bits, is exactly
divisible by some predetermined
number.
• The receiver then divides the incoming
frame by the same number and, if there
is no remainder, assumes that there
was no error. 250
Sensitivity: Public
Binary Division
251
Sensitivity: Public
Polynomial
252
Sensitivity: Public
Polynomial and Divisor
253
Sensitivity: Public
Standard Polynomials
254
Sensitivity: Public
Checksum
255
Sensitivity: Public
At the sender
The unit is divided into k sections, each of
n bits.
All sections are added together using
one’s complement to get the sum.
The sum is complemented and becomes
the checksum.
The checksum is sent with the data
256
Sensitivity: Public
At the receiver
The unit is divided into k sections, each of
n bits.
All sections are added together using
one’s complement to get the sum.
The sum is complemented.
If the result is zero, the data are accepted:
otherwise, they are rejected.
257
Sensitivity: Public
Performance
🢂The checksum detects all errors involving
an odd number of bits.
🢂It detects most errors involving an even
number of bits.
🢂If one or more bits of a segment are
damaged and the corresponding bit or bits
of opposite value in a second segment
are also damaged, the sums of those
columns will not change and the receiver
will nota problem.
detect 258
Sensitivity: Public
Error Correction
It can be handled in two ways:
1) receiver can have the sender retransmit
the entire data unit.
2) The receiver can use an error-correcting
code, which automatically corrects
certain errors.
259
Sensitivity: Public
Single-bit error correction
To correct an error, the receiver reverses the
value of the altered bit. To do so, it must
know which bit is in error.
Number of redundancy bits needed
• Let data bits = m
• Redundancy bits = r
Total message sent = m+r
The value of r must satisfy the following
relation:
2r ≥ m+r+1 260
Sensitivity: Public
Error Correction
261
Sensitivity: Public
Hamming Code
262
Sensitivity: Public
Hamming Code
263
Sensitivity: Public
Hamming Code
264
Sensitivity: Public
Example of Hamming Code
265
Sensitivity: Public
Single-bit error
266
Sensitivity: Public
Error
Detection
267
Sensitivity: Public
Data Link Control
268
Sensitivity: Public
Announcements
• Midterm: November 28, Monday, 11:40 – 13:30
– Places:
FENS G032 if (lastName[0] >= 'A' && lastName[0] <=
'D')
FASS G022 if (lastName[0] >= 'E' && lastName[0] <=
'Ö')
FASS G049 if (lastName[0] >= 'P' && lastName[0] <=
'Z')
• Exam will be closed book, closed notes
– calculators are allowed
– you are responsible all topics I covered in the class even if
some of them are not in the book (I sometimes used other books)
and not in the ppt files (I sometimes used board and showed
Sensitivity: Public applications on269 the computer)
Flow Control
• In Data Link Layer, we deal with issues
related to point to point links
– Flow control is one of these issues
transmission
time
272
Sensitivity: Public
Stop and Wait Flow Control
• Source transmits frame
• Destination receives frame and replies
with acknowledgement (ACK)
• Source waits for ACK before sending next
frame
• Destination can stop flow by not sending
ACK
• Works well for large frames
• Inefficient for smaller frames 273
Sensitivity: Public
Stop and Wait Flow Control
• However, generally large block of data split
into small frames
– Called “Fragmentation”
– Advantages are
• Limited buffer size at receiver
• Errors detected sooner (when whole frame
received)
– On error, retransmission of smaller frames is needed
• Prevents one station occupying medium for long
periods
• Channel Utilization is higher when
– propagation
the transmission
time time is longer than the 274
t0 + T t0 + D
t0 + D t0 + T
t0 +T+D t0 +T+D
t0 +T+2D t0 +T+2D
D> T
275
Sensitivity: Public D< T
Sliding Window Flow Control
• The problem of “Stop and Wait” is not able to send
multiple packets
• Sliding Window Protocol allows multiple frames to be in
transit
• Receiver has buffer of W (called window size) frames
• Transmitter can send up to W frames without ACK
• Each frame is numbered
– Sequence number bounded by size of the sequence number
field (k bits)
– thus frames are numbered modulo 2k (0 … 2k-1)
• ACK includes number of next frame expected
276
Sensitivity: Public
Sliding Window Flow Control
(W = 7)
277
Sensitivity: Public
Example of a Sliding Window
Protocol (W = 7)
278
Sensitivity: Public
Sliding Window Enhancements
in Implementation
• Receiver can acknowledge frames without
permitting further transmission (Receive
Not Ready)
– Must send a normal acknowledgement to
resume
• If the link is duplex, use piggybacking
– Send data and ack together in one frame
• frame has both data and ack fields
– If no data to send, use acknowledgement
frame
279
Sensitivity: Public – If data but no acknowledgement to send,
Sliding Windows Performance -
1
• two cases: W >= 2a+1 and W < 2a+1, where a=D/T
• details are on board
2T
D+T
2D+T
D+T
W.T
2D+T
• Parity
– single bit added to the end of the data
– Value of parity bit is such that data and parity
have even (even parity) or odd (odd parity)
number of ones
Sensitivity: Public
– Even number of bit errors goes undetected 284
Error Detection Process using
Cyclic Redundancy Check
F= F’=
285
Sensitivity: Public
Cyclic Redundancy Check
(CRC)
• For a data block of k bits, transmitter
generates n-k bit frame check sequence
(FCS) and appends it to the end of the data
bits
• Transmits n bits, which is exactly divisible
by some number (generator)
– the length of the generator is n-k+1 and first
and last bits are 1
• Receiver divides the received frame by
generator
– If no remainder, assume no error 286
•
Sensitivity: Public
Cyclic Redundancy Check
(CRC)
• Standard CRCs (generators are standard)
– checks all single, double and odd number of
errors
– checks all burst errors with length less than or
equal to the length of FCS (n-k)
– checks most of the burst errors of longer
length
• for bursts of length n-k+1 (length of generator),
probability of an undetected error is 1/2n-k-1
• for longer bursts, probability of an undetected error
is 1/2n-k
287
Sensitivity: Public
Error Control
• Actions to be taken against
– Lost frames
– Damaged frames
• Automatic repeat request (ARQ)
mechanism components
– Error detection
– Positive acknowledgment
– Retransmission after timeout
– Negative acknowledgement and
Sensitivity: Public
retransmission 288
Automatic Repeat Request
(ARQ)
• Stop-and-wait ARQ
• Go-back-N ARQ
• Selective-reject (selective retransmission)
ARQ
289
Sensitivity: Public
Stop and Wait ARQ
• Source transmits single frame
• Wait for ACK
• If received frame is damaged, discard it
– If transmitter receives no ACK within timeout,
retransmits
• If ACK damaged,transmitter will not
recognize it
– Transmitter will retransmit after
timeout
– Receiver gets two copies of frame, but
290
Sensitivity: Public
disregards
– Use oneACK
ACK0 and of them
1
Stop-and-Wait ARQ –
Example
291
Sensitivity: Public
Stop and Wait - Pros and Cons
• Simple
• Inefficient
292
Sensitivity: Public
Go-Back-N ARQ
• Based on sliding window
• If no error, ACK as usual with next frame
expected
– ACKi means “I am ready to receive frame i”
and “I received all frames between i and my
previous ack”
• Sender uses window to control the
number of unacknowledged frames
• If error, reply with rejection (negative ack)
– Discard that frame and all future frames until
the frame in error is received correctly 293
Sensitivity: Public – Transmitter must go back and retransmit that
Go-Back-N ARQ -
Damaged Frame
• Receiver detects error in frame i
• Receiver sends “reject i”
• Transmitter gets “reject i”
• Transmitter retransmits frame i and all
subsequent frames
294
Sensitivity: Public
Go-Back-N ARQ - Lost Frame
(1)
• Frame i lost
• Transmitter sends frame i+1
• Receiver gets frame i+1 out of sequence
• Receiver sends “reject i”
• Transmitter goes back to frame i and
retransmits it and all subsequent frames
295
Sensitivity: Public
Go-Back-N ARQ- Lost Frame
(2)
• Frame i lost and no additional frame sent
• Receiver gets nothing and returns neither
acknowledgment nor rejection
– This is kind of a deadlock situation that needs to be
resolved
• Transmitter times out and sends
acknowledgment frame with P bit set to 1
(this is actually a command for ack request)
– Receiver interprets this as an ack request
command which it acknowledges with
the number of the next frame it expects (i 296
• Transmitter then retransmits frame i
Sensitivity: Public
Go-Back-N ARQ-
Damaged/Lost
Acknowledgment
• Receiver gets frame i and sends
acknowledgment (i+1) which is lost
• Acknowledgments are cumulative, so next
acknowledgement (i+n) may arrive before
transmitter times out on frame i
==> NO PROBLEM
• If transmitter times out, it sends
acknowledgment request with P bit set, as
before
297
Sensitivity: Public
Go-Back-N ARQ- Damaged
Rejection
• As in lost frame (2)
– sender asks the receiver the last frame
received and continue by retransmitting next
frame
298
Sensitivity: Public
Go-Back-N ARQ -
Example
299
Sensitivity: Public
Selective Reject
• Also called selective retransmission
• Only rejected frames are retransmitted
• Subsequent frames are accepted by the
receiver and buffered
• Minimizes retransmissions
• Receiver must maintain large enough
buffer
• Complex implementation
300
Sensitivity: Public
Selective Reject -
Diagram
301
Sensitivity: Public
Issues
• RR with P=1 is from HDLC standard
– pure protocol just have retransmissions after
timeout
• as explained in Tanenbaum
302
Sensitivity: Public
Issues – Window Size
• Given n-bit sequence numbers, what is
Max window size?
– go-back-n ARQ 2n-1
• Why?
• what about receiver’s window size?
– It is 1, why?
– selective-reject(repeat) 2n-1
• Why?
305
Sensitivity: Public
High Level Data Link Control
• HDLC
• ISO Standard
• Basis for some other DLL protocols
306
Sensitivity: Public
HDLC Station Types
• Primary station
– Controls operation of link
– Frames issued are called commands
• Secondary station
– Under control of primary station
– Frames issued called responses
• Combined station
– May issue commands and responses
307
Sensitivity: Public
HDLC Link Configurations
• Unbalanced
– One primary and one or more secondary
stations
– Supports full duplex and half duplex
• Balanced
– Two combined stations
– Supports full duplex and half duplex
308
Sensitivity: Public
HDLC Transfer Modes (1)
• Normal Response Mode (NRM)
– Unbalanced configuration
– Primary initiates transfer to secondary
– Secondary may only transmit data in
response to command from primary
– Terminal-host communication
• Host computer as primary
• Terminals as secondary
– not so common nowadays
309
Sensitivity: Public
HDLC Transfer Modes (2)
• Asynchronous Balanced Mode (ABM)
– Balanced configuration
– Either station may initiate transmission
without receiving permission
– Most widely used
310
Sensitivity: Public
Frame Structure
• All transmissions in frames
• Single frame format for all data and
control exchanges
311
Sensitivity: Public
Frame Structure Diagram
312
Sensitivity: Public
Flag Fields
• Delimit frame at both ends
• 01111110
• Receiver hunts for flag sequence to
synchronize
• Bit stuffing used to avoid confusion with
data containing 01111110
– 0 inserted after every sequence of five 1s
– If receiver detects five 1s after a 0 it checks
next bit
313
Sensitivity: Public
• If 0, it is deleted
Bit Stuffing Example
314
Sensitivity: Public
Address Field
• Identifies secondary station that sent or
will receive frame
• Usually 8 bits long (but 7 bits are
effective)
• May be extended to multiples of 7 bits with
prior agreement
– leftmost bit of each octet indicates that it is
the last octet (1) or not (0)
315
Sensitivity: Public
Frame Types
• Information frame- data to be transmitted to
user
– Acknowledgment is piggybacked on information
frames (only for positive acknowledgment)
• Supervisory frame – ARQ messages
(RR/RNR/REJ/SREJ) when piggyback not
used (actually only RR can be piggybacked;
for the other, we need Supervisory frames)
• Unnumbered frame – supplementary link
control functions. For examples,
– setting the modes 316
Sensitivity: Public
Control Field Diagram
317
Sensitivity: Public
Poll/Final Bit
• Use of this bit depends on context. A
typical use is below.
• Command frame
– P bit set to 1 to solicit (poll) supervisory frame
from peer
• Response frame
– F bit set to 1 to indicate response to soliciting
command
318
Sensitivity: Public
Information Field
• Only in information and some unnumbered
frames
• Must contain integral number of octets
• Variable length
319
Sensitivity: Public
Frame Check Sequence Field
• FCS
• Error detection
• 16 bit CRC
• Optional 32 bit CRC
320
Sensitivity: Public
HDLC Operation
• Exchange of information, supervisory and
unnumbered frames
• Three phases
– Initialization
– Data transfer
– Disconnect
321
Sensitivity: Public
Initialization
• Issue one of six set-mode commands
– Signals other side that initialization is
requested
– Specifies mode (NRM, ABM, ARM)
– Specifies 3- or 7-bit sequence
numbers
• If request accepted, HDLC module on
other side transmits "unnumbered
acknowledged" (UA) frame
• If request rejected, "disconnected mode" 322
(DM) sent
Sensitivity: Public
Data Transfer
• Both sides may begin to send user data in I-frames (Information
Frame)
– N(S): sequence number of outgoing I-frames
• modulo 8 or 128, (3- or 7-bit)
– N(R) acknowledgment for I-frames received
• seq. number of I-frame expected next
• S-frames are also used for flow and error control
– Receive ready (RR) frame acknowledges last I-frame received
• Indicating next I-frame expected
• Used when there is no reverse data
– Receive not ready (RNR) acknowledges, but also asks peer to suspend
transmission of I-frames
• When ready, send RR to restart
– REJ initiates go-back-N ARQ
• Indicates last I-frame received has been rejected
• Retransmission is requested beginning with N(R)
– Selective reject (SREJ) requests retransmission of single frame 323
Sensitivity: Public
Disconnect
• Send disconnect (DISC) frame
• Remote entity must accept by replying
with UA
– Informs layer 3 user about the termination of
connection
• These frames are unnumbered frames
324
Sensitivity: Public
Examples of Operation (1)
325
Sensitivity: Public
Examples of Operation (2)
326
Sensitivity: Public
Other DLC Protocols
(LAPB,LAPD)
• Link Access Procedure, Balanced (LAPB)
– Part of X.25 (ITU-T)
– Subset of HDLC - ABM (Async. Balanced
Mode)
– Point to point link between user and packet
switching network node
– HDLC frame format
• Link Access Procedure, D-Channel
(LAPD)
– Part of ISDN (ITU-T)
– ABM 327
Sensitivity: Public – Always 7-bit sequence numbers (no 3-bit)
Other DLC Protocols (LLC)
• Logical Link Control (LLC)
– IEEE 802
– For LANs (Local Area Networks)
– Link control split between medium access control layer (MAC) and
LLC (on top of MAC)
– Different frame format
• Two addresses needed (sender and receiver) – actually at MAC layer
• Sender and receiver SAP addresses
• Control field is same as HDLC (16-bit version for I and S frames; 8-bit
for U frames)
– No primary and secondary - all stations are peers
– Error detection at MAC layer
• 32 bit CRC
328
Sensitivity: Public
Other DLC Protocols (LLC)
• LLC Services
– 3 alternatives
– Connection Mode Services
• Similar to HDLC ABM
– Unacknowledged connectionless services
• no connection setup
• No flow-control, no error control, no acks (thus not
reliable)
• good to be used with TCP/IP. Why?
– Acknowledged Connectionless Service
• No connection setup 329
Sensitivity: Public
•
VLANs
330
Sensitivity: Public
Topics
• The role of VLANs in a network
• Trunking VLANs
• Configure VLANs on switches
• Troubleshoot common VLAN problems
331
Sensitivity: Public
Semester 3
LAN Design
VLANs STP
VTP Inter-VLAN
routing
332
Sensitivity: Public
Some requirements of LANs
• Need to split up broadcast domains to
make good use of bandwidth
• People in the same department may need
to be grouped together for access to
servers
• Security: restrict access by certain users
to some areas of the LAN
• Provide a way for different areas of the
LAN to communicate with each other
333
Sensitivity: Public
Solution using routers
• Divide the LAN into
subnets
• Use routers to link
the subnets
334
Sensitivity: Public
Solution using routers
BUT
• Routers are expensive
• Routers are slower than switches
• Subnets are restricted to limited physical
areas
• Subnets are inflexible
335
Sensitivity: Public
Solution using VLANs
• VLAN membership can
be by function and not
by location
• VLANs managed by
switches
• Router needed for
communication
between VLANs
336
Sensitivity: Public
VLANs
• All hosts in a VLAN have addresses in the
same subnet. A VLAN is a subnet.
• Broadcasts are kept within the VLAN. A
VLAN is a broadcast domain.
• The switch has a separate MAC address
table for each VLAN. Traffic for each VLAN
is kept separate from other VLANs.
• Layer 2 switches cannot route between
VLANs. 337
Sensitivity: Public
VLAN numbers
• VLAN 1: default Ethernet LAN, all ports start
in this VLAN.
• VLANs 1002 – 1005 automatically created
for Token Ring and FDDI
• Numbers 2 to 1001 can be used for new
VLANs
• Up to 255 VLANs on Catalyst 2960
switch
• fewer
Extended range 1006 – 4094 possible
features 338
Sensitivity: Public
VLAN information
• VLAN information is stored in the VLAN
database.
• vlan.dat in the flash memory of the
switch.
339
Sensitivity: Public
Port based
• Each switch port intended for an end
device is configured to belong to a VLAN.
• Any device connecting to that port belongs
to the port’s VLAN.
• There are other ways of assigning VLANs
but this is now the normal way.
• Ports that link switches can be configured
to carry traffic for all VLANs (trunking)
340
Sensitivity: Public
Types of VLAN
• Data or user VLAN
• Voice VLAN
• Management VLAN
• Native VLAN
• Default VLAN
341
Sensitivity: Public
Data VLAN
• Carry files, e-mails, shared application
traffic, most user traffic.
• Separate VLAN for each group of
users.
342
Sensitivity: Public
Voice VLAN
• Use with IP phone.
• Phone acts as a switch too.
• Voice traffic is tagged, given priority.
• Data not tagged, no priority.
343
Sensitivity: Public
Management VLAN
• Has the switch IP address.
• Used for telnet/SSH or web access for
management purposes.
• Better not to use VLAN 1 for security
reasons.
344
Sensitivity: Public
Native VLAN
• For backward compatibility with older
systems.
• Relevant to trunk ports.
• Trunk ports carry traffic from multiple
VLANs.
• VLAN is identified by a “tag” in the
frame.
• Native VLAN does not have a tag.
345
Sensitivity: Public
Default VLAN
• VLAN 1 on Cisco switches.
• Carries CDP and STP (spanning tree
protocol) traffic.
• Initially all ports are in this VLAN.
• Do not use it for data, voice or
management traffic for security reasons.
346
Sensitivity: Public
Static VLAN
• The normal type. Port configured to be on
a VLAN. Connected device is on this
VLAN.
• VLAN can be created using CLI command,
given number and name.
• VLAN can be learned from another switch.
• If a port is put on a VLAN and the VLAN
does not exist, then the VLAN is created.
347
Sensitivity: Public
Static VLAN (Port-centric)
348
Sensitivity: Public
Voice VLAN
349
Sensitivity: Public
Dynamic VLAN
• Not widely used.
• Use a VLAN Membership Policy Server
(VMPS).
• Assign a device to a VLAN based on its
MAC address.
• Connect device, server assigns VLAN.
• Useful if you want to move devices
around.
350
Sensitivity: Public
Traffic between VLANs
• Layer 2 switch keeps VLANs separate.
• Router can route between VLANs. It
needs to provide a default gateway for
each VLAN as VLANs are separate
subnets.
• Layer 3 switch has a switch virtual
interface (SVI) configured for each VLAN.
These act like router interfaces to route
between VLANs.
351
Sensitivity: Public
Trunking
• Both switches have the same 5 VLANs.
• Do you have a link for each VLAN?
352
Sensitivity: Public
Trunking
• Traffic for all the VLANs travels between the
switches on a shared trunk or backbone
Sensitivity: Public
Tag to identify VLAN
• Tag is added to the frame when it goes on to
the trunk
• Tag is removed when it leaves the trunk
Sensitivity: Public
Frame tagging IEEE 802.1Q
355
Sensitivity: Public
Native VLAN
• Untagged frames received on a trunk port
are forwarded on to the native VLAN.
• Frame received from the native VLAN
should be untagged.
• Switch will drop tagged frames received
from the native VLAN. This can happen if
non-Cisco devices are connected.
356
Sensitivity: Public
Configure trunk port
• Make a port into a trunk port and tell it
which VLAN is native.
• SW1(config)#int fa0/1
• SW1(config-if)switchport mode
trunk
• SW1(config-if)switchport trunk native
vlan 99
• By default native VLAN is 1.
357
Sensitivity: Public
Dynamic trunking protocol
Dynamic trunk Mode
auto/des trunk
access Mode
Dynamic
access
auto/des access Dynamic
Dynamic auto
auto trunk Dynamic
Dynamic
desirable trunk desirable
Dynamic Dynamic
auto 358
desirable
Sensitivity: Public
Create a VLAN
• SW1(config)#vlan 20
• SW1(config-vlan)#name Finance
• SW1(config-vlan)#end
• VLAN will be saved in VLAN database
rather than running config.
• If you do not give it a name then it will be
called vlan0020.
359
Sensitivity: Public
Assign port to VLAN
• SW1(config)#int fa 0/14
• SW1(config-if)#switchport mode access
• SW1(config-if)#switchport access vlan
20
• SW1(config-if)#end
360
Sensitivity: Public
show vlan brief
• List of VLANs with ports
361
Sensitivity: Public
Show commands
• show vlan brief (list of VLANs and ports)
• show vlan summary
• show interfaces vlan (up/down, traffic etc)
• Show interfaces fa0/14 switchport (access
mode, trunking)
362
Sensitivity: Public
Remove port from VLAN
• SW1(config)#int fa 0/14
• SW1(config-if)#no switchport access
vlan
• SW1(config-if)#end
• The port goes back to VLAN 1.
• If you assign a port to a new VLAN, it is
automatically removed from its existing
VLAN.
363
Sensitivity: Public
Delete a VLAN
• SW1(config)#no vlan 20
• SW1(config)#end
• VLAN 20 is deleted.
• Any ports still on VLAN 20 will be inactive
– not on any VLAN. They need to be
reassigned.
364
Sensitivity: Public
Delete VLAN database
• Erasing the startup configuration does not
get rid of VLANs because they are saved
in a separate file.
• SW1#delete flash:vlan.dat
• Switch goes back to the default with all
ports in VLAN 1.
• You cannot delete VLAN 1.
365
Sensitivity: Public
UNIT-3
366
Sensitivity: Public
Network Layer Design Isues
• Store-and-Forward Packet Switching
• Services Provided to the Transport Layer
• Implementation of Connectionless Service
• Implementation of Connection-Oriented Service
• Comparison of Virtual-Circuit and Datagram Subnets
367
Sensitivity: Public
Store-and-Forward Packet
Switching
The environment of the network
layer
protocols.
fig 5-1
368
Sensitivity: Public
Services Provided to the
Transport Layer
1. The services should be independent of the
router technology
2. The transport layer should be shielded
from the number, type and topology of the
routers present
3. The network addresses made available to
the transport layer should use a uniform
numbering plan, even across LANs and
WANs 369
Sensitivity: Public
Implementation of Connectionless
Service
Routing within a diagram subnet.
370
Sensitivity: Public
Implementation of Connection-
Oriented Service
5-4
372
Sensitivity: Public
Routing Algorithms
• The Optimality Principle
• Shortest Path Routing
• Flooding
• Distance Vector Routing
• Link State Routing
• Hierarchical Routing
• Broadcast Routing
• Multicast Routing
• Routing for Mobile Hosts
• Routing in Ad Hoc Networks 373
Sensitivity: Public
Desirable Properties (Elaborate)
Correctness
Simplicity
Robustness – System will be in place for
years with small failures
Fairness,
Efficiency.
374
Sensitivity: Public
Routing Algorithms (2)
A – A’, B – B’, C – C’, can fill the channel, then X-X’ doesn’t get a chance
376
Sensitivity: Public
The Optimality Principle
378
Sensitivity: Public
Dijkstra
5-8 top
5-8
botto
m
384
Sensitivity: Public
Hierarchical Routing (2)
385
Sensitivity: Public
Link State Routing
Each router must do the following:
1. Discover its neighbors, learn their network address.
2. Measure the delay or cost to each of its neighbors.
3. Construct a packet telling all it has just learned.
4. Send this packet to all other routers.
5. Compute the shortest path to every other router.
386
Sensitivity: Public
Learning about the Neighbors
• Bandwidth
• Delay – measured by sending special ECHO
388
Sensitivity: Public
Measuring Line Cost
393
Sensitivity: Public
Broadcast Routing
Multidimensional Routing
•Each packet contains a list of destinations.
•On arrival of a packet, router checks the set of destinations, and sends
copies of packet along outgoing links to those destinations.
Flooding
•Flood with a sequence number per source.
Spanning Tree
•Build spanning tree (such as, a sink tree).
•Forward packet along all links of spanning tree except the one from
which packet is received.
Reverse Path Forwarding 394
Sensitivity: Public
Broadcast – Reverse Path
• Broadcast.
Forwarding
• Check if the packet has arrived following the correct hop
or not.
• If correct hop, then rebroadcast.
397
Sensitivity: Public
Routing for Mobile Hosts
A WAN to which LANs, MANs, and wireless
cells are attached.
398
Sensitivity: Public
Routing for Mobile Hosts (2)
Packet routing for mobile users.
399
Sensitivity: Public
Routing in Ad Hoc Networks
Possibilities when the routers are mobile:
1.Military vehicles on battlefield.
– No infrastructure.
2.A fleet of ships at sea.
– All moving all the time
3. Emergency works at earthquake .
– The infrastructure destroyed.
4. A gathering of people with notebook
computers.
– In an area lacking 802.11. 400
Sensitivity: Public
Ad Hoc Networks: Route
Discover
y
402
Sensitivity: Public
Route Discovery (3)
• The (Source Address, Request ID) pair is looked up in a
local history table
404
Sensitivity: Public
Route Discovery (5)
IN response
•Source addr., destination addr. and Hop Count copied but
Dest. Seq. number taken from its counter.
•Hopcount is set to 0, Lifetime field controls how long the
route is valid.
1. No route to I is known,
2.Sequence number of I in the ROUTE REPLY packet is
greater than the value in the routing table
3. The sequence numbers are equal but the new route is
shorter
4. Hop Count incremented
5.In large network, discovery increases with Time to Live
405
incrementally being increased from 1, 2, 3, …
Sensitivity: Public
Ad Hoc Networks: Route
Maintenance
407
Sensitivity: Public
Routing for Mobile Hosts (2)
Packet routing for mobile users.
408
Sensitivity: Public
Routing in Ad Hoc Networks
Possibilities when the routers are mobile:
1.Military vehicles on battlefield.
– No infrastructure.
2.A fleet of ships at sea.
– All moving all the time
3. Emergency works at earthquake .
– The infrastructure destroyed.
4. A gathering of people with notebook
computers.
– In an area lacking 802.11. 409
Sensitivity: Public
AODV
410
Sensitivity: Public
Ad Hoc Networks: Route
Discover
y
412
Sensitivity: Public
Route Discovery (3)
• The (Source Address, Request ID) pair is looked up in a
local history table
414
Sensitivity: Public
Route Discovery (5)
IN response
•Source addr., destination addr. and Hop Count copied but
Dest. Seq. number taken from its counter.
•Hopcount is set to 0, Lifetime field controls how long the
route is valid.
1. No route to I is known,
2.Sequence number of I in the ROUTE REPLY packet is
greater than the value in the routing table
3. The sequence numbers are equal but the new route is
shorter
4. Hop Count incremented
5.In large network, discovery increases with Time to Live
415
incrementally being increased from 1, 2, 3, …
Sensitivity: Public
Ad Hoc Networks: Route
Maintenance
separately.
Sensitivity: Public
Assumption
• Each record (data to be shared) can be
identified by a ASCII string such as the
filename.
424
Sensitivity: Public
Maintaining finger table
• Maintaining the finger table does not come for
free.
425
Sensitivity: Public
The Network Layer
Congestion Control Algorithms &
Quality-of-Service
426
Sensitivity: Public
Congestion Control Algorithms
• Approaches to Congestion Control
• Traffic-Aware Routing
• Admission Control
• Traffic Throttling
• Load Shedding
427
Sensitivity: Public
Congestion
4. flow controlbetween
Difference – Elaborate
Congestion
429
Sensitivity: Public
Approaches to Congestion
Control
Two solutions possible:
1)Increase resources
2)Decrease load
430
Sensitivity: Public
Traffic-Aware Routing
router
Sensitivity: Public
Traffic Throttling: Feedback
• Routers must deliver timely feedback to the senders that
are causing the congestion.
• The router must identify the appropriate senders.
• It must then warn them carefully, without sending many
more packets into the already congested network.
434
Sensitivity: Public
Mechanisms 2 & 3:
Direct Choke Packets,
Hop-by-Hop
Backpressure
M-2: A choke packet
that affects only the
source.
M-3: A choke packet
that affects each
hop it passes
through.
Sensitivity: Public
435
Mechanism 4: Load Shedding
• Performed when all other strategies fail.
• Cause blackout in some areas to save the entire
network from failing.
• Intelligent packet drop policy desired.
• Which packets to discard may depend
on application
Multimedia – old packets (full frame not to be
discarded)
Text – Recent Packets
• Packet’s importance can be marked in the
beginning (application layer), then decision on 436
Sensitivity: Public
Mechanism 5: Random Early
Detection
• Discard packets before all the buffer space is
really exhausted.
• To determine when to start discarding, routers
maintain a running average of their queue
lengths.
• When average queue length exceeds a
threshold, the link is said to be congested –
small fraction of packets dropped at random.
• The affected sender will notice the loss when
there is no acknowledgement – transport
protocol slowed down. 437
Sensitivity: Public
Quality of Service
• Requirements
• Minimum throughput and maximum
latency
• Techniques for Achieving Good Quality of
Service
• Integrated Services
• Differentiated Services
• Label Switching and MPLS
438
Sensitivity: Public
Requirements
How stringent the quality-of-service
requirements are.
5-30
439
Sensitivity: Public
Categories of QoS and Examples
1. Constant bit rate
• Telephony
2. Real-time variable bit rate
• Compressed videoconferencing
3. Non-real-time variable bit rate
• Watching a movie on demand
4. Available bit rate
• File transfer
440
Sensitivity: Public
Jitter Control
442
Sensitivity: Public
Traffic Shaping
• Traffic in data networks is bursty – typically
arrives at non-uniform rates as the traffic rate
varies.
• Traffic shaping is a technique for regulating
the average rate and burstiness of a flow of
data that enters the network.
• When a flow is set up, the user and the
network agree on a certain traffic pattern
(shape).
• Sometimes this agreement is called an
SLA
443
(Service Level Agreement).
Sensitivity: Public
The Leaky Bucket Algorithm
5-34
Sensitivity: Public
(a) Before. (b) After. 445
Token Bucket Algorithm (2)
• Burst length – S sec.
• Maximum output rate – M bytes/sec
• Token bucket capacity – B bytes
• Token arrival rate – R bytes/sec
1. Bandwidth.
2. Buffer space.
3. CPU cycles.
449
Sensitivity: Public
Packet Scheduling (2)
453
Sensitivity: Public
Admission Control (2)
Bandwidth and delay guarantees with token
buckets and WFQ.
454
Sensitivity: Public
Integrated Services:
RSVP—The Resource reSerVation Protocol
Expedited Forwarding
Packets marked – Regular or Expedited
Assured Forwarding
Gold, Silver, Bronze, common
Sensitivity: Public
459
Differentiated Services:
Assured Forwarding
462
Sensitivity: Public
Network Layer
• Concerned with getting packets from source to
destination.
• The network layer must know the topology of the
subnet and choose appropriate paths through it.
• When source and destination are in different
networks, the network layer (IP) must deal with
these differences.
* Key issue: what service does the network layer
provide to the transport layer (connection-
oriented or connectionless).
463
Sensitivity: Public
Network Layer Design Goals
1. The services provided by the network layer
should be independent of the subnet topology.
2. The Transport Layer should be shielded from
the number, type and topology of the
subnets present.
3. The network addresses available to the
Transport Layer should use a uniform
numbering plan (even across LANs and WANs).
464
Sensitivity: Public
Messages
Messages
End system Data link Data link Dalataye Data link End system
layer layer layer
lirnk
Physical Physical layer Physical
layer layer layer
Physical
layer
Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 7.2
465
Sensitivity: Public
Machine A Machine B
Application Application
Transport Transport
Router/Gateway
Internet Internet
Internet
Network Network
Network
Interface Interface
Interface
Network 1 Network 2
466
Sensitivity: Public Figure 8.3
Gateway Metropolitan Area
Network (MAN) Organization
To internet Servers
or wide area
network
s s
Backbone
R R
R
S
Departmenta S S
l Server R R
R
s
s
s
s s s s
s s
467
Sensitivity: Public
Wide Area Network
(WAN)
Interdomain level
Border routers
Internet service
Autonomous system Border routers provider
or domain
LAN level
468
Sensitivity: Public
(a) National service provider A National ISPs
NAP
NAP
National service provider C
Network Access
Point
(b) NAP RA
Route RB
server
LAN
RC
Packet 1
Packet 1
Packet 2
Packet 2
Packet 2
Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 7.15
470
Sensitivity: Public
Routing Table
in Datagram Network
Destination Output
address port
0785 7
1345 12
1566 6
2458 12
471
Sensitivity: Public
Virtual Circuit Packet Switching
Packet
Packet
Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 7.17
472
Sensitivity: Public
Routing Table
in Virtual Circuit Network
12 13 44
27 13 16
58 7 34
473
Sensitivity: Public
Routing
Routing algorithm:: that part of the
Network Layer responsible for deciding
on which output line to transmit an
incoming packet.
Remember: For virtual circuit subnets the
routing decision is made ONLY at set up.
Algorithm properties:: correctness,
simplicity, robustness, stability, fairness,
optimality, and scalability.
474
Sensitivity: Public
Routing Classification
Adaptive Routing Non-Adaptive
• based on current Routing
measurements • routing computed in
of traffic and/or topology. advance and off-line
1. centralized 1. flooding
2. isolated
2. static routing
3. distributed using shortest
path algorithms
475
Sensitivity: Public
Flooding
• Pure flooding :: every incoming packet
to a node is sent out on every outgoing
line.
– Obvious adjustment – do not send out on
arriving link (assuming full-duplex links).
– The routing algorithm can use a hop
counter (e.g., TTL) to dampen the
flooding.
– Selective flooding :: only send on those
lines going “approximately” in the right
direction. 476
Sensitivity: Public
Shortest Path Routing
1. Bellman-Ford Algorithm [Distance Vector]
2. Dijkstra’s Algorithm [Link State]
478
Sensitivity: Public
Metrics
– Unstable under heavy link load.
– Difficulty with granularity of the links.
• Revised ARPANET routing metric:
– Compress dynamic range of the metric
– Account for link type
– Smooth variation of metric with time:
• Delay transformed into link utilization
• Utilization was averaged with last reported utilization.
• Hard limit set on how much the metric could change per
measurement cyle.
479
Sensitivity: Public
225
30
[IGP] [EGP]
Intradomain routing Interdomain routing
Interior [BGP,IDRP] Exterior
Gateway Protocols Gateway Protocols
[RIP] [OSPF,IS-IS,PNNI]
482
Sensitivity: Public
Adaptive Routing
Basic functions:
1.Measurement of pertinent network data.
2.Forwarding of information to where the
routing computation will be done.
3.Compute the routing tables.
4.Convert the routing table information
into a routing decision and then
dispatch the data packet.
483
Sensitivity: Public
Adaptive Routing
Design Issues:
1. How much overhead is incurred due to
gathering the routing information
and sending routing packets?
2. What is the time frame (i.e, the
frequency) for sending routing packets
in support of adaptive routing?
3. What is the complexity of the routing
strategy?
484
Sensitivity: Public
Distance Vector Routing
• Historically known as the old ARPANET
routing algorithm {or known as Bellman-Ford
algorithm}.
Basic idea: each network node maintains a
Distance Vector table containing the
distance between itself and ALL possible
destination nodes.
• Distances are based on a chosen metric and
are computed using information from the
neighbors’ distance vectors.
Metric: usually hops or delay 485
Sensitivity: Public
Distance Vector Routing
Information kept by DV router
1. each router has an ID
2. associated with each link connected to a
router, there is a link cost (static or
dynamic) the metric issue!
Address of net 1
(network_address
, distance) Distance to net 1
pairs
Family of net 2 Address of net 2
Address of net 2
Distance to net 2
P&D slide
490
Sensitivity: Public
Link State Algorithm
1. Each router is responsible for meeting its
neighbors and learning their names.
2. Each router constructs a link state packet (LSP)
which consists of a list of names and cost to reach
each of its neighbors.
3. The LSP is transmitted to ALL other routers.
Each router stores the most recently generated
LSP from each other router.
4. Each router uses complete information on the
network topology to compute the shortest path
route to each destination node.
491
Sensitivity: Public
X A X A
C B D C B D
(a) (b)
X A X A
C B D C B D
(c) (d)
R9 R7
R3
R8 R1
R4
R2
Area 2
Backbone
R6 R5 area
499
Sensitivity: Public
Indicates
LSA
LS Age Options Type=1 type
Link-state ID
Advertising router
LS sequence number
LS checksum Length
0 Flags 0 Number of links
Link ID
Link data
Link type Num_TOS Metric Indicates
Optional TOS information link
More links
cost
N2 R3 R6 N4 R7
R2
R4 N6
R5
N3
Area 0.0.0.0
Area 0.0.0.1 R8 Area 0.0.0.2
N7 ABR
R = router
N=
Area 0.0.0.3
network
Copyright ©2000 The McGraw Hill Companies Leon-Garcia & Widjaja: Communication Networks Figure 8.33
501
Sensitivity: Public
OSPF
503
Sensitivity: Public
UNIT-4
504
Sensitivity: Public
Transport Layer
• Services
• Elements of transport protocol
• Simple transport protocol
• UDP
• Remote Procedure Call (see Distributed
Systems)
• TCP
505
Sensitivity: Public
Layer overview
application
transport
network
data link network
physical data
network link
data physical
link
physical network
data
link network
physical data
link
physical
network
data
link
physical
application
transport
network
data link
physical
506
Sensitivity: Public
Layer overview
Host 1 Transpor Host 2
t
Application layer addresses Application layer
Network
Network layer Network layer
addresses
507
Sensitivity: Public
Services
• To upper layer
– efficient, reliable, cost-effective service
– 2 kinds
• Connection oriented
• Connectionless
508
Sensitivity: Public
Services
• needed from network layer
– packet transport between hosts
– relationship network <> transport
• Hosts <> processes
• Transport service
– independent network
– more reliable
• Network
– run by carrier
– part of communication subnet for WANs
509
Sensitivity: Public
Simple service: primitives
• Simple primitives:
– connect
– send
– receive
– disconnect
510
Sensitivity: Public
Simple service: primitives
listen Wait till a process wants a connection
No TPDU
connect Try to setup a connection
Connection Request TPDU
send Send data packet
Data TPDU
receive Wait for arrival of data packet
No TPDU
disconnect Calling side breaks up the
Disconnect TPDU
connection
511
Sensitivity: Public
Simple service: state diagram
512
Sensitivity: Public
Simple service: state diagram
513
Sensitivity: Public
Simple service: state diagram
514
Sensitivity: Public
Berkeley service primitives
• Used in Berkeley UNIXsocket
for TCP
• Addressing primitives: bind
listen
accept
• Server primitives: send + receive
close
connect
send + receive
• Client primitives: close
515
Sensitivity: Public
Berkeley service primitives
socket create new communication end point
516
Sensitivity: Public
Transport Layer
• Services
• Elements of transport protocol
• Simple transport protocol
• UDP
• Remote Procedure Call (see Distributed
Systems)
• TCP
517
Sensitivity: Public
Elements of transport protocols (etp)
518
Sensitivity: Public
etp: Transport <> data link
• Physical channel <> subnet
Explicit addressing
Connection establishment
Potential existence of storage capacity in
subnet Dynamically varying number of
connections 519
Sensitivity: Public
etp: Addressing
• TSAP = transport service access point
– Internet: IP address + local port
– ATM: AAL-SAPs
• Connection scenario
• Getting TSAP addresses?
• From TSAP address to NSAP address?
520
Sensitivity: Public
etp: Addressing
• Connection scenario
521
Sensitivity: Public
etp: Addressing
• Connection scenario
– Host 2 (server)
• Time-of-day server attaches itself to TSAP 1522
– Host 1 (client)
• Connect from TSAP 1208 to TSAP 1522
• Setup network connection to host 2
• Send transport connection request
– Host 2
• Accept connection request
522
Sensitivity: Public
etp: Addressing
• Getting TSAP addresses?
– Stable TSAP addresses
• For key services
• Not for user processes
– active for a short time
– number of addresses limited
– Name servers
• to find existing servers
• map service name into TSAP address
– Initial connection protocol
523
Sensitivity: Public
etp: Addressing
• Getting TSAP addresses?
– Initial connection protocol
• to avoid many waiting servers one process
server
– waits on many TSAPs
– creates requested
server
524
Sensitivity: Public
etp: Addressing
• From TSAP address to NSAP address?
– hierarchical addresses
• address = <country> <network> <host> <port>
– Examples: IP address + port
Telephone numbers (<> number portability?)
• Disadvantages:
– TSAP bound to host!
– flat address space
• Advantages:
– Independent of underlying network addresses
– TSAP address not bound to host
• Mapping to network addresses:
– Name server
– broadcast
525
Sensitivity: Public
etp: Establishing a connection
• Problem: delayed duplicates!
• Scenario:
– Correct bank transaction
• connect
• data transfer
• disconnect
– Problem: same packets are received in same
order a secondRecognized?
time!
526
Sensitivity: Public
etp: Establishing a connection
• Unsatisfactory solutions:
– throwaway TSAP addresses
• need unlimited number of addresses?
• process server solution impossible
– connection identifier
• Never reused!
Maintain state in hosts
• Satisfactory solutions
527
Sensitivity: Public
etp: Establishing a connection
• Satisfactory solutions
– Ensure limited packet lifetime (incl. Acks)
– Mechanisms
• prevent packets from looping + bound congestion
delay
• hopcounter in each packet
• timestamp in each packet
Maximum packet lifetime T
– Basic assumption
If we wait a time T after sending a packet all
traces of it (including Acks) are gone
528
Sensitivity: Public
etp: Establishing a connection
• Tomlinson’s method
– requires: clock in each host
• Number of bits > number of bits in
sequence number
• Clock keeps running, even when a
hosts crashes
– Basic 2idea:
identically numbered TPDUs are
never outstanding at the same
time!
529
Sensitivity: Public
etp: Establishing a connection
• Tomlinson’s method
Never reuse a sequence number x within
the lifetime T for the packet with x
– Problems to solve
• Selection of the initial sequence number for a new
connection
• Wrap around of sequence numbers for an active
connection
• Handle host crashes
Forbidden region
530
Sensitivity: Public
etp: Establishing a connection
• Tomlinson’s method
– Initial sequence number
= lower order bits of clock
– Ensure initial sequence numbers are always
OK
forbidden region
– Wrap around
• Idle
• Resynchronize sequence numbers
531
Sensitivity: Public
etp: Establishing a connection
• Tomlinson - forbidden region
532
Sensitivity: Public
etp: Establishing a connection
• Tomlinson – three-way-
handshake
No combination of
delayed packets can
cause the protocol to
fail
533
Sensitivity: Public
etp: Establishing a connection
• Tomlinson – three-way-
handshake
534
Sensitivity: Public
etp: Releasing a connection
• 2 styles:
– Asymmetric
• Connection broken when one party
hangs up
• Abrupt! may result in data loss
– Symmetric
• Both parties should agree to release connection
• How to reach agreement? Two-army
problem
• Solution: three-way-handshake
– Pragmatic approach
• Connection = 2 unidirectional connections
• Sender can close unidirectional connection 535
Sensitivity: Public
etp: Releasing a connection
• Asymmetric: data loss
536
Sensitivity: Public
etp: Releasing a connection
• Symmetric: two-army-problem
Simultaneous attack by blue army
Communication is unreliable
No protocol exists!!
537
Sensitivity: Public
etp: Releasing a connection
• Three-way-handshake + timers
– Send disconnection request
+ start timer RS to resend (at most N times)
the disconnection request
– Ack disconnection request
+ start timer RC to release connection
538
Sensitivity: Public
etp: Releasing a connection
RC
539
Sensitivity: Public
etp: Releasing a connection
RS
540
Sensitivity: Public
etp: Flow control and buffering
Transport Data link
connections, lines many few
varying fixed
541
Sensitivity: Public
etp: Flow control and buffering
• Buffer organization
542
Sensitivity: Public
etp: Flow control and buffering
• Buffer management: decouple buffering from Acks
543
Sensitivity: Public
etp: Flow control and buffering
• Where to buffer?
– datagram network @ sender
– reliable network
+ Receiver process guarantees free buffers?
• No: for low-bandwidth bursty traffic
@ sender
• Yes: for high-bandwidth smooth
traffic
@ receiver
544
Sensitivity: Public
etp: Flow control and buffering
• Window size?
– Goal:
• Allow sender to continuously send packets
• Avoid network congestion
– Approach:
• maximum window size = c * r
– network can handle c TPDUs/sec
– r = cycle time of a packet
• measure c & r and adapt window size
545
Sensitivity: Public
etp: Multiplexing
• Upward: reduce number of network connections to reduce cost
• Downward: increase bandwidth to avoid per connection limits
546
Sensitivity: Public
etp: Crash recovery
• recovery from network, router crashes?
– No problem
• Datagram network: loss of packet is always handled
• Connection-oriented network: establish new connection + use state to
continue service
• recovery from host crash?
– server crashes, restarts: implications for client?
– assumptions:
• no state saved at crashed
Recovery
server
from a layer N crash can only
– • no simultaneous events
be done
NOT by layer
POSSIBLE N+1 and only if the
higher layer retains enough status
information.
547
Sensitivity: Public
etp: Crash recovery
• Illustration of problem: File transfer:
– Sender: 1 bit window protocol: states S0, S1
• packet with seq number 0 transmitted; wait for ack
– Receiver: actions
• Ack packet
• Write data to disk
• Order?
548
Sensitivity: Public
etp: Crash recovery
• Illustration of problem: File transfer
549
Sensitivity: Public
Transport Layer
• Services
• Elements of transport protocol
• Simple transport protocol
• UDP
• Remote Procedure Call (see Distributed
Systems)
• TCP
550
Sensitivity: Public
Simple transport protocol
• Service primitives:
– connum = LISTEN (local)
• Caller is willing to accept connection
• Blocked till request received
– connum = CONNECT ( local, remote)
• Tries to establish connection
• Returns identifier (nonnegative number)
– status = SEND (connum, buffer, bytes)
• Transmits a buffer
• Errors returned in status
– status = RECEIVE (connum, buffer, bytes)
• Indicates caller’s desire to get data
– status = DISCONNECT (connum)
• Terminates connection
551
Sensitivity: Public
Simple transport protocol
• Transport entity
– Uses a connection-oriented reliable network
– Programmed as a library package
– Network interface
• ToNet(…)
• FromNet(…)
• Parameters:
– Connection identifier (connum = VC)
– Q bit: 1 = control packet
– M bit: 1 = more data packets to come
– Packet type
– Pointer to data
– Number of bytes of data
552
Sensitivity: Public
Simple transport protocol
• Tra nspNeowt rotrkepnact packet types Meaning
kietty:
Call request Sent to establish a connection
553
Sensitivity: Public
Simple transport protocol
• Tra nsporSttatee state of a conneMcteioanning
ntity:
Idle Connection not established
Established
554
Sensitivity: Public
Simple transport protocol
• Transport entity: code
– See fig 6-20, p. 514 – 517
– To read and study at home!
– Questions?
• Is it acceptable not to use a transport header?
• How easy would it be to use another network
protocol?
555
Sensitivity: Public
Example Transport Entity (1)
556
Sensitivity: Public
Example Transport Entity (2)
557
Sensitivity: Public
Example Transport Entity (3)
558
Sensitivity: Public
Example Transport Entity (4)
559
Sensitivity: Public
Example Transport Entity (5)
560
Sensitivity: Public
Example Transport Entity (6)
561
Sensitivity: Public
Example Transport Entity (7)
562
Sensitivity: Public
Example Transport Entity (8)
563
Sensitivity: Public
Transport Layer
• Services
• Elements of transport protocol
• Simple transport protocol
• UDP
• Remote Procedure Call (see Distributed
Systems)
• TCP
564
Sensitivity: Public
UDP
• User Data Protocol
– Datagram service between processes
• No connection overhead
– UDP header:
• Ports = identification of end points
565
Sensitivity: Public
UDP
• Some characteristics
– Supports broadcasting, multicasting
(not in TCP)
– Packet oriented
(TCP gives byte stream)
– Simple protocol
566
Sensitivity: Public
Transport Layer
• Services
• Elements of transport protocol
• Simple transport protocol
• UDP
• Remote Procedure Call (see Distributed
Systems)
• TCP
567
Sensitivity: Public
TCP service model
• point-to-point
– one sender, one receiver
• reliable, in-order byte stream
– no message/packet boundaries
• pipelined & flow controlled
– window size set by TCP congestion and flow control
algorithms
• connection-oriented
– handshaking to get at initial state
• full duplex data
– bi-directional data flow in same connection
568
Sensitivity: Public
TCP service model
• …
• send & receive buffers
application applicatio
writes n reads
socket socket
data data
door door
TCP TCP
send buffer receive buffer
segment
569
Sensitivity: Public
TCP protocol
• Three-way handshake to set up connections
• Every byte has its own 32-bit sequence number
– Wrap around
– 32-bit Acks; window size in bytes
• Segment = unit of data exchange
– 20-byte header + options + data
– Limits for size
• 64Kbyte
• MTU, agreed upon for each direction
– Data from consecutive writes may be accumulated in
a single segment
– Fragmentation possible
• Sliding window protocol
570
Sensitivity: Public
TCP header
571
Sensitivity: Public
TCP header
• source & destination ports (16 bit)
• sequence number (32 bit)
• Acknowledgement number (32 bit)
• Header length (4 bits) in 32-bit words
• 6 flags (1 bit)
• window size (16 bit): number of bytes the sender is
allowed to send starting at byte acknowledged
• checksum (16 bit)
• urgent pointer (16 bit) : byte position of urgent data
572
Sensitivity: Public
TCP header
• Flags:
– URG: urgent pointer in use
– ACK: valid Acknowledgement number
– PSH: receiver should deliver data without delay to user
– RST: reset connection
– SYN: used when establishing connections
– FIN: used to release connection
• Options:
– Maximum payload a host is willing to receive
– Scale factor window size
– Use selective repeat instead of go back n
573
Sensitivity: Public
TCP connection management
• Three-way handshake
– Initial sequence number: clock based
– No reboot after crash for T (maximum packet lifetime=120 sec)
– Wrap around?
• Connection identification
– Pair of ports of end points
• Connection release
– Both sides are closed separately
– No response to FIN: release after 2*T
– Both sides closed: wait for time 2 * T
574
Sensitivity: Public
TCP connection management
575
Sensitivity: Public
576
Sensitivity: Public
TCP connection management
State Description
577
Sensitivity: Public
TCP transmission policy
• Window size decoupled from Acks (ex. next slides)
• Window = 0 no packets except for
– Urgent data
– 1 byte segment to send Ack & window size
• Incoming user data may be buffered
– May improve performance: less segments
to send
• Ways to improve performance:
– Delay acks and window updates for 500 msec
– Nagle’s algorithm
– Silly window syndrome
578
Sensitivity: Public
TCP transmission policy
579
Sensitivity: Public
580
Sensitivity: Public
TCP transmission policy
• Telnet scenario: interactive editor reacting on each keystroke:
One character typed
21 byte segment or 41 byte IP packet
(packet received) 20 byte segment with Ack
(editor has read byte) 20 byte segment with window update
(editor has processed byte; sends echo) 21 byte segment
(client gets echo) 20 byte segment with Ack
• Solutions:
– delay acks + window updates for 500 msec
– Nagle’s algorithm:
• Receive one byte from user; send it in segment
• Buffer all other chars till Ack for first char arrives
• Send other chars in a single segment
• Disable algorithm for X-windows applications (do not delay sending of mouse
movements)
581
Sensitivity: Public
TCP transmission policy
• Silly window syndrome
– Problem:
• Sender transmits data in large blocks
• Receiver reads data 1 byte at a time
– Scenario: next slide
– Solution:
• Do not send window update for 1 byte
• Wait for window update till
– Receiver can accept MTU
– Buffer is half empty
582
Sensitivity: Public
TCP transmission policy
583
Sensitivity: Public
TCP transmission policy
• General approach:
– Sender should not send small segments
• Nagle: buffer data in TCP send buffer
– Receiver should not ask for small segments
• Silly window: do window updates in large units
584
Sensitivity: Public
Principles of Congestion Control
Congestion:
• informally: “too many sources sending too much data
too fast for network to handle”
• different from flow control!
= end-to-end issue!
• manifestations:
– lost packets (buffer overflow at routers)
– long delays (queue-ing in router buffers)
• a top-10 problem!
585
Sensitivity: Public
Causes/costs of congestion: scenario
• two senders, two
receivers
• one router, infinite
buffers
• no retransmission
• large delays
when congested
• maximum
achievable
throughput
586
Sensitivity: Public
Approaches towards congestion control
Two broad approaches towards congestion control:
end-to-end congestion Network-assisted
control: congestion control:
• no explicit feedback from • routers provide
network feedback to
• congestion inferred from end systems
end-system observed – single bit indicating
loss, delay congestion (SNA, ATM)
• approach taken by TCP – explicit rate sender
should send at
587
Sensitivity: Public
TCP Congestion Control
• How to detect congestion?
• Timeout caused
b:yRaper ackfeortwloeri sdsn:etrweoakr ssons
– Transmission errors
– Packed discardedPaactkcetolnosgsested router
588
Sensitivity: Public
TCP congestion control
589
Sensitivity: Public
TCP Congestion Control
• How to detect congestion?
• Timeout caused by: Rparae cket loss:
reasons
– Transmission errors
– Packed discardedPaatckceot
nol gApproach:
sestecdon2rgwindows
oeutstieonrfor sender
Receiver window
Minimum of Congestion window
590
Sensitivity: Public
TCP Congestion Control
• end-end control (no network assistance)
• transmission rate limited by congestion window size, Congwin,
over segments:
Congwin
throughput = w * MSS
RTT Bytes/sec
591
Sensitivity: Public
TCP Congestion Control:
• “probing” for usable • two “phases”
bandwidth: – slow start
– ideally: transmit as fast as – congestion avoidance
possible (Congwin as • important variables:
large as possible) without – Congwin
loss – threshold: defines
– increase Congwin until threshold between two
loss (congestion) phases:
– loss: decrease Congwin, • slow start phase
then begin probing • congestion control
(increasing) again phase
592
Sensitivity: Public
TCP Slow start
Host A Host B
Slow start algorithm
RT
initialize: Congwin = 1
T
for (each segment ACKed)
Congwin++
until (loss event OR
CongWin > threshold)
• exponential increase (per RTT) in
window size (not so slow!)
• loss event: timeout (Tahoe TCP)
and/or three duplicate ACKs
(Reno TCP) time
593
Sensitivity: Public
TCP Congestion Avoidance
Congestion avoidance
/* slowstart is over */
/* Congwin > threshold */
Until (loss event) {
every w segments
ACKed:
Congwin++
}
threshold = Congwin/2
Congwin = 1
1
perform slowstart
1: TCP Reno skips slowstart (fast
recovery) after three duplicate ACKs
594
Sensitivity: Public
TCP congestion control
595
Sensitivity: Public
TCP timer management
• How long should the timeout interval be?
– Data link: expected delay predictable
– Transport: different environment; impact of
• Host
• Network (routers, lines)
unpredictable
• Consequences
– Too small:
unnecessary
retransmissi
ons
– Too large:
poor
performance
• Solution: adjust timeout interval based on continuous measurements of
network performance
596
Sensitivity: Public
TCP timer management
597
Sensitivity: Public
TCP timer management
Timeout = RTT + 4 * D
• Algorithm of Jacobson:
598
Sensitivity: Public
TCP timer management
• Algorithm of Jacobson: Timeout = RTT + 4 * D
– D = D + (1 - ) RTT - M
• Karn’s algorithm: how handle retransmitted segments?
– Do not update RTT for retransmitted segments
– Double timeout
599
Sensitivity: Public
TCP timer management
• Other timers:
– Persistence timer
• Problem: lost window update packet when window is 0
• Sender transmits probe; receivers replies with window size
– Keep alive timer
• Check whether other side is still alive if connection is idle for
a long time
• No response: close connection
– Timed wait
• Make sure all packets are died off when connection is closed
• =2T
600
Sensitivity: Public
Wireless TCP & UDP
• Transport protocols
– Independent of underlying network layer
– BUT: carefully optimized for wired networks
– Assumption:
• Packet loss caused by congestion
• Invalid for wireless networks: always loss of
packets
• Congestion algorithm:
– Timeout ( = congestion) slowdown
• ion for wireless networks:
Solut Wireless: Lower throughput – same loss NO solution
– Retransmit asap
601
Sensitivity: Public
Wireless TCP
• Heterogeneous networks
• Solutions?
– Retransmissions can cause congestion in
wired network
602
Sensitivity: Public
Wireless TCP
• Solutions for heterogeneous networks
– Indirect TCP
+ 2 homogeneous connections
– violates TCP
semantics
603
Sensitivity: Public
Wireless TCP
• Solutions for heterogeneous networks
– Snooping agent at base station
Snooping
• agent
Cashes segments for mobile host
•• Retransmits segment if ack is
Removes duplicate acks
missing
• Generates selective repeat requests for
segments originating
at mobile host
604
Sensitivity: Public
Wireless UDP
• UDP = datagram service loss permitted
no problems?
605
Sensitivity: Public
Transactional TCP
• How to implement RPC?
– On top of UDP?
– Yes if
• Request and reply fit in a single packet
• Operations are idempotent
– Otherwise
• Reimplementation of reliability
– On top of TCP?
606
Sensitivity: Public
Transactional TCP
How to implement RPC?
• On top of UDP?
– Yes if
• Request and reply fit in a single
packet
• Operations are idempotent
– Otherwise
• Reimplementation of reliability
• On top of TCP?
– Unattractive because of connection
set up
• Solution: transactional TCP
607
Sensitivity: Public
Transactional TCP
How to implement RPC?
• On top of UDP?
– Problems withreliability
• On top of TCP?
– Overhead of connection set up
• Solution: transactional TCP
– Allow data transfer during setup
– Immediate close of stream
608
Sensitivity: Public
UNIT
5
INTRODUCTION TO
APPLICATION LAYER
609
Sensitivity: Public
Chapter 2: Application layer
• 2.1 Principles of network applications
• 2.2 Web and HTTP
• 2.3 FTP
• 2.4 Electronic Mail
– SMTP, POP3, IMAP
• 2.5 DNS
• 2.6 P2P applications
• 2.7 Socket programming with TCP
• 2.8 Socket programming with UDP
610
Sensitivity: Public
Processes communicating
host or host or
server server
Process:
program running within a host controlled by
app developer
process process
613
Sensitivity: Public
Internet transport protocols services
TCP service:
• connection-oriented: setup required between client and server
processes
• reliable transport between sending and receiving process
• flow control: sender won’t overwhelm receiver
• congestion control: throttle sender when network overloaded
• does not provide: timing, minimum throughput guarantees, security
UDP service:
• unreliable data transfer between sending and receiving process
• does not provide: connection setup, reliability, flow control,
congestion control, timing, throughput guarantee, or security
614
Sensitivity: Public
HTTP overview
Web page consists of base HTML-file
which includes several referenced
objects
Each object is addressable by a URL
PC running
Explorer HTTP: hypertext transfer protocol
Web’s application layer protocol
client/server model
client: browser that requests,
Server receives, “displays” Web objects
running server: Web server sends objects
Apache Web
in response to requests
server
uses TCP
is “stateless”
Mac running
Navigator
615
Sensitivity: Public
HTTP connections
Nonpersistent HTTP Persistent HTTP
• At most one object is sent Multiple objects can be
• sent over single TCP
over a TCP connection. connection between client
and server.
616
Sensitivity: Public
Non-Persistent HTTP: Response time
Definition of RTT: time for a
small packet to travel from
client to server and back.
initiate TCP
Persistent HTTP
• server leaves connection open after sending response
• subsequent HTTP messages between same client/server
sent over open connection
• client sends requests as soon as it encounters a referenced
object
• as little as one RTT for all the referenced objects
618
Sensitivity: Public
HTTP messages
two types of HTTP messages: request, response
HTTP request message:
ASCII (human-readable format)
619
Sensitivity: Public
Method types
HTTP/1.0 HTTP/1.1
• GET • GET, POST, HEAD
– request an object from • PUT
server – uploads file in entity body
• POST to path specified in URL
– upload information field
using • DELETE
forms – deletes file specified in
• HEAD the URL field
– asks server to leave
requested object out of
response
620
Sensitivity: Public
Cookies: Keeping state
What cookies can bring:
• authorization aside
Cookies and privacy:
• shopping carts cookies permit sites to learn a
lot about you
• recommendations you may supply name and e-
• user session state (Web mail to sites
e-mail)
621
Sensitivity: Public
Web caches (proxy server)
Goal: satisfy client request without involving origin server
624
Sensitivity: Public
FTP: the file transfer protocol
625
Sensitivity: Public
FTP: separate control, data connections
TCP control connection
port 21
• FTP client contacts FTP server at
port 21
TCP data
• client authorized over FTP port 20
connection client connectiocnontr o l
F T Pserver
• client browses by
sending
remote directory
commands over control connection.
• when server receives file transfer command, server opens 2nd
TCP connection (for file) to client
• after transferring one file, server closes data connection.
• server opens another TCP data connection to transfer another file.
• control connection: “out of band”
• FTP server maintains “state”: current directory, earlier
authentication
626
Sensitivity: Public
FTP commands, responses
Sample commands:
• sent as ASCII text over control channel
• USER username
• PASS password
• LIST return list of file in current directory
• RETR filename retrieves (gets) file
• STOR filename stores (puts) file onto remote host
Sample return codes
• status code and phrase (as in HTTP)
• 331 Username OK, password required
• 125 data connection already open; transfer starting
• 425 Can’t open data connection
• 452 Error writing file 627
Sensitivity: Public
FTP issues
• Multiple connections are used
– for each directory listing and file transmission
• No integrity check at receiver
• Messages are sent in clear text
– including Passwords and file contents
– can be sniffed by eavesdroppers
• Solution
– Secure FTP (SSH FTP)
• allows a range of operations on remote files
– FTPS ( FTP over Secure Sockets Layer (SSL) )
– Transport Layer Security (TLS) encryption
628
Sensitivity: Public
Lecture 5: Outline
• 2.1 Principles of network applications
• 2.2 Web and HTTP
• 2.3 FTP
• 2.4 Electronic Mail
– SMTP
– POP3
– IMAP
• 2.5 DNS
629
Sensitivity: Public
Electronic Mail outgoing
message queue
user mailbox
Three major components: user
• user agents agent
632
Sensitivity: Public
Scenario: Alice sends message to Bob
1) Alice uses UA to compose message and “to”
[email protected]
2) Alice’s UA sends message to her mail server; message placed in
message queue
3) Client side of SMTP opens TCP connection with Bob’s mail
server
4) SMTP client sends Alice’s message over the TCP
connection
5) Bob’s mail server places the message in Bob’s mailbox
6) Bob invokes his user agent to read message
1 mail
mail
server user
user server
2 agent
agent 3 6
4 5
633
Sensitivity: Public
Sample SMTP interaction
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello
crepes.fr, pleased
to meet you
C: MAIL FROM:
<[email protected]>
S: 250 [email protected]... Sender ok
C: RCPT TO: <[email protected]>
S: 250 [email protected] ...
Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message 634
accepted for delivery
Sensitivity: Public
SMTP: final words
• SMTP uses persistent connections
• SMTP requires message (header & body) to be in 7-bit ASCII
• SMTP server uses CRLF.CRLF to determine end of
message
• body body
– the
“message”,
ASCII characters only
636
Sensitivity: Public
Message format: multimedia extensions
• MIME: multimedia mail extension, RFC 2045, 2056
• additional lines in msg header declare MIME content type
From:
MIME version [email protected] To:
[email protected]
method used Subject: Picture of yummy crepe.
to encode MIME-Version: 1.0
data Content-Transfer-Encoding: base64
Content-Type: image/jpeg
multimedia data base64 encoded data .....
type, subtype, .........................
parameter declaration ......base64 encoded data
encoded data
637
Sensitivity: Public
Mail access protocols
SMTP SMTP access
user
user protocol
agent
agent
• telnet servername 25
• see 220 reply from server
• enter HELO, MAIL FROM, RCPT TO, DATA, QUIT
commands
above lets you send email without using email client
(reader)
641
Sensitivity: Public
Lecture 5: Outline
• 2.1 Principles of network applications
• 2.2 Web and HTTP
• 2.3 FTP
• 2.4 Electronic Mail
– SMTP
– POP3
– IMAP
• 2.5 DNS
642
Sensitivity: Public
DNS: Domain Name System
People: many identifiers:
– SSN, name, passport #
Internet hosts, routers:
– IP address (32 bit) -
used for addressing
datagrams
– “name”, e.g.,
ww.yahoo.com - used
by humans
Domain Name System:
• distributed database implemented in hierarchy of many name
servers
• application-layer protocol host, routers, name servers to
communicate to resolve names (address/name translation)
643
Sensitivity: Public
– note: core Internet function, implemented as application-layer
DNS services
• hostname to IP address translation
• host aliasing
– Canonical, alias names
• mail server aliasing
• load distribution
– replicated Web servers: set of IP addresses for one canonical
name
646
Sensitivity: Public