ECT423 COMPUTER NETWORKS
Preamble:
• The course aims to expose students to
computer networks taking a top-down
approach of viewing from the layer of
user applications and zooming into link
layer protocols. The principles of various
protocols used in every layer are studied
in detail. A brief introduction to
mathematical modelling of queues with
an application to a single example is
included.
Prerequisite:
• MAT 204 Probability,
Random Process and
Numerical Methods
Course Outcomes:
• After the completion of the course the
student will be able to
•
Assessment Pattern
Assessment Pattern
Syllabus
Syllabus
Syllabus
Syllabus
syllabus
What is a Computer Network?
• A group of computers -connected
with each other- through
wires/co-axial cables, /optical
fibers/ , optical links / even
wireless-so that various devices
can interact with each other
through a network.
• The aim - the sharing of resources
among various devices.
• -simple to complex level.
Modern computer networks
have the following
functionality:
• help in operating virtually
• integrate on a large scale
• respond very quickly in case
of conditions change
• help in providing data
security
OSI LAYERS
OSI layer functions
OSI MODEL
• acts as a roadmap of what is happening
within a network
• helps to see how information is transferred
across a network.
Mnemonics to remember :
All People Seem to Need Data Processing
or in reverse order
Please Do Not Throw Sausage Pizza Away
Components of computer
networks
• Physical components- hardware
devices and media that enable
connectivity and data exchange
between devices.
• Software components: The
operating system and protocols
Physical components
Some Physical components-
• NIC(Network Interface Card)-
a network adapter used to connect the
computer to the network.
installed in the computer to establish a
LAN connection.
offers physical access to networking
media
has a unique ID (MAC address) that is
written on the chip, and
it has a connector to connect the cable
to it.
NIC
The cable- acts as an interface between the
computer and the router or modem.
A layer 2 device,
works on the network model’s physical and data
link layers.
• Wired NIC: -Cables and Connectors use Wired
NIC to transfer data.
• Wireless NIC: - connect to a wireless network
such as Wifi, Bluetooth, etc.
NIC
Some Physical components
• HUB:
• a multi-port repeater
• connects multiple wires coming from
different branches,
• cannot filter data, so data packets are sent
to all connected devices.
• cannot identify the destination of the
packet,
• So it sends the message to each port.
• A hub acts as a dumb switch that does not
know, which data needs to be forwarded
HUB
Types of HUB
• Active HUB: regenerates and amplifies the
electric signal before sending them to all
connected device.
• Passive HUB: does not amplify or regenerate
electric signal, (the simplest types of Hub) and
not suitable for long-distanceconnections.
• Switching HUB:intelligent HUB, (provides
some additional functionality over active and
passive hubs). analyze data packets and make
decisions based on MAC address and they are
operated on DLL(Data Link Layer).
Router
• that routes data packets based on their IP
addresses.
• (IP address-a unique string of characters that
identifies each computer using the Internet
Protocol to communicate over a network.)
• A Network Layer device.
• It serves two primary functions: managing
traffic between these networks by
forwarding data packets to their intended IP
addresses, and allowing multiple devices to
use the same Internet connection.
Router
Types of routers
1. Broadband Routers: . It is used to do
different types of things
2. Wireless routers:
3. Wired Routers:
4. Edge Routers:.
5. Core Routers: Core routers distribute
packets within the same network.
The main task is to carry heavy data
transfers.
Types of router
6. Virtual Router: They are
implemented using a software on the
virtual machine , and they are more
flexible and scalable.
7. Portable Routers: They are used to
create private Wi-Fi and hence
designed for easy portability
Modem
• short form ofModulator/Demodulator.
• hardware component/device that can
connect computers and other devices
such as routers and switches to the
internet.
• Modems convert or modulate the
analog signals coming from
telephone wire into a digital form that
is in the form of 0s and 1s.
Modem
Modem
• Modems can modulate as well as demodulate
the signals simultaneously.
• Modem allows to connect only a specific number
of devices to the internet.
• According to the features of modem, it’s price
ranges.
• Modems can be upgraded with the help of a
specific software patch.
• To use the devices over the internet with a
modem devices need to be configured with
an Internet Service Provider(ISP).
the modem when connected to Hub it slows down
its process
Types of Modem
• Optical Modem
• Dial up modem
• Satellite modem
• Cable modem
Switch
• a multiport bridge with a buffer
• A switch is a data link layer device.
• The switch can perform error checking before
forwarding data, which makes it very efficient
as it does not forward packets that have errors
and forward good packets selectively to the
correct port only.
• A network switch connects devices within a
network
• A switch only sends data to the single device it
is intended for (unlike router which sends to
network to network)
Media
• Link which is going to carry data from
one side to another side.
• Wired Medium (Guided Medium) and
Wireless Medium (Unguided
Medium).
Wired Media
• Ethernet: Ethernet is the most widely
used LAN technology, which is
defined under IEEE standards 802.3.
There are two types of Ethernet:
• Fibre Optic Cable: In fibre optic
cable data is transferred in the form
of light waves.
• Wireless Medium
• Infrared (E.g. short-range communication –
TV remote control).
• Radio (E.g. Bluetooth, Wi-Fi).
• Microwaves (E.g. Cellular system).
• Satellite (E.g. Long range communications
– GPS).
Repeater
• an important component of computer
networks as it is used to regenerate and
amplify signal in the computer networks.
• Repeaters are used to improve the quality of
the networks and they are operated on the
Physical Layer of the OSI Model.
Repeater
Server
• Acomputer program that provides various
functionality to another computer program.
• plays a vital role in facilitating communication,
data storage, etc.
• have more data storage as compared to normal
computers.
• They are designed for the specific purpose of
handling multiple requests from clients.
•
Server
Applications of internet
Internet usage
• There are 5.35 billion people using
the internet in 2024, equating to
66.2 percent of the world’s total
population.
The Internet
• is a computer network that
interconnects billions of computing
devices throughout the world.
• Some computing devices -traditional
desktop PCs, Linux workstations, and servers that
store and transmit information such as Web pages and
e-mail messages
• nontraditional Internet “things” such as laptops,
smartphones, tablets, TVs, gaming consoles,
thermostats, home security systems, home appliances,
watches, eye glasses, cars, traffic control systems and
more are being connected to the Internet
• End systems are
connected together by a
network of
communication links
and packet switches
• Different links can transmit data at
different rates, with the transmission
rate of a link measured in bits/second.
• When one end system has data to send to
another end system, the sending end
system segments the data and adds header
bytes to each segment. The resulting
packages of information, known as packets
ISP
• End systems access the Internet through
Internet Service Providers (ISPs)
• An ISP (internet service provider) is a
company that provides individuals and
organizations access to the internet and
other related services.
• An ISP has the equipment and the
telecommunication line access required to
have a point of presence on the internet for
the geographic area served.
Protocols
• End systems, packet switches, and other
pieces of the Internet run protocols that
control the sending and receiving of
information within the Internet .
•
analogy
Internet Protocol definition
• A protocol defines the format
and the order of messages
exchanged between two or more
communicating entities, as well
as the actions taken on the
transmission and/or receipt of a
message or other event.
Protocol
• A set of rules that determines how data is sent
and received over a network.
• A language that computers use to talk to each
other, ensuring they understand and can
respond to each other’s messages correctly.
• Help make sure that data moves smoothly and
securely between devices on a network.
Key elements in Protocol
• Syntax- structure of protocol
• Semantics- rules and norms for data transfer
• Timing – synchronization and co-ordination
• Sequence control
• Flow control
• Security
Standardization of protocols
• Standards are the set of rules for data
communication that are needed for the
exchange of information among devices.
• It is important to follow Standards which are
created by various Standard Organizations
like IEEE, ISO, ANSI, etc.
Types of standards
• De facto standard – by fact- not
approved
• De Jure Standard: ” is “By Law” or
“By Regulations”.
NETWORK EDGES, NETWORK
CORES AND NETWORK LINKS:
mobile network
• network edge:
– hosts: clients and global ISP
servers
– servers often in data
home
centers network
regional ISP
❖ access networks,
physical media: wired,
wireless communication
links
❖ network core:
▪ interconnected routers
▪ network of networks institutional
network
I
Network edges , Network core and Network
Links
Network edges, Network core and Network
Links
• The computers and other devices -connected
to the Internet -often referred to as -end
systems.
• Because they sit at the edge of the Internet.
• End systems are also referred to as hosts.
• Because they host (that is, run) application
programs such as a Web browser program, a
Web server program, an e-mail client
program, or an e-mail server program.
• Hosts are divided into : clients and servers
A network
• Consider the applications and end
systems at the “edge of the network.
•
Access net: digital subscriber line (DSL)
central office telephone
network
DSL splitter
modem DSLAM
ISP
voice, data transmitted
at different frequencies over DSL access
dedicated line to central office multiplexer
❖ use existing telephone line to central office DSLAM
▪ data over DSL phone line goes to Internet
▪ voice over DSL phone line goes to telephone net
❖ < 2.5 Mbps upstream transmission rate (typically < 1 Mbps)
❖ < 24 Mbps downstream transmission rate (typically < 10 Mbps)
Introduction 1-63
Access net: cable network
cable headend
cable splitter cable modem
modem CMTS termination system
data, TV transmitted at different
frequencies over shared cable ISP
distribution network
❖ HFC: hybrid fiber coax
▪ asymmetric: up to 30Mbps downstream transmission rate, 2
Mbps upstream transmission rate
❖ network of cable, fiber attaches homes to ISP router
▪ homes share access network to cable headend
▪ unlike DSL, which has dedicated access to central office
Introduction
Access net: home network
wireless
devices
to/from headend or
central office
often combined
in single box
cable or DSL modem
wireless access router, firewall, NAT
point (54 Mbps)
wired Ethernet (100 Mbps)
Enterprise access networks
(Ethernet)
institutional link to
ISP (Internet)
institutional router
Ethernet institutional mail,
switch web servers
• typically used in companies, universities, etc
❖ 10 Mbps, 100Mbps, 1Gbps, 10Gbps transmission
rates
❖ today, end systems typically connect into Ethernet
switch Introduction 1-66
Wireless access networks
• shared wireless access network connects end system to
router
– via base station aka “access point”
wireless LANs: wide-area wireless access
▪ within building (100 ft) ▪ provided by telco (cellular)
▪ 802.11b/g (WiFi): 11, 54 Mbps operator, 10’s km
transmission rate ▪ between 1 and 100 Mbps
▪ 4G: LTE,5G, 6 G
to Internet
to Internet
Physical media
• Data- propagates between
transmitter/receiver pairs as
bits twisted pair (TP)
• physical link: what lies • two insulated copper
between transmitter & wires
– Category 5: 100 Mbps,
receiver. Two types
1 Gpbs Ethernet
• guided media: – Category 6: 10Gbps
– signals propagate in solid
media. eg: copper wires,
fiber, coaxial cables
• unguided media:
– signals propagate freely,
e.g., radio
Physical media: coax, fiber
coaxial cable: fiber optic cable:
• two concentric copper ❖ glass fiber carrying light
pulses, each pulse a bit
conductors
❖ high-speed operation:
• bidirectional ▪ high-speed point-to-point
• broadband: transmission (e.g., 10’s-100’s
Gpbs transmission rate)
– multiple channels on
cable ❖ low error rate:
▪ repeaters spaced far apart
– HFC
▪ immune to electromagnetic
noise
Physical media: radio
• signal carried in radio link types:
electromagnetic ❖ terrestrial microwave
spectrum ▪ e.g. up to 45 Mbps channels
❖ LAN (e.g., WiFi)
• no physical “wire”
▪ 11Mbps, 54 Mbps
• bidirectional ❖ wide-area (e.g., cellular)
• propagation environment ▪ 4G cellular
effects: ❖ satellite
▪ Kbps to 45Mbps channel (or
– reflection multiple smaller channels)
– obstruction by ▪ 270 msec end-end delay
objects ▪ geosynchronous versus low
altitude
– interference
Host: sends packets of data
host sending function:
•takes application message
two packets,
•breaks into smaller chunks, L bits each
known as packets, of length L
bits
•transmits packet into access 2 1
network at transmission rate R R: link transmission rate
host
– Link capacity, or link
bandwidth
packet time needed to L (bits)
transmission = transmit L-bit =
R (bits/sec)
delay packet into link
The network core
• mesh of interconnected
routers
• packet-switching: hosts
break application-layer
messages into packets
– forward packets from
one router to the next,
across links on path
from source to
destination
– each packet transmitted
at full link capacity
Two key network-core functions
routing: determines forwarding: move packets
source-destination route taken from router’s input to
by packets
▪ routing algorithms appropriate router output
routing algorithm
local forwarding table
header value output link
0100 3 1
0101 2
0111 2 3 2
1001 1
11
01
dest address in arriving
packet’s header
Connection oriented services
and connection less services
provided to host
Connection oriented services and
connection less services
The two services given by the layers to
layers above them
a) Connection oriented services
b) Connection less services
Connection oriented services
• There is a sequence of operation to be followed
by the users.
1. Connection is established.
2. Information is sent.
3. Connection is released
• Connection oriented service - more reliable than
connectionless service.
• We can send the message in connection
oriented service-even if there is an error at the
receivers end. Example of connection oriented is
TCP (Transmission Control Protocol) protocol.
Connectionless protocol
• Each message is routed independently from
source to destination.
• The order of message sent can be different from
the order received.
• In connectionless the data is transferred in one
direction from source to destination without
checking that destination- is still there or not or if
it prepared to accept the message.
• No Authentication needed.
• Example of Connectionless service is UDP (User
Datagram Protocol) protocol.
Analogy for connection oriented
and connection less services
Circuit switching and packet
switching
Circuit switching
• A communication method where a
dedicated communication path, or circuit,
is established between two devices
before data transmission begins.
• The circuit remains dedicated to the
communication for the duration of the
session, and no other devices can use it
while the session is in progress.
• commonly used in voice communication
and some types of data communication.
•
Advantages of Circuit Switching
• Guaranteed bandwidth: -As it provides a
dedicated path for communication
• Low latency: -because the path is
predetermined, and -no need to establish a
connection for each packet.
• Predictable performance: -because
the bandwidth is reserved, and there is no
competition for resources.
• Suitable for real-time communication: because
of above advantages
Disadvantages of Circuit Switching
• Inefficient use of bandwidth: - because the
bandwidth is reserved for the entire duration of
the call, even when no data is being transmitted.
• Limited scalability: -the number of circuits that
can be established is finite, which can limit the
number of simultaneous calls that can be made.
• High cost: It requires dedicated resources, such
as hardware and bandwidth, for the duration of
the call.
Packet Switching
• A communication method where data is divided
into smaller units called packets and transmitted
over the network.
• Each packet contains the source and destination
addresses, as well as other information needed
for routing.
• The packets may take different paths to reach
their destination, and they may be transmitted
out of order or delayed due to network
congestion.
Advantages of Packet switching
• Efficient use of bandwidth: Bandwidth is
shared among multiple users, and resources
are allocated only when data needs to be
transmitted.
• Flexible: It can handle a wide range of data
rates and packet sizes.
• Scalable: Highly scalable and can handle
large amounts of traffic on a network.
• Lower cost: The resources are shared
among multiple users.
Disadvantages of Packet Switching
• Higher latency: The packets must be routed
through multiple nodes, which can cause delay.
• Limited QoS: That different types of traffic may
be treated equally.
• Packet loss: Result in packet loss due
to congestion on the network or errors in
transmission.
• Unsuitable for real-time communication :.
Multiplexing
• sharing of a medium or bandwidth.
• The process in which multiple signals coming
from multiple sources are combined and
transmitted over a single communication /
physical line.
Types of Multiplexing :
• Frequency Division Multiplexing (FDM)
• Time-Division Multiplexing (TDM)
• Wavelength Division Multiplexing (WDM)
• Code-division multiplexing (CDM)
• Space-division multiplexing (SDM)
Frequency division multiplexing
• The bandwidth of a single physical medium
is divided into a number of smaller,
independent frequency channels.
Frequency division multiplexing
• A number of signals are transmitted at the
same time, and each source transfers its
signals in the allotted frequency range.
• A suitable frequency gap (guard band)
between the 2 adjacent signals to avoid
over-lapping.
• Since the signals are transmitted in the
allotted frequencies so this decreases the
probability of collision.
Time division multiplexing
(TDM)
• The packets are divided into fixed lengths
and assigned fixed time slots for
transmission.
• Each divided signal and packet, which must
be transmitted within assigned time slots, are
reassembled into a complete signal at the
destination.
TDM
Types of TDM
• There are two types of Time Division
Multiplexing :
• Synchronous Time Division Multiplexing
• Statistical (or Asynchronous) Time Division
Multiplexing
Synchronous TDM
• The time slots are assigned at the beginning,
irrespective of the idea about the presence of
data at the source.
• This leads to the wastage of the channel
capacity. As in the absence of any data unit,
that particular time slot gets entirely wasted.
Asynchronous TDM or Statistical TDM
• A type of Time Division Multiplexing where
the output frame collects data from the input
frame till it is full, not leaving an empty slot
like in Synchronous TDM.
• A more efficient type of time-division
multiplexing as the channel capacity is fully
utilized and improves the bandwidth
efficiency.
How do loss and delay occur?
packets queue in router buffers
• packet arrival rate to link (temporarily) exceeds output link
capacity
• packets queue, wait for turn
packet being transmitted (delay)
B
packets queueing (delay)
free (available) buffers: arriving packets
dropped (loss) if no free buffers
Introduction 1-98
Delays in Packet switching
networks
Four types of Delay
• The most important of these delays :
• the nodal processing delay,
• queuing delay,
• transmission delay, and
• propagation delay
• Together, these delays accumulate to
give a total nodal delay.
Processing delay.
• The time required to examine the packet’s
header and determine where to direct the
packet is part of the processing delay.
• The processing delay -also includes factors,
such as the time needed to check for
bit-level errors in the packet that occurred in
transmitting the packet’s bits from the
upstream node to router
• Processing delays in high-speed routers
-typically on the order of microseconds or
less.
Queuing delay
• At the queue, the packet experiences a
queuing delay as it waits to be transmitted
onto the link.
• The length of the queuing delay of a specific
packet will depend on the number of
earlier-arriving packets that are queued and
waiting for transmission onto the link.
•
Queuing delay
• If the queue is empty and no other packet is
currently being transmitted, then our packet’s
queuing delay will be zero.
• On the other hand, if the traffic is heavy and
many other packets are also waiting to be
transmitted, the queuing delay will be long.
• Queuing delays can be on the order of
microseconds to milliseconds in practice.
Transmission Delay
• Let the length of the packet by L bits, and
• denote the transmission rate of the link from
router A to router B by R bits/sec.
• The transmission delay is L/R.
• This is the amount of time required to push (that
is, transmit) all of the packet’s bits into the link.
• Transmission delays are typically on the order
of microseconds to milliseconds in practice.
Propagation Delay
• The time required to propagate from the
beginning of the link to router B is the
propagation delay.
• The bit propagates at the propagation
speed of the link.
• The propagation delay is d/s, where d is
the distance between router A and router
B and s is the propagation speed of the
link.
Total nodal delay
Types of delay
Queuing delay
• The most complicated and interesting
component of nodal delay is the queuing
delay, dq .
• Unlike the other three delays - the
queuing delay - vary from packet to
packet .
• If 10 packets arrive at an empty queue at the
same time, the first packet transmitted will
suffer no queuing delay, while the last packet
transmitted will suffer a relatively large
queuing delay .
Queuing delay
• While characterizing queuing delay-
uses statistical measures, - like average
queuing delay, variance of queuing
delay, and the probability that the
queuing delay exceeds some specified
value etc.
• When the traffic arrives periodically or
arrives in bursts – queuing delay is large
Queuing delay
• depends on the rate at which
traffic arrives at the queue, the
transmission rate of the link, and
the nature of the arriving traffic
Queuing delay
• Let a denote the average rate at which
packets arrive at the queue (a is in units of
packets/sec)
• R is the transmission rate; that is, it is the
rate (in bits/sec) at which bits are pushed
out of the queue.
• Let all packets consist of L bits.
• The average rate at which bits arrive at the
queue is La bits/sec
• The ratio La/R, called the traffic intensity
Queuing delay and Packet loss
• If La/R > 1, -then the average rate at
which bits arrive at the queue exceeds
the rate at which the bits can be
transmitted from the queue.
• And the queue will tend to increase
without bound and the queuing delay
will approach infinity!
• So design your system so that the
traffic intensity is no greater than 1.
Queuing delay and Packet loss
• For example,
• Suppose N packets arrive simultaneously
every (L/R)N seconds.
• Then the first packet transmitted has no
queuing delay;
• The second packet transmitted has a
queuing delay of L/R seconds;
• and more generally, the nth packet
transmitted has a queuing delay of(n-1)*
L/R seconds
Queuing delay and Packet loss
As the traffic intensity approaches
1, the average queuing delay
increases rapidly
. A small percentage increase in
the intensity will result in a much
larger percentage-wise increase in
delay.
Queuing delay and Packet loss
• In reality -a queue preceding a link has
finite capacity,
• The queuing capacity greatly depends on
the router design and cost .
• The queue capacity is finite, packet delays
do not really approach infinity as the traffic
intensity approaches 1 .
• A packet can arrive to find a full queue,
With no place to store such a packet, a
router will drop that packet; - the packet will
be lost .
End to end delay
• dend-end=N(dproc+dtrans+dprop)
Throughput
• Another critical performance measure in
computer networks is end -to-end throughput.
• Consider transferring a large file from Host A to
Host B across a computer network.
• Let the file be a large video clip from one peer
to another in a P2P file sharing system.
• The instantaneous throughput at any instant
of time is the rate (in bits/sec) at which Host B
is receiving the file.
Throughput
• If the file consists of F bits and the
transfer takes T seconds for Host B
to receive all F bits.
• Average throughput of the file
transfer - F/T bits/s.
• Let R the rate of the link between
s-
the server and the router;
• Rc - the rate of the link between the
router and the client.
Throughput
Throughput
• Throughput: rate (bits/time unit) at which bits
transferred between sender/receiver
– instantaneous: rate at given point in time
– average: rate over longer period of time
server,
server withbits
sends linkpipe
capacity
that can carry linkpipe
capacity
that can carry
file ofinto
(fluid) F bits
pipe fluid at rate
R bits/sec fluid at rate
R bits/sec
to send to client s c
R bits/sec) R bits/sec)
s c
Throughput (more)
• Rs < Rc What is average end-end throughput?
R bits/sec R bits/sec
s c
❖ Rs > Rc What is average end-end throughput?
R bits/sec R bits/sec
s c
bottleneck
link
link on end-end path that constrains end-end throughput
Throughput
• If Rs> Rc then the bits pumped by the
server will “flow” right through the router
and arrive at the client at a rate of R
bps, giving a throughput of R bps.
• If Rc> Rs, then the router will not be
able to forward bits as quickly as it
receives them.
Layering in computer network
• Refers to dividing a network’s functioning into
different layers, each responsible for a certain
communication component.
• defined as a model where a whole network
process is divided into various smaller sub-tasks.
• A layered architecture allows us to discuss a
well-defined, specific part of a large and complex
system
Layered architecture analogy
Horizontal layering
Layering of airline functionality
ticket (purchase) ticket (complain) ticket
baggage (check) baggage (claim baggage
gates (load) gates (unload) gate
runway (takeoff) runway (land) takeoff/landing
airplane routing airplane routing airplane routing airplane routing airplane routing
departure intermediate air-traffic arrival
airport control centers airport
layers: each layer implements a service
– via its own internal-layer actions
– relying on services provided by layer
below
Why layering?
dealing with complex systems:
• explicit structure allows identification,
relationship of complex system’s pieces
– layered reference model for discussion
• modularization eases maintenance, updating
of system
– change of implementation of layer’s service
transparent to rest of system
– e.g., change in gate procedure doesn’t affect
rest of system
• layering considered harmful?
Layering
Advantages Disadvantages
Simplifies troubleshooting Increased complexity in design
Easier to manage Potential performance overhead
Promotes interoperability Harder to optimize layers individually
Encourages modular design Difficult cross-layer interaction
Allows for scalability Inflexible to rapid changes
Internet protocol stack
• application: supporting network
applications
– FTP, SMTP, HTTP application
• transport: process-process data
transfer transport
– TCP, UDP
• network: routing of datagrams network
from source to destination
– IP, routing protocols link
• link: data transfer between
neighboring network elements physical
– Ethernet, 802.111 (WiFi), PPP
• physical: bits “on the wire”
ISO/OSI reference model
• presentation: allow applications
to interpret meaning of data, application
e.g., encryption, compression,
presentation
machine-specific conventions
session
• session: synchronization,
checkpointing, recovery of data transport
exchange network
• Internet stack “missing” these link
layers! physical
– these services, if needed, must
be implemented in application
– needed?
source
Encapsulation
message M application
H
segment M transport
H H
t
datagram M network
H H
n H
t
frame M link
l n t
physical
link
physical
switch
H H
destination M network
H H
n H
t H H
M application M link M
H l n t
M transport physical n t
H H
t
M network
H H
n H
t router
M link
l n t
physical
Application Layer
Some network apps
▪ social networking ▪ voice over IP (e.g., Skype)
▪ Web ▪ real-time video
▪ text messaging conferencing (e.g., Zoom)
▪ e-mail ▪ Internet search
▪ multi-user network games ▪ remote login
▪ streaming stored video ▪…
(YouTube, Hulu, Netflix)
▪ P2P file sharing Q: your favorites?
Creating a network app
write programs that:
▪run on (different) end systems
application
transport
network
mobile network data link
▪communicate over network
physical
national or global ISP
▪e.g., web server software communicates
with browser software
no need to write software for local or
regional ISP
network-core devices
home network
▪network-core devices do not run user
content
application
transport
provider
network network datacenter
applicationnetwork
applications data link
physical
transport
network
data link
▪applications on end systems allows for
physical
rapid app development, propagation enterprise
network
Processes communicating
process: program running clients, servers
within a host client process: process
that initiates
▪within same host, two communication
processes communicate server process: process
using inter-process that waits to be contacted
communication (defined by
OS) ▪ note: applications with
P2P architectures have
▪processes in different hosts client processes &
communicate by exchanging server processes
messages
Transport service requirements: common apps
application data loss throughput time sensitive?
file transfer/download no loss elastic no
e-mail no loss elastic no
Web documents no loss elastic no
real-time audio/video loss-tolerant audio: 5Kbps-1Mbps yes, 10’s msec
video:10Kbps-5Mbps
streaming audio/video loss-tolerant same as above yes, few secs
interactive games loss-tolerant Kbps+ yes, 10’s msec
text messaging no loss elastic yes and no
Internet transport protocols services
TCP service: UDP service:
▪ reliable transport between sending ▪ unreliable data transfer
and receiving process between sending and
▪ flow control: sender won’t receiving process
overwhelm receiver ▪ does not provide: reliability,
▪ congestion control: throttle sender flow control, congestion
when network overloaded control, timing, throughput
guarantee, security, or
▪ connection-oriented: setup required connection setup.
between client and server processes
▪ does not provide: timing, minimum Q: why bother? Why
throughput guarantee, security is there a UDP?
Internet applications, and transport protocols
application
application layer protocol transport protocol
file transfer/download FTP [RFC 959] TCP
e-mail SMTP [RFC 5321] TCP
Web documents HTTP [RFC 7230, 9110] TCP
Internet telephony SIP [RFC 3261], RTP [RFC TCP or UDP
3550], or proprietary
streaming audio/video HTTP [RFC 7230], DASH TCP
interactive games WOW, FPS (proprietary) UDP or TCP
RFC (Request For Comment)
• RFC - a type of technical document issued
by the Internet Engineering Task Force (IETF)
that describes specifications, procedures, and
standards in given Internet technologies.
• Purpose of RFCs
✔ Documentation
✔ Standardization
✔ Discussion and Collaboration
✔ Guidance
WEB and HTTP
• Until the early 1990s -the Internet - used primarily
by researchers, academics, and university
students- to log in to remote hosts- to transfer files
from local hosts to remote hosts and vice versa, to
receive and send news, and to receive and send
electronic mail.
• But after-a major new application arrived on the
scene—the World Wide Web -dramatically
changed, and continues to change .
• Web operates on demand. Users receive what they
want, when they want it.
Common RFCs
• RFC 1035: This RFC defined the Domain
Name System, the convention of translating
reasonable sounding names into digitally
suitably formatted IP addresses.
• RFC 2616: Under HTTP 1.1 this document
had described the Hypertext Transfer
Protocol that is so crucial for Web
communication.
Web and HTTP
• Easy for any individual to make information
available over the Web .
• Hyperlinks and search engines help us
navigate through an ocean of information.
• Photos and videos stimulate our senses.
Forms, JavaScript, Java applets, and many
other devices enable us to interact with pages
and sites.
• Web and its protocols serve as a platform for
YouTube, Web-based e-mail (such as Gmail),
and most mobile Internet applications,
including Instagram and Google Maps.
Webpage
• A Web page (also called a document) consists
of objects.
• An object is simply a file—such as an HTML
file, a JPEG image, a Java applet, or a video
clip—that is addressable by a single URL.
• Most Web pages consist of a base HTML file
and several referenced objects.
Web and HTTP
First, a quick review…
▪Web page consists of objects, each of which can be
stored on different Web servers
▪Object can be HTML file, JPEG image, Java applet,
audio file,…
▪Web page consists of base HTML-file includes several
referenced objects, each addressable by a URL, e.g.,
[Link]/ecdept/people/[Link]
host name path name
HyperText Transfer Protocol (HTTP),
• the Web’s application-layer protocol, is at the
heart of the Web.
• It is defined in [RFC 1945] and [RFC 2616].
• HTTP is implemented in two programs: a client
program and a server program.
• The client program and server program,sits on
two end systems- executing on different end
systems, talk to each other by exchanging HTTP
messages.
• HTTP defines the structure of these messages
and how the client and server exchange the
messages
HTTP overview
HTTP: hypertext transfer
protocol
▪ Web’s application-layer
protocol HT
TP
▪ client/server model:
req
PC running H ues
TTP t
Firefox browser res
pon
•client: browser that se
st
requests, receives, (using P req
ue
e server running
T ns
HTTP protocol) and HT
TP
res po Apache Web
HT server
“displays” Web objects
•server: Web server sends iPhone running
Safari browser
(using HTTP protocol)
objects in response to
requests
HTTP overview (continued)
HTTP uses TCP:
▪ client initiates TCP connection HTTP is “stateless”
(creates socket) to server, ▪ server maintains no
port 80 information about past client
requests
▪ server accepts TCP connection
▪ Only single request
from client
▪ HTTP messages
(application-layer protocol
messages) exchanged
between browser (HTTP
client) and Web server (HTTP
server)
▪ TCP connection closed
HTTP connections: two types
Non-persistent HTTP Persistent HTTP
[Link] connection opened ▪TCP connection opened to
[Link] most one object sent a server
over TCP connection ▪multiple objects can be
[Link] connection closed sent over single TCP
connection between
downloading multiple client, and that server
objects -required multiple ▪TCP connection closed
connections
Non-persistent HTTP: example
User enters URL: [Link]/ec/faculty/name
(containing text, references to 10 jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server 1b. HTTP server at host [Link]
(process) at [Link] on port waiting for TCP connection at port 80
80 “accepts” connection, notifying client
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection 3. HTTP server receives request message,
socket. Message indicates forms response message containing
time that client wants object requested object, and sends message
ec/faculty/name into its socket
Non-persistent HTTP: example (cont.)
User enters URL: [Link]/ec/[Link]
(containing text, references to 23 jpeg images)
4. HTTP server closes TCP
5. HTTP client receives response connection.
message containing html file,
displays html. Parsing html file,
finds 10 referenced jpeg objects
6. Steps 1-5 repeated for
each of 23 jpeg objects
time
RTT
• Round-trip time (RTT), which is the time it
takes for a small packet to travel from client to
server and then back to the client.
• The RTT includes packet-propagation delays,
packet queuing delays in intermediate routers
and switches, and packet-processing delays.
Non-persistent HTTP: response time
RTT (definition): time for a small
packet to travel from client to initiate TCP
server and back connection
RTT
HTTP response time (per object):
▪ one RTT to initiate TCP connection request file
▪ one RTT for HTTP request and first few RTT time to
transmit
bytes of HTTP response to return file
file received
▪ object/file transmission time
time time
Non-persistent HTTP response time = 2RTT+ file transmission time
Back-of-the-envelope calculation for the time needed to request and
receive an HTML file
Issues with Non-Persistent HTTP
▪requires 2 RTTs per object
▪OS overhead for each TCP connection
▪browsers often open multiple parallel TCP
connections to fetch referenced objects in
parallel
Persistent HTTP (HTTP1.1):
▪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
▪So one RTT for all the referenced objects
HTTP request message
▪ two types of HTTP messages: request, response
▪ HTTP request message:
• ASCII (human-readable format)
carriage return character
line-feed character
request line (GET,
GET /[Link] HTTP/1.1\r\n
POST, Host: [Link]\r\n
HEAD commands) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15;
rv:80.0) Gecko/20100101 Firefox/80.0 \r\n
header Accept: text/html,application/xhtml+xml\r\n
lines Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Connection: keep-alive\r\n
\r\n
carriage return, line
feed at start of line
indicates end of header * Check out the online interactive exercises for more
lines examples: [Link]
HTTP request message: general format
method sp URL sp version cr lf request
line
header field name value cr lf
header
~
~ ~
~ lines
header field name value cr lf
cr lf
~
~ entity body ~
~ body
Other HTTP request messages
POST method: HEAD method:
▪web page often includes form input ▪requests headers (only) that would
▪user input sent from client to be returned if specified URL were
server in entity body of HTTP POST requested with an HTTP GET
request message method.
GET method (for sending data to PUT method:
server): ▪uploads new file (object) to server
▪completely replaces file that exists
▪include user data in URL field of HTTP GET at specified URL with content in
request message (following a ‘?’): entity body of POST HTTP request
[Link]/animalsearch?monkeys&banana
message
HTTP response message
status line (protocol HTTP/1.1 200 OK
status code status phrase) Date: Tue, 08 Sep 2020 00:53:20 GMT
Server: Apache/2.4.6 (CentOS)
OpenSSL/1.0.2k-fips PHP/7.4.9
mod_perl/2.0.11 Perl/v5.16.3
header Last-Modified: Tue, 01 Mar 2016 18:57:50 GMT
ETag: "a5b-52d015789ee9e"
lines Accept-Ranges: bytes
Content-Length: 2651
Content-Type: text/html; charset=UTF-8
\r\n
data data data data data ...
data, e.g., requested
HTML file
* Check out the online interactive exercises for more examples: [Link]
HTTP response status codes
▪ status code appears in 1st line in server-to-client response message.
▪ some sample codes:
200 OK
• request succeeded, requested object later in this message
301 Moved Permanently
• requested object moved, new location specified later in this message (in
Location: field)
400 Bad Request
• request msg not understood by server
404 Not Found
• requested document not found on this server
505 HTTP Version Not Supported
Simple Mail Transfer protocol
(SMTP)
E-mail
user
agent
Three major components: mail user
▪ user agents server agent
▪ mail servers SMTP mail user
▪ simple mail transfer protocol: SMTP SMTP
server agent
user
User Agent (UA) SMTP agent
mail
▪ Or “mail reader” server
user
▪ composing, editing, reading mail messages agent
▪ e.g., Outlook, iPhone mail client user
agent
▪ outgoing, incoming messages stored on outgoing
message queue
server user mailbox
SMTP RFC (5321)
“client” “server”
▪uses TCP to reliably transfer email
SMTP server SMTP server
message from client (mail server
initiate TCP
initiating connection) to server, port 25 connection
▪direct transfer: sending server (acting TCP connection
RTT
like client) to receiving server initiated
▪ after TCP set up- three phases of 22
transfer SMTP 0
HEL
handshaking
•SMTP handshaking O
250 Hello
•SMTP transfer of messages
•SMTP closure SMTP
transfers
▪command/response interaction (like
time
HTTP)
•commands: ASCII text
•response: status code and phrase
Scenario: A sends e-mail to B
1) Al uses User Agent to compose 4) SMTP client sends A’s message
e-mail message “to” b@[Link] over the TCP connection
2) A’s UA sends message to her mail 5) B’s mail server places the
server using SMTP; message placed message in Bob’s mailbox
in message queue
3) client side of SMTP at mail server 6) B invokes his user agent
opens TCP connection with B’s mail to read message
server
1user mail user
mail agent
agent server server
2 3 6
4
5
Alice’s mail server Bob’s mail server
Mail message format
SMTP: protocol for exchanging e-mail messages, defined in RFC 5321
(like RFC 7231 defines HTTP)
RFC 2822 defines syntax for e-mail message itself (like HTML defines
syntax for web documents)
▪ header lines, e.g., header
blank
• To: line
• From:
• Subject:
these lines, within the body of the email body
message area different from SMTP MAIL
FROM:, RCPT TO: commands!
▪ Body: the “message” , ASCII characters only
Mail Access Protocols
• Two popular mail access protocols:
POP3 (Post Office Protocol - Version 3)
and
• IMAP (Internet Mail Access Protocol).
• used to transfer mail from the recipient's
mail server to the recipient's user agent.
POP3
• extremely simple mail access protocol. so , its
functionality is rather limited.
• POP3 begins when the user agent (the client)
opens a TCP connection to the mail server (the
server) on port 110.
• With the TCP connection established, POP3
goes through three phases: authorization,
transaction and update.
•
POP3
• The first phase- authorization- the user agent sends a
user name and a password to authenticate the user
downloading the mail.
• The second phase- transaction- the user agent
retrieves messages. During the transaction phase, the
user agent can also mark messages for deletion,
remove deletion marks, and obtain mail statistics.
• The third phase- update, occurs after the client has
issued the quit command ending the POP3 session; at
this time, the mail server deletes the messages that
were marked for deletion.
POP 3 transaction
• In a POP3 transaction, the user agent issues
commands, and the server responds to each
command with a reply.
• There are two possible responses:
• +OK (sometimes followed by
server-to-client data), whereby the server is
saying that the previous command was fine;
and
• -ERR, whereby the server is saying that
something was wrong with the previous
command
• The authorization phase has two
principle commands:
• user<user name> and
pass<password>
What is happening in POP3
(eg.)
• A user agent using POP3 -can be configured (by the
user) to "download and delete" or to "download and
keep" .
• In download-and-delete mode - the recipient, nomadic- want to
access his mail from multiple machines. The
download-and-delete mode scatters receivers 's mail over all the
local machines; in particular,- he will not be able to reread the
message in another machine later.
• In the download-and-keep mode, the user agent leaves the
messages on the mail server after downloading them. In this case,
receiver can reread messages from different machines; he can
access a message from work, and then access it again later in the
week from home.
Internet Mail Access Protocol (IMAP), defined
in [RFC 1730]
• is a mail access protocol.
• more features than POP3, and significantly more
complex.
• designed to allow users to manipulate remote
mailboxes as if they were local.
• enables receiver to create and maintain multiple
message folders at the mail server
• it has commands that permit a user agent to obtain
components of messages
• Mailboxes located in server
IMAP connection establishment
• an initial greeting from the server, followed
by client-server interactions.
Four states of IMAP SERVER
• non-authenticated state- which starts when the
connection starts, the user must supply a user name
and password before most commands will be
permitted.
• the authenticated state- the user must select a folder
before sending commands that affect messages.
• selected state- the user can issue commands that affect
messages (retrieve, move, delete, retrieve a part in a
multipart message, etc.)
• logout state - when the session is being terminated
MIME Protocol
• Multipurpose Internet Mail
Extensions(MIME).
• a supplementary protocol that mainly allows
the non-ASCII data to be sent through E-mail.
• transforms the non-ASCII data at the sender
site NVT ASCII data and then delivers them to
the client in order to be sent through the
Internet.
• At the receiver side, the message is
transformed back to the original data.
Different kinds of data files that can be
exchanged on the Internet using MIME:
• audio
• images
• text
• video
• Other application-specific data(it can be pdf,
Microsoft word document, etc).
MTA- Mail Transfer agent
Features of MIME
1. MIME supports the character set other than
ASCII.
2. With the help of MIME, we can send multiple
attachments in a single message.
3. MIME also provides support for different
content types and multi-part messages.
4. It provides support of compound documents
5. It also provides support for non-textual content
in the email message.
MIME HEADER
MIME HEADER
• MIME Version-defines the version of the MIME
used.
• Content-Type-defines the type of data that is
used in the body of the message
• Content-Transfer-Encoding-defines the
method that is used to encode the messages
into 0s and 1s for transport.
• Content-Id-used to uniquely identify the whole
message in the multiple-message
environment.
• Content Description – defines whether the
body is in the form of image, audio, or video.
Advantages of MIME
• Supports Interactive Multimedia.
• Supports the transfer of Multiple
attachments.
• Supports different content types.
• Also supports text with different fonts
and colors.
Domain Name Systems (DNS)
DNS
• application layer protocol defines how the
application processes running on different
systems, pass the messages to each
other.
• a directory service that provides a
mapping between the name of a host on
the network and its numerical address.
• a service that translates the domain name
into IP addresses. This allows the users of
networks to utilize user-friendly names
when looking for other hosts instead of
remembering the IP addresses.
DNS: Domain Name System
people: many identifiers: Domain Name System (DNS):
• SSN, name, passport # ▪ distributed database implemented in
Internet hosts, routers: hierarchy of many name servers
• IP address (32 bit) - used for ▪ application-layer protocol: hosts, DNS
addressing datagrams servers communicate to resolve
• “name”, e.g., [Link] - names (address/name translation)
used by humans
• note: core Internet function,
The map between IP address
implemented as application-layer
and name, and vice versa
protocol
• complexity at network’s “edge”
DNS: services, structure
DNS services: Q: Why not centralize DNS?
▪ hostname-to-IP-address translation ▪ single point of failure
▪ host aliasing ▪ traffic volume
• canonical, alias names ▪ distant centralized database
▪ maintenance
▪ mail server aliasing
▪ load distribution A: doesn‘t scale!
• replicated Web servers: many IP ▪ Comcast DNS servers alone:
addresses correspond to one 600B DNS queries/day
name ▪ Akamai DNS servers alone:
2.2T DNS queries/day
Thinking about the DNS
humongous distributed database:
▪~ billion records, each simple
handles many trillions of queries/day:
▪many more reads than writes
▪performance matters: almost every Internet
transaction interacts with DNS - msecs count!
organizationally, physically
decentralized:
▪millions of different organizations
responsible for their records
“bulletproof”: reliability, security
DNS: a distributed, hierarchical database
Root DNS Servers Root
… …
.com DNS servers .org DNS servers .edu DNS servers Top Level Domain
… … … …
[Link] [Link] [Link] [Link] [Link]
DNS servers DNS servers DNS servers DNS servers DNS servers Authoritative
Client wants IP address for [Link]; 1st approximation:
▪client queries root server to find .com DNS server
▪client queries .com DNS server to get [Link] DNS server
▪client queries [Link] DNS server to get IP address for [Link]
Last part in website id
• The domain name space is divided into
three different sections: generic domains,
country domains, and inverse domain.
generic
DNS: root name servers
▪ official, contact-of-last-resort by
name servers that can not 13 logical root name “servers”
worldwide each “server” replicated
resolve name many times (~200 servers in US)
▪ incredibly important Internet
function
• Internet couldn’t function without it!
• DNSSEC – provides security
(authentication, message integrity)
▪ ICANN (Internet Corporation for
Assigned Names and Numbers)
manages root DNS domain
Top-Level Domain, and authoritative servers
Top-Level Domain (TLD) servers:
▪ responsible for .com, .org, .net, .edu, .aero, .jobs, .museums, and all top-level
country domains, e.g.: .cn, .uk, .fr, .ca, .jp
▪ Network Solutions: authoritative registry for .com, .net TLD
▪ Educause: .edu TLD
authoritative DNS servers:
▪ organization’s own DNS server(s), providing authoritative hostname to IP
mappings for organization’s named hosts
▪ can be maintained by organization or service provider
Local DNS name servers
▪ when host makes DNS query, it is sent to its local DNS server
• Local DNS server returns reply, answering:
• from its local cache of recent name-to-address translation pairs (possibly out
of date!)
• forwarding request into DNS hierarchy for resolution
• each ISP has local DNS name server; to find yours:
• MacOS: % scutil --dns
• Windows: >ipconfig /all
▪ local DNS server doesn’t strictly belong to hierarchy
DNS name resolution: iterated query
root DNS server
Example: host at [Link]
wants IP address for [Link] 2
3
TLD DNS server
Iterated query: 1 4
▪ contacted server replies 8
5
with name of server to requesting host at local DNS server
contact [Link] [Link]
[Link]
▪ “I don’t know this 7 6
name, but ask this
server” authoritative DNS server
[Link]
DNS name resolution: recursive query
root DNS server
Example: host at [Link]
wants IP address for [Link] 2 3
7 6
Recursive query: 1 TLD DNS server
▪ puts burden of name 8
resolution on requesting host at local DNS server
5 4
[Link] [Link]
contacted name [Link]
server
▪ heavy load at upper authoritative DNS server
levels of hierarchy [Link]
Caching DNS Information
▪ once (any) name server learns mapping, it caches mapping,
and immediately returns a cached mapping in response to a
query
• caching improves response time
• cache entries timeout (disappear) after some time (TTL)
• TLD servers typically cached in local name servers
▪ cached entries may be out-of-date
• if named host changes IP address, may not be known
Internet-wide until all TTLs expire!
• best-effort name-to-address translation!
TTL-time
to Live
DNS records
DNS: distributed database storing resource records (RR)
RR format: (name, value, type, ttl)
type=A type=CNAME
▪ name is hostname ▪ name is alias name for some “canonical”
▪ value is IP address (the real) name
▪ [Link] is really [Link]
type=NS ▪ value is canonical name
▪ name is domain (e.g., [Link])
▪ value is hostname of
type=MX
authoritative name server for ▪ value is name of SMTP mail
this domain server associated with name
DNS protocol messages
DNS query and reply messages, both have same format:
2 bytes 2 bytes
identification flags
message header:
▪ identification: 16 bit # for query, # questions # answer RRs
reply to query uses same # # authority RRs # additional RRs
▪ flags:
questions (variable # of questions)
• query or reply
• recursion desired
answers (variable # of RRs)
• recursion available
• reply is authoritative authority (variable # of RRs)
additional info (variable # of RRs)
DNS protocol messages
DNS query and reply messages, both have same format:
2 bytes 2 bytes
identification flags
# questions # answer RRs
# authority RRs # additional RRs
name, type fields for a query questions (variable # of questions)
RRs in response to query answers (variable # of RRs)
records for authoritative servers authority (variable # of RRs)
additional “ helpful” info that may additional info (variable # of RRs)
be used