0% found this document useful (0 votes)
10 views

Computer Networks (2)

The document outlines the syllabus for a Computer Networks course, detailing key topics such as Internet protocols, network layers, and various network devices. It includes assessment components, textbook references, and an overview of basic terminologies and concepts related to computer networks. The course aims to provide a comprehensive understanding of networking principles and technologies.

Uploaded by

Siva Keerthi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Computer Networks (2)

The document outlines the syllabus for a Computer Networks course, detailing key topics such as Internet protocols, network layers, and various network devices. It includes assessment components, textbook references, and an overview of basic terminologies and concepts related to computer networks. The course aims to provide a comprehensive understanding of networking principles and technologies.

Uploaded by

Siva Keerthi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 210

19ECE311-Computer Networks

Dr. Gayathri M
Assistant professor
ECE Department
[email protected]
Syllabus
Unit 1

Introduction to the Internet - Services and Protocols, Edge and Core, Packet Switching vs. Circuit Switching - Performance Metrics Delay -
Loss – Throughput - Protocol Layers and Service Models OSI and TCP/IP models - Application Layer: Client-Server and Peer-to-Peer
architectures - Application Layer protocols - Transport Layer - Unreliable Connectionless vs. Reliable Connection-Oriented Services -
Multiplexing; Stop-and Wait - Go-Back-N and Selective-Repeat - UDP vs. TCP - Flow and Congestion Control.

Unit 2

Network Layer - Data plane forwarding vs. Control plane routing -Software Defined Networking (SDN) approach - Network Services -
Router architecture - Switching fabrics - Input and output queueing IPv4 and IPv6 addressing DHCP -NAT - IPv4 and IPv6 fragmentation -
SDN based generalized forwarding - Routing and Supporting Algorithms - Link State vs Distance Vector - RIP - OSPF – BGP – ICMP - SNMP -
SDN Control Plane.

Unit 3

Link Layer – Services - Error Detection and Correction; Multiple Access protocols Channel partitioning - Random access - Taking-Turns
protocols - Switched LANs ARP - Ethernet - Link layer switching – VLANs – MPLS - Introduction to Wireless and Mobile Networks - Link
characteristics - CDMA - 802.11 WiFi - Bluetooth and Zigbee - Cellular Networks - GSM – UMTS – LTE - Mobility management and handoff -
Mobile IP.
Text Book and References
• Text Book(s)

1. James Kurose and Keith Ross, “Computer Networking: A Top-Down Approach”, Seventh (Global) Edition, Pearson
Education Ltd., 2017.
2. Larry L. Peterson and Bruce S. Davie, “Computer Networks - A Systems Approach”, Morgan Kaufmann, Fifth Edition,
2011.

• Reference(s)

1. Brandon Rhodes, John Goerzen, “Foundations of Python Network Programming”, Third Edition, Apress, 2014.

2. Teerawat Issariyakul and Ekram Hossain, “Introduction to Network Simulator NS”2, Springer, Boston, MA, 2009.
Assessment
Component Marks
Quiz (2) 15
Assignment (1) 10
Attendance 05
Midterm Exam 30
Continuous Assessment Total 60
End Sem 40

QUIZ I - 27.01.2025
QUIZ II -10.03.2025
Assignment – [01.03.2024-07.03.2024]
1.1 what is the Internet
1.2 network edge
• end systems, access networks, links
1.3 network core
• packet switching, circuit switching, network structure
1.4 delay, loss, throughput in networks
Network
• A computer network is a collection of interconnected devices that share resources and
information. These devices can include computers, servers, printers, and other hardware.
Networks allow for the efficient exchange of data, enabling various applications such as email, file
sharing, and internet browsing.
Building blocks of CN
Basics building blocks of a Computer network are Nodes and Links

Nodes
• A node is any physical device within a LINKS
network of other tools that’s able to A link refers to The
send, receive, or forward information. transmission media connecting
A personal computer is the most two nodes, which can be
common node. It's called the computer physical (like cable wires or
node or internet node. optical fibers) or wireless
(used by WiFi)
• Nodes within a computer network
must have some form of identification,
like an IP address or MAC address, for
other network devices to recognize
them. A node without this information,
or one that's offline, no longer
functions as a node.
Basic Terminologies of Computer Networks
• Nodes: Nodes are devices that are connected to a
network. These can include computers, Servers,
Printers, Routers, Switches, and other devices.
• Protocol: A protocol is a set of rules and standards
that govern how data is transmitted over a network.
Examples of protocols include TCP/IP, HTTP, and FTP.
• Topology: Network topology refers to the physical
and logical arrangement of nodes on a network. The
common network topologies include bus, star, ring,
mesh, and tree.
• Service Provider Networks: These types of
Networks give permission to take Network Capacity
and Functionality on lease from the Provider. Service
Provider Networks include Wireless Communications,
Data Carriers, etc.
Basic Terminologies of Computer Networks
• IP Address: An IP address is a unique numerical identifier that is assigned to every device on a
network. IP addresses are used to identify devices and enable communication between them.

• DNS: The Domain Name System (DNS) is a protocol that is used to translate human-readable
domain names (such as www.google.com) into IP addresses that computers can understand.

• Firewall: A firewall is a security device that is used to monitor and control incoming and
outgoing network traffic. Firewalls are used to protect networks from unauthorized access and
other security threats.
Network Devices
• Network devices are physical devices that
allow hardware on a computer network to
communicate and interact with each other.
• NIC- Network Interface cards
• A network interface card (NIC) is a hardware
component without which a computer cannot
be connected over network. It is a circuit
board installed in a computer that provides a
dedicated network connection to the
computer
• it works on both the physical and data link
layers of the network model.
Network Devices
• Wireless Access Point •Hub
A Wireless Access Point (WAP) is a • A hub is a hardware device used at the physical
networking device that allows layer to connect multiple devices in the
connecting the devices with the network. Hubs are widely used to connect
wired network. A Wireless Access LANs. It cannot identify the destination of the
Point (WAP) is used to create the packet, So it broadcasts or sends the message
WLAN to each port.
• operates only on physical layers of the OSI
model.
Network Devices
• Switch
• Switch is a point-to-point communication
device. It operates at the data link layer and
advanced switch in network layer of OSI
model.
• It uses switching table to find out the
correct destination.
Network Devices
• Routers
• The router is a physical or virtual
internetworking device that is designed to
receive, analyze, and forward data packets
between computer networks.
• A router examines a destination IP address of a
given data packet, and it uses the headers and
forwarding tables to decide the best way to
transfer the packets.
• It shares information with other routers in
networking.
• A router works on the third layer (network
layer) of the OSI model, and it is based on the
IP address of a computer.
Difference

HUB SWITCH ROUTER


Works in physical layer L2-Data/L3-Network Network layer
layer
Broadcasts messages Multicasts messages Routes messages
Sends data as bits Sends data as Frames Sends data as packets
Connects devices within Connect devices to Connect two different
the same network networks network
Does not store MAC stores MAC address stores MAC address
address
Network Devices
• Bridge
• A bridge is a network device that operates at
the data link layer device. A bridge is a repeater
with the added functionality of filtering content
by reading the MAC addresses of the source
and destination.
• It is also used to connect two LANs that use
the same protocol. It has a single
input and output port, making it a two-port
device.
Network Devices • Repeater
• A repeater is a networking device that helps to
• Gateway amplify and regenerate signals to increase the
reach of a network.
• A gateway is a network node or
device that connects two • Operating at the physical layer of the OSI
networks that use different model, repeaters help overcome distance-
transmission protocols. related limitations by strengthening the
strength and quality of the signal.
Introduction to the Internet
PC mobile network
server
• billions of connected
computing devices: global ISP
wireless
laptop • hosts = end systems
smartphone • running network apps
home
network
▪ communication links regional ISP
wireless • fiber, copper, radio,
links
wired
satellite
links • transmission rate:
bandwidth
router ▪ packet switches: forward packets
(chunks of data)
institutional
• routers and switches network
Introduction to the Internet
• Different links can transmit data at different rates. the transmission rate of a link measured in
bits/second.
• End systems are not usually directly attached to each other via a single communication link.
Instead, they are indirectly connected to each other through intermediate switching devices
known as packet switches.
• A packet switch takes a chunk of information arriving on one of its incoming communication links
and forwards that chunk of information on one of its outgoing communication links. In the jargon
of computer networking, the chunk of information is called a packet.
• routers and switches - Both types of switches forward packets toward their ultimate destinations.
Introduction to the internet
• The "route" or "path" is the series of communication links (such as physical cables or wireless
connections) and packet switches (like routers or link-layer switches) that a packet of data takes
to move from the sender (source) to the receiver (destination).
• Instead of having a single, fixed connection like in a phone line, the path a packet takes can be
dynamic and adapt to network conditions.
• Packet switching is a method of breaking data into small pieces called packets, which are sent
individually over a network and reassembled at the destination.
• like traditional circuit switching (e.g., old telephone systems), packet switching doesn’t require a
dedicated path. Multiple packets from different users can share the same network paths
simultaneously, maximizing resource utilization.
Introduction to the internet
• Internet: “network of networks”
• Interconnected ISPs
• protocols control sending, receiving of messages
• e.g., TCP, IP, HTTP, Skype, 802.11
• Internet standards
• RFC: Request for comments
They serve as the formal means of communication for proposing and discussing internet
standards.
• IETF: Internet Engineering Task Force
The IETF is the primary organization responsible for developing and promoting voluntary
internet standards. It operates in working groups focused on specific technical areas like
routing, transport protocols, or security.
Introduction to the internet (ISPs)
• Internet Service Providers (ISPs) are organizations that provide Internet access to various
types of users. Examples include:
• Residential ISPs: These serve home users (e.g., local telephone or cable companies).(Jio-Fibre,
Airtel XStream Fibre etc)
• Corporate ISPs: They offer Internet services to businesses.(Tata Communications, Airtel
Bussiness)
• University ISPs: These cater to educational institutions.(BSNL Campus Broadband, National
Knowledge Network (NKN))
• Wireless ISPs: Companies like T-Mobile provide wireless Internet access in public places such as
airports, hotels, and coffee shops.(Jio 5G/4G,Airtel 5G/4G)
• Each ISP is essentially a network of packet switches (e.g., routers) and communication links
(fiber optics, cables, wireless technologies) that handle data transmission.
Types of Network Access ISPs Provide
• ISPs offer several ways for end systems to access the Internet, depending on user needs and
available infrastructure:
1.Dial-up Modem Access (56 kbps): A slower, legacy technology where Users connect to the
Internet through a telephone line using a modem.
2.Broadband Access:
1. Cable Modem or DSL: Common for residential users, providing faster speeds than dial-up.
2. High-speed LAN: Typically used in offices or schools.
3.Wireless Access: Internet over Wi-Fi in public places or through cellular networks.
• ISPs also enable content providers (e.g., websites and servers) to connect directly to the
Internet, allowing users to access online content.
ISPs
ISPs are arranged in a hierarchy to ensure seamless global connectivity:
1. Lower-tier ISPs:
• These are the local ISPs that provide Internet access to end users (home or business).
• Example: local broadband or DSL provider.
2. Upper-tier ISPs:
• These are larger, national or international networks, such as AT&T and Sprint.
• They consist of high-speed routers interconnected with fiber-optic links to handle large-
scale data traffic.
• Lower-tier ISPs rely on upper-tier ISPs to reach other networks and ensure global
communication.
What’s the Internet: a service view
mobile network
• infrastructure that provides services to applications:
• Web,VoIP, email, games, e-commerce, social nets, global ISP

• provides programming interface to apps
home
• hooks that allow sending and receiving app network
programs to “connect” to Internet regional ISP
• provides service options, analogous to postal
service

institutional
network
What’s a protocol?
human protocols: network protocols:
• “what’s the time?” ▪ machines rather than
humans
• “I have a question”
▪ all communication activity
• introductions
in Internet governed by
protocols
… specific messages sent
… specific actions taken when protocols define format, order of
messages received, or other messages sent and received
events among network entities, and
actions taken on message
transmission, receipt
What’s a protocol?
Network edge mobile network

global ISP
▪ network edge:
• hosts: clients and servers
home
• servers often in data centers network
regional ISP
▪ access networks, physical media:
wired, wireless communication links

▪ network core:
• interconnected routers
• network of networks institutional
• Two approach-Circuit Switching,Packet network

Switching
Access networks and physical media
Q: How to connect end systems to edge
router?
▪ residential access nets
▪ institutional access networks
(school, company)
▪ mobile access networks
keep in mind:
▪ bandwidth (bits per second)
of access network?
▪ shared or dedicated?

1-28
Network edge (End Systems)
• The computers connected to the Internet are often referred to as end systems.
• They are 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 reader program, or an e-mail
server program.
• Hosts are sometimes further divided into two categories: clients and servers. Informally, clients
tend to be desktop and mobile PCs, PDAs, and so on, whereas servers tend to be more powerful
machines that store and distribute Web pages, stream video, relay e-mail, and so on.
• A client program is a program running on one end system that requests and receives a service
from a server program running on another end system.
• a client program typically runs on one computer and the server program runs on another
computer, client/server Internet applications are, by definition, distributed applications.
Access network: Digital Subscriber line (DSL)

▪ use existing telephone line to central


office DSLAM(Digital Subscriber Line
Access Multiplexer)
• 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) • DSL (Digital Subscriber Line) is a modem technology that uses existing
telephone lines to transport high-bandwidth data, such as multimedia and
video, to service subscribers.
• DSL provides dedicated, point-to-point, public network access.
Access network: cable network
Cable modem termination system (CMTS) is a hardware
device at the headend of a cable TV network that is used to
connect cable subscribers to the Internet Service Provider (ISP).
They provide high speed data services like Internet or Voice over
Internet Protocol (VoIP) over the cable TV 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
Access network: home network
Enterprise access networks (Ethernet)

▪ typically used in companies, universities, etc.


▪ 10 Mbps, 100Mbps, 1Gbps, 10Gbps transmission rates
▪ today, end systems typically connect into Ethernet switch
Wireless access networks
• shared wireless access network connects end system to router
• via base station - “access point”
wide-area wireless access
wireless LANs:
▪ provided by telco (cellular)
▪ within building (100 ft.) operator, 10’s km
▪ 802.11b/g/n (WiFi): 11, 54, 450 ▪ between 1 and 10 Mbps
Mbps transmission rate
▪ 3G, 4G: LTE
Physical media
twisted pair (TP)
• bit: propagates between ▪ two insulated copper wires
transmitter/receiver pairs • Category 5: 100 Mbps, 1
Gbps Ethernet
• physical link: what lies between transmitter & receiver
• Category 6: 10Gbps
• guided media:
• signals propagate in solid media: copper, fiber, coax
• unguided media:
• signals propagate freely, e.g., radio
Physical media: coax, fiber
coaxial cable:
fiber optic cable:
▪ glass fiber carrying light
▪ two concentric copper pulses, each pulse a bit
conductors ▪ high-speed operation:
▪ bidirectional • high-speed point-to-point
transmission (e.g., 10 ’ s-
▪ broadband: 100 ’ s Gbps transmission
• multiple channels on cable rate)
• HFC ▪ low error rate:
• repeaters spaced far apart
• immune to electromagnetic
noise
Physical media (Radio)
• signal carried in electromagnetic spectrum radio link types:
▪ terrestrial microwave
• no physical “wire” • e.g. up to 45 Mbps channels
• bidirectional ▪ LAN (e.g., WiFi)
• 54 Mbps
• propagation environment effects: ▪ wide-area (e.g., cellular)
• reflection • 4G cellular: ~ 10 Mbps
• obstruction by objects ▪ satellite
• interference • Kbps to 45Mbps channel (or
multiple smaller channels)
• 270 msec end-end delay
Network core
Network core
• Circuit switching, packet
switching, message
switching
• network structure
Switching
• Switching in a computer
network helps in deciding the
best route for data B
transmission if there are
multiple paths in a larger
network.

A
Circuit Switching
• A dedicated path is established between sender and receiver.
• Before data transfer, At first connection will be established.
• Ex: Telephone network

• Three Phases in Circuit Switching:


1.Connection Establishment
2. Data Transfer
3.Connection Termination
Connection-oriented Packet Switching
(Virtual Circuit)
• Before starting the transmission, it establishes a logical path or virtual connection using a signaling
protocol, between sender and receiver and all packets belongs to this flow will follow this
predefined route.
• Virtual Circuit ID is provided by switches/routers to uniquely identify this virtual connection.
Circuit Switching
Circuit Switching
• Circuit switching is a switching technique that establishes a dedicated path between sender and
receiver.
• In the Circuit Switching Technique, once the connection is established then the dedicated path
will remain to exist until the connection is terminated.
• Circuit switching in a network operates in a similar way as the telephone works.
• A complete end-to-end path must exist before the communication takes place.
• In case of circuit switching technique, when any user wants to send the data, voice, video, a
request signal is sent to the receiver then the receiver sends back the acknowledgment to ensure
the availability of the dedicated path. After receiving the acknowledgment, dedicated path
transfers the data.
• Circuit switching is used in public telephone network. It is used for voice transmission.
• Fixed data can be transferred at a time in circuit switching technology.
Multiplexing in Circuit Switching
• A circuit in a link is implemented with either frequency-division multiplexing (FDM) or
time-division multiplexing (TDM)
• With FDM, the frequency spectrum of a link is divided up among the connections established
across the link. Specifically, the link dedicates a frequency band or bandwidth to each
connection for the duration of the connection.
• For a TDM link, time is divided into frames of fixed duration, and each frame is divided into a fixed
number of time slots.
• When the network establishes a connection across a link, the network dedicates one time slot
in every frame to this connection.
Circuit switching: FDM versus TDM
Example:
FDM
4 users

frequency

time
TDM

frequency

time
Multiplexing in Circuit-Switched Networks
• FDM and TDM for a specific network link supporting up to four circuits or users.
• For FDM, the frequency domain is segmented into four bands, each of bandwidth 4 kHz.
• For TDM, the time domain is segmented into frames, with four time slots in each frame;
• Each circuit is assigned the same dedicated slot in the revolving TDM frames.
• For TDM, the transmission rate of a circuit is equal to the frame rate multiplied by the number of bits in a
slot.
• For example, if the link transmits 8,000 frames per second and each slot consists of 8 bits, then the
transmission rate of each circuit is 64 kbps
TDM

• Transmission Rate of a Circuit = Frame Rate × Bits per Slot

• Frame Rate = 8,000 frames per second


• Bits per Slot = 8 bits.

Transmission Rate of a Circuit =64kbps

• The frame rate ensures how frequently data from each circuit is transmitted.
• The number of bits per slot determines the granularity of data transferred in each time interval.
Packet Switching
• 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
Packet Switching - Datagram approach- Connectionless
Datagram forwarding: an example network.

Forwarding table of switch 2


Packet Switching
• The packet switching is a switching technique in which the message is sent in one go, but it is
divided into smaller pieces, and they are sent individually.
• The message splits into smaller pieces known as packets and packets are given a unique number
to identify their order at the receiving end.
• Every packet contains some information in its headers such as source address, destination
address and sequence number.
• Packets will travel across the network, taking the shortest path as possible.
• All the packets are reassembled at the receiving end in correct order.
• If any packet is missing or corrupted, then the message will be sent to resend the message.
• If the correct order of the packets is reached, then the acknowledgment message will be sent.
Packet Switching: queueing delay, loss

R = 100 Mb/s C
A
D
R = 1.5 Mb/s
B
queue of packets E
waiting for output link

queuing and loss:


▪ if arrival rate (in bits) to link exceeds transmission rate of link for a period of time:
• packets will queue, wait to be transmitted on link
• packets can be dropped (lost) if memory (buffer) fills up

1-52
Two key network-core functions
routing: determines source-destination route taken by packets
▪ routing algorithms
forwarding: move
packets from routers
input to appropriate
router output
routing algorithm

local forwarding table


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

destination address in arriving


packet’s header
Message Switching
• Message Switching is a switching technique in which a message is transferred as a complete unit
and routed through intermediate nodes at which it is stored and forwarded.
• In Message Switching technique, there is no establishment of a dedicated path between the
sender and receiver.
• The destination address is appended to the message. Message Switching provides a dynamic
routing as the message is routed through the intermediate nodes based on the information
available in the message.
• Message switches are programmed in such a way so that they can provide the most efficient
routes.
• Each and every node stores the entire message and then forward it to the next node. This type of
network is known as store and forward network.
• Packets are transmitted over each
communication link at a rate equal to the full one-hop numerical example:
transmission rate of the link.
• So, if a source end system or a packet switch is ▪ L = 7.5 Mbits
sending a packet of L bits over a link with ▪ R = 1.5 Mbps
transmission rate R bits/sec, then the time to
transmit the packet is L /R seconds. ▪ one-hop transmission
delay = 5 sec
Transmission delay = L/R sec
Difference between Packet Switching and
Circuit Switching
Packet Switching Circuit Switching
In packet switching data is divided into packets, and There is a dedicated path for each packet in circuit
packets is sent independently. switching.

In Packet switching, data is processed at all In-Circuit switching, data is processed at the source
intermediate nodes including the source system. system only.

The delay between data units in packet switching is The delay between data units in circuit switching is
not uniform. uniform.

Packet switching is less reliable. Circuit switching is more reliable.

Less wastage of resources. Wastage of resources is more in Circuit Switching.

In Packet Switching there is no physical path between In-Circuit Switching there is a physical path between
the source and the destination. the source and the destination.
Internet structure: network of networks
Question: given millions of access ISPs, how to connect them
together?
access access
net net
access
net
access
access net
net
access
access net
net

access access
net net

access
net
access
net

access
net
access
net
access access
net access net
net

1-57
Internet structure: network of networks
Option: connect each access ISP to every other access ISP?

access access
net net
access
net
access
access net
net
access
access net
net

connecting each access ISP


access
to each other directly doesn’t access
net
scale: O(N2) connections. net

access
net
access
net

access
net
access
net
access access
net access net
net

1-58
Internet structure: network of networks
Option: connect each access ISP to one global transit ISP?
Customer and provider ISPs have economic agreement.
access access
net net
access
net
access
access net
net
access
access net
net

global
access
net
ISP access
net

access
net
access
net

access
net
access
net
access access
net access net
net

1-59
Internet structure: network of networks
But if one global ISP is viable business, there will be competitors
….
access access
net net
access
net
access
access net
net
access
access net
net
ISP A

access
net ISP B access
net

access
net
ISP C
access
net

access
net
access
net
access access
net access net
net

1-60
Internet structure: network of networks
But if one global ISP is viable business, there will be competitors
…. which must be interconnected
access access
Internet exchange point
net net
access
net
access
access net
net

access
IXP access
net
net
ISP A

access
net
IXP ISP B access
net

access
net
ISP C
access
net

access peering link


net
access
net
access access
net access net
net

1-61
Internet structure: network of networks
… and regional networks may arise to connect access nets to
ISPs
access access
net net
access
net
access
access net
net

access
IXP access
net
net
ISP A

access
net
IXP ISP B access
net

access
net
ISP C
access
net

access
net regional net
access
net
access access
net access net
net

1-62
Internet structure: network of networks
… and content provider networks (e.g., Google, Microsoft,
Akamai) may run their own network, to bring services, content
close to end users
access access
net net
access
net
access
access net
net

access
IXP access
net
net
ISP A
Content provider network
access
net
IXP ISP B access
net

access
net
ISP C
access
net

access
net regional net
access
net
access access
net access net
net

1-63
Internet structure: network of networks

Tier 1 ISP Tier 1 ISP Google

IXP IXP IXP

Regional ISP Regional ISP

access access access access access access access access


ISP ISP ISP ISP ISP ISP ISP ISP
• at center: small # of well-connected large networks
• “tier-1” commercial ISPs (e.g., Level 3, Sprint, AT&T, NTT), national & international coverage
• content provider network (e.g., Google): private network that connects it data centers to Internet, often bypassing
tier-1, regional ISPs
Tier-1 ISP: e.g., Sprint

POP: point-of-presence
to/from backbone

peering
… …



to/from customers
1.1 what is the Internet
1.2 network edge
• end systems, access networks, links
1.3 network core
• packet switching, circuit switching, network structure
1.4 delay, packet loss, throughput in networks
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
Four sources of packet delay
transmission
A propagation

B
nodal
processing queueing

dnodal = dproc + dqueue + dtrans + dprop

dproc: nodal processing dqueue: queueing delay


▪ check bit errors ▪ time waiting at output link for
transmission
▪ determine output link ▪ depends on congestion level of
router
▪ typically < msec
Four sources of packet delay
transmission
A propagation

B
nodal
processing queueing

dnodal = dproc + dqueue + dtrans + dprop

dtrans: transmission delay: dprop: propagation delay:


▪ L: packet length (bits) ▪ d: length of physical link
▪ R: link bandwidth (bps) ▪ s: propagation speed (~2x108 m/sec)
▪ dtrans = L/R dtrans and dprop ▪ dprop = d/s
very different
Processing Delay : Transmission Delay
• This is the time taken by a router or node to This is the time required to push all the bits of the packet
examine the packet's header and decide onto the link.
where to forward it. •It is calculated as: ▪ dtrans = L bits/R bits/s
• It includes operations like error checking and For example, if a packet is 1,000 bits and the link is
determining the next-hop address. 100 Mbps, the transmission delay
• Usually, this delay is very small and depends on ▪ dtrans = 1,000/100,000,000 =1microsec
the processing power of the router.
Propagation Delay
Queueing Delay • This is the time it takes for a single bit to
• This is the time a packet spends waiting in the propagate from one end of the link to the
queue of a router or switch before being other.
transmitted. • It depends on the distance between the nodes
• Queueing delay depends on the congestion and the propagation speed of the medium (e.g.,
level of the router. If many packets are waiting the speed of light in fiber-optic cables).
to be processed, this delay can increase •It is calculated as: dprop = d/s
significantly.
dnodal = dproc + dqueue + dtrans + dprop
Caravan analogy Will first car will be
forwarded?
No, Store and forward

100 km 100 km
1h12s
ten-car 12s
toll toll
caravan booth booth

• cars “propagate” at • Transmission delay time to “push”


100 km/hr entire caravan through toll booth
onto highway = 12*10 = 120 sec
• toll booth takes 12 sec to
service car (bit transmission • time for a car to propagate from 1st
time-transmission delay) to 2nd toll both: 100km/(100km/hr)=
1 hr
• car ~ bit; caravan ~ packet
“Real” Internet delays, routes
traceroute
3 delay measurements from
gaia.cs.umass.edu to cs-gw.cs.umass.edu
1 cs-gw (128.119.240.254) 1 ms 1 ms 2 ms
2 border1-rt-fa5-1-0.gw.umass.edu (128.119.3.145) 1 ms 1 ms 2 ms
3 cht-vbns.gw.umass.edu (128.119.3.130) 6 ms 5 ms 5 ms
4 jn1-at1-0-0-19.wor.vbns.net (204.147.132.129) 16 ms 11 ms 13 ms
5 jn1-so7-0-0-0.wae.vbns.net (204.147.136.136) 21 ms 18 ms 18 ms
6 abilene-vbns.abilene.ucaid.edu (198.32.11.9) 22 ms 18 ms 22 ms
7 nycm-wash.abilene.ucaid.edu (198.32.8.46) 22 ms 22 ms 22 ms trans-oceanic
8 62.40.103.253 (62.40.103.253) 104 ms 109 ms 106 ms
9 de2-1.de1.de.geant.net (62.40.96.129) 109 ms 102 ms 104 ms link
10 de.fr1.fr.geant.net (62.40.96.50) 113 ms 121 ms 114 ms
11 renater-gw.fr1.fr.geant.net (62.40.103.54) 112 ms 114 ms 112 ms
12 nio-n2.cssi.renater.fr (193.51.206.13) 111 ms 114 ms 116 ms
13 nice.cssi.renater.fr (195.220.98.102) 123 ms 125 ms 124 ms
14 r3t2-nice.cssi.renater.fr (195.220.98.110) 126 ms 126 ms 124 ms
15 eurecom-valbonne.r3t2.ft.net (193.48.50.54) 135 ms 128 ms 133 ms
16 194.214.211.25 (194.214.211.25) 126 ms 128 ms 126 ms
17 * * *
18 * * * * means no response (probe lost, router not replying)
19 fantasia.eurecom.fr (193.55.113.142) 132 ms 128 ms 136 ms

* Do some traceroutes from exotic countries at www.traceoute.org


Packet loss
• queue (aka buffer) preceding link in buffer has finite capacity
• packet arriving to full queue dropped (aka lost)
• lost packet may be retransmitted by previous node, by source end system, or
not at all

buffer
(waiting area) packet being transmitted
A

B
packet arriving to
full buffer is lost
Throughput
• throughput: rate (bits/time unit) at which bits transferred between
sender/receiver
• instantaneous: rate at given point in time
• average: rate over longer period of time

server,
server withbits
sends linkpipe
capacity
that can carry linkpipe
capacity
that can carry
file of into
(fluid) F bitspipe Rs bits/sec
fluid at rate Rc bits/sec
fluid at rate
to send to client Rs bits/sec) Rc bits/sec)
Throughput (more)
• Rs < Rc What is average end-end throughput?

Rs bits/sec Rc bits/sec

▪ Rs > Rc What is average end-end throughput?

Rs bits/sec Rc bits/sec

bottleneck link
link on end-end path that constrains end-end throughput
Throughput: Internet scenario

• per-connection end-end
throughput: min(Rc ,Rs,R/10)
Rs
• in practice: Rc or Rs is often
bottleneck Rs Rs
Throughput is the number of packets successfully transmitted
per unit time. It is controlled by available bandwidth, the
R
available signal-to-noise ratio, and hardware limitations.

Throughput = Amount of Data Transferred / Time Taken Rc Rc

Rc

10 connections (fairly) share


backbone bottleneck link R bits/sec
* Check out the online interactive exercises for more
examples: http://gaia.cs.umass.edu/kurose_ross/interactive/ 1-76
INTRODUCTIOM TO
OMNET++
OMNeT++
• OMNeT++ is an extensible, modular, component-based C++ simulation library and
framework, primarily for building network simulators.
• “Network” is meant in a broader sense that includes wired and wireless communication
networks, on-chip networks, queueing networks, and so on.
• Domain-specific functionality such as support for sensor networks, wireless ad-hoc
networks, Internet protocols, performance modeling, photonic networks, etc., is provided by
model frameworks, developed as independent projects.
• OMNeT++ offers an Eclipse-based IDE, a graphical runtime environment, and a host of other
tools.
Workflow
• An OMNeT++ model is built from components (modules) which communicate by exchanging messages. Modules can be
nested, that is, several modules can be grouped together to form a compound module. When creating the model, you need to
map your system into a hierarchy of communicating modules.

• Define the model structure in the NED language. You can edit NED in a text editor or in the graphical editor of the Eclipse-
based OMNeT++ Simulation IDE.

• The active components of the model (simple modules) are programmed in C++, using the simulation kernel and class library.
C++ classes that represent protocol headers are described in MSG files which are then translated into C++ code.

• Provide a suitable omnetpp.ini file to hold OMNeT++ configuration and parameters to your model. One ini file may hold
several configurations which can build on one another, and may even contain parameter studies.

• Build the simulation program and run it. You’ll link the code with the OMNeT++ simulation kernel and one of the user
interfaces OMNeT++ provides. There are command line and interactive, graphical user interfaces.

• Simulation results are written into output vector and output scalar files. You can use the Analysis Tool powered by Pandas and
Matplotlib in the Simulation IDE to analyze and plot them. Event logs recorded from the simulation can be viewed in the
Sequence Chart Tool in the IDE. Result files are text-based, so you can also process them with R, Matlab or other tools.
Platforms
The OMNeT++ simulation kernel is standard C++, and runs basically on all platforms where a
modern C++ compiler is available. The Simulation IDE requires Windows, Linux, or macOS.
Frameworks
• INET is especially useful when designing and validating new protocols, or exploring new or exotic
scenarios.
• INET contains models for the Internet stack (TCP, UDP, IPv4, IPv6, OSPF, BGP, etc.), wired and
wireless link layer protocols (Ethernet, IEEE 802.11, etc), support for mobility, MANET protocols,
DiffServ, MPLS with LDP and RSVP-TE signalling, several application models, and many other
protocols and components.
• Several other simulation frameworks take INET as a base, and extend it into specific directions,
such as vehicular networks, overlay/peer-to-peer networks, or LTE.

• Simu5G is a simulator for 5G NewRadio and LTE/LTE-A networks for OMNeT++ and INET
frameworks.
• SimuLTE has been superseded by Simu5G, which contains support for both the LTE and 5G
protocol stack.
• Veins - Vehicles in Network Simulation
Veins is an open source Inter-Vehicular Communication (IVC) simulation framework composed of
an event-based network simulator (OMNeT++) and a road traffic simulator (SUMO), using
cosimulation. Versions before 3.0 required INET or MiXiM, later versions can be used without these
frameworks.
• Artery - V2X simulation framework for ETSI ITS-G5
• Core4INET - Real-Time Ethernet protocols for INET
• FiCo4OMNeT - Fieldbus Communication (CAN, FlexRay)
• ANSA - Automated Network Simulation and Analysis
• RSPSIM - Reliable Server Pooling (RSerPool) Simulation
• OverSim - Overlay Network Simulation Framework
Protocol “layers”
Networks are complex,
with many “pieces”:
▪ hosts
▪ routers Question:
is there any hope of organizing
▪ links of various structure of network?
media
▪ applications …. or at least our discussion of
▪ protocols networks?

▪ hardware,
software
Organization of air travel

ticket (purchase) ticket (complain)

baggage (check) baggage (claim)

gates (load) gates (unload)

runway takeoff runway landing

airplane routing airplane routing


airplane routing

• a series of steps
Layering of airline functionality

ticket (purchase) ticket (complain) ticket

baggage (check) baggage (claim baggage

gates (load) gates (unload) gate

runway (takeoff) runway (land) takeoff/landing

airplane routing airplane routing airplane routing airplane routing airplane routing

departure intermediate air-traffic arrival


airport control centers airport

layers: each layer implements a service


▪ via its own internal-layer actions
▪ relying on services provided by layer below
Why layering? What is Top-Down Approach?
Top-Down Approach is an approach to design
dealing with complex algorithms in which a bigger problem is broken
down into smaller parts. Thus, it uses the
systems: decomposition approach.
• explicit structure allows The drawback of using the top-down approach is
identification, relationship of complex that it may have redundancy since every part of
system’s pieces the code is developed separately.
• layered reference model for
discussion
• modularization eases maintenance, Bottom-Up Approach is one in which the smaller
updating of system problems are solved, and then these solved
• change of implementation of problems are integrated to find the solution to a
bigger problem. Therefore, it uses composition
layer’s service transparent to approach.
rest of system It requires a significant amount of communication
• e.g., change in gate procedure among different modules.
doesn’t affect rest of system
Open Systems Interconnections (OSI)
Physical Layers

•The protocols in this layer are again link dependent and further depend on the
actual transmission medium of the link (for example, twisted-pair copper wire,
single-mode fiber optics).
Link Layers

•The Internet’s network layer routes a datagram through a series of routers between the source and
destination.
•To move a packet from one node (host or router) to the next node in the route, the network layer
relies on the services of the link layer.
•In particular, at each node, the network layer passes the datagram down to the link layer, which delivers
the datagram to the next node along the route.
•At this next node, the link layer passes the datagram up to the network layer.
•The services provided by the link layer depend on the specific link-layer protocol that is employed over
the link.
•For example, some link-layer protocols provide reliable delivery, from transmitting node, over one link, to
receiving node. Note that this reliable delivery service is different from the reliable delivery service of
TCP, which provides reliable delivery from one end system to another
•the link-layer packets as frames.
Network Layers
•The Internet’s network layer is responsible for moving network-layer packets known as datagrams from
one host to another.
•The Internet transport-layer protocol (TCP or UDP) in a source host passes a transport-layer segment and a
destination address to the network layer, just as you would give the postal service a letter with a destination
address.
•The network layer then provides the service of delivering the segment to the transport layer in the
destination host.
•The Internet’s network layer includes the IP protocol, which defines the fields in the datagram as well as
how the end systems and routers act on these fields.
•There is only one IP protocol, and all Internet components that have a network layer must run the IP
protocol.
•The Internet’s network layer also contains routing protocols that determine the routes that datagrams take
between sources and destinations.
•The Internet has many routing protocols.
Transport Layers
•The Internet’s transport layer transports application-layer messages between application endpoints.
•In the Internet there are two transport protocols, TCP and UDP, either of which can transport
application layer messages. TCP provides a connection-oriented service to its applications.
•This service includes guaranteed delivery of application-layer messages to the destination and flow
control (that is, sender/receiver speed matching).
•TCP also breaks long messages into shorter segments and provides a congestion-control mechanism,
so that a source throttles its transmission rate when the network is congested.
•The UDP protocol provides a connectionless service to its applications.
•transport-layer packet as a segment.
Application Layers

• An application-layer protocol is distributed over multiple end systems, with the application in
one end system using the protocol to exchange packets of information with the application in
another end system.
• We’ll refer to this packet of information at the application layer as a message.
• HTTP
• SMTP
• FTP
Internet protocol stack
• application: supporting network applications
• FTP, SMTP, HTTP
• transport: process-process data transfer
• TCP, UDP
• network: routing of datagrams from source to destination
• IP, routing protocols
• link: data transfer between neighboring network elements
• Ethernet, 802.111 (WiFi), PPP
• physical: bits “on the wire”
ISO/OSI reference model
• presentation: allow applications to interpret
meaning of data, e.g., encryption, compression,
machine-specific conventions application
• session: synchronization, checkpointing, presentation
recovery of data exchange
• Internet stack “missing” these layers! session
• these services, if needed, must be transport
implemented in application
network
link
physical
TCP/IP models
• The TCP/IP model is a fundamental framework
for computer networking.
• It stands for Transmission Control
Protocol/Internet Protocol, which are the core
protocols of the Internet.
• This model defines how data is transmitted over
networks, ensuring reliable communication
between devices.
• It consists of four layers: the Link Layer, the
Internet Layer, the Transport Layer, and the
Application Layer
• Each layer has specific functions that help manage
different aspects of network communication,
making it essential for understanding and working
with modern networks.
FTP- File Transfer Protocol
SMTP- Simple Mail Transfer Protocol
DNS- Domain Name System
RIP- Routing Information Protocol
SNMP- Simple Network Management Protocol
TCP- Transmission Control Protocol
UDP- User Datagram Protocol
ARP - Address Resolution Protocol
IGMP- Internet Group Management Protocol
ICMP -Internet Control Message Protocol
ATM -Asynchronous Transfer Mode
Differences between the OSI and TCP/IP model
OSI Model TCP/IP Model
It stands for Open System Interconnection. It stands for Transmission Control Protocol.
OSI model has been developed by ISO (International It was developed by ARPANET (Advanced Research
Standard Organization). Project Agency Network).
It consists of standard protocols that lead to the
It is an independent standard and generic protocol
development of an internet. It is a communication
used as a communication gateway between the
protocol that provides the connection among the
network and the end user.
hosts.
In this model, the session and presentation layer are
In this model, the session and presentation layers are
not different layers. Both layers are included in the
separated, i.e., both the layers are different.
application layer.
The network layer provides only connectionless
In this model, the network layer provides both
service.
connection-oriented and connectionless service.

It provides standardization to the devices like router, It does not provide the standardization to the devices.
motherboard, switches, and other hardware devices. It provides a connection between various computers.
Similarities between the OSI and TCP/IP model
Share common architecture
Both the models are the logical models and having similar architectures as both the models are
constructed with the layers.
Define standards
Both the layers have defined standards, and they also provide the framework used for implementing
the standards and devices.
Simplified troubleshooting process
Both models have simplified the troubleshooting process by breaking the complex function into
simpler components.
Pre-defined standards
The standards and protocols which are already pre-defined; these models do not redefine them;
they just reference or use them. For example, the Ethernet standards were already defined by the
IEEE before the development of these models; instead of recreating them, models have used these
pre-defined standards.
message M
source
application
Encapsulation
segment Ht M transport
datagram Hn Ht M network
frame Hl Hn Ht M link
physical
link
physical

switch

destination Hn Ht M network
M application Hl Hn Ht M link Hn Ht M
Ht M transport physical
Hn Ht M network
Hl Hn Ht M link router
physical
M -text, a file
Ht-source and destination port,sequence numbers,
numbers, and it breaks the message into smaller
segments if necessary
Hn - logical addressing information, such as IP addresses,
and is used for routing.

Hl - frame, which includes physical (MAC) addressing. A MAC


address is a unique identifier assigned to a network interface
card (NIC) of a device. It is a hardware address that ensures
devices on the same local network (LAN) can communicate
Physical Layer - The frame is converted into raw bits for
transmission over the physical medium
• Sockets: A socket is an endpoint for sending or receiving data across a computer network. It is an abstraction
that provides a programming interface to the underlying network protocols. Sockets enable communication
between processes, typically over TCP or UDP.
• Process:A process is a running instance of a program. In the context of networking, processes on different
devices can communicate with each other over the network using sockets.
• Message:A message is a unit of communication that is exchanged between processes or devices. It contains
application-layer data, such as an email, a web request, or a response.
• Segment:In TCP, the term "segment" refers to a piece of application data that is wrapped with TCP headers
for reliability and sequencing.
• Datagram:A datagram is a connectionless unit of communication at the network layer, typically associated
with UDP. It includes source and destination addresses along with the data but does not guarantee delivery or
sequencing.
• Frame:A frame is a link-layer data unit that contains network layer packets (e.g., IP datagrams). It includes
headers and trailers specific to the data link protocol (e.g., Ethernet) and provides error detection and addressing
at the physical level.
Application Layer
Application Layer: Client-Server and Peer-to-Peer architectures - Application Layer protocols - Transport Layer -
Unreliable Connectionless vs. Reliable Connection-Oriented Services - Multiplexing; Stop-and Wait - Go-Back-N and
Selective-Repeat - UDP vs. TCP - Flow and Congestion Control.
Some network apps
• e-mail
• voice over IP (e.g., Skype)
• web
• real-time video conferencing
• text messaging
• social networking
• remote login
• search
• P2P file sharing
• multi-user network games
• streaming stored video (YouTube, Hulu, Netflix)

2-104
Creating a network app application
transport
network
data link
physical
write programs that:
• run on (different) end systems
• communicate over network
• e.g., web server software communicates
with browser software
no need to write software for network-core devices
application

• network-core devices do not run user transport


network

applications
data link application
physical transport
network

• applications on end systems allows for


data link
physical

rapid app development, propagation

2-105
Application architectures
possible structure of applications:
• client-server
• peer-to-peer (P2P)

2-106
Client-server architecture
server:
• always-on host
• permanent IP address
• data centers for scaling
clients:
• communicate with server
client/server • may be intermittently
connected
• may have dynamic IP
addresses
• do not communicate directly
with each other
2-108

P2P architecture
• no always-on server peer-peer
• arbitrary end systems directly
communicate
• peers request service from
other peers, provide service
in return to other peers
• self scalability – new peers bring
new service capacity, as well as
new service demands
• peers are intermittently
connected and change IP
addresses
• complex management
Processes communicating
process: program running within a host
• within same host, two processes communicate using inter-process
communication (defined by OS)
• processes in different hosts communicate by exchanging messages

clients, servers
client process: process that
initiates communication ▪ aside: applications with P2P
architectures have client processes
server process: process that
& server processes
waits to be contacted
2-110

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

application application
socket controlled by
process process app developer

transport transport
network network controlled
link by OS
link Internet
physical physical
Multiplexing/demultiplexing-Addressing processes

multiplexing at sender:
handle data from multiple demultiplexing at receiver:
sockets, add transport header use header info to deliver
(later used for demultiplexing) received segments to correct
socket

PORT = 15 application PORT = 55


PORT = 20
application P1 P2 application socket
PORT = 55 P3 transport P4
process
transport network transport
network link network
link physical link
IP = 3.3.3.3
physical physical
IP = 2.2.2.2 IP = 1.1.1.1

Src=2.2.2.2 Port=55
Dst IP = 1.1.1.1 Port = 15
Addressing processes
• identifier includes both IP address and • to receive messages, process must
port numbers associated with have identifier
process on host.
• host device has unique 32-bit IP
• example port numbers: address
• HTTP server: 80
• mail server: 25
• to send HTTP message to
gaia.cs.umass.edu web server:
• IP address: 128.119.245.12
• port number: 80
• more shortly…
App-layer protocol defines
• types of messages exchanged, open protocols:
• e.g., request, response • defined in RFCs
• message syntax: • allows for interoperability
• what fields in messages & how fields are delineated
• e.g., HTTP, SMTP
• message semantics
• meaning of information in fields ex.404 proprietary protocols:
• rules for when and how processes send & • e.g., Skype
respond to messages
ex: Handshake protocol
What transport service does an app need?
data integrity throughput
▪ some apps (e.g., file transfer, ▪ some apps (e.g.,
web transactions) require 100% multimedia) require
reliable data transfer minimum amount of
▪ other apps (e.g., audio) can throughput to be
tolerate some loss “effective”
▪ other apps (“elastic apps”)
timing
make use of whatever
• some apps (e.g., Internet telephony, throughput they get
interactive games) require low
delay to be “effective” security
▪ encryption, data integrity,

2-115

Pure P2P architecture


• no always-on server
• arbitrary end systems directly
communicate
• peers are intermittently connected
and change IP addresses
examples:
• file distribution (BitTorrent)
• Streaming (KanKan)
• VoIP (Skype)
File distribution: client-server vs P2P
Question: how much time to distribute file (size F) from one server to N peers?
• peer upload/download capacity is limited resource

us: server upload


capacity

di: peer i download


file, size F u1 d1 capacity
us u2 d2
server
di
uN network (with abundant
bandwidth) ui
dN
ui: peer i upload
capacity

2-116
File distribution time: client-server
• server transmission: must sequentially send (upload) N file copies:
• time to send one copy: F/us
F
• time to send N copies: NF/us us
di
network
ui

▪ client: each client must


download file copy
• dmin = min client download rate
• min client download time: F/dmin

time to distribute F
to N clients using
client-server approach Dc-s > max{NF/us,,F/dmin}

increases linearly in N
2-117
• Us : Server upload bandwidth
• Ui : peer i upload bandwidth
• di: peer i download bandwidth

Server Sequentially sends N copies : NF/us


Us= 30MB
F = 100MB, N = 3
• At client, d1 = 5MB, d2 = 20MB, dn = 2MB,
min(d1,d2,dn)=dn
• At server,
• time to send N copies: NF/us
= 3*100/30=10s

Client i takes F/di time to download


Ex:d1 = 100/5=20s time to distribute F
to N clients using = 20s+10s=30s
client-server approach
File distribution time: P2P
• server transmission: must
upload at least one copy F
us
• time to send one copy: F/us
di
▪ client: each client must network
download file copy ui
• min client download time: F/dmin
▪ clients: as aggregate must download NF bits
• max upload rate (limiting max download rate) is us + ui

time to distribute F
to N clients using
P2P approach
DP2P > max{F/us,,F/dmin,,NF/(us + ui)}

increases linearly in N …
… but so does this, as each peer brings service capacity
2-119
• Us : Server upload bandwidth
• Ui : peer i upload bandwidth
• di: peer i download bandwidth

Server Sequentially sends N copies : NF/us


Us= 30MB U1= 10MB
F = 100MB, N = 3
• At client, d1 = 5MB, d2 = 20MB, dn = 2MB,
min(d1,d2,dn)=dn
• At server,
• time to send 1 copies: NF/us
=
1*100/30=3.3sec
Client i takes F/di time to download
Ex:d1 = 100/5=20s

d2, dn, NF/(Us+U1)= 200/(30+10) =50s


Client-server vs. P2P: example
client upload rate = u, F/u = 1 hour, us = 10u, dmin ≥ us

3.5
P2P

Minimum Distribution Time


3
Client-Server
2.5

1.5

0.5

0
0 5 10 15 20 25 30 35

N
2-121
P2P file distribution: BitTorrent
▪ file divided into 256Kb chunks
▪ peers in torrent send/receive file chunks

tracker: tracks peers torrent: group of peers


participating in torrent exchanging chunks of a file

Alice arrives …
… obtains list
of peers from tracker
… and begins exchanging
file chunks with peers in torrent

2-122
P2P file distribution: BitTorrent
• peer joining torrent:
• has no chunks, but will accumulate
them over time from other peers
• registers with tracker to get list of
peers, connects to subset of peers
(“neighbors”)

▪ while downloading, peer uploads chunks to other peers


▪ peer may change peers with whom it exchanges chunks
▪ churn: peers may come and go
▪ once peer has entire file, it may (selfishly) leave or
(altruistically) remain in torrent

2-123
BitTorrent: requesting, sending file chunks
requesting chunks:
sending chunks: tit-for-tat
▪ at any given time, different peers ▪ Alice sends chunks to those
have different subsets of file chunks four peers currently sending her
▪ periodically, Alice asks each peer for chunks at highest rate
• other peers are choked by Alice
list of chunks that they have (do not receive chunks from her)
▪ Alice requests missing chunks from • re-evaluate top 4 every10 secs
peers, rarest first ▪ every 30 secs: randomly select
another peer, starts sending
chunks
• “optimistically unchoke” this peer
• newly chosen peer may join top 4

2-124
BitTorrent: tit-for-tat
(1) Alice “optimistically unchokes” Bob
(2) Alice becomes one of Bob’s top-four providers; Bob reciprocates
(3) Bob becomes one of Alice’s top-four providers

higher upload rate: find better


trading partners, get file faster !

2-125
• Application layer protocol-HTTP,SMTP,DNS
HTTP overview
HTTP: hypertext transfer protocol
• Web’s application layer
protocol
• client/server model PC running
Firefox browser
• client: browser that requests,
receives, (using HTTP
protocol) and “displays”
Web objects
• server: Web server sends server
(using HTTP protocol) running
objects in response to Apache Web
requests server

iPhone running
Safari browser

2-127
HTTP overview (continued)
uses TCP: HTTP is “stateless”
▪ client initiates TCP • server maintains no
connection (creates socket) information about past
to server, port 80 client requests
▪ server accepts TCP
connection from client aside
protocols that maintain
▪ HTTP messages (application- “state” are complex!
layer protocol messages) ▪ past history (state) must be
exchanged between browser maintained
(HTTP client) and Web ▪ if server/client crashes, their
server (HTTP server) views of “state” may be
inconsistent, must be
▪ TCP connection closed reconciled

2-128
HTTP connections
persistent HTTP
non-persistent HTTP
• multiple objects can be sent over
• at most one object sent over TCP single TCP connection between
connection client, server
• connection then closed
• downloading multiple objects required
multiple connections

2-129
2-130

Non-persistent HTTP: response time


(connection will be closed)
RTT (definition): time for a small packet to
travel from client to server and back
HTTP response time:
initiate TCP
• one RTT to initiate TCP connection connection

• one RTT for HTTP request and first few RTT

bytes of HTTP response to return request


file
• file transmission time RTT
time to
transmit
• non-persistent HTTP response time = file
file
received
2RTT+ file transmission time
time time
Persistent HTTP

non-persistent HTTP issues: persistent HTTP:


▪ requires 2 RTTs per object ▪ server leaves connection
▪ OS overhead for each TCP open after sending
connection response
▪ browsers often open parallel ▪ subsequent HTTP
TCP connections to fetch messages between same
referenced objects 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
2-131
persistent HTTP:
SMTP-Simple mail transfer protocol
• e-mail is an asynchronous communication medium—people send and read messages when it is
convenient for them, without having to coordinate with other people’s schedules.
• In contrast with postal mail, electronic mail is fast, easy to distribute, and inexpensive.
• Modern e-mail has many powerful features, including messages with attachments, hyperlinks,
HTML-formatted text, and embedded photos.
A high-level view
of the Internet e-
mail system
• three major components:
• user agents,
• mail servers, and the
• Simple Mail Transfer Protocol (SMTP)
• SMTP is the principal application-layer protocol for Internet electronic mail.
• It uses the reliable data transfer service of TCP to transfer mail from the sender’s mail server to
the recipient’s mail server.
• As with most application-layer protocols, SMTP has two sides: a client side, which executes on
the sender’s mail server, and a server side, which executes on the recipient’s mail server.
• Both the client and server sides of SMTP run on every mail server. When a mail server sends mail
to other mail servers, it acts as an SMTP client.
• When a mail server receives mail from other mail servers, it acts as an SMTP server
Alice sends a message to Bob
• SMTP, defined in RFC 5321, is at the heart of Internet electronic mail.
• As mentioned above, SMTP transfers messages from senders’ mail servers to the recipients’ mail
servers.
1. Alice invokes her user agent for e-mail, provides Bob’s e-mail address (for example,
[email protected]), composes a message, and instructs the user agent to send the message.
2. Alice’s user agent sends the message to her mail server, where it is placed in a message queue.
3. The client side of SMTP, running on Alice’s mail server, sees the message in the message queue. It
opens a TCP connection to an SMTP server, running on Bob’s mail server.
4. After some initial SMTP handshaking, the SMTP client sends Alice’s message into the TCP
connection.
5. At Bob’s mail server, the server side of SMTP receives the message. Bob’s mail server then places
the message in Bob’s mailbox.
6. Bob invokes his user agent to read the message at his convenience
• First, the client SMTP (running on the sending mail server host) has TCP establish a connection to
port 25 at the server SMTP (running on the receiving mail server host).
• If the server is down, the client tries again later. Once this connection is established, the server
and client perform some application-layer handshaking—just as humans often introduce
themselves before transferring information from one to another,
• SMTP clients and servers introduce themselves before transferring information. During this SMTP
handshaking phase, the SMTP client indicates the e mail address of the sender (the person who
generated the message) and the e-mail address of the recipient.
• Once the SMTP client and server have introduced themselves to each other, the client sends the
message. SMTP can count on the reliable data transfer service of TCP to get the message to the
server without errors.
• The client then repeats this process over the same TCP connection if it has other messages to
send to the server; otherwise, it instructs TCP to close the connection
Mail Message Formats
Mail Access Protocols
• mail access uses a client-server architecture—the typical user reads e-mail with a client that
executes on the user’s end system, for example, on an office PC, a laptop, or a smartphone
POP3-Post Office Protocol (POP3)
• POP3 is an extremely simple mail access protocol. It is defined in [RFC 1939], which is short and quite readable. Because the protocol is
so simple, its functionality is rather limited.
• The Post Office Protocol (POP3) is a standard protocol used by email clients to retrieve emails from a mail server. POP3 is widely used
because of its simplicity and its ability to download and manage email messages locally.
• 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 progresses through three phases:
• authorization,
• transaction, and
• update.
During the first phase, authorization, the user agent sends a username and a password (in the clear) to authenticate the user.
During the second phase, transaction, the user agent retrieves messages; also during this phase, the user agent can 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
IMAP
• The Internet Message Access Protocol (IMAP) is a standard email protocol used for
retrieving emails from a mail server.
• Unlike POP3, IMAP allows users to manage their emails directly on the mail server, offering
enhanced synchronization and flexibility for multi-device access.
• IMAP synchronizes emails between the mail server and multiple devices (e.g., laptops,
smartphones, tablets).Actions such as reading, deleting, or organizing emails are reflected across
all devices.
• Emails remain stored on the server, allowing users to access their entire mailbox from any device.
Folders can be created and organized directly on the server.
• Default Port: 143
•LOGIN: Authenticates the user with a username and password.
•SELECT: Opens a specific mailbox (e.g., Inbox).
•FETCH: Retrieves specific emails or parts of emails (e.g., headers, body).
•STORE: Updates the flags of an email (e.g., read/unread, starred).
•EXPUNGE: Permanently deletes marked emails.
•LOGOUT: Ends the session.
Feature IMAP POP3
No, emails are downloaded and
Synchronization Yes, across multiple devices managed locally.

Emails are downloaded and


Storage Emails stored on the server
usually deleted from the server.
Access Mode Online or cached access Primarily offline after download.
Port Numbers 143 (non-secure), 993 (secure) 110 (non-secure), 995 (secure)
DNS-Domain Name system
• A Domain Name System (DNS) is a critical component of the Internet infrastructure that plays a
fundamental role in connecting users to websites, services, and resources across the World Wide
Web.
• DNS-The Internet’s Directory Service

IP Address→ Naming || Naming→ IP Address


DNS—The Internet’s Directory Service
• Hostnames—such as www.facebook.com, www.google.com, gaia.cs.umass.edu—are mnemonic
and are therefore appreciated by humans.
• However, hostnames provide little, if any, information about the location within the Internet of the
host. (A hostname such as www.eurecom.fr, which ends with the country code .fr, tells us that the
host is probably in France, but doesn’t say much more.)
• Furthermore, because hostnames can consist of variable-length alphanumeric characters, they
would be difficult to process by routers.
• For these reasons, hosts are also identified by so-called IP addresses.
• An IP address looks like 121.7.106.83, where each period separates one of the bytes expressed in
decimal notation from 0 to 255.
• An IP address is hierarchical because as we scan the address from left to right, we obtain more
and more specific information about where the host is located in the Internet (that is, within
which network, in the network of networks).
Services Provided by DNS
• The DNS is a distributed database implemented in a hierarchy of DNS servers, and an
application-layer protocol that allows hosts to query the distributed database.
• The DNS servers are often UNIX machines running the Berkeley Internet Name Domain (BIND)
software [BIND 2016]. The DNS protocol runs over UDP and uses port 53.
• DNS is commonly employed by other application-layer protocols—including HTTP and SMTP to
translate user-supplied hostnames to IP addresses.
• As an example, consider what happens when a browser (that is, an HTTP client), running on
some user’s host, requests the URL www.someschool.edu/index.html.
1. The same user machine runs the client side of the DNS application.
2. The browser extracts the hostname, www.someschool.edu, from the URL and passes the
hostname to the client side of the DNS application.
3. The DNS client sends a query containing the hostname to a DNS server.
4. The DNS client eventually receives a reply, which includes the IP address for the hostname.
5. Once the browser receives the IP address from DNS, it can initiate a TCP connection to the
HTTP server process located at port 80 at that IP address.
DNS provides a few other important services in addition to
translating hostnames to IP addresses
Host aliasing: A host with a complicated hostname can have one or more alias names.
• For example, a hostname such as relay1.west-coast.enterprise.com could have, say, two
aliases such as enterprise.com and www.enterprise.com.
Canonical Hostname:
• A canonical hostname refers to the true or official name of a host in the network. For
example, relay1.west-coast.enterprise.com is the canonical hostname.
Alias Hostnames:
• An alias hostname is an alternative name given to a host, often for convenience or mnemonic
purposes.
• For instance, enterprise.com and www.enterprise.com are aliases for relay1.west-
coast.enterprise.com.These aliases are usually easier to remember and are intended for user-
friendly access to the host.
Mail server aliasing
• The concept of Mail Server Aliasing refers to the use of alias hostnames for mail servers to
simplify email routing and provide flexibility.
• it is highly desirable that e-mail addresses be mnemonic.
• For example, if Bob has an account with Yahoo Mail, Bob’s e-mail address might be as simple as
[email protected].
• However, the hostname of the Yahoo mail server is more complicated and much less mnemonic
than simply yahoo.com
• (for example, the canonical hostname might be something like relay1.west-coast.yahoo.com).
Load Distribution
• Load Distribution is a strategy used to distribute network or server traffic across multiple
servers or resources to optimize performance, improve reliability, and prevent any single server
from becoming a bottleneck.
• Replication of Servers:
Large or busy websites, like cnn.com, replicate their web servers across multiple systems (or
locations) to handle a high volume of traffic.
Each of these servers has a unique IP address, but they share the same canonical hostname.
• DNS Database and IP Address Mapping:
The DNS database maintains a set of IP addresses associated with the canonical hostname (e.g.,
www.cnn.com).
When a user queries the DNS for the hostname, the DNS server responds with all the IP
addresses for the replicated servers.
DNS Rotation (Round-Robin):
• The order of the IP addresses in the DNS response is rotated for every query.For example:
• Query 1: IP1, IP2, IP3
• Query 2: IP2, IP3, IP1
• Query 3: IP3, IP1, IP2
• This rotation ensures an even distribution of traffic among the servers, as most clients send their
requests to the first IP address in the list.
Load Distribution for Web Servers:
• Web Traffic Distribution:When users visit a website like cnn.com, the DNS rotation ensures that
not all requests are directed to a single server.This helps balance the load and prevents any single
server from being overwhelmed.
• A simple design for DNS would have one DNS server that contains all the mappings.
• In this centralized design, clients simply direct all queries to the single DNS server, and the
DNS server responds directly to the querying clients.
• Although the simplicity of this design is attractive, it is inappropriate for today’s Internet, with its vast
(and growing) number of hosts. The problems with a centralized design include.
• A single point of failure. If the DNS server crashes, so does the entire Internet!
• Traffic volume. A single DNS server would have to handle all DNS queries (for all the HTTP
requests and e-mail messages generated from hundreds of millions of hosts).
• Distant centralized database. A single DNS server cannot be “close to” all the querying clients. If
we put the single DNS server in New York City, then all queries from Australia must travel to the
other side of the globe, perhaps over slow and congested links. This can lead to significant delays.
• Maintenance. The single DNS server would have to keep records for all Internet hosts. Not only
would this centralized database be huge, but it would have to be updated frequently to account for
every new host
The DNS namespace is the
Components of DNS hierarchical structure of the
domain name system
Location of Website The root of the tree (.) is at the top.
google.com Top-Level Domains (TLDs): .com, .org,
example.org .net
Domain names -easier to Second-Level Domains: example.com
remember compared to IP Subdomains: mail.example.com
addresses
A Name resolver (or client) is
A name server is a specialized a software component that
server that stores DNS records and initiates DNS queries to resolve
responds to queries for translating domain names.
domain names into IP addresses. www.example.com into a
browser, the resolver is
responsible for finding the IP
address of the website.
• These root name servers are managed by 13 different
organizations.
• Top-level domain (TLD) servers. For each of the top-level
domains — top-level domains such as com, org, net, edu, and
gov, and all of the country top-level domains such as uk, fr, ca,
and jp — there is TLD server (or server cluster).
• Authoritative DNS servers are a critical component of
the Domain Name System (DNS). They are responsible for
answering DNS queries with definitive information about
domain names and their associated records.
DNS Messages
RR-resource records
Interaction of the
various DNS servers

Recursive and Iterative queries


Recursive queries in DNS
Transport Layer - Unreliable Connectionless vs. Reliable Connection-Oriented Services -
Multiplexing; Stop-and Wait - Go-Back-N and Selective-Repeat - UDP vs. TCP - Flow and
Congestion Control.
Transport vs. network layer
▪ network layer: logical
communication between
hosts
▪ transport layer: logical
communication between
processes
• relies on, enhances, network
layer services

3-160
Internet transport-layer protocols
• reliable, in-order delivery (TCP) application
transport
network
• congestion control data link
physical
• flow control network
network
data link
• connection setup data link
physical
physical

network
• unreliable, unordered delivery: UDP data link
physical

• services not available: network


data link
• delay guarantees physical
network
• bandwidth guarantees data link
physical
network
data link application
physical transport
network
data link network
physical data link
physical

3-161
Multiplexing/demultiplexing
multiplexing at sender:
handle data from multiple demultiplexing at receiver:
sockets, add transport header use header info to deliver
(later used for demultiplexing) received segments to correct
socket

application

application P1 P2 application socket


P3 transport P4
process
transport network transport
network link network
link physical link
physical physical

3-162
Connectionless demultiplexing
▪ DatagramSocket mySocket1 ▪ When creating datagram to
= new send into UDP socket,
DatagramSocket(12534);
must specify
• destination IP address
• destination port #

▪ when host receives UDP segment: IP datagrams with same


• checks destination port # in dest. port #, but different
segment source IP addresses
• directs UDP segment to socket and/or source port
with that port # numbers will be directed
to same socket at dest

3-163
Connectionless demux: example
DatagramSocket
DatagramSocket serverSocket = new
mySocket2 = new DatagramSocket DatagramSocket
DatagramSocket (6428); mySocket1 = new
(9157); DatagramSocket
application
(5775);
application application
P1
P3 P4
transport
transport transport
network
network link network
link physical link
physical physical

source port: 6428 source port: ?


dest port: 9157 dest port: ?

source port: 9157 source port: ?


dest port: 6428 dest port: ?
3-164
Connection-oriented demux
▪ TCP socket identified by 4-tuple: ▪ server host may support many
• source IP address simultaneous TCP sockets:
• source port number • each socket identified by its
• dest IP address own 4-tuple
• dest port number ▪ web servers have different sockets
for each connecting client
▪ demux: receiver uses all four values to direct segment
to appropriate socket • non-persistent HTTP will have
different socket for each
request

3-165
Connection-oriented demux: example-Multiplexing/demultiplexing-Addressing processes

multiplexing at sender:
handle data from multiple demultiplexing at receiver:
sockets, add transport header use header info to deliver
(later used for demultiplexing) received segments to correct
socket

PORT = 15 application PORT = 55


PORT = 20
application P1 P2 application socket
PORT = 55 P3 transport P4
process
transport network transport
network link network
link physical link
IP = 3.3.3.3
physical physical
IP = 2.2.2.2 IP = 1.1.1.1

Src=2.2.2.2 Port=55
Dst IP = 1.1.1.1 Port = 15
Internet transport protocols services
UDP service:
TCP service:
• reliable transport between sending ▪ unreliable data transfer
and receiving process between sending and
receiving process
• flow control: sender won’t
overwhelm receiver ▪ does not provide: reliability,
• congestion control: throttle sender flow control, congestion
when network overloaded control, timing, throughput
guarantee, security, or
• does not provide: timing, minimum
throughput guarantee, security connection setup,
• connection-oriented: setup required
between client and server
processes

2-167
Principles of reliable data transfer
▪ important in application, transport, link layers

▪ characteristics of unreliable channel will determine


complexity of reliable data transfer protocol (rdt)
▪ unreliable data transfer protocol (udt)

3-168
Reliable data transfer: getting started
rdt_send(): called from above, deliver_data(): called by
(e.g., by app.). Passed data to rdt to deliver data to upper
deliver to receiver upper layer

send receive
side side

udt_send(): called by rdt, rdt_rcv(): called when packet


to transfer packet over arrives on rcv-side of channel
unreliable channel to receiver

3-169
Reliable data transfer: getting started

• incrementally develop sender, receiver sides of reliable data transfer protocol (rdt)
• consider only unidirectional data transfer
• but control info will flow on both directions!
• use finite state machines (FSM) to specify sender, receiver

event causing state transition


actions taken on state transition
state: when in this
“state” next state state state
uniquely determined 1 event
by next event 2
actions

3-170
rdt1.0: reliable transfer over a reliable channel
▪ underlying channel perfectly reliable
• no bit errors
• no loss of packets, no out of order
▪ separate FSMs for sender, receiver:
• sender sends data into underlying channel
• receiver reads data from underlying channel

Wait for rdt_send(data) Wait for rdt_rcv(packet)


call from call from extract (packet,data)
above packet = make_pkt(data) below deliver_data(data)
udt_send(packet)

sender receiver

3-171
rdt2.0: channel with bit errors
▪ underlying channel may flip bits in packet
• checksum to detect bit errors
▪ the question: how to recover from errors:
• acknowledgements (ACKs): receiver
explicitly tells sender that pkt BIT error only
received OK
• negative acknowledgements (NAKs): A checksum is a value used to verify the integrity of data
receiver explicitly tells sender that during transmission or storage. It is a mathematical summary of
pkt had errors
a set of data, calculated using an algorithm. The checksum allows
• sender retransmits pkt on receipt of
NAK the receiver to detect errors in the data caused by corruption,
transmission errors, or hardware issues.
▪ new mechanisms in rdt2.0 (beyond
rdt1.0):
• error detection
• receiver feedback: control msgs
(ACK,NAK) rcvr->sender
rdt2.0: FSM specification
rdt_send(data)
sndpkt = make_pkt(data, checksum) receiver
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for Wait for rdt_rcv(rcvpkt) &&
call from ACK or udt_send(sndpkt) corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for

call from
sender below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt2.0: operation with no errors
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for Wait for rdt_rcv(rcvpkt) &&
call from ACK or udt_send(sndpkt) corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
 call from
below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt2.0: error scenario
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
isNAK(rcvpkt)
Wait for Wait for rdt_rcv(rcvpkt) &&
call from ACK or udt_send(sndpkt) corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
 call from
below

rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt2.0 has a fatal flaw! handling duplicates:
• sender retransmits current
what happens if ACK/NAK corrupted? pkt if ACK/NAK corrupted
• sender doesn’t know what happened at receiver! • sender adds sequence
• can’t just retransmit: possible duplicate number to each pkt
• receiver discards (doesn’t
deliver up) duplicate pkt

stop and wait


sender sends one packet,
then waits for receiver
response
rdt2.1: sender, handles garbled ACK/NAKs –
redundant transmission
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt) rdt_rcv(rcvpkt) && NAK-
( corrupt(rcvpkt) || Retransmission
Wait for Wait for isNAK(rcvpkt) )
call 0 from ACK or
NAK 0 udt_send(sndpkt)
above
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt) && notcorrupt(rcvpkt)
&& isACK(rcvpkt)


Wait for Wait for
ACK or call 1 from
rdt_rcv(rcvpkt) && NAK 1 above
NAK- ( corrupt(rcvpkt) ||
isNAK(rcvpkt) ) rdt_send(data)
Retransmission
udt_send(sndpkt) sndpkt = make_pkt(1, data, checksum)
udt_send(sndpkt)
rdt2.1: receiver, handles garbled ACK/NAKs
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) Not Corrupted/Deliver
&& has_seq0(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) && (corrupt(rcvpkt) rdt_rcv(rcvpkt) && (corrupt(rcvpkt)
sndpkt = make_pkt(NAK, chksum) sndpkt = make_pkt(NAK, chksum)
udt_send(sndpkt) udt_send(sndpkt)
Wait for Wait for
rdt_rcv(rcvpkt) && 0 from 1 from rdt_rcv(rcvpkt) && Discards-
Discards- below
not corrupt(rcvpkt) && below not corrupt(rcvpkt) && Duplicates
Duplicates has_seq1(rcvpkt) has_seq0(rcvpkt)
sndpkt = make_pkt(ACK, chksum) sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt) udt_send(sndpkt)
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt)

extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
rdt2.1: discussion receiver:
▪ must check if received packet is duplicate
sender: • state indicates whether 0 or 1 is
expected pkt seq #
• seq # added to pkt
▪ note: receiver can not know if its last
• two seq. #’s (0,1) will suffice. Why? ACK/NAK received OK at sender
• must check if received ACK/NAK corrupted
• twice as many states
• state must “remember” whether “expected” pkt should have seq # of 0 or 1
rdt2.2: NAK-free protocol
▪ same functionality as rdt2.1, using ACKs only
▪ instead of NAK, receiver sends ACK for last pkt received OK
• receiver must explicitly include seq # of pkt being ACKed
▪ duplicate ACK at sender results in same action as NAK: retransmit current pkt
▪ If we send P0 and P1 (0,1)
▪ Received correctly P0,P1>>Ack0,Ack1
rdt2.2: sender, receiver fragments
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
Wait for Wait for
ACK isACK(rcvpkt,1) )
call 0 from
above 0 udt_send(sndpkt)
sender FSM
fragment rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt)
rdt_rcv(rcvpkt) && && isACK(rcvpkt,0)
(corrupt(rcvpkt) || 
has_seq1(rcvpkt)) Wait for receiver FSM
0 from
udt_send(sndpkt) below fragment
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK1, chksum)
udt_send(sndpkt)
rdt3.0: channels with errors and loss
approach: sender waits
new assumption: underlying channel can also lose “reasonable” amount of time for
packets (data, ACKs) ACK
• checksum, seq. #, ACKs, retransmissions will be
of help … but not enough • retransmits if no ACK
received in this time
• if pkt (or ACK) just delayed
(not lost):
• retransmission will be
duplicate, but seq. #’s already
handles this
• receiver must specify seq # of
pkt being ACKed
• requires countdown timer
rdt3.0 sender
rdt_send(data)
rdt_rcv(rcvpkt) &&
sndpkt = make_pkt(0, data, checksum) ( corrupt(rcvpkt) ||
udt_send(sndpkt) isACK(rcvpkt,1) )
rdt_rcv(rcvpkt) start_timer 
 Wait for Wait
for timeout
call 0from
ACK0 udt_send(sndpkt)
above
start_timer
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt,1) && notcorrupt(rcvpkt)
stop_timer && isACK(rcvpkt,0)
stop_timer
Wait Wait for
timeout for call 1 from
udt_send(sndpkt) ACK1 above
start_timer rdt_rcv(rcvpkt)
rdt_send(data) 
rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) || sndpkt = make_pkt(1, data, checksum)
isACK(rcvpkt,0) ) udt_send(sndpkt)
start_timer

rdt3.0 in action
sender receiver sender receiver
send pkt0 pkt0 send pkt0 pkt0
rcv pkt0 rcv pkt0
ack0 send ack0 ack0 send ack0
rcv ack0 rcv ack0
send pkt1 pkt1 send pkt1 pkt1
rcv pkt1 X
ack1 send ack1 loss
rcv ack1
send pkt0 pkt0
rcv pkt0 timeout
ack0 send ack0 resend pkt1 pkt1
rcv pkt1
ack1 send ack1
rcv ack1
send pkt0 pkt0
(a) no loss rcv pkt0
ack0 send ack0

(b) packet loss


rdt3.0 in action sender receiver
sender receiver send pkt0 pkt0
send pkt0 pkt0 rcv pkt0
send ack0
rcv pkt0 ack0
send ack0 rcv ack0
ack0 send pkt1 pkt1
rcv ack0 rcv pkt1
send pkt1 pkt1
send ack1
rcv pkt1 ack1
ack1 send ack1
X
loss timeout
resend pkt1 pkt1
rcv pkt1
timeout
resend pkt1 pkt1 rcv ack1 (detect duplicate)
rcv pkt1 send pkt0
pkt0
send ack1
(detect duplicate) ack1
ack1 send ack1 rcv ack1 rcv pkt0
rcv ack1 send pkt0
ack0 send ack0
send pkt0 pkt0 pkt0
rcv pkt0
rcv pkt0 ack0 (detect duplicate)
ack0 send ack0 send ack0
(c) ACK loss
(d) premature timeout/ delayed ACK
Performance of rdt3.0 Link Bandwidth (R): 1 Gbps
(10⁹ bits/sec)
Packet Size (L): 8000 bits
▪ rdt3.0 is correct, but performance stinks
▪ e.g.: 1 Gbps link, 15 ms prop. delay, 8000 bit packet

L 8000 bits
Dtrans = R = = 8 microsecs
109 bits/sec

▪ U sender: utilization – fraction of time sender busy sending

U L/R .008
sender = = = 0.00027
RTT + L / R 30.008

▪ if RTT=30 msec, 1KB pkt every 30 msec: 33kB/sec thruput


over 1 Gbps link
▪ network protocol limits use of physical resources!
rdt3.0: stop-and-wait operation
sender receiver
first packet bit transmitted, t = 0
last packet bit transmitted, t = L / R

first packet bit arrives


RTT last packet bit arrives, send ACK

ACK arrives, send next


packet, t = RTT + L / R

U L/R .008
sender = = = 0.00027
RTT + L / R 30.008
Pipelined Protocol
• GO-BACK
• Selective ARQ
Pipelined protocols
pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged pkts
• range of sequence numbers must be increased
• buffering at sender and/or receiver

▪ two generic forms of pipelined protocols: go-Back-N, selective repeat


Pipelining: increased utilization
sender receiver
first packet bit transmitted, t = 0
last bit transmitted, t = L / R

first packet bit arrives


RTT last packet bit arrives, send ACK
last bit of 2nd packet arrives, send ACK
last bit of 3rd packet arrives, send ACK
ACK arrives, send next
packet, t = RTT + L / R
3-packet pipelining increases
utilization by a factor of 3!

U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008
Pipelined protocols: overview
Selective Repeat:
Go-back-N:
• sender can have up to N unack’ed
• sender can have up to N unacked packets in pipeline packets in pipeline
• receiver only sends cumulative ack • rcvr sends individual ack for each
• Doesn’t ack packet if there’s a gap packet
• sender has timer for oldest unacked packet
• when timer expires, retransmit all unacked packets
• sender maintains timer for each
unacked packet
• when timer expires, retransmit
only that unacked packet
GBN in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0
012345678 send pkt3 Xloss receive pkt1, send ack1
(wait)
receive pkt3, discard,
012345678 rcv ack0, send pkt4 (re)send ack1
012345678 rcv ack1, send pkt5 receive pkt4, discard,
(re)send ack1
ignore duplicate ACK receive pkt5, discard,
(re)send ack1
pkt 2 timeout
012345678 send pkt2
012345678 send pkt3
012345678 send pkt4 rcv pkt2, deliver, send ack2
012345678 send pkt5 rcv pkt3, deliver, send ack3
rcv pkt4, deliver, send ack4
rcv pkt5, deliver, send ack5
Go-Back-N: sender
• k-bit seq # in pkt header
• “window” of up to N, consecutive unack’ed pkts allowed

▪ ACK(n): ACKs all pkts up to, including seq # n - “cumulative


ACK”
• may receive duplicate ACKs (see receiver)
▪ timer for oldest in-flight pkt
▪ timeout(n): retransmit packet n and all higher seq # pkts in
window
GBN: sender extended FSM
rdt_send(data)
if (nextseqnum < base+N) {
sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum)
udt_send(sndpkt[nextseqnum])
if (base == nextseqnum)
start_timer
nextseqnum++
}
 else
refuse_data(data)
base=1
nextseqnum=1
timeout
start_timer
Wait
udt_send(sndpkt[base])
rdt_rcv(rcvpkt) udt_send(sndpkt[base+1])
&& corrupt(rcvpkt) …
udt_send(sndpkt[nextseqnum-1])
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
base = getacknum(rcvpkt)+1
If (base == nextseqnum)
stop_timer
else
start_timer
GBN: receiver extended FSM
default
udt_send(sndpkt) rdt_rcv(rcvpkt)
&& notcurrupt(rcvpkt)
 && hasseqnum(rcvpkt,expectedseqnum)
expectedseqnum=1 Wait extract(rcvpkt,data)
sndpkt = deliver_data(data)
make_pkt(expectedseqnum,ACK,chksum) sndpkt = make_pkt(expectedseqnum,ACK,chksum)
udt_send(sndpkt)
expectedseqnum++

ACK-only: always send ACK for correctly-received pkt with highest in-order seq #
• may generate duplicate ACKs
• need only remember expectedseqnum
• out-of-order pkt:
• discard (don’t buffer): no receiver buffering!
• re-ACK pkt with highest in-order seq #
Selective repeat
• receiver individually acknowledges all correctly received pkts
• buffers pkts, as needed, for eventual in-order delivery to upper layer
• sender only resends pkts for which ACK not received
• sender timer for each unACKed pkt
• sender window
• N consecutive seq #’s
• limits seq #s of sent, unACKed pkts
Selective repeat in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0
012345678 send pkt3 Xloss receive pkt1, send ack1
(wait)
receive pkt3, buffer,
012345678 rcv ack0, send pkt4 send ack3
012345678 rcv ack1, send pkt5 receive pkt4, buffer,
send ack4
record ack3 arrived receive pkt5, buffer,
send ack5
pkt 2 timeout
012345678 send pkt2
012345678 record ack4 arrived
012345678 rcv pkt2; deliver pkt2,
record ack5 arrived
012345678 pkt3, pkt4, pkt5; send ack2

Q: what happens when ack2 arrives?


Selective repeat: sender window
(after receipt)
receiver window
(after receipt)

dilemma 0123012 pkt0


0123012 pkt1 0123012
example: 0123012 pkt2 0123012

• seq #’s: 0, 1, 2, 3 0123012 pkt3


0123012

X
• window size=3 0123012
pkt0 will accept packet
with seq number 0
(a) no problem
▪ receiver sees no receiver can’t see sender side.
difference in two receiver behavior identical in both cases!
scenarios! something’s (very) wrong!
▪ duplicate data 0123012 pkt0
accepted as new in (b) 0123012 pkt1 0123012
0123012 pkt2 0123012
X 0123012
Q: what relationship X
between seq # size timeout
retransmit pkt0 X
and window size to 0123012 pkt0
will accept packet
avoid problem in (b)? with seq number 0
(b) oops!
Selective repeat: sender, receiver windows
Selective repeat
sender
data from above: receiver
▪ if next available seq # in window, pkt n in [rcvbase, rcvbase+N-1]
send pkt ▪ send ACK(n)
timeout(n): ▪ out-of-order: buffer
▪ in-order: deliver (also
▪ resend pkt n, restart timer deliver buffered, in-order
ACK(n) in [sendbase,sendbase+N]: pkts), advance window to
next not-yet-received pkt
▪ mark pkt n as received
▪ if n smallest unACKed pkt, advance
pkt n in [rcvbase-N,rcvbase-1]
window base to next unACKed seq ▪ ACK(n)
# otherwise:
▪ ignore
TCP Flow control
TCP flow control
application
application may process
remove data from application
TCP socket buffers ….
TCP socket OS
receiver buffers
… slower than TCP
receiver is delivering
(sender is sending) TCP
code

IP
flow control code
receiver controls sender, so
sender won’t overflow
receiver’s buffer by transmitting from sender
too much, too fast
receiver protocol stack
TCP flow control
• receiver “advertises” free buffer
space by including rwnd(Receiver-
Advertised window)value in TCP to application process
header of receiver-to-sender segments
• RcvBuffer size set via socket options
(typical default is 4096 bytes) RcvBuffer buffered data
• many operating systems autoadjust
RcvBuffer rwnd free buffer space
• sender limits amount of unacked (“in-
flight”) data to receiver’s rwnd
value TCP segment payloads
• guarantees receive buffer will not
overflow receiver-side buffering
TCP- Connection oriented protocol-Connection
Management
before exchanging data, sender/receiver “handshake”:
• agree to establish connection (each knowing the other willing to establish
connection)
• agree on connection parameters
application application

connection state: ESTAB connection state: ESTAB


connection variables: connection Variables:
seq # client-to-server seq # client-to-server
server-to-client server-to-client
rcvBuffer size rcvBuffer size
at server,client at server,client

network network
Socket clientSocket = Socket connectionSocket =
newSocket("hostname","port welcomeSocket.accept();
number");
Agreeing to establish a connection

2-way handshake:
Q: will 2-way handshake always work
in network?
• variable delays
Let’s talk
ESTAB • retransmitted messages (e.g.
OK
ESTAB req_conn(x)) due to message
loss
• message reordering
• can’t “see” other side
choose x
req_conn(x)
ESTAB
acc_conn(x)
ESTAB
Agreeing to establish a connection
2-way handshake failure scenarios:

choose x choose x
req_conn(x) req_conn(x)
ESTAB ESTAB
retransmit acc_conn(x) retransmit acc_conn(x)
req_conn(x) req_conn(x)

ESTAB ESTAB
data(x+1) accept
req_conn(x)
retransmit data(x+1)
data(x+1)
connection connection
client x completes server x completes server
client
terminates forgets x terminates forgets x
req_conn(x)

accept
ESTAB ESTAB data(x+1)
data(x+1)
half open connection!
(no client!)
TCP 3-way handshake

client state server state


LISTEN LISTEN
choose init seq num, x
send TCP SYN msg
SYNSENT SYNbit=1, Seq=x
choose init seq num, y
send TCP SYNACK
msg, acking SYN SYN RCVD
SYNbit=1, Seq=y
ACKbit=1; ACKnum=x+1
received SYNACK(x)
ESTAB indicates server is live;
send ACK for SYNACK;
this segment may contain ACKbit=1, ACKnum=y+1
client-to-server data
received ACK(y)
indicates client is live
ESTAB
TCP 3-way handshake: FSM
closed

Socket connectionSocket =
welcomeSocket.accept();

 Socket clientSocket =
SYN(x) newSocket("hostname","port
number");
SYNACK(seq=y,ACKnum=x+1)
create new socket for SYN(seq=x)
communication back to client listen

SYN SYN
rcvd sent

SYNACK(seq=y,ACKnum=x+1)
ESTAB ACK(ACKnum=y+1)
ACK(ACKnum=y+1)

TCP: closing a connection
▪ client, server each close their side of connection
• send TCP segment with FIN bit = 1
▪ respond to received FIN with ACK
• on receiving FIN, ACK can be combined with own FIN
▪ simultaneous FIN exchanges can be handled
TCP: closing a connection
client state server state
ESTAB ESTAB
clientSocket.close()
FIN_WAIT_1 can no longer FINbit=1, seq=x
send but can
receive data CLOSE_WAIT
ACKbit=1; ACKnum=x+1
can still
FIN_WAIT_2 wait for server send data
close

LAST_ACK
FINbit=1, seq=y
TIMED_WAIT can no longer
send data
ACKbit=1; ACKnum=y+1
timed wait
for 2*max CLOSED
segment lifetime

CLOSED

You might also like