0% found this document useful (0 votes)
23 views103 pages

Chapter 1. Networking Fundamentals

Uploaded by

thang2005win
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views103 pages

Chapter 1. Networking Fundamentals

Uploaded by

thang2005win
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 103

03/02/2020

 

Lecturer: Nguyễn Thị Thanh Vân – FIT - HCMUTE

 History of computer network


 Computer network
 Network topology
 Network protocol
 Network Components
 Internet
 Packet-Switched Networks problems:
o Delay, Loss, and Throughput in
 Protocol Layers and Their Service Models
 OSI model
 TCP/IP model

03/02/2020 2

1
03/02/2020

 1960’s – “How can we transmit bits across a


communication medium efficiently and reliably?”
 1970’s – “How can we transmit packets across a
communication medium efficiently and reliably?”
 1980’s – “How can we provide communication services
across a series of interconnected networks?
 1990’s – “How can we provide high-speed, broadband
communication services to support high-performance
computing and multimedia applications across the globe?”
 2000's – What do you think will dominate in the next 10
years?

03/02/2020 3

1 2 3 4 5 6

Input Input data g Transmitted Received Output data g’ Output


Information or signal signal signal or signal Information
m g(t) s(t) r(t) g’(t)
’ m’
Receiver
Sender

Input Transmission Output


Transmitter Receiver
Device medium Device

Source System Destination System

03/02/2020 4

2
03/02/2020

 Data encoding
 Signal generation: electro-magnetic signals to be transmitted over a
transmission medium
 Synchronization: timing of signals between the transmitter and receiver
 Error detection and correction: ensuring that transmission errors are
detected and corrected
 Flow control: ensuring that the source does not overwhelm the
destination by sending data faster than the receiver can handle
 Multiplexing: make more efficient use of a transmission facility. This
technique is used at different levels of communication
 Addressing: indicating the identity of the intended destination
 Routing: selecting appropriate paths for data being transmitted
 Message formatting: conforming to the appropriate format
 Security: ensuring secure message transmission
 Systems management
03/02/2020 5

A communication network is a collection of devices connected by some


communications media and Network Architecture (topology and protocol)
o Example devices are:
• mainframes, minicomputers, supercomputers
• workstations, personal computers
• printers, disk servers, robots
• X-terminals
• Gateways, switches, routers, bridges
• Cellular phone, Pager, TRS
• Refrigerator, Television, Video Tape Recorder
o Communications Media
• twisted pairs, coaxial cables, fiber optics
• line-of-sight transmission: lasers, infra-red, microwave, radio
• satellite links
• Power line
03/02/2020 6

3
03/02/2020

 Computer Communication – the exchange of information


between computers for the purpose of cooperative action
 Computer Network – a collection of computers
interconnected via a communication network

03/02/2020 7

Transportation Network Computer Network


 Vehicles/People Packets/Payload
 Street address IP address
 Intersection Bridge/router
 Street, highway, path Link/broadband/path
 Traffic jam Network congestion
 Stop and go traffic light Flow control
 Taking alternative path Alternative route
 Collision Collision of packets
 HOV lane Flow Priority
 Following a route to school Routing algorithm
 … …
8

4
03/02/2020

 Resource Sharing
o Hardware (computing resources, disks, printers)
o Software (application software)
 Information Sharing
o Easy accessibility from anywhere (files, databases)
o Search Capability (WWW)
 Communication
o Email
o Message broadcast
 Remote computing
 Distributed processing (GRID Computing)

03/02/2020 9

 History of computer network


 Computer network
 Network topology
 Network protocol
 Network Components
 Internet
 Packet-Switched Networks problems:
o Delay, Loss, and Throughput in
 Protocol Layers and Their Service Models
 OSI model
 TCP/IP model

03/02/2020 10

5
03/02/2020

 The network topology defines the way in which devices are


connected.

03/02/2020 11

 All networked nodes are interconnected, peer to peer, using


a single, open-ended cable
 Both ends of the bus must be terminated with a terminating
resistor to prevent signal bounce

03/02/2020 12

6
03/02/2020

 Advantage:
o Easy to implement and extend
o Well suited for temporary networks that must be set up in a hurry
o Typically the least cheapest topology to implement
o Failure of one station does not affect others
 Disadvantage
o Difficult to administer/troubleshoot
o Limited cable length and number of stations
o A cable break can disable the entire network; no redundancy
o Maintenance costs may be higher in the long run
o Performance degrades as additional computers are added

03/02/2020 13

 A frame travels around the ring, stopping at each node. If a


node wants to transmit data, it adds the data as well as the
destination address to the frame.
 The frame then continues around the ring until it finds the
destination node, which takes the data out of the frame.
o Single ring – All the devices on the network share a single cable
o Dual ring – The dual ring topology allows data to be sent in both
directions.

03/02/2020 14

7
03/02/2020

 Advantage
o This type of network topology is very organized
o Performance is better than that of Bus topology
o No need for network server to control the connectivity between
workstations
o Additional components do not affect the performance of network
o Each computer has equal access to resources
 Disadvantage:
o Each packet of data must pass through all the computers between
source and destination, slower than star topology
o If one workstation or port goes down, the entire network gets affected
o Network is highly dependent on the wire which connects different
components
03/02/2020 15

 Have connections to networked devices that “radiate” out


form a common point
 Each device can access the media independently
 Have become the dominant topology type in contemporary
LANs (replace buses and rings)
Extended start

03/02/2020 16

8
03/02/2020

 Advantage:
o Compare to bus: gives far much better performance
o Easy to connect new nodes or devices
o Centralized management.
o Failure of one node or link doesn’t affect the rest of network
 Disadvantage:
o If central device fails whole network goes down
o The use of hub, a router or a switch as central device increases the
overall cost of the network
o Performance and as well number of nodes which can be added in
such topology is depended on capacity of central device

03/02/2020 17

 Partial Mesh Topology :


o In this topology some of the systems are connected in the same
fashion as mesh topology but some devices are only connected to
two or three devices.
 Full Mesh Topology :
o Each and every nodes or devices are connected to each

03/02/2020 18

9
03/02/2020

 Advantages
o Each connection can carry its own data load.
o It is robust.
o Fault is diagnosed easily.
o Provides security and privacy.
 Disadvantages:
o Installation and configuration is difficult.
o Cabling cost is more.
o Bulk wiring is required.

03/02/2020 19

 Many different types of topologies which is a mixture of two


or more topologies.

03/02/2020 20

10
03/02/2020

 A protocol defines the format and the order of messages


exchanged between two or more communicating entities, as
well as the actions taken on the transmission and/or receipt
of a message or other event

03/02/2020 21

 Physical Media
o Cable,

 Interconnecting Devices
o Router, switch, hub…

 Computers
o Server, client

 Networking Software
o Protocol, Network OS

 Applications
o Mail, web….

03/02/2020 22

11
03/02/2020

 Depending on the size and range of the computer network,


you can differentiate between different network
dimensions.
 The most important network types include:
o Personal Area Networks (PAN): modern devices are integrated into a
network
o Local Area Networks (LAN): more than 1 computer is to be connected
o Metropolitan Area Networks (MAN): connects several LAN
o Wide Area Networks (WAN): extend MAN across large geographic
areas, such as countries or continents
o Global Area Networks (GAN): Internet

03/02/2020 23

 History of computer network


 Computer network
 Network topology
 Network protocol
 Network Components
 Internet
 Packet-Switched Networks problems:
o Delay, Loss, and Throughput in
 Protocol Layers and Their Service Models
 OSI model
 TCP/IP model

03/02/2020 24

12
03/02/2020

 Introduction to Internet
 The Network Edge
 The Network core
o Switching Techniques: Circuit and Packet

03/02/2020 25

26

13
03/02/2020

1961–1972: Early packet-switching principles

 1961: Kleinrock – queueing  1972:


theory shows effectiveness o ARPAnet demonstrated
of packet-switching publicly
 1964: Baran – packet- o NCP (Network Control
switching in military nets Protocol) first host-host
 1967: ARPAnet conceived by protocol
Advanced Research Projects o First e-mail program
Agency o ARPAnet has 15 nodes
 1969: First ARPAnet node
operational

27

1972–1980: Internetworking, new and proprietary nets


 1970: ALOHAnet satellite Cerf and Kahn’s internetworking
network in Hawaii principles:
 1973: Metcalfe’s PhD thesis o Minimalism, autonomy - no
proposes Ethernet internal changes required to
 1974: Cerf and Kahn - interconnect networks
architecture for interconnecting o Best effort service model
networks
o Stateless routers
 late 70s: Proprietary
o Decentralized control
architectures: DECnet, SNA,
XNA Define today’s Internet
architecture
 late 70s: Switching fixed length
packets (ATM precursor)
 1979: ARPAnet has 200 nodes
28

14
03/02/2020

1980–1990: New protocols, a proliferation of networks

 1983: Deployment of TCP/IP  New national networks:


 1982: SMTP e-mail protocol Csnet, BITnet, NSFnet,
defined Minitel
 1983: DNS defined for  100,000 hosts connected
name-to-IP-address to confederation of
translation networks
 1985: FTP protocol defined
 1988: TCP congestion
control

29

1990s: Commercialization, the WWW


 Early 1990’s: ARPAnet Late 1990’s:
decommissioned
 1991: NSF lifts restrictions on  Est. 50 million computers
commercial use of NSFnet on Internet
(decommissioned, 1995)  Est. 100 million+ users
 Early 1990s: WWW
 Backbone links running
o hypertext [Bush 1945, Nelson
1960s]
at 1 Gbps
o HTML, http: Berners-Lee
o 1994: Mosaic, later Netscape
o Late 1990s:
commercialization of the
WWW 30

15
03/02/2020

 Scale
 How to manage such a large system,
 growing rapidly and uncontrollably,
 consisting of heterogeneous devices,
 managed by multiple entities
 having limited resources

 Let’s take things one at a time

31

03/02/2020 32

16
03/02/2020

03/02/2020 33

03/02/2020 34

17
03/02/2020

03/02/2020 35

36

18
03/02/2020

37

38

19
03/02/2020

Mobile network
PC
 Millions of connected devices:
o Hosts = end systems Global ISP
Server
o Running network apps

Wireless
laptop Home
Communication links
• network
Regional ISP
Smartphone
– Fiber, copper, radio,
satellite
– Transmission rate:
Wireless bandwidth
links
Wired
Enterprise
links network

• Packet switches: forward packets


(chunks of data)
Router
– Routers and switches
03/02/2020 39

 Devices connected to the Internet are often referred to as


end systems.
 End systems are also referred to as hosts because they
host (that is, run) application programs
 They are referred to as end systems because they sit at the
edge of the Internet,

03/02/2020 40

20
03/02/2020

 Network:
o Mobile
o Home
o Enterprise

03/02/2020 41

 The network that


physically connects an
end system to the first
(edge router) on a path
from the end system to
any other distant end
system

03/02/2020 42

21
03/02/2020

 Home Access: DSL, Cable, FTTH, Dial-Up, Satellite

DSL

FTTH

03/02/2020 43

 Access in the Enterprise (and the Home): Ethernet and WiFi


Ethernet

03/02/2020 44

22
03/02/2020

 Access in the Enterprise (and the Home): Ethernet and WiFi

03/02/2020 45

 the mesh of packet switches and links that interconnects the


Internet’s end systems

03/02/2020 46

23
03/02/2020

 Network Structure 1
o interconnects all of the access ISPs with a single global transit ISP - a
network of routers and communication links that not only spans the
globe, but also has at least one router near each of the hundreds of
thousands of access ISPs
 Network Structure 2,
o consists of the hundreds of thousands of access ISPs and multiple global
transit ISPs (the top tier and access ISPs at the bottom tier)
 Network Structure 3
o multi-tier hierarchy – Internet
o Add more points of presence (PoPs) - group of routers in the provider’s
network
 Network Structure 4
o ISPs, regional ISPs, tier-1 ISPs, PoPs, multi-homing, peering, and IXPs
 Network Structure 5
o Network Structure 4 by adding content provider networks

03/02/2020 47

03/02/2020 48

24
03/02/2020

 The switching technique will decide the best route for data
transmission.

03/02/2020 49

Circuit Switching Packet Switching

Message Switching

03/02/2020 50

25
03/02/2020

03/02/2020 51

 FDM: the frequency spectrum of a


link is divided up among the
connections established across the
link
 TDM: time is divided into frames of
fixed duration, and each frame
is divided into a fixed number of time
slots

 Ex, How long does it take to send a


file of 640,000 bits from host A to host
B over a circuit- switched network?
o All links are 1.536 Mbps 1 circuit: (1.536 Mbps)/24 = 64 kbps
o Each link uses TDM with 24 slots/sec so it takes:
o 500 msec to establish end-to-end circuit (640,000 bits)/(64 kbps) = 10 seconds
to transmit the file
add the circuit establishment time,
03/02/2020 52
=> 10.5 seconds to send the file

26
03/02/2020

 The message splits into packets that 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 numbe
 Sequence of A & B packets does not have fixed pattern,
bandwidth shared on demand => statistical multiplexing.
 TDM: each host gets same slot in revolving TDM frame

03/02/2020 53

 store and forward: entire packet must arrive at router before


it can be transmitted on next link
 takes L/R seconds to transmit (push out) packet of L bits on
to link at R bps
 Example:
o L = 7.5 Mbits
o R = 1.5 Mbps
o transmission delay = 15sec
 the general case of sending one packet from source to
destination over a path consisting of N links each of rate R
(N-1 router) between source and destination
𝐿
𝑑𝑒𝑛𝑑−𝑡𝑜−𝑒𝑛𝑑 = 𝑁
03/02/2020 𝑅 54

27
03/02/2020

03/02/2020 55

 History of computer network


 Computer network
 Network topology
 Network protocol
 Network Components
 Internet
 Packet-Switched Networks problems
o Delay, Loss, and Throughput in
 Protocol Layers and Their Service Models
 OSI model
 TCP/IP model

03/02/2020 56

28
03/02/2020

 Store and forward:


o entire packet must arrive at router before it can be transmitted on next
link
 Ideally,
o Internet services need to move as much data as we want between
any two end systems, without any loss of data.
o computer networks necessarily constrain throughput (the amount of
data per second that can be transferred) between end systems,
 Problems: Delay, Loss, and Throughput

03/02/2020 57

 Packets experience delay on end-to-end path


 Four sources of delay at each hop

1. Processing delay: 2. Queueing delay


– The time to examine the – Time waiting at output link for
packet’s header and determine transmission
where to direct the packet – Depends on congestion level of
router

58

29
03/02/2020

3. Transmission Delay: 4. Propagation Delay:


R = Link bandwidth (bps) d = Length of physical link
L = Packet length (bits) s = propagation speed in medium
Time to send bits into link: (~2×108 m/sec)
T = L/R propagation delay: dprop = d/s
Note: s and R are very different quantities Fiber: v= velocity of light =3x108m/s
=> s = v x 70%speed

Ex:
R=1kbps, L=1Kb
T=?
59
d=20km, dprop ?

 cars “propagate” at 100 km/hr  Time to “push” entire caravan


 toll booth takes 12 sec to through toll booth onto highway:
service car (transmission 12*10 = 120 sec = 2minutes
time)  Time for last car to propagate
 car~bit; caravan ~ packet from 1st to 2nd toll both:
 Q: How long until caravan 100km/(100km/hr)= 1 hr
is lined up before 2nd toll
 A:
booth?

03/02/2020 60

30
03/02/2020

 Cars now “propagate” at  Yes! After 7 min, 1st car at 2nd booth
and 3 cars still at 1st booth.
1000 km/hr
 Toll booth now takes 1 min to  1st bit of packet can arrive at 2nd
service a car router before packet is fully
transmitted at 1st router!
 Q: Will cars arrive to 2nd booth
before all cars serviced at 1st  See Ethernet applet at AWL
Web site
booth?
 the first bits in a packet can arrive at a router while many of the
remaining bits in the packet are still waiting to be transmitted by the
03/02/2020 61
preceding router

 dqueue is the time it takes for the packet


to be transmitted onto the link
 the length of this time is defined by the
number of packets that was added to
the queue prior to this packet

R = Link bandwidth (bps)


L = Packet length (bits)
a = Average packet arrival rate
Traffic intensity = La/R

 La/R ~ 0: Average queueing delay small


 La/R → 1: Delays become large
 La/R > 1: More “work” arriving than can be serviced, average delay
62
infinite!

31
03/02/2020

 dproc = processing delay: typically a few microsecs or less


o The time that Packet will be taken by receiver and then it will be
processed
 dqueue = queuing delay: depends on congestion
o dqueue is the time it takes for the packet to be transmitted onto the link
dproc and dqueue depend on the speed of processor
 dtrans = transmission delay: significant for low-speed links
 dprop = propagation delay: a few microsecs to hundreds of msecs

 Note: speed of processor is very high, dqueue and dproc are less
03/02/2020 63

traceroute (or tracert): Routers, round-trip delays on source-dest path


Also: pingplotter, various Windows programs

64

32
03/02/2020

 queue (aka buffer) preceding link in buffer has finite capacity


o a packet can arrive to find a full queue.
o With no place to store such a packet, a router will drop that packet;
that is, the packet will be lost
 lost packet may be retransmitted by previous node, by
source end system, or not at all

03/02/2020 65

 throughput: rate bits transferred between sender/receiver


o instantaneous: rate at given point in time
o average: rate over longer period of time

 What is average end-end throughput?


o Rs < Rc
o Rs > Rc

 link on end-end path that constrains end-end throughput


03/02/2020 66

33
03/02/2020

 10 connections (fairly) share


backbone bottleneck link R bits/sec
 per-connection end-end throughput:
min(Rc,Rs,R/10)

 in practice: Rc or Rs is often bottleneck


 Ex:
o Rs = 2 Mbps, Rc = 1 Mbps, R = 5 Mbps,
and the common link divides its transmission
rate equally among the 10 downloads
o the end-to-end throughput for each
download is now reduced to…?

03/02/2020 67

 Latency – The time taken for a packet to be transferred


across a network. You can measure this as one-way to its
destination or as a round trip.
 Throughput – The quantity of data being sent and received
within a unit of time

03/02/2020 68

34
03/02/2020

 The more routers a packet has to travel through the more


latency there is because each router has to process the
packet
 Throughput is a good way to measure the performance of
the network connection because it tells you how many
messages are arriving at their destination successfully
 Both network latency and throughput are important because
they have an effect on how well your network is performing.
 The bandwidth of your network is limited to the standard of
your internet connection and the capabilities of your network
devices
 Tools for Measuring Network Throughput, BW
o SolarWinds Flow Tool Bundle
o speedtest
03/02/2020 69

 How long does it take a packet of length 1,000 bytes to


propagate over a link of distance 2,500 km, propagation speed
2.5 x 108 m/s, and transmission rate 2 Mbps? More generally,
how long does it take a packet of length L to propagate over a link
of distance d, propagation speed s, and transmission rate R bps?
Does this delay depend on packet length? Does this delay
depend on transmission rate?
 Suppose Host A wants to send a large file to Host B. The path
from Host A to Host B has three links, of rates R1 = 500 kbps, R2
= 2 Mbps, and R3 = 1 Mbps.
o a. Assuming no other traffic in the network, what is the throughput for the
file transfer?
o b. Suppose the file is 4 million bytes. Dividing the file size by the
throughput, roughly how long will it take to transfer the file to Host B?
03/02/2020 c. Repeat (a) and (b), but now with R2 reduced to 100 kbps.
o 70

35
03/02/2020

 Layered Architecture
o Ex: Taking an airplane trip: actions

03/02/2020 71

03/02/2020 72

36
03/02/2020

■ Less complex: network models break the concepts into smaller parts.
■ Standard interfaces: allow multiple vendors to create products that fill a
particular role, with all the benefits of open competition.
■ Easier to learn: more easily discuss and learn about the many details of a
protocol specification.
■ Easier to develop: Reduced complexity allows easier program changes and
faster product development.
■ Multivendor interoperability: meet the same networking standards means
that computers and networking gear from multiple vendors can work in the
same network.
■ Modular engineering: implements higher layers, another vendor can write
software that implements the lower layers
03/02/2020 73

 History of computer network


 Computer network
 Network topology
 Network protocol
 Network Components
 Internet
 Packet-Switched Networks problems:
o Delay, Loss, and Throughput in
 Protocol Layers and Their Service Models
 OSI model
 TCP/IP model

03/02/2020 74

37
03/02/2020

 

03/02/2020 76

38
03/02/2020

 the OSI model can be used


as a standard of comparison
to other networking models
 OSI did have a well-defined
set of functions associated
with each of its seven layers,

03/02/2020 77

Layer Functional Description

Application. Provides an interface from the application to the network


7
by supplying a protocol with actions meaningful to the application
6 Presentation. negotiates data formats, such as ASCII text, JPEG.
Session. provides methods to group multiple bidirectional messages
5 into a workflow for easier management and easier backout of work that
happened if the entire workflow fails.
4 Transport. focuses on data delivery between the two endpoint hosts
3 Network. defines logical addressing, routing, and the routing protocols
Data link. defines the protocols for delivering data over a particular
2
single type of physical network
Physical. defines the physical characteristics of the transmission
1
03/02/2020 medium 78

39
03/02/2020

03/02/2020 79

03/02/2020 80

40
03/02/2020

03/02/2020 81

03/02/2020 82

41
03/02/2020

a. Physical Provides ------------- error-free packet delivery


b. Data Link ------------- Establishes responses between
applications
c Networking ------------- Deals with mechanical and electrical
communications
d. Transport ------------- Formats, encrypts, and compresses data
e. Session ------------- Determines routes and addressing
f. Presentation ------------- Provides user access to the
environment
g. Application ------------- Packages bits into data

03/02/2020 83

 History of computer network


 Computer network
 Network topology
 Network protocol
 Network Components
 Internet
 Packet-Switched Networks problems:
o Delay, Loss, and Throughput in
 Protocol Layers and Their Service Models
 OSI model
 TCP/IP model

03/02/2020 84

42
03/02/2020

 Introduction
 TCP/IP Encapsulation
 Internet protocol stack
 Application layer
 Transport layer
 Network layer
 Link layer

03/02/2020 85

03/02/2020 86

43
03/02/2020

 The TCP/IP stands for Transmission Control Protocol /


Internet Protocol suite
o was designed and implemented by Department of Defense(DoD) to
maintain communication.
o TCP first came on the scene way back in 1973, It was divided into two
distinct protocols TCP & IP.
o Later in 1983, TCP/IP replaced the Network Control Protocol (NCP).

03/02/2020 87

 Hosts, routers, and link-layer switches;


each contains a different set of layers,
reflecting their differences in
functionality

03/02/2020 88

44
03/02/2020

03/02/2020 89

 Introduction
 Application architectures
 Socket programming

03/02/2020 90

45
03/02/2020

 e-mail  voice over IP (e.g.,


 web Skype)
 text messaging  real-time video
 remote login conferencing
 P2P file sharing  social networking
 multi-user network  search
games  …
 streaming stored video  …
(YouTube, Hulu, Netflix)

Application Layer 2-91

 provide services to the application


software running on a computer.
 write programs that
o run on (different) end systems
o communicate over network
e.g., web server software
communicates with browser
software
 No need to write software for
network-core devices
o Network-core devices do
not run user applications
o applications on end systems
allows for rapid app development,
propagation

03/02/2020 92

46
03/02/2020

 Application architectures Client-


server
 Peer to peer

Hybrid of client-
server and P2P

03/02/2020 93

 Socket
o process sends/receives messages to/from its socket
o 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


by OS
link Internet link

physical physical

47
03/02/2020

 to receive messages,  identifier includes both IP


process must have address and port numbers
identifier associated with process
 host device has unique on host.
32-bit IP address  example port numbers:
 Q: does IP address of o HTTP server: 80

host on which process o mail server: 25

runs suffice for identifying  to send HTTP message to


the process? gaia.cs.umass.edu web
 A: no, many processes server:
can be running on o IP address: 128.119.245.12
same host o port number: 80
 more shortly… 2-95

 types of messages open protocols:


exchanged,
 defined in RFCs
o e.g., request, response
 message syntax:  allows for

o what fields in messages interoperability


& how fields are  e.g., HTTP, SMTP
delineated
proprietary protocols:
 message semantics
 e.g., Skype
o meaning of information
in fields
 rules for when and how
processes send & respond
to messages

2-96

48
03/02/2020

data integrity throughput


 some apps (e.g., file transfer,  some apps (e.g., multimedia)
web transactions) require require minimum amount of
100% reliable data transfer throughput to be “effective”
 other apps (“elastic apps”)
 other apps (e.g., audio) can
tolerate some loss make use of whatever
throughput they get
timing
 some apps (e.g., Internet
telephony, interactive
games) require low delay security
to be “effective”  encryption, data integrity, …

Application Layer 2-97

application data loss throughput time sensitive

file transfer no loss elastic no


e-mail no loss elastic no
Web documents no loss elastic no
real-time audio/video loss-tolerant audio: 5kbps-1Mbps yes, 100’s
video:10kbps-5Mbps msec
stored audio/video loss-tolerant same as above
interactive games loss-tolerant few kbps up yes, few secs
text messaging no loss elastic yes, 100’s
msec
yes and no

2-98

49
03/02/2020

TCP service: UDP service:


 reliable transport between  unreliable data transfer
sending and receiving process
 flow control: sender won’t between sending and
overwhelm receiver receiving process
 congestion control: throttle  does not provide: reliability,
sender when network
overloaded flow control, congestion
 does not provide: timing, control, timing, throughput
minimum throughput guarantee, security,
guarantee, security orconnection setup,
 connection-oriented: setup
required between client and
server processes Q: why bother? Why is there a
UDP?

Application Layer 2-99

application underlying
application layer protocol transport protocol

e-mail SMTP [RFC 2821] TCP


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

Application Layer 2-100

50
03/02/2020

 TCP/IP Encapsulation
 Internet protocol stack
 Application layer
 Transport layer
 Network layer
 Link layer

03/02/2020 101

 Introduction
 TCP and UDP
 TCP - reliable data transfer
 TCP Connection Management
 TCP flow Control
 TCP Congestion Control

03/02/2020 102

51
03/02/2020

 provide logical communication


between app processes running
on different hosts
 transport protocols run in
end systems
o send side: breaks app messages
into segments, passes to network
layer
o rcv side: reassembles segments into
messages, passes to app layer
 more than one transport protocol
available to apps
o Transmission Control Protocol - TCP
o User Datagram Protocol - UDP
03/02/2020 103

 a multiplexing/demultiplexing service is needed for all


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

03/02/2020 104

52
03/02/2020

 Two clients, using the same destination port number (80) to


communicate with the same Web server application

03/02/2020 105

32 bits
How demultiplexing works
source port # dest port #
 host receives IP datagrams
 each datagram has source IP
address, destination IP address other header fields
 each datagram carries one
transport-layer segment
 each segment has source, application
destination port number data
 host uses IP addresses & port (payload)
numbers to direct segment to
appropriate socket
TCP/UDP segment format

Transport Layer 3-106

53
03/02/2020

 TCP and UDP

03/02/2020 107

TCP UDP
 reliable transport between sending  unreliable data transfer between
and receiving process
 flow control: sender won’t sending and receiving process
overwhelm receiver  does not provide: reliability, flow
 congestion control: throttle sender control, congestion control, timing,
when network overloaded throughput guarantee, security,
 does not provide: timing, minimum
throughput guarantee, security orconnection setup,
 connection-oriented: setup required
between client and server processes Q: why bother? Why is there a UDP?

54
03/02/2020

 Header format TCP & UDP

03/02/2020 109

1. Source Port - is used to identify the source port of the packet.


2. Destination Port - is used identify application level service on destination machine.
3. Length - specifies the entire length of UDP packet (including header).
It is 16-bits field and minimum value is 8-byte, i.e. the size of UDP header itself
4. Checksum - stores the checksum value generated by the sender before sending.
IPv4 has this field as optional so when checksum field does not contain any value it is made 0
and all its bits are set to zero.

03/02/2020 110

55
03/02/2020

1. Source Port (16-bits) - of the application process on the sending device.


2. Destination Port (16-bits) - of the app process on the receiving device.
3. Sequence Number (32-bits) - data bytes of a segment in a session.
4. Acknowledgement Number (32-bits) - When ACK flag is set, this number contains the
next sequence number of the data byte expected and works as acknowledgement of the
previous data received.
03/02/2020 111

5. Data Offset (4-bits) - implies both, the size of TCP header (32-bit words) and the offset of
data in current packet in the whole TCP segment.
6. Reserved (3-bits) - for future use and all are set zero by default
7. Flags(1-bit each):
URG - Urgent Pointer field has significant data and should be processed.
ACK - If ACK is cleared to 0, it indicates that packet does not contain ack.
PSH - When set, it is a request to the receiving station to PUSH data (as soon as it
comes) to the receiving application without buffering it.
RST - It is used to restart a connection.
SYN - This flag is used to set up a connection between hosts.
FIN - release a connection and no more data is exchanged thereafter.
8. Windows Size - is used for flow control between two stations and indicates the amount of
buffer (in bytes) the receiver has allocated for a segment, i.e. how much data is the receiver
expecting.
9. Checksum - contains the checksum of Header, Data and Pseudo Headers.
10. Urgent Pointer - It points to the urgent data byte if URG flag is set to 1.
11. Options - It facilitates additional options which are not covered by the regular header.

03/02/2020 112

56
03/02/2020

No. TCP UDP

1. Connection Oriented Protocol Connection-less Protocol

2. Connection in byte stream Connection in message stream

It does’t support multicasting


3. It supports broadcasting
and broadcasting

It provides error control and Error Control and Flow control


4.
flow control is not provided

5. Supports full Duplex Does not support full Duplex

TCP packet is called as UDP packet is called as User


6.
Segment Datagram

03/02/2020 113

 implementing reliable data transfer at layer: link, transport, app

 the layer below the reliable data


transfer protocol may be unreliable

03/02/2020 114

57
03/02/2020

 underlying channel perfectly reliable


 No Bit Errors
 No Packets Loss
Sender Receiver

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)

 Rdt over a Perfectly Reliable Channel: rdt1.0.


 No need feedback, but bits in a packet may be corrupted.
 Rdt over a Channel with Bit Errors: rdt2.0: control mess “OK” or “NOT.”
 retransmission (ARQ (Automatic Repeat reQuest): detect error, feedback, retransmits
 Rdt over a Lossy Channel with Bit Errors: rdt3.0
 corrupting bits, the underlying channel can lose packets as well,
 checksumming, sequence numbers, ACK packets, and retransmissions

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

58
03/02/2020

sender receiver
sender receiver send pkt0 pkt0
send pkt0 pkt0
rcv pkt0
ack0 send ack0
rcv pkt0
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
timeout rcv pkt1
resend pkt1 pkt1 rcv ack1 (detect duplicate)
rcv pkt1 pkt0
send ack1
send pkt0
(detect duplicate) ack1
ack1 send ack1 rcv ack1 rcv pkt0
rcv ack1 send pkt0
ack0 send ack0
pkt0
send pkt0 pkt0
rcv pkt0
rcv pkt0 ack0 (detect duplicate)
ack0 send ack0 send ack0

(c) ACK loss (d) premature timeout/ delayed ACK

 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

59
03/02/2020

 Pipelined Reliable Data Transfer Protocols


o stop-and-wait protocol: delay, the poor performance
o => send multiple packets without waiting for acknowledgments

 Pipelined protocols:

Go-back-N: Selective Repeat:


 sender  sender
o can have up to N unACKed o can have up to N unACKed
packets in pipeline packets in pipeline
 receiver  receiver
o only sends cumulative ACK o sends individual ACK for each
packet
o doesn’t ACK packet if there’s a
gap  sender
 sender o maintains timer for each unACKed
o has timer for oldest unACKed packet
packet o when timer expires, retransmit only
o when timer expires, retransmit all that unACKed packet
unACKed packets

60
03/02/2020

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

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?

61
03/02/2020

 TCP Connection Establishing: agree on connection parameters

03/02/2020 123

 TCP Connection Termination

03/02/2020 124

62
03/02/2020

application
process
application may remove data
from TCP socket buffers …. application

TCP socket OS
receiver buffers
… slower than TCP
receiver is delivering
(sender is sending) TCP
code
TCP provides a flow-control service:
- receiver controls sender, so sender
won’t overflow receiver’s buffer by IP
transmitting too much, too fast. code
- the sender maintain a variable called
the receive window - how much
free buffer space is available at the from sender
receiver
receiver protocol stack

Receiver Sender
Sends rwnd to Sender Limits # of unACKed bytes to
rwnd

 Unused Buffer Space: spare room in the buffer

 TCP is not permitted to overflow the allocated buffer

03/02/2020 126

63
03/02/2020

 Congestion informally: “too many sources sending too much data


too fast for network to handle”
 different from flow control!
 manifestations:
o lost packets (buffer overflow at routers)
o long delays (queueing in router buffers)
 TCP Congestion Control
o why congestion occurs in the first place
o at the cost of congestion
• more work (retrans) for given “goodput”
• unneeded retransmissions: link carries multiple copies of pkt
• decreasing goodput

03/02/2020 127

original data: 𝜆in throughput: 𝜆out


 2 senders, 2 receivers
 1 router, infinite buffers
Host A
 output link capacity: R
unlimited shared
 no retransmission output link buffers

Host C
Host B

 maximum per-
connection throughput: R/2 Host D
R/2

 large delays as
delay

arrival rate, 𝜆in ,


approaches
capacity

𝜆in R/2 𝜆out R/2

64
03/02/2020

 one router, finite buffers


 sender retransmission of timed-out packet
o application-layer input = application-layer output: 𝜆in = 𝜆out
o transport-layer input includes retransmissions : 𝜆in ≥ 𝜆 in
lin : original data
lout
l'in: original data, plus
retransmitted data

Host A

finite shared output


Host B link buffers

R/2
idealization: perfect
knowledge
lout

 sender sends only when


router buffers available
lin R/2
lin : original data
lout
copy l'in: original data, plus
retransmitted data

A free buffer space!

finite shared output


Host B link buffers

65
03/02/2020

R/2
Idealization: known loss
packets can be lost,
dropped at router due to when sending at R/2, some
full buffers packets are retransmissions
but asymptotic goodput is
 sender only resends if

lout
still R/2 (why?)
packet known to be lost

lin R/2

lin : original data


l'in: original data, plus lou
retransmitted data t

A free buffer space!

Host B

R/2
Realistic: duplicates
 packets can be lost, dropped at router
due to full buffers when sending at R/2, some
 sender times out prematurely, sending packets are retransmissions
two copies, both of which are delivered including duplicated that are
lout

delivered!

R/2
lin lin
timeout lout
copy l'in

A
free buffer space!

Host B

66
03/02/2020

03/02/2020 133

 TCP/IP Encapsulation
 Internet protocol stack
 Application layer
 Transport layer
 Network layer
 Link layer

03/02/2020 134

67
03/02/2020

 Introduction
 Functions
 Internet protocol
 IP fragmentation and reassembly
 IP Address
 ICMP
 Tools: Traceroute, Ping, pingpath

03/02/2020 135

application
transport
network
data link
 transport segment from sending to physical
network network
receiving host data link data link
network
 on sending side encapsulates physical physical
data link
segments into datagrams physical network network
data link data link
 on receiving side, delivers physical physical
segments to transport layer
network network
 network layer protocols in every data link
data link
host, router physicalnetwork physical

 router examines header fields in all data link


physical
IP datagrams passing through it application
network transport
data link network network
network physical data link data link
data link physical physical
physical

68
03/02/2020

 Functions
o forwarding: move packets from
router’s input to appropriate router
output
o routing: determine route taken by
packets from source to destination:
routing algorithms
 Interplay between routing and
forwarding
o the routing algorithm determines
the values that are inserted into the
routers’ forwarding tables

03/02/2020 137

 virtual-circuit (VC) network: provide a connection service:


o ATM and frame relay
 datagram networks : provide a connectionless service:
o Internet
 VC: “source-to-dest path behaves much like telephone
circuit”
o call setup, teardown for each call before data can flow
o each packet carries VC identifier (not destination host address)
o every router on source-dest path maintains “state” for
o link, router resources (bandwidth, buffers) may be
allocated to VC (dedicated resources = predictable service)

03/02/2020 138

69
03/02/2020

 a VC consists of:
o path from source to destination
o VC numbers, one number for each link along path
o entries in forwarding tables in routers along path
 packet belonging to VC carries VC number (rather than dest
address)
 VC number can be changed on each link.
o New VC number comes from forwarding table

03/02/2020 139

 A simple VC
o Host A -> Host B
o Path: A-R1-R2-B
o VC nums: 12, 22, 32
 when a packet in this VC
o leaves Host A, the value in the VC
number field is 12;
o leaves R1, the value is 22;
o leaves R2, the value is 32 In Int Incoming Out int Outgoing
 the forwarding table in R1 might look VC VC
something 1 12 2 22
like this 2 63 1 18
3 7 2 17
1 97 3 87
03/02/2020 … … … … 140

70
03/02/2020

03/02/2020 141

 IP: Forwarding and Addressing in the Internet


transport layer: TCP, UDP

routing protocols IP protocol


• path selection • addressing conventions
• RIP, OSPF, BGP • datagram format
network • packet handling conventions

layer
forwarding
table ICMP protocol
• error reporting
• router “signaling”

link layer

physical layer
03/02/2020 142

71
03/02/2020

IP protocol version
32 bits total datagram
number
length (bytes)
header length head. type of
ver length
(bytes) len service
for
“type” of data fragment fragmentation/
16-bit identifier flgs
offset reassembly
max number time to upper header
remaining hops live layer checksum
(decremented at
each router) 32 bit source IP address

32 bit destination IP address


upper layer protocol
to deliver payload to options (if any) e.g. timestamp,
record route
how much overhead?
data taken, specify
 20 bytes of TCP (variable length, list of routers
typically a TCP to visit.
 20 bytes of IP
 = 40 bytes + app layer or UDP segment)
overhead
143

 For example,
o Ethernet frames can carry up to 1,500 bytes of data,
o some wide-area links can carry no more than 576 bytes.

 The maximum amount of


data that a link-layer
frame can carry:
maximum transmission unit
(MTU).

03/02/2020 144

72
03/02/2020

length ID fragflag offset


example: =4000 =x =0 =0
 4000 byte datagram
one large datagram becomes
 MTU = 1500 bytes several smaller datagrams

1480 bytes in length ID fragflag offset


data field =1500 =x =1 =0

offset = length ID fragflag offset


1480/8 =1500 =x =1 =185

length ID fragflag offset


=1040 =x =0 =370

 IP address: 32-bit identifier for


host, router interface
223.1.1.1
 interface: connection between 223.1.2.1
host/router and physical link 223.1.1.4 223.1.2.9
o router’s typically have multiple 223.1.1.2
interfaces
o host typically has one or two 223.1.3.27
interfaces (e.g., wired Ethernet, 223.1.1.3
wireless 802.11) 223.1.2.2

 IP addresses associated with


each interface

223.1.3.1 223.1.3.2

146

73
03/02/2020

 The IP (Internet Protocol) relies on several other protocols to


perform necessary control and routing functions:
• Control functions (ICMP)
• Multicast signaling (IGMP)
• Setting up routing tables (RIP, OSPF, BGP, PIM, …)

Routing
RIP OSPF BGP PIM

ICMP IGMP Control

 The ICMP is a helper protocol that supports IP with facility for


o Error reporting
o Simple queries
147

IP header ICMP message

IP payload
4 byte header:
• Type (1 byte): type of ICMP message
• Code (1 byte): subtype of ICMP message
• Checksum (2 bytes): similar to IP header checksum. Checksum is
calculated over entire ICMP message
If there is no additional data, there are 4 bytes set to zero.
 each ICMP messages is at least 8 bytes long
bit # 0 7 8 15 16 23 24 31

type code checksum

additional information
or
0x00000000
148

74
03/02/2020

 ICMP query:
• Request sent by host to a router or host
• Reply sent back to querying host Type/Code: Description
 Ex, ICMP queries: 8/0 Echo Request
0/0 Echo Reply
13/0 Timestamp Request
14/0 Timestamp Reply
 The ping command
10/0 Router Solicitation
uses Echo Request/
9/0 Router Advertisement
Echo Reply

149

 Ping’s are handled directly by the kernel


 Each Ping is translated into an ICMP Echo Request
 The Ping’ed host responds with an ICMP Echo Reply

ICMP ECHO REQUEST


Host Host
or or
Router ICMP ECHO REPLY router

150

75
03/02/2020

 A system (host or router) asks another Timestamp


system for the current time. Sender Request
 Time is measured in milliseconds after
midnight UTC (Universal Coordinated Receiver
Time) of the current day
 Sender sends a request, receiver Timestamp
responds with reply Reply

Type Code
Checksum
(= 17 or 18) (=0)
identifier sequence number

32-bit sender timestamp

32-bit receive timestamp

32-bit transmit timestamp


151

• report error conditions


• Typically sent when a datagram is discarded
• is often passed from ICMP to the application program
• include the complete IP header (the first 8 bytes of the payload UDP, TCP)

152

76
03/02/2020

Type Code Description

3 0–15 Destination Notification that an IP datagram could not be


unreachable forwarded and was dropped. The code field
contains an explanation.
5 0–3 Redirect Informs about an alternative route for the
datagram and should result in a routing table
update. The code field explains the reason for
the route change.
11 0, 1 Time Sent when the TTL field has reached zero (Code
exceeded 0) or when there is a timeout for the reassembly
of segments (Code 1)
12 0, 1 Parameter Sent when the IP header is invalid (Code 0) or
problem when an IP header option is missing (Code 1)

153

Code Description Reason for Sending


0 Network No routing table entry is available for the destination
Unreachable network.
1 Host Destination host should be directly reachable, but
Unreachable does not respond to ARP Requests.
2 Protocol The protocol in the protocol field of the IP header is
Unreachable not supported at the destination.
3 Port The transport protocol at the destination host cannot
Unreachable pass the datagram to an application.
4 Fragmentation IP datagram must be fragmented, but the DF bit in the
Needed IP header is set.
and DF Bit Set

154

77
03/02/2020

 RFC 792: If, in the destination host, the IP module cannot deliver the datagram
because the indicated protocol module or process port is not active, the destination
host may send a destination unreachable message to the source host.
 Ex1: Port Unreachable No process
Request a service port 80 is waiting
at port 80
Client Server
Port Unreachable

 Ex2: net Unreachable

155

 Ping: Packet InterNet Groper (by Mike Muuss of the Army Research
Laboratory in 12,1983)
o check if a particular IP address is accessible or not.
o checking if the computers on a local network are activeIt also
measures round trip time and reports errors
o Operate based on ICMP
Ping <host> [-t/-n/-l] -> time, count, size

03/02/2020 156

78
03/02/2020

 Tracert/Traceroute: (windows/Linux)
o traces a packet from your computer to the host,
o show the number of steps (hops) required to reach there and time
o works by:
• sending the packets of data with low survival time TTL - specifies how
many steps (hops) can the packet survive before it is returned.
• When a packet can’t reach the final destination and expires at an
intermediate step, that node returns the packet and identifies itself.
• So, by increasing the TTL gradually,
o identify the intermediate hosts.
• If any of the hops come back with “Request timed out”, it denotes network
congestion and a reason for slow loading Web pages and dropped
connections.

03/02/2020 157

TTL=1 TTL=2 TTL=3

ICMP “time exceeded

 Send packets with


increasing TTL values (+1)
o Nodes along IP layer path
decrement TTL
o When TTL=0, nodes return
“time exceeded” message and
hop’s IP is return.
o When TTL<>0, TTL decrease
and go next hop

158

79
03/02/2020

 TCP/IP Encapsulation
 Internet protocol stack
 Application layer
 Transport layer
 Network layer
 Link layer

03/02/2020 160

80
03/02/2020

 Introduction
 services
 Error detection and correction
 Transmission Modes
o Simplex,
o Half-Duplex and
o Full-Duplex
 LAN addresses and ARP
 PPP

03/02/2020 161

Some terminology:
 hosts and routers are nodes (bridges and switches too)
 communication channels that connect adjacent nodes along
communication path are links
o wired links
o wireless links
o LANs
 PDU is a frame,
encapsulates a
network-layer datagram

 Link-layer protocol has the


responsibility of transferring
datagram from one node  different links:
 to adjacent node over a link e.g., Ethernet on first link, frame relay on
03/02/2020 intermediate links, 802.11 on last link 162

81
03/02/2020

 Framing:
o encapsulate datagram into frame, adding header, trailer
o ‘physical addresses’ used in frame headers to identify source,
destination
• different from IP address!
 Link access
o Media access control (MAC) protocol
o Coordinate the frame transmissions of many nodes if multiple
nodes share a medium
 Reliable delivery between adjacent nodes
o we learned how to do this already (chapter 3)!
o seldom used on low bit error link (fiber, some twisted pair)
o Used on wireless links: high error rates
• Correct an error locally at link level
5a-
163

 Flow Control:
o pacing between adjacent sending and receiving nodes
 Error Detection:
o errors caused by signal attenuation, noise.
o receiver detects presence of errors:
• signals sender for retransmission or drops frame
 Error Correction:
o receiver identifies and corrects bit error(s) without resorting to
retransmission
 Half-duplex and full-duplex
o with half duplex, nodes at both ends of link can transmit, but not at
same time

5a-
164

82
03/02/2020

 the link layer is implemented in a network adapter


o its relationship to other host components and to protocol stack
functionality
 most of the link layer is
implemented in hardware
 part of the link layer is
implemented in software

 sending side:
o encapsulates datagram in a frame
o adds error checking bits, rdt, flow
control, etc.
 receiving side
o looks for errors, rdt, flow control,
o extracts datagram, passes to
receiving node

03/02/2020 165

 EDC= Error Detection and Correction bits (redundancy)


 D = Data protected by error checking, may include header fields

 Error detection not 100% reliable!


• protocol may miss some errors,
but rarely

• larger EDC field yields better


detection and correction

03/02/2020 166

83
03/02/2020

 Techniques for Error Detection


o Parity checks
o Checksumming methods
o Cyclic redundancy checks

03/02/2020 167

Single Bit Parity: Detect single bit errors

 Even parity scheme: choose the value of the parity bit


such that the total number of 1s in the d+1 bits is even

 Odd parity scheme: choose the value of the parity bit


such that the total number of 1s in the d+1 bits is odd

168

84
03/02/2020

Two Dimensional Bit Parity: Detect and correct


single bit errors

(Even parity scheme)

0 0

5a-

Goal: detect “errors” (e.g., flipped bits) in transmitted segment


(note: used at transport layer only)
Internet checksum:
Sender: Receiver:
 treat segment contents as  compute checksum of received
sequence of 16-bit integers segment
 check if computed checksum
 checksum: addition (1’s
equals checksum field value:
complement sum) of segment
o NO - error detected
contents
o YES - no error detected. But
 sender puts checksum value maybe errors nonetheless?
into segment header More later ….
Checksum is easy and fast to compute
Typically used in software implemented protocols
(e.g. ,TCP and UDP ) 170

85
03/02/2020

 view data bits, D, as a binary number


 choose r+1 bit pattern (generator), G (both sender and
receiver know G)
 sender chooses r CRC bits, R, such that
o <D,R> exactly divisible by G (modulo 2)
 receiver knows G, divides <D,R> by G.
o If non-zero remainder: error detected!
o can detect all burst errors less than r+1 bits
 widely used in practice (ATM, HDLC)

Left shifts r bits 171

Want to find R such that:


D.2r XOR R = nG
XOR R to the right of both
sides :
0
D.2r = nG XOR R 0
equivalently:
if we divide D.2r by G, the 0
remainder is R 0

D.2r
R = remainder[ ]
G
5a-
172

86
03/02/2020

 Transferring of data between


two devices
Simplex

Full-Duplex

Half-Duplex

03/02/2020 173

Simplex Half Duplex Full Duplex


Two-directional, one at Two-directional,
Unidirectional
a time simultaneously
Sender can send and Sender can send and
Sender can only send
receive data, but one a receive data
data
time simultaneously
Worst performing mode Best performing mode
Better than Simplex
of transmission of transmission
Keyboard and monitor Walkie-talkie Telephone

03/02/2020 174

87
03/02/2020

 Introduction
 services
 Error detection and correction
 Transmission Modes
o Simplex,
o Half-Duplex and
o Full-Duplex
 LAN addresses
 ARP
 PPP

03/02/2020 175

32-bit IP address:
 network-layer address
 used to get datagram to destination IP network (recall IP
network definition)
LAN (or MAC or physical or Ethernet) address:
 used to get datagram from one interface to another
physically-connected interface (same network)
 48 bit MAC address (for most LANs) burned in the
adapter ROM

5: DataLink Layer 5a-


176

88
03/02/2020

 Each adapter on LAN has unique LAN address


 Six bytes
 Expressed in hexadecimal notation Broadcast address:
FF-FF-FF-FF-FF-FF
1A-2F-BB-76-09-AD

= adapter
LAN
(wired or
wireless)

71-65-F7-2B-08-53
58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98
5a-
177

 MAC address allocation administered by IEEE


 manufacturer buys portion of MAC address space (to assure
uniqueness)
 Analogy:
(a) MAC address: like Social Security Number
(b) IP address: like postal address
 MAC flat address => portability
o MAC address of an adapter card does not change when it is moved
from one LAN to another
 IP hierarchical address NOT portable
o depends on IP network to which node is attached

5: DataLink Layer 5a-


178

89
03/02/2020

Starting at A, given IP datagram addressed to B:


 look up network address of B, find B on same network as A
 link layer send datagram to B inside link-layer frame

A 223.1.1.1

223.1.2.1
223.1.1.2
223.1.1.4 223.1.2.9
B
223.1.2.2
223.1.1.3 223.1.3.27 E

223.1.3.1 223.1.3.2

5a-179

frame dest frame source datagram source,


address address dest address

B’s MAC A’s MAC A’s IP B’s IP


IP payload
addr addr addr addr

datagram
frame

03/02/2020 180

90
03/02/2020

 ARP: a communication protocol used for discovering the link


layer address, such as a MAC address,
 It associated with a given internet layer address, typically an IPv4
address. This mapping is a critical function in the Internet protocol suite.
 ARP was defined in 1982 by RFC 826
237.196.7.78

1A-2F-BB-76-09-AD

237.196.7.23
237.196.7.14

LAN
71-65-F7-2B-08-53
58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98
237.196.7.88 5a-
181

91
03/02/2020

92
03/02/2020

Ethernet II, Src: 00:30:65:2c:09:a6, Dst: ff:ff:ff:ff:ff:ff


Destination: ff:ff:ff:ff:ff:ff (Broadcast)
Source: 00:30:65:2c:09:a6 (AppleCom_2c:09:a6)
Type: ARP (0x0806)
Address Resolution Protocol (request)
Hardware type: Ethernet (0x0001)
Protocol type: IP (0x0800)
Hardware size: 6
Protocol size: 4
Opcode: request (0x0001)
Sender MAC address: 00:30:65:2c:09:a6 (AppleCom_2c:09:a6)
Sender IP address: 172.16.1.21 (172.16.1.21)
Target MAC address: 00:00:00:00:00:00 (00:00:00_00:00:00) Target
IP address: 172.16.1.33 (172.16.1.33)

Ethernet II, Src: 00:10:5a:e5:0e:e3, Dst: 00:30:65:2c:09:a6


Destination: 00:30:65:2c:09:a6 (AppleCom_2c:09:a6)
Source: 00:10:5a:e5:0e:e3 (3com_e5:0e:e3)
Type: ARP (0x0806)
Trailer: 15151515151515151515151515151515...
Address Resolution Protocol (reply)
Hardware type: Ethernet (0x0001)
Protocol type: IP (0x0800)
Hardware size: 6
Protocol size: 4
Opcode: reply (0x0002)
Sender MAC address: 00:10:5a:e5:0e:e3 (3com_e5:0e:e3)
Sender IP address: 172.16.1.33 (172.16.1.33)
Target MAC address: 00:30:65:2c:09:a6 (AppleCom_2c:09:a6)
Target IP address: 172.16.1.21 (172.16.1.21)

93
03/02/2020

 How ARP resolves media access control addresses for local


traffic

 How ARP resolves media access control addresses for


remote traffic

94
03/02/2020

 RARP – Reserve Address Resolution Protocol


o an obsolete computer networking protocol used by a client computer
to request its Internet Protocol (IPv4) address from a computer
network, when all it has available is its link layer or hardware address,
such as a MAC address

95
03/02/2020

 A wants to send datagram to B,  A caches (saves) IP-to-MAC


and B’s MAC address not in A’s address pair in its ARP table until
ARP table. information becomes old (times
 A broadcasts ARP query out)
packet, containing B's IP o soft state: information that
address times out (goes away) unless
o Dest MAC address = FF-FF- refreshed
FF-FF-FF-FF
 ARP is “plug-and-play”:
o all machines on LAN receive
ARP query o nodes create their ARP tables
without intervention from net
 B receives ARP packet, replies
administrator
to A with its (B's) MAC address
o frame sent to A’s MAC address
(unicast)

5a-191

walkthrough: send datagram from A to B via R


assume A know’s B IP address

R
B
 Two ARP tables in router R, one for each IP network (LAN)
 In routing table at source Host, find router 111.111.111.110
 In ARP table at source, find MAC address E6-E9-00-17-BB-4B, etc
5a-
192

96
03/02/2020

R
B
 A creates datagram with source A, destination B
 A uses ARP to get R’s MAC address for 111.111.111.110
 A creates link-layer frame with R's MAC address as destination, frame
contains A-to-B IP datagram
 A’s data link layer sends frame
 R’s data link layer receives frame
 R removes IP datagram from Ethernet frame, sees its destined to B
 R uses ARP to get B’s physical layer address, and creates frame containing A- 193
to-B IP datagram sends to B

 Introduction
 services
 Error detection and correction
 Transmission Modes
o Simplex,
o Half-Duplex and
o Full-Duplex
 LAN addresses
 ARP
 PPP

03/02/2020 194

97
03/02/2020

 one sender, one receiver, one link: easier than


broadcast link:
o no Media Access Control
o no need for explicit MAC addressing
o e.g., dialup link, ISDN line
 popular point-to-point Data Link Control (DLC)
protocols:
o PPP (point-to-point protocol)
o HDLC: High level data link control (Data link used to be
considered “high layer” in protocol stack!)

5: DataLink Layer 5a-


195

 packet framing: encapsulation of network-layer datagram in


data link frame
o carry network layer data of any network layer protocol (not just IP) at
same time
o ability to demultiplex upwards
 bit transparency: must carry any bit pattern in the data field
 error detection (no correction)
 connection liveness: detect a link failure, signal link failure
to network layer
 network layer address negotiation: endpoint can
learn/configure each other’s network address

5: DataLink Layer 5a-


196

98
03/02/2020

 no error correction/recovery
 no flow control
 out of order delivery OK
 no need to support multipoint links (e.g., polling)

Error recovery, flow control, data re-ordering


all relegated to higher layers!

5: DataLink Layer 5a-


197

 Flag: delimiter (framing)


 Address: does nothing (only one option)
 Control: does nothing; in the future possible multiple control
fields
 Protocol: upper layer protocol to which frame delivered (eg,
PPP-LCP, IP, IPCP, etc)

5: DataLink Layer 5a-


198

99
03/02/2020

 info: upper layer data being carried, default maximum length


= 1500 bytes
 check: cyclic redundancy check for error detection

5: DataLink Layer 5a-


199

 “data transparency” requirement: data field must be


allowed to include flag pattern <01111110>
o Q: is received <01111110> data or flag?

 Sender:
o adds (“stuffs”) extra < 01111101> byte before each < 01111110> data
byte
o adds (“stuffs”) extra < 01111101> byte before each < 01111101> data
byte
 Receiver:
o single 01111101 byte: discard 01111101
o two 01111101 bytes in a row: discard first byte, continue data
reception
o single 01111110: flag byte

5: DataLink Layer 5a-


200

100
03/02/2020

flag byte
pattern
in data
to send

flag byte pattern plus


stuffed byte in transmitted
data

5: DataLink Layer 5a-


201

 Begins and ends in the dead


state
 Enters link establishment
state when the physical layer
is present and ready to be
used
 In the link establishment state,
PPP link-control protocol
(LCP) is used to negotiate link
configuration options such as
maximum frame size,
authentication protocol (if any)
to be used, etc.
5a-
202

101
03/02/2020

 Then, the end points enter the


network layer configuration state to
learn/configure network layer
information using a network-control
protocol
 The network-control protocol to be
used depends on the specific
network layer protocol
o for IP: IP Control Protocol (IPCP)
(protocol field: 8021) is used to
configure/learn IP address
 Once the network layer has been
configured, PPP enters the open
state and may begin sending
network layer datagrams
03/02/2020 203

 The LCP echo-request frame and echo


reply frame can be exchanged between
Two PPP endpoints in order to check
the status of the link
 To terminate the link, one end of the
PPP link sends a terminate-request LCP
frame and the other end replies with a
terminate-ack LCP frame
 The link enter the dead state

03/02/2020 204

102
03/02/2020

 History of computer network


 Computer network
 Network topology
 Network protocol
 Network Components
 Internet
 Packet-Switched Networks problems:
o Delay, Loss, and Throughput in
 Protocol Layers and Their Service Models
 OSI model
 TCP/IP model

03/02/2020 205

103

You might also like