0% found this document useful (0 votes)
15 views178 pages

Chapter 1 - Concept of Computer Networks (6 Files Merged)

The document outlines the course objectives related to understanding Internet technology, networking mechanisms, and TCP/IP protocols. It includes a historical overview of the Internet, key concepts of computer networks, and the evolution of Internet infrastructure in Vietnam. Additionally, it covers network architecture, protocols, and assessment criteria for the course.

Uploaded by

cretech.site
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)
15 views178 pages

Chapter 1 - Concept of Computer Networks (6 Files Merged)

The document outlines the course objectives related to understanding Internet technology, networking mechanisms, and TCP/IP protocols. It includes a historical overview of the Internet, key concepts of computer networks, and the evolution of Internet infrastructure in Vietnam. Additionally, it covers network architecture, protocols, and assessment criteria for the course.

Uploaded by

cretech.site
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/ 178

Course objectives

• Understand the Internet technology


• Some networking mechanisms
• Some protocols of TCP/IP

Chapter 1: Concept of • Explain how the Internet works

Computer networks • Be able to use the Internet efficiently, install


new technologies and services
History of Internet
Concept of computer networks
Network architecture
Packet switching vs. circuit switching

Reading: Chapter 1, Computer Networks, Tanenbaum

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

1 3

1 3

About me Topics
• Dr. Tran Nguyen Ngoc
• Introduction to computer networks
• Computer Engineering Department, SoICT, HUST
• Basic concepts of computer communication
• Email: model (OSI)
[email protected] • Details of each layer
[email protected] • Physical Layer
• Office: • Data-link Layer
• 405 - B1 (working office) • Internet/ Network Layer
• Routing problem
• Transport Layer
• Application Layer

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

2 4

1 2
Assessment In 12/1969, after 3 months

• Progress (50%)
• Practical labs (60%)
• Mid-term examination (40%)
• Attendance (HUST regulation) SRI UTAH

• No absence: +1 point
UCSB
• Missing 3 or more: -1 point UCLA

• Exercises: Students can earn extra points by solving


exercises provided by the lecturer
• Final examination (50%)
A network with 4 nodes, 56kbps

UCSB:University of California, Santa Barbara


UTAH:University of Utah
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology
source: http://www.cybergeography.org/atlas/historical.html
5 7

5 7

History of the Internet ARPANET, 1971

 Originated from an
experiemental project of ARPA
 Intially having only two nodes
(IMP atUCLA and IMP at SRI).

ARPA: Advanced Research Project Agency


UCLA: University California Los Angeles
SRI: Stanford Research Institute
IMP: Interface Message Processor, that \
each computer must be attached with

Source:
http://www.cybergeography.org/
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
atlas/historical.html One node was added each month
Source: http://www.cybergeography.org/atlas/historical.html
School of Information and Communication Technology School of Information and Communication Technology

6 8

6 8

3 4
Years 70s

• Since 1970, new networks private


architectures appear:
Years 70s: Interconnection, • ALOHAnet in Hawaii
• DECnet, IBM SNA, XNA
new network architectures • 1974: Cerf & Kahn – principles of
and private architectures interconnection of open systems (Turing
Awards)
• 1976: Ethernet, Xerox PARC
• End of 1970s: ATM

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

9 11

9 11

Expansion of ARPANET, 1974

Years 80s: New protocols, more


expansion

source:
Traffic each day not more than 3.000.000 package
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
http://www.cybergeography.org/
School of Information and Communication Technology

atlas/historical.html 10 12

10 12

5 6
1981: Beginning of NSFNET More network to join and more protocol

• More networks join in: MFENET, HEPNET


NSF: National Science Foundation (Dept. Energy), SPAN (NASA), BITnet, CSnet,
NSF network is separated from ARPANET for academic research
uniquely
NSFnet, Minitel …
• TCP/IP is standardized and becomes popular in
1980
• Berkeley integrate TCP/IP in BSD Unix
• Services: FTP, Mail, DNS …

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

13 15

13 15

1986: Connect USENET and NSFNET

Years 90s: Web and E-commerce


over Internet

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

Source: http://www.cybergeography.org/atlas/historical.html 14 16

14 16

7 8
Years 90s Development of the Internet in Vietnam

Begining of 90s:
Begining of Web End of 1990’s – 2000’s:
HTML, HTTP:
• Many new Internet
Berners-Lee applications was introduced:
1994: Mosaic, • Chat, file sharing P2P…
Netscape • E-commerce, Yahoo, Ebay,
Amazon, Google…
End of 90s: • > 50 millions hosts, > 100
Commercialized the millions users.
Internet

The numbers of users are estimated by 2 times the number of subscribers


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology Source: Vietnam Internet
School of Information Case
and Communication Study, http://www.itu.int/asean2001/reports/material/VNM%20CS.pdf
Technology

17 19

17 19

Internet in Việt Nam Statistics until 2007

•1996: Preparation for the Internet infrastructure


• ISP: VNPT
• 64kbps, 01 connection to the world, few end users.
•1997: Việt Nam connects to the Internet officially
• 1 IXP (Internet Exchange Point): VNPT
• 4 ISP (Internet Service Provider) : VNPT, Netnam (IOT), FPT,
SPT
•2007: After 10 years
• 20 ISPs, 4 IXPs: VNPT, FPT, Viettel, EVN Telecom
• 19 mil. users, 22.04% population

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

18 Source: Vnnic, http://www.thongkeinternet.vn 20

18 20

9 10
Bandwidth to the world (Mbps), 3rd Quarter Some fixed internet subscription technologies
2007
• Dial-up:
• 56kbps,
• use public telephone lines,
• Data are transmitted over the same frequency with voice,
• Old technology, popular before 2000
• ADSL, xDSL:
FPT, 2635
• few Mbps,
EVN, 400 • use public telephone lines,
SPT, 200 • Data are transmitted over the different frequency with voice,
HanoiTelecom,
4
• popular between 2000-2010
Vietel, 2056
VNPT, 6820
• Internet over TV cable
• Use TV cable to carry data
• FTTH
• several dozen Mbps,
• Use optical fiber
• Popular nowadays.
Total: 12115.0 Mbps

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

21 23

21 23

Fixed internet subscription, 2019 Data usage on mobile phones 2019

Statistics are provided by Department of Telecommunication, Ministry of


Information and Communication. Statistics are provided by Department of Telecommunication, Ministry of
http://vnta.gov.vn/thongke/Trang/dulieuthongke.aspx Information and Communication.
http://vnta.gov.vn/thongke/Trang/dulieuthongke.aspx
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

22 24

22 24

11 12
International Internet data volume 2019 Internet management in Việt Nam

• VNNIC
• Is responsible for managing the Internet domain
name, address in Việt Nam;
• Provides guidelines, statistics about Internet and
participates in international activity about Internet.
• VNIX: Vietnam National Internet eXchange
• switching system between national ISP.

Statistics are provided by Department of Telecommunication, Ministry of


Information and Communication.
http://vnta.gov.vn/thongke/Trang/dulieuthongke.aspx
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

25 27

25 27

Domestic Internet data volume

Statistics are provided by Department of Telecommunication, Ministry of


Information and Communication.
http://vnta.gov.vn/thongke/Trang/dulieuthongke.aspx
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

26 28

26 28

13 14
International connections International connections

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

29 31

29 31

International connections Optical fiber under the ocean

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

30 Source: https://www.submarinecablemap.com 32

30 32

15 16
Optical fiber under the ocean Concepts
A set of computers/nodes
connecting to each other according
to an architecture in order to
exchange data
 Computer/node: workstation,
server, router, mobile phone .etc
with information processing
capacity
 They connect to each other by a
media (wired or wireless)
 Arcording to an archirecture
Different kind of computers

Source: https://www.submarinecablemap.com
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

33 35

33 35

Example of networks

• Computer networks
• The Internet
• Ethernet
Concepts of computer •

Wireless LANs: 802:11

networks • Banking system (ATM networks)
• Traffic light networks
• Train networks (our new train systems in Hanoi
and HCM city)
• Power, gas networks (in developed countries)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

34 36

34 36

17 18
Centralized or distributed What is a protocol?

Hi request
PSTN Internet non response

What time is it now? request

ok response
• Centralized: Network  Computer has stronger
does everything power Thời gian
 Most functions are
Protocol between human being: Protocol between
implemented at host vocabulary, procedure
machines
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

37 39

37 39

Network architecture Network protocol


• A protocol defines communication rules between nodes
• Network architecture contain 2 aspects:
• Protocol defines:
• topology: the form that network nodes connects to each
other • Format of messages/ information to be exchanged between
nodes.
• Protocol: language and procedure of communication
• Order of messages sending between entities/nodes
between nodes.
• Action should be performed when an entity receives a message.
• Topology • Example of protocols running on the Internet: TCP, UDP, IP,
• Bus, Ring, Star… HTTP, Telnet, SSH, Ethernet, …

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

38 40

38 40

19 20
Communication media Computer network classification

• Physical medium that can carry signal • MAN – Metropolitian Area Network
• Classification: • Scope: hundreds of km
• Wired media: twisted pair, coaxial cable, optical fiber,… • #users: Millions
• Wireless media: radio wave, microwave, infrared wave,…
• To serve a metro, area
• Some characteristics:
• Bandwidth (băng thông): width of the frequency band could be • WAN – Wide Area Network
used for carrying signal • Scope: thousands of km
• fmin: minimum frequency, fmax: maximum frequency • #users: billions
• Bandwidth = fmax - fmin
• BER – Bit Error Rate= nb of error bits/nb of transmitted bits) • GAN – Global Area Network: over the world
• Attenuation (suy hao): signal power decrement level (ex: Internet)
gradual loss of signal strength - travels over a transmission medium
-> impacts quality and reliability

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

41 43

41 43

Computer network classification LAN

• PAN – Personal Area Network • LAN (Local Area Networks):


• Scope: a building, an office, an organization
• Scope: several metres
• Wireless LAN
• #users: few
• VD: WIFI
• To serve an individual
• Wired LAN
• LAN – Local Area Network): • VD: Ethernet
• Scope: few km
• #users: few to hundreds of thousands
• To serve a household, an organization

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

42 44

42 44

21 22
MAN GAN

• Metropolitan Area • Global Area Networks


Networks • Interconnect different networks
• Cover a city
• Ex: • Cover many continentals.
• Television network
• Backbone networks of
ISP.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

45 47

45 47

WAN Internet

• Wide Area Networks • Contain more than 5 billions


mobile network

• Cover a large scope such as devices


global ISP
a country • 3.2 billion users (40%)
• Ex: network connecting • Medium: optical fiber, twisted
different branches of a pair, Wimax, 3G… home
company network
• Transport ~3x109 GB data per regional ISP
• Technology characteristics: day
• Using long distant lines to • Services: Web, email, social
connect different parts of the networks, …
network
• Ex: Using public telephone
network
• Ex: using optical cable.
institutional
network

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

46 48

46 48

23 24
Internet Internet: Network of networks(2)
• Network of networks • Connect each access network to a relay stations of a global ISP
access access
network access network access access
net net
network access
net
access
access net
net
access
access net
net

Internet global
access
network
access
net
ISP access
net

How to interconnects millions access


net
access
of network systems? access
net

access
network net
access
net
access access
net access net
net

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

49 51

49 51

Internet: network of networks Internet: Network of networks(3)

• Directly connect one network with all others? • Add more ISP...

access
Internet relay station
access access
access net net
net net access
access net
net access
access net
net access
access net
net
access access
IXP access
net
access net
net
net
ISP A
Not scalable:
access
net
Number of access
net
access
net
IXP
ISP B
access
net

access
connections O(n2) access
ISP C
net
net access
access net
Peer-to-peer
net
access
access net
net access
access net
net access access
access access net access net
net access net net
net

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

50 52

50 52

25 26
Internet: Network of networks(4) Problem
• Add regional networks... • Point-point connection between two hosts

access
access
net
access
net A B
net
access
access net
net

access
IXP access
net
net
ISP A
• Connection parameters:
IXP • Bandwith - R: maximum amount of data transmitted within a time
access
access
net ISP B net unit (bps – bit per second).
• Example: optical cable has the bandwidth of 100Mbps.
ISP C
access
net • Latency: transmission delay from A to B
access
net • Propagation delay: Connection length / speed of signal
access
net regional net • Example: optical cable has the length of 10 km, speed of light
access
net
(3 x 108m/s)  10 x 103/(3 x 108) ~ 3.333 x 10-5 = 0.03333 ms
access access
net access net • Transmission delay: data size / bandwidth
net

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

53 55

53 55

Point-point connection
Time for signal to reach
• Transfer 100B from A to B the destination: 1ms
A B
1Mbps, AB = 200km

Transmission models
time=0
Time to transfer
Timing of the first bit
1 bit = 1/106s
reaching B
Transmission time 100Byte packet
= 1/106+1/103s
800 bits=800x1/106s
Packet switching vs. Circuit switching
Connection oriented vs. Connectionless Timing of the last bit
Time Reaching B
(800x1/106)+1/103s
= 1.8ms

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

54 56

54 56

27 28
Exercise Connecting hosts
Bus model

• Point-to-multipoint:
• Single communication medium is used for all hosts 
• Each packet with the size of 1000 bytes need to broadcast communication
transfer through optical cable with the bandwidth • Weakness: long physical link, few hosts can
of 100 Mbps. Cable length is 100km. Calculate communicate simultaneously
• A) Time for the source to send a packet
• B) Time for one bit to reach the destination (assume A
that the propagation speed is 200000 km/s)
• C) Number of packages can be appeared on the
transmission medium
• D) The practical speed, if each sent bit need to be
X
replied by an ACK bit by the destination

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

57 61

57 61

Connecting hosts Connections between hosts


Direct links model

• Using direct links between all pairs of hosts • Solution: switching network
• A link: a segment of medium without any processing unit in the middle • Each host connects to be switching devices
• Weakness: too many links, distance limitation.
• Switching devices connect point-to-point and forward data to
the destination
• Share resources
Question: How to
G D determine the routes?
A Answer: Routing
3
1
C 5 B
2

E F
4

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

60 62

60 62

29 30
Circuit switching End-to-end data transmission time in circuit switching

• Circuit switching network: allocate resources for logical A Sw1 Sw2 B


private channels between 2 network points

10Mb/s?
A 10Mb/s?
3 10Mb/s? Setup
1
10Mb/s? circuit
5 B
2 Transmit
data Information
(1) A requires to establish a channel
4 (2) Switching devices establish the channel time
(3) A starts data transmission
(4) A finish its transmission: send a signal to Teardown
terminate the channel circuit
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

63 65

63 65

Example of circuit switching : Public Switched Telephone


Circuit switching Network PSTN

 Resources (ex: bandwidth over a link) is dedicatedly assigned to


a circuit. When the circuit is unused (no data is transmitted), no
other circuits can use the resources.
 3 phases of data transmission
 Setup circuit: close ports of switches along the path
 Transmit data
 Tear down the circuit: release the closed switches
 Circuit switching guaranties that the circuits uses the whole
available the bandwidth over each link for data transmission
(good for audio/video transmission)
 Waste of bandwidth if the data transmission process does not
consume the whole capacity of each link of the circuit.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

64 66

64 66

31 32
Cons : case of idle chanel (“blank” channel) Cons: fault channel

Sw1 Sw2
A
3
1
5
B
Setup 2

4
Transmit Transfer
data Information
• Have to restart from the channel establishment stage if
t errors happen
teardown

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

67 69

67 69

Cons : case of small channel Packet switching


• Data are splitted to packets
Sw1 Sw2 • Header: address, order number
• Payload data
• Switching devices forward packets depending on header

Setup

Transmit data
Information
Data
Teardown
Header
t
01000111100010101001110100011001 header
payload

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

68 70

68 70

33 34
Example of packet switching Transmission time in packet switching
 Switch forwards a packet only A Sw B
after receiving all the packet
(store and forward)
h
payl
d
oad r

 Switch needs time to process a


packet (dproc):
 Checks error
 Decides which ports to forward
packet out
 dproc is usually smaller than
transmission delay
dproc

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

71 73

71 73

Packet switching Circuit vs packet switching


• Each packet can be processed independently Example:
• Each packet can have different paths to the destination, without the  Bandwidth10 Mb/s
ordering
 Each connection of users:
• Resources are shared for all connections N
• Allocate 1 Mb/s users
• If resources are available, it can be used by any node
• Time to use for data
transmission: 10% of total time 10 Mbps
 Circuit switching:
 Maximum 10 users can transmit
data simultaneously
 Packet switching : • Binomial distribution:
 Assume there are 30 shared P(x = k) = Cnk pk (1-p)n-k
users
 Probability of more than 10
• What happen if there are
users to send data at the same more users?
time? (~0.0003)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

72 74

72 74

35 36
Switching performance Queue

• Circuit switching network : Probability of all 10


users to send data at the same time:
Queue(FIFO)
P(k = 10) = C1010 x 0.110 x 0.90 = 10-10

1
• Packet switching network : Probability of more
than 10 users to send data at the same time 1
P(k = 10) = C3010 x 0.110 x 0.920 = 0.00037

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

75 77

75 77

Queue Queue

Queue(FIFO) Queue(FIFO)

2 2

1 1

1 Mbps

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

76 78

76 78

37 38
Queue Packet loss

• Queue has its own limit


Queue(FIFO) • Packets coming to a full queue will be lost

2 2 1 1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

79 81

79 81

Queue 3. Basic parameters in networks

 Bandwidth
 Throughput
Queue(FIFO)
 MTU (Maximum Transmission Unit)
 Latency
• Delay on end nodes
• Delay on intermediate nodes
• Transmission delay
• Propagation delay
 Package loss

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

80 82

80 82

39 40
r_s: sender rate
r_c: channel capacity
r_s < r_c -> throughput limited by the sender's rate
r_s > r_c -> throughput limited by the capacity of the channel

Bandwidth Throughput (cont.)

• Bandwidth - R
 Rs < Rc What is the average throughput?
• In telecommunication: bandwidth= fmax - fmin
• In computer networks: Maximum amount of data
can be transmitted in a unit of time over a link (bps Rs bits/sec Rc bits/sec
– bit per second).
• Ex: optical fiber has bandwidth of 1000Mbps.
 Rs > Rc What is the average throughput?

Rs bits/sec Rc bits/sec

Nút thắt cổ chai (bottleneck)


The point limits the bandwidth of the transmission connection

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

83 85

83 85

Thông lượng (throughput) Bottleneck

 Throughput: Speed (bits/sec) of data transmission • How to


at a time
determine the
 Instant: throughput at a time
bottlenecks?
 Average: average throughput during a period of time

Sender: send Channel can send Channel can send


data into Rs bits/sec Rc bits/sec
channel

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

84 86

84 86

41 42
Latency Queuing delay
a L
Transmission delay
R
A Propagation delay a

 R: bandwidth(bps)
C D  L: size of packet (bits)
B
Processing delay  a: coming speed of packet
Queue delay

dnodal = dproc + dqueue + dtrans + dprop


 La/R ~ 0: small delay
dtrans: transmission delay: dprop: propagation delay  La/R  1: high delay La/R
Time to send data out of a Time to propagate data from one  La/R > 1: extreme high delay (loss) La/R ~ 0 La/R -> 1
node end of link to the other
 L: data size(bits)  d: length of link  The problem of speed coordination on end-
 R: bandwidth(bps) to-end connection
 s: signal propagation speed in medium
 dtrans = L/R (ex: ~2x108 m/sec)
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
 dprop = d/s TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

87 89

87 89

Latency Round Trip Time (RTT)

Transmission delay
A Propagation delay • RTT: = t3 – t0
A B
C D T = t0
B
Processing delay
Queue delay

dnodal = dproc + dqueue + dtrans + dprop T = t1


Processing
time at B
T = t2

dproc: processing delay dqueue: queue delay T = t3


 Error check  Time data stay in queue
 Identify out port waiting for processing
 Usually < μsec  Depending on the amount  One way delay: t1 – t0
of data in the queue.
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

88 90

88 90

43 44
MTU Connection oriented vs connectionless communication

• Maximum Transmission Unit: maximum size of a packet can be sent on the • Connection oriented communication:
connection
• Data is transmitted over a connection already setup
• Example: Ethernet has MTU of 1526 byte
• 3 phase of communication
• Why? • Setup connection
• Reason 1: reduce error rate • Data transmission
• BER = error bits / total sent bits  constant • Tear down connection
• Ex: BER = 10-3  send 1000 bits will yield 1 error bit • Connection setup allows to make sur that receiver is ready for
• If L = 1000 bit  probability of a packet having error(s)? the communication  more reliable
• If L = 100 bit  probability of a packet having error(s)? • More control mechanism can be performed before the data
• Reason 2: reduce the probability (or data size) of sending lost packets transmission to enhance it QoS
• Queue size: N byte
• If L = 1000 byte: full queue  lost packet  resend it  send 1000 bytes
• Connectionless
• If L = 100 byte: full queue  ? • No connection is setup, there is only data transmission phase
• Conclusion: reducing MTU will reduce the size of re-sending data • Not reliable
• “Best effort” QoS, sending data as quick as possible.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

91 93

91 93

But MTU cannot be too small Summary

• Too small MTU will reduce performance of data • Introduction to the course
transmission
• History of the Internet
• Explanation :
• Packet: header + payload • Concept of Computer Networks
• Header: Constant • Architecture
• Performance:
• Topology
• Protocol
H=
• Circuit switching vs. packet switching
• Pros & cons

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

92 94

92 94

45 46
Devide and conquer principle

• Big work is divided into small tasks


• Assign some tasks to individuals
• Ex: Compagny A & B needs to discuss about a contract
Lecture 2: • Director of A,B: Identify the main points of the contracts & ask
Basic concepts of computer networks secretary to write down the contract.
• Secretary:
Layer architecture
• Format the contract, put contract to envelope, write down the
OSI & TCP/IP reference model address of company B
Addressing • Ask post office (VNPT) to send to company B
Domain name and conversion/resolution of • Post office:
domain name • Encapsulate the package/documents
• Write down the received post office
• Forward the envelop through several hub of post then to B

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

95 97

95 97

Example

• Parties at the same level performs similar tasks and use the same
information communication methods.
Compagny A Compagny B
Prepare idea of contract
Director Director
Natural language

Layer architecture Secretary


Make envelop/ unfold
envelope Secretary
address

Forward mail using code


Zip code
Post office Post office

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

96 98

96 98

47 48
Example of layers

Architecture with Architecture


layers without layers

Reference models
Cassette
OSI
Sound system All functionalities are put TCP/IP
on the same box
Player
Speaker
When we want to upgrade:
Amplifier Upgrade the whole box
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

99 101

99 101

Advantage of layering systems OSI - Open System Interconnection: 7 layers

• For the complex system: principle of ” devide and


conquer” Application layer Tầng ứng dụng

• Allow to determine the responsibility of each layer Presentation layer Tầng trình diễn
and the relationship amongst them
Session layer Tầng phiên
• Allow to maintain and upgrade easily the system
Transport layer Tầng giao vận
• Changes in some parts do not influence the other
parts. Network layer Tầng mạng Tầng mạng

• Ex: upgrade a media lecture from CD lecture to Tầng liên kết dữ liệu
DVD lecture without the need to change speakers. Data link layer

Physical layer Tầng vật lý

Intermediate nodes End system


End system

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

100 102

100 102

49 50
The main functionality of each layers ISO/OSI reference model

• Physical layer: Transfering bits “over medium”


• Datalink layer: Transfering data between direct
connected elements in the networks. application Two layers not found in Internet
application
• Network layer: Routing, forwarding data from the presentation protocol stack!
source to the distant destination presentation
session  presentation: allow applications to
• Transport: Transmitting data between interpret meaning of data, e.g., encryption, session
applications transport compression, machine-specific conventions transport
• Session : synchronization, check-point, recovery network  session: synchronization, checkpointing, network
of transmission process data link recovery of data exchange link
• Presentation: data encoding, compression, data physical
 Internet stack “missing” these layers! physical
conversion… • these services, if needed, must be
implemented in application The seven layer OSI/ISO
• Application: Supporting communications between reference model
distant parts of an application. • needed?

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

103 Introduction: 1-105

103 105

Models OSI and TCP/IP Layering model of the Internet


In the TCP/IP model of the Internet, the Example of data transmission from a source to a
functionalities of 3 first layers are combined in destination through intermediate nodes (router)
a single layer.
Application layer
Application HTTP HTTP
Presentation layer HTTP, FTP, SMTP…
TCP TCP
Session layer
IP IP IP
Transport layer TCP UDP
Ethernet/10M 10M 100M 100M/Ethernet
Network layer IP
CAT5 CAT5 CAT5 CAT5
Datalink layer Network Interface
Source Intermediate nodes Destination
Physical layer Physical
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

104 106

104 106

51 52
Data Encapsulation Data Encapsulation

• Sender side: Add header containing the information necessary for


Data encapsulation is similar to a packaging process for a gift. package processing at that layer, then send packet to the lower layer.
• Receiver side: Process data in the package according to information in
the header, remove the header and send data to the upper layer.
Packaging

PDUN Layer N Protocol N Layer N PDUN

Decoration Protocol N-1


HN-1 Layer (N-1) Layer (N-1) HN-1

...

...
addr.
H2 ... Layer 2 Layer 2 H2 ...
Put address

H1 ... Layer 1 Layer 1 H1 ...


address address

Sender Receiver
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

107 109

107 109

Protocol stack Data transmission in layering systems

• Functions are splitted to layers


Protocol PN
• Each layer has multiple ways to implement Protocols of Layer N Layer N
its functions  multiple protocols layer N
Protocol PN-1
Protocols of Layer (N-1) Layer (N-1)
Protocol stack: stack protocols based on
layering systems layer N-1

...

...
Protocols at each layer include: Protocol P2
...

Layer 2 Layer 2
• Call a service of the below layer
• Provide service(s) for the upper layer Protocols of Protocol P1
layer 2 Layer 1 Layer 1
Protocols of
layer 1 • Layers (same level) on each side use the same protocol to
exchange logical information
• Two way to communicate logical information at the same logical
level: connectionless or connected-oriented

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

108 110

108 110

53 54
PDU: Protocol Data Unit The protocols TCP/IP and encapsulation process
• At sender
• Each layer add control information to the header of packet
and transfer to the lower layer.
Protocol N+1
• At receiver
• Each layer process packet according to the information of
Layer (N+1) (N+1) PDU the header, then remove the corresponding header and
deliver the remaining data to the upper layer.
Service interface Ex:HTTP header
Application Application
Protocol N Data Data

Layer (N) (N) PDU HN TCP header TCP TCP

IP header IP IP
Service interface
Protocol N-1 Ethernet Frame Network Interface Network Interface
addr.
Layer (N-1) (N-1) PDU HN HN-1
Physical Physical
Signal

Sender Receiver

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

111 113

111 113

SAP: Service Access Point Protocol stack and encapsulation


Protocol 1
Client 1 Server 1
Client 2 Protocol 1 Server 2
FTP FTP
Server 3 Protocol 1 Client 3
Application
TCP TCP

SAP SAP IP IP IP IP

transport TCP/UDP Ethernet/10M 10M 10G 10G 100M Ethernet/100M


TCP/UDP TCP/UDP
protocol CAT5 CAT5 WDM WDM CAT5 CAT5

End node Intermediate node End node


Internet

Dữ liệu - payload
SAP: is a conceptual location at which one OSI layer can request the services
of another OSI layer

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

112 114

112 114
SAP: a logical interface or point where one layer of a network stack
communicates with another layer, or where a service is made available to
upper layers (service available to upper without knowing exactly activities of
lower 55 56
Protocol stack and encapsulation Protocol stack and encapsulation

FTP FTP FTP FTP

TCP TCP TCP TCP

IP IP IP IP IP IP IP IP

Ethernet/10M 10M 10G 10G 100M Ethernet/100M Ethernet/10M 10M 10G 10G 100M Ethernet/100M

CAT5 CAT5 WDM WDM CAT5 CAT5 CAT5 CAT5 WDM WDM CAT5 CAT5

End node Intermediate node End node End node Intermediate node End node

TCP header Dữ liệu - payload Ethernet header IP header TCP header Dữ liệu - payload

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

115 117

115 117

Protocol stack and encapsulation Protocol stack and encapsulation

FTP FTP FTP FTP

TCP TCP TCP TCP

IP IP IP IP IP IP IP IP

Ethernet/10M 10M 10G 10G 100M Ethernet/100M Ethernet/10M 10M 10G 10G 100M Ethernet/100M

CAT5 CAT5 WDM WDM CAT5 CAT5 CAT5 CAT5 WDM WDM CAT5 CAT5

End node Intermediate node End node End node Intermediate node End node

IP header TCP header Dữ liệu - payload Ethernet header IP header TCP header Dữ liệu - payload

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

116 118

116 118

57 58
Protocol stack and encapsulation Protocol stack and encapsulation

FTP FTP FTP FTP

TCP TCP TCP TCP

IP IP IP IP IP IP IP IP

Ethernet/10M 10M 10G 10G 100M Ethernet/100M Ethernet/10M 10M 10G 10G 100M Ethernet/100M

CAT5 CAT5 WDM WDM CAT5 CAT5 CAT5 CAT5 WDM WDM CAT5 CAT5

End node Intermediate node End node End node Intermediate node End node

IP header TCP header Dữ liệu - payload WDM header IP header TCP header Dữ liệu - payload

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

119 121

119 121

Protocol stack and encapsulation Protocol stack and encapsulation

FTP FTP FTP FTP

TCP TCP TCP TCP

IP IP IP IP IP IP IP IP

Ethernet/10M 10M 10G 10G 100M Ethernet/100M Ethernet/10M 10M 10G 10G 100M Ethernet/100M

CAT5 CAT5 WDM WDM CAT5 CAT5 CAT5 CAT5 WDM WDM CAT5 CAT5

End node Intermediate node End node End node Intermediate node End node

WDM header IP header TCP header Dữ liệu - payload IP header TCP header Dữ liệu - payload

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

120 122

120 122

59 60
Protocol stack and encapsulation Protocol stack and encapsulation

FTP FTP FTP FTP

TCP TCP TCP TCP

IP IP IP IP IP IP IP IP

Ethernet/10M 10M 10G 10G 100M Ethernet/100M Ethernet/10M 10M 10G 10G 100M Ethernet/100M

CAT5 CAT5 WDM WDM CAT5 CAT5 CAT5 CAT5 WDM WDM CAT5 CAT5

End node Intermediate node End node End node Intermediate node End node

Ethernet header IP header TCP header Dữ liệu - payload IP header TCP header Dữ liệu - payload

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

123 125

123 125

Protocol stack and encapsulation Protocol stack and encapsulation

FTP FTP FTP FTP

TCP TCP TCP TCP

IP IP IP IP IP IP IP IP

Ethernet/10M 10M 10G 10G 100M Ethernet/100M Ethernet/10M 10M 10G 10G 100M Ethernet/100M

CAT5 CAT5 WDM WDM CAT5 CAT5 CAT5 CAT5 WDM WDM CAT5 CAT5

End node Intermediate node End node End node Intermediate node End node

Ethernet header IP header TCP header Dữ liệu - payload TCP header Dữ liệu - payload

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

124 126

124 126

61 62
Protocol stack and encapsulation Unicast, Multicast, Broadcast protocols
• Unicast protocol: control data to send to one
FTP FTP
destination node
• Multicast protocol: control data to send to
TCP
multiple destination nodes
TCP

IP IP IP IP
• Broadcast protocol: control data to send to all
Ethernet/10M 10M 10G 10G 100M Ethernet/100M nodes
CAT5 CAT5 WDM WDM CAT5 CAT5

End node Intermediate node End node

Dữ liệu - payload

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

127 129

127 129

Summary: Advantage of layering architecture

• Layering architecture allows to divide the


functionalities of networks into small components
• Layers are independent:

Identification in the
• An upper layer makes use of the functionality of its right
bellow layer but does not care about further layer.
• Extensibility/Scalability
• Flexible
• It is possble to upgrade the communication system by
Internet
upgrading the technology of some layers: Ex:
• ADSL→FTTH MAC Address
• IPv4→IPv6 IP Address
Port number
• Without layering:
• Any change in the system requires changing the whole
systems.
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

128 130

128 130

63 64
Identification Identification in the Internet and the relationship between layers

Identification allows identify a person or


an object Domain name, e.g., hust.edu.vn
Name application
 Nguyen Thanh Ha
Address TCP/UDP Port Number, e.g. Port 80
 1 Dai Co Viet, Hai Ba Trung, Ha Noi
IP IP address, e.g. 203.12.15.165
Telephone number
 8680896
data link Physical address / MAC address
Email
e.g. 00:11:24:79:8e:82
[email protected]
physical

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

131 133

131 133

Identification Addressing in the Datalink layer

• Identification usually has hierarchical structure


• Allow to manage efficiently a large addressing space • Physical address/ MAC address
• Scalability • Using in Datalink layer
• Fixed on NIC (Network Interface Card)
• Used for identifying machine in broadcast network
• Example of hierarchy segment.
• Address

00:11:24:79:8e:82
• 1 Dai Co Viet street, Hai Ba Trung district, Ha Noi Hanoi
• Telephone number HEX
• +84-(4) 868-08-96 Hai Ba Trung BIN 00000000 00010001 00100100 01111001 10001110 10000010

Dai Co Viet Assigned by manufacture


OUI

So 1 OUI (Organizationally Unique Identifier):


Each Manufacture have an some OUI unique

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

132 134

132 134

65 66
Addressing in the Internet Addressing in Application layer

• IP address • Domain Name


• Used in IP-Internet Protocol (network layer) (FQDN: Fully Qualified Domain Name)
• Value depends on the networks. Each network • Domain name is the name given to a
interface card should be assigned an IP address. computer or a network using alphabet and
• Used for identifying a machine in an IP network, numbers
example: • www.keio.ac.jp
• 133.113.215.10 (ipv4) • soict.hust.edu.vn
• 2001:200:0:8803::53 (ipv6)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

135 137

135 137

Addressing in transport layer Domain name space

• Port number
• On each machine, there may be several applications running.
• Applications of the same machine are distinguished by port
number.
• An application instance in the internet is identified by the IP
address of the host and port number on which it runs
• Similar to the address of a room in a building
• Buiding address: B1 Building, 1 Dai Co Viet, Ha Noi => similar
to IP address
• Room number 325 => Similar to port number
• E.g. HTTP runs on port 80, FTP runs on ports 20, 21 …
• http://bidv.vn:81

.keio.ac.jp
pc24.cs.keio.ac.jp

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

136 138

136 138

67 68
Domain name and IP address Address resolution/conversion
• For sending data to a host/machine, the host must be identified
• By an IP address Concept
• By a domain name (easy to be memorized by human)  Mechanism finding address IP from a domain name
• name and vice versa.
• Variable length  There is no mathematical formula for this conversion.
• easy to be memorized by human
• Nothing to do with the location of the host Domain name server (DNS)
• IP address  Store the mapping of IP address and Domain name of
• Fixed length (32 bits or 128 bits)
the same host in a database
• Computer process address more easily  Answer requests to resolve IP addresses or domain
• Used for routing purpose names from users.
 Widely used in the Internet

203.162.7.194 www.hedspi.hut.edu.vn

www.hust.edu.vn 202.47.142.40
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

139 141

139 141

Conversion/resolution of address Example


• Computer prefers numbers
• Human prefers names I want to see the webpage User
www.hust.edu.vn
(1)
User
www.hedspi.hut.edu.vn
(2)
www.hust.edu.vn
Need to access to DNS Web browser
Need address conversion
202.47.142.40 (3)
202.47.142.40 (4) 202.47.142.40

Domain name server


Web server

If user knows the IP address of


Webserver of Provide mapping IP-domain name
www.hust.edu.vn the webserver, he can access
202.47.142.40 via IP address from Browser
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

140 142

140 142

69 70
Nslookup tools on Windows, Linux Example: ARP table (on Windows)

• nslookup www.soict.hust.edu.vn
• Conversion “name⇔ IP address”
C:\Documents and Settings\hongson>arp -a
IP address
C:\>nslookup www.soict.hust.edu.vn Interface: 192.168.1.34 --- 0x2
Server: Internet Address Physical Address Type
Address: 192.168.1.1 192.168.1.1 00-02-cf-75-a1-68 dynamic
192.168.1.33 08-00-1F-B2-A1-A3 dynamic
Non-authoritative answer:
Name: www.soict.hust.edu.vn C:\Documents and Settings\hongson>
Address: 202.191.56.68

C:\> MAC address

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

143 145

143 145

ARP Conversion of Mac and IP addresses Summary

Layer architecture
• Address Resolution Protocol Why layering
• MAC and IP are both used for identifying a NIC. Model TCP/IP vs. Model OSI
• ARP allows to find MAC address from IP address Encapsulation, PDU. SAP
Addressing on Internet
Adress IP, MAC, domain name, port
32bit IP address
Address conversion
ARP RARP

48bit MAC address

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

144 146

144 146

71 72
10/4/2024

Quizz

• What do the following objects identify


• IP address
• Transport port
• Mac address
• Domain name
• What identifies uniquely an application.
• IP of the host running the application?
Chapter 2: Physical layer
• Transport port of the application?

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

147 1

147 1

Overview

Physical layer is responsible for transmission of


a stream of bits
Put bits from a machine to a medium
Pick bits from the medium give to receiver
Some issues
Medium
Line Encoding: representing the digital logic levels
using the physical attributes associated with the
media.
Multiplexing

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

73 1
10/4/2024 10/4/2024

From signal to packet Data Communication networks

Analog Signal

“Digital” Signal

Bit Stream 0 0 1 0 1 1 1 0 0 0 1
0100010101011100101010101011101110000001111010101110101010101101011010111001
Packets
Header/Body Header/Body Header/Body

Packet
Transmission Sender Receiver
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

3 5

3 5

Model of data transmission system Communication Media

• Wired media: cable guides signals


• Twisted Pair
• Coaxial Cable
• Fiber Optics
• Wireless media: no cable guides signal
• Radio
• Infra red
• Light
•…

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

4 7

4 7

2 3
10/4/2024 10/4/2024

Twisted pair Evaluation

Cheap, simple Need amplification after each


Widely used 5km in analog transmission
Weak resistance to noice In digital transmission
 Need repeater after each 2
Short Transmission distance km
 In Ethernet LAN
deployment < 100m
Limited speed (100Mbps)

(a) Category 3 UTP.


(b) Category 5 UTP.
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

8 10

8 10

Twisted pair Coaxial cable

• Contains several pairs of copper,


cable in the one pair is twisted
together.
• Two kinds of twisted pair: Category Impedance Use
• STP-Shielded Twisted Pair: RG-59 75  Cable TV
• There is a metal coat, not popular RG-58 50  Thin Ethernet
• UTP-Unshielded Twisted Pair: RG-11 50  Thick Ethernet
• No metal coat, popular Structure:
oInner conduct is coated by an insulator
enviroment
oShielded by a metal grill
oA plastic cover for protection.
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
9 School of Information and Communication Technology School of Information and Communication Technology

11

9 11

4 5
10/4/2024 10/4/2024

Application Optical fiber transmission mode

• Using in TV transmission For digital transmission


• For transmission of  Repeater should be used
telephone signal after each 1km
• 10,000 calls in the same  More repeater is needed
time for high speed
• Is being replaced by fiber transmission
optics
• Linking the computers of the
short distance
• LAN 10BaseT, 100BaseT, …

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

12 14

12 14

Optical fiber Optical fiber

(a) Single core


(b) Cable with 3 cores
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

13 15

13 15

6 7
10/4/2024 10/4/2024

Optical fiber Application of optical fiber

• Multimode stepped index : Used for long distance Advantage in comparison


• Several beam travel in slightly different direction transmission with other cables
 Large data rate
• Beams arrive in different delay Used for communication  Small and light cable
• Pulse can easily distort in metropolitan  Low attenuation
networks
• Multimode graded index:  Better isolation from
Used for connecting electromagnetic
• Index reduce gradually from the center to cladding. environment
• Beams closed to center travel slower than cladding. routers of ISP  Large distance between
Beams travel in curve form. Used in backbone part repeaters
• Reduce pulse distortion. of a LAN  Multimode 10km
 Singlemode 40 km

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
16 School of Information and Communication Technology School of Information and Communication Technology

18

16 18

Optical fiber Wireless media

• Single mode:  Terrestrial microwave


• Index change less from center to cladding in  Used for metropolitan connection, for cellular
comparison with multimode. network
• Beams travel along the center axe.  Microwave satellite
• Pulses experience less distortion.  Used in TV, Long distance telephone
communication
 Radio broadcast
 Infrared
 Small scope, low data rate, unable to travel
through the wall

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
17 School of Information and Communication Technology School of Information and Communication Technology

19

17 19

8 9
10/4/2024 10/4/2024

Wireless media Frequency range of transmission channels

• Radio wave:
• Wavelengths: 1mm – 100.000km
• Frequencies: 3 Hz – 300 GHz
• Ex: Bluetooth, WIFI
• Microwave:
• Wavelengths: 1mm-1 m
• Frequencies: 300 MHz-300 GHz
• Terrestrial microwave : metro connection, cellular
communication
• Satelite microwave: TV, long distance telephone

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

20 22

20 22

Wireless media Transmission methods

Infra red: Simplex: Data is trasmitted in one direction


Wavelengths: 700 nm- 1 mm Full Duplex: Data can be transmitted in both
frequency: 300 GHz-430 THz directions at the same time
Small scope, no wall penetration
Ex: use in remote controls
Half duplex: Data can be transmitted in both
directions but one direction at a time.
Free Space Optics
Wavelengths: 850nm, 1300nm, 1550 nm

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

21 23

21 23

10 11
10/4/2024 10/4/2024

Transmission format Point -to-Point

 Sequent transmission: Transmit 1 bit at a moment (over a signal


line)
 Parallel transmission: Transmit multiple bits at the same time
(over multiple signal lines)

0
1010 A B
A B 1

0 1 2 3 4 5 N-2 N-1 N

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

24 26

24 26

Topology Point-to-point

In point-to-point topology, a transmission line


connects two devices.
Point-to-point
o Link between two devices:
 Star
o 1 line (half duplex) or
 Ring o 2 lines (duplex)
 Mesh o In case of half duplex transmission, there may be collision
 Point-to-multipoint if two devices on the same link send data at the same
 Bus time
 Ring
 Star

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology 27 School of Information and Communication Technology

25

25 27

12 13
10/4/2024 10/4/2024

Point-to-multipoint Medium interface


Data terminal equipment (DTE)
 Have data to transmit but has no feature for transmission
 Need an additional device for accessing the media
Data circuit terminating equipment (DCE)
 transmit bits on the media
 transmit data and control information to another DCE
Need a clear interface standard between DTE - DCE

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

28 30

28 30

Point-to-multipoint Medium interface

• Common character of point-to-multipoint The medium interface is defined according to different aspects:
topo is to use a unique medium to connects  Mechanism
 Define the form of the interface, number of pins for assuring
multiple nodes. the interfaces match together
• Data is broadcasting over the medium  Electrics
 Define the level of voltage to be used
• Collision when two nodes transmit signal in  Define the length of pulse (frequency)
the same time  Define enconding method
 Functionalities
• Need a control mechanism to allow a single  Functionality of each pins
node to transmit multiple access method   There are 4 groups of pins: data, control, synchronization,
see in Datalink layer. ground
 Procedure
 Lists of events to perform for transmitting data

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
29 School of Information and Communication Technology School of Information and Communication Technology

31

29 31

14 15
10/4/2024 10/4/2024

Example: EIA-232-E/RS-232

Define for serial communication


Mechanism: ISO 2110
Electrics: V. 28
Encoding Technics: Data
Functionality: V. 24 to Signals
Procedure: V. 24
representations
Introduction

Digital data - digital signal

Digital data - analogical signal

Analogical data - digital signal

Analogical data - analogical signal

Reading: Chapter 5, Data and Computer Communications, William Stallings

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

32 34

32 34

Example: V.24 /EIA-232-E Basic ideas

• Representing data by symbols


• A symbol is an elementary signal:
Mechanic:
 25 or 15 pins
 Transmission distance 15m Set of mapping is the Encoding scheme
Electrics
 Digital data Ex: 1: , 0: or 1: 0:
 1=-3v, 0=+3v (NRZ-L)
 Data rate 20kbps
 Transmission distance< Encoding could be performed by bit or by a group of
15m bits e.g., 2 or 4 or 8 bits.

Ex: 00: 01: 10: 11:

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

33 35

33 35

16 17
10/4/2024 10/4/2024

Basic ideas Line coding: represent digital data by digital signals

Receiver should know when a symbol starts or ends:


Encoding and Modulation clock synchronization between sender and receiver
There are many ways to represent 0 and 1  different
encoding methods

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

36 38

36 38

Line coding: represent digital data by digital signals Some line codes

NRZ Biphase encoding


 NRZ-L,NRZI  Manchester
• Use different digital signals at different voltage levels to represent Bipolar  Differential Manchester
digital data (bits 0 and 1)
 Bipolar alternate mark
• “A digital signal is one in which the signal intensity maintains a constant level for
some period of time and then abruptly changes to another constant level” inversion
(Data and Computer Communications, 8th Edition, William Stallings)  Pseudoternary
 An element signal / A symbol/ A pulse of signal
 Case of digital signal: the shortest signal maintaining a constant level
 Senders encodes a flow of bits  flow of symbols
 Receiver: picks signals, detects symbols, decodes to bits

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

37 10/4/2024 39

37 39

18 19
10/4/2024 10/4/2024

NRZ-L Non Return to Zero Level Line code consideration

 During bit time, signal does not go back to 0 level Three aspects should be considered in any
 Signal level is not changed during bit time. encoding method:
 NRZ-L Non return to zero level Data speed: number of bits could be sent per second
 Bit 1 signal is in low/high level given symbol rate
 Bit 0 signal is in high/low level
 1 bit  1 symbol Clock recovery on receiver side: If the clock recovery is
correctly at receiver side, the received signal can be incorrectly
seperated into symbols  cause error in the received data.
DC-component: Directed Current vontage
Signal baseline
component.
 DC-component makes recepter mistakenly detect level of
signal (by wrongly detect signal baseline)
Signal baseline
 Encoding should avoid DC-component by maintaining signal
mean amplitude around 0.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 40 42

40 42

NRZ-I Non return to zero invert NRZ


 Bit 0: signal level is not changed at the begining of bit time
 Bit 1: signal level is changed at the begining of bit time NRZ advantages
 A differential encoding method :  Simple, utilise the maximum capacity of the line
 0 and 1 are represented by the signal level change, not by the level
itself. NRZ weaknesses
 Reliable/ simple.  NRZ does not contain factors supporting clock synchorization
 Example: when sending a flow of 20 bits 1s, the signal maintains one
level and can be detected wrongly at receivers as 19 bits 1s.
 Contain DC-component when sending a chain of 1s.
Signal baseline Application
 Encoding data on magnetic storage
 Not popular in data transmission
Signal baseline

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 41 10/4/2024 43

41 43

20 21
10/4/2024 10/4/2024

Bipolar AMI Biphase: Manchester


 Use more than 2 signal levels for 1 bit
 Bipolar alternate mark inversion Manchester: Always change signal level in the middle of
 0 : No signal bit time
 1: Presence of signal. Two consequent 1s have two different signal Bit 1: Signal change from low level to high level.
levels
 pseudoternary Bit 0: Signal change from high level to low level
 1 : No signal
 0 : Presence of signal. Two consequent 0 have two different signal
levels Level change provides a synchonisation mechanism.
Differential Manchester:
0: signal level change at the begining of bit
1: no signal level change at the begining of bit
 Always change signal level in the middle of bit time for
Baseline synchronization purpose

Baseline
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 44 10/4/2024 46

44 46

Bipolar AMI Manchester encoding


No DC component
 Mean of signal lever is always 0
Good synchronization when sending many bit 1s
 Lost of synchronization when sending many bit 0s
3 possible signal levels for 1 bit:
Not optimal in transmission line usage.
Receiver needs to distinguish 3 levels of signal

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 45 10/4/2024 47

45 47

22 23
10/4/2024 10/4/2024

Manchester encoding Symbol rate


Number of symbol changes, waveform changes, or
signaling events across the transmission medium per
unit of time
Unit: Baud/s = symbol/s

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 48 10/4/2024 50

48 50

Units in transmitting digital data in digital transmission Nyquist rate


• Nyquist rate: 2 times bandwidth of a transmission line
• Bandwidth: B (Hz)
• Nyquist rate = 2B (Hz)
Term Units Definition
• The maximum pulse rate for a baseband channel is the Nyquist rate, and is
Data unit bit A single bit, Value 0 or 1 double the bandwidth
• Bandwidth B (Hz) max pulse rate is 2B pulse/s

• Data rate (bps) = pulse rate * number of bits represented by a


Data rate bit/s Rate transmitting bit symbol/pulse.
Pulse • Data rate using NRZ-L?
• Data rate using Manchester encoding?
voltage of
Signal element constant Part of a signal that occupies the • Baseband transmission: signal is directly sent using its original frequency
/Symbol amplitude shortest interval of a signal code • Passband transmission: signal is shifted to frequency around carrier
frequency.
Number of
Symbol rate/pulse symbol/s Number of symbols generated in a
rate (baud) unit of time

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology 51 School of Information and Communication Technology

10/4/2024 49

49 51

24 25
10/4/2024 10/4/2024

Line codes Exercise-02

• We know that the following signal is generated


from some data using standard Manchester
encoding, assume that you act as receiver,
please
• Identify the starting and ending points of signal
corresponding to bits
• Identify the original data sent

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 52 10/4/2024 54

52 54

Exercise-01 Modulation of digital data to analog signal

• Draw the signal generated when we encode • Example: data transmission over telephone line
• Telephone line accept signal with frequencies between 300Hz -
following data using different encodings: 3400Hz
• 11000000 11001101 • Digital data from the source must be modulated to analog signal to
transmit over telephone line.
• NRZ-L
• Bipolar AMI • 3 modulation techniques:
• Amplitude-Shift Key
• Manchester • Frequency-Shift Key
• Phase-Shift Key

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 53 10/4/2024 56

53 56

26 27
10/4/2024 10/4/2024

Amplitude-Shift Key (ASK) On-Off Keying (OOK)

• Varying the amplitude of the 𝐴𝑐𝑜𝑠 2𝜋𝑓𝑡 𝑓𝑜𝑟 1


carrier wave to represent 𝑠 𝑡 =
0 𝑓𝑜𝑟 0
digital data
• Carrier original wave
function:
𝐴 cos(2𝜋𝑓𝑡)
• 0 and 1 are represented
by signals of two
different amplitudes. Ex:
• Amplitude A for 1
• Amplitude 0 for 0
• Usually used in optical fiber

On off key observed from optical intensity (upper figure)


And optical field (lower figure)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology 59 School of Information and Communication Technology

10/4/2024 57

57 59

On-Off Keying (OOK) Frequency-shift key (FSK)

• Used in optical fiber • Varying the frequency of the


• A kind of ASK. carrier wave to represent
• 1: having light during the bit time (turn on the light digital data
source). • Two symbols to represent bit
• 0: no light during the bit time (turn off light source). 0 and 1 are two carrier
signals of different
• OOK may be realized in two forms: frequencies.
• NRZ: light is on during all bit time of bit 1. • Lower error rate
• RZ (return-to-zero): light is on only in a part of 1. • Used for transmiting data
over telephone line (low
frequency) or wireless
network (high frequency)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
58 School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 60

58 60

28 29
10/4/2024 10/4/2024

Phase-shift key (PSK) Digital to analog modulation recaptulation

• Carrier signal at different


phases to represent bit 0 and 1
• A symbol is a signal with one
phase

• By using more than 2 phases,


more than two symbols can be
generated.
• A symbol may be used to
represent more than one bits.
• May be combined with other
modulation methods.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 61 10/4/2024 63

61 63

PSK is used in combination with ASK Analog signal to digital data

Constellation diagram • Used to digitalize real life analog signal, for example voice signal.
• Converting the analog signal to digital data then
• Encode digital data to digital signal for transmission.
• Using line codes: NRZ-L, Manchester etc…
• Two methods for converting analog signal to digital data
• Pulse Code Modulation
• Delta Modulation

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 62 10/4/2024 64

62 64

30 31
10/4/2024 10/4/2024

Pulse Code Modulation (PCM) Delta Modulation

• Pulse Code Modulation • Nếu 𝑥 𝑡 > 𝑥 𝑡 → 𝑥 𝑡 ≔ 𝑥 𝑡 + 𝛿


• Sample signal according to • Output = 1
Nyquist–Shannon sampling
theorem • Nếu 𝑥 𝑡 < 𝑥 𝑡 → 𝑥 𝑡 ≔ 𝑥 𝑡 − 𝛿
• If sample a signal with
frequency >= 2 *max frequency, • Output = 0
the original signal can be 𝑥 𝑡 >𝑥 𝑡
recovered fidely from the +𝛿
samples.
• Ex: human voice has greatest Output: 1
frequency of 4300Hz, it should
be sampled with at least 8600
sample/s.
𝑥 𝑡 <𝑥 𝑡
• Sample are then quantized −𝛿
• Approximate the amplitude of
the sample by some digital Output: 0
values
• 4 bit quantization  16 diffrent
possible sample amplitudes.
• More bits, more precise. Transmitting signal: 1 1 1 0000011

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10/4/2024 65 67

65 67

Delta Modulation Delta Modulation

• Weakness of PCM: generate a lot of data • Parameters of the


• Delta modulation: Use a single bit for each modulation
• Step delta
sample • Sampling rate
• Idea: Instead sending the real value of the • Errors:
sample 𝑥(𝑡), send the variation in sample value • When the signal
varies slowly:
in comparison with the last sample: quantizing noise
approximative value 𝑥 (𝑡). • When the signal
varies quickly:
• If x t > 𝑥(𝑡) : send bit 1 overloaded noise
• If x t < 𝑥(𝑡) : send bit 0

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

66 10/4/2024 68

66 68

32 33
10/4/2024 10/4/2024

Analog data – analog signal

• Send analog data over a carrier


using analog signal
• Integrate signal m(t) to carrier
wave with Fc frequency to a signal Chapter 3:
with frequency around Fc
• Technic is used to shift signal to a
Datalink layer
frequency appropriate to the
frequency of the transmission • Functionalities:
channel
• Encapsulation, addressing
• 3 methods
• Amplitude modulation
• Error detection and correction
• Frequency modulation • Flow control
• Phase modulation • Media access control

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

10/4/2024 69 1

69 1

Overview of Data link layer

34 1
10/4/2024 10/4/2024

Network nodes and links Functionalities

“link”
• Network nodes:
• PCs, Laptop, Routers,
Server… Framing Flow control
• Links:
• Communication chanel Media Access Control
between adjacent nodes
• Wired link: Ethernet LAN,
ADSL, fiber optic… Addressing Error control
• Wireless link: Wi-fi, FSO,
Satellite,…
Datalink layer
• Datalink layer responsibility:
• Transmit data between
adjacent elements.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

3 5

3 5

Datalink layer in Layer architecture Functionalities

Application Media independent


sub-layer
• Framing:
Transport • Sender: place the network layer packet into the
frame, add header, tail
Network LLC • Receiver: Remove the header, tail for extracting the
Data-link
(Logical Link Control) network packet.
MAC
Physical (Media Access Control) Media dependent sub- • Addressing:
layer
• Physical address in the header of the frame for
identifying the source and the destination.
802.2 LLC

802.3 802.4 802.5 802.11 ….. 802.16


Ethernet Token Bus Token Ring Wi-Fi Wi-Max
IEEE 802.x series
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

4 6

4 6

2 3
10/4/2024 10/4/2024

Framing-Example of HDLC frame

Error control
• Error detection
• Error correction

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

7 9

7 9

Functionalities (2) Principle of error detection

• Media access control: EDC= Error Detection Code (redundancy)


• If the nodes in the network share common media, a EDC is added to data before sending to the destination.
Media access control protocol is required.
• Flow control: Data Data
• Control the transmission speed of the sender so that Y
Error
the receiver does not overloaded. All bit in Data’
OK?
• Error control: N

• Detect and correct errors


Data EDC Data’ EDC’
• e.g. parity check, checksum, CRC check

Link with bit errors

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

8 10

8 10

4 5
10/4/2024 10/4/2024

Principal of error detection Parity code

• Condition for all error detection


• Sent data with Odd code:
• fedc(Dsend) != fedc (Dreceive) ∀ Dsend != Dreceive • 01010101 Code: 1
• Space of codes (number of possible codes) • Case 1: Received data 01110101 Received code: 1
must at least equals to space of data •  Total number of 1 : 6 even number Code does not match
with data
(number of possible data) •  Error
•  code length (bits) >= data length (bits) • Case 2: Received data 01110100 Received code: 1
• Transmission efficiency <= %50 • Total number of bit 1  5 code matches with data
•  No error
• Data of m bit long space of data is 2^m  expected to
have different code for different data  codes must be
>=m bit long.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

11 13

11 13

Parity code Checksum code

A check bit is added to the original data to ensure that the • Sender:
total number of bit 1 is even (even parity code) or odd (odd • Divides data into small parts of n bit
parity code) • Calculates binary sum of all parts. If there are some overflow bit,
• Single code add the overflow bit to the result.
• Able to detect single bit error • Alters all bits (two’s complement) to get the checksum
• Sends the checksum with data

Two-dimension code • Receiver:


 101011 101011 • Extracts data and checksum
 Detect and correct single bit error 111100 101100 • Divides data into block of n bits
011101 011101
• Calculates the sum as in the sender side including with the
001010 001010 checksum received
• If result contains at least one bit 0 error.
 Application: mainly on hardware, ex: while sending data
on PCI and SCSI bus
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology
12
14

12 14

6 7
10/4/2024 10/4/2024

Checksum: Example CRC: Cyclic Redundancy Check


• Data is considered as a binary string: D
Data: 0011 0110 1000 • We wants to generate a error code with length r
Calculate checksum 4 bit: • Choose another binary string of (r+1) bit, G (Generator)
• Find a string R with length r bits such that the concatenation of D and
0011 R is a binary number that divides G (modulo 2)
• <D, R> divides G
+ 0110
1000 D D

Overflow
10001 Y
N
bit 1 <D’, R’> mod G = 0 ?

0010 <D, R> mod G = 0


D’ R’
Alter bit -> checksum code: 1101 D R

Bits to send: 0011 0110 1000 1101 Link with bit errors
17

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

15

15 17

Checksum: Processing on receiver CRC: How to find R


 Ex: D= 10101001
Bits received: 0011 0110 1000 1101 • <D, R> = D.2r XOR R  r= 3 bits
Verification: • Since <D, R> divides G then
 G=1001
• D.2r XOR R = n.G G
0011 •  D.2r = n.G XOR R 10101001000 1001
1001 D 1011110
0110 (associativity)
+ 1000 • This means, R is the remainder of 1110
the division D.2r by G (division 1001
1101 modulo 2) 1110
1001
11110 1111
Overflow 1001
bit
1 R= D.2r mod G 1100
1111  no bit error 1001
R=110, the string to send is 1010
10101001110 1001
D R 110
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology
R
16 18

16 18

8 9
10/4/2024 10/4/2024

CRC under polynomial form CRC – Example

• 1011 > x3 +x +1 11010110110000 10011


• Example of some CRC generators using in the pratice:
• CRC-8 = x8 + x2 + x + 1
10011
• CRC-12 = x12+x11+x3+x2+x 010011
• CRC-16-CCITT = x16 + x12 + x5 + 1
• CRC-32 = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + 10011
x5 + x4 + x2 + x + 1
0000010110
• The longer G is, the more possible that CRC detects
errors. 10011
• CRC is widely used in the practice 0010100
• Wi-fi, ATM, Ethernet…
• Operation XOR is implemented in hardware 10011
• Capable to detect less than r+1 bits errors
001110 🡪 Remainder:CRC
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

19 21

19 21

CRC – Example CRC – Check 11010110111110

Frame : 1101011011 11010110111110 10011


Generator : G(x) = x4 + x + 1  P = 10011 10011
Dividend : Fk = 11010110110000 010011
10011
R = Fk mod P = 1110
0000010111
Send : 11010110111110
10011
0010011
10011
000000 🡪 No errors

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

20 22

20 22

10 11
10/4/2024 10/4/2024

CRC – Check 11010010111110 Stop-and-wait ARQ


11010010111110 10011 Normal case
10011 Sender Receiver

010010
10011 send pkt0

000011011 pkt0 is
OK
10011 rcv ACK
send pkt1
010001 pkt1 is
10011 corrupted

00010110 rcv NAK


resend pkt1

10011
Time
00101 🡪 not 0 🡪 errors
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology
25
23

23 25

Reaction when errors detected Stop-and-wait ARQ


Error ACK/NAK
• Objective: to assure that data • Popular techniques:
are received correctly even • Error detection (as we seen) Sender Receiver
though the chanel is not • Acknowledgement/confirmation • ACK error, resend the
realiable. • Retransmis after a clear previous packet
confirmation that frame is not
• Constraint arrived • Duplicated packets send pkt0
• Retransmis after timeout problem.
• Data frame must be pkt0 is
correctly received • ARQ technique: automatic repeat
request). There are 3 versions: • To eliminate repeated OK
• Negligible transmission • Stop and Wait ARQ packet: Use Seq.# rcv ACK
delay. • Go Back N ARQ send pkt1
• All packets are assigned
• Possible errors • Selective Reject ARQ
Seq# before sending out. pkt1 is
• Whole frame loss • Similar to techniques used in flow Repeated packet has OK
• Error frame control.
identical Seq#
• Loss of error warning rcv sth corrupted!
message resend pkt1 rcv pkt1
duplicate,
Time discard it
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology
26
24

24 26

12 13
10/4/2024 10/4/2024

Stop-and-wait ARQ ARQ with timeout


not using NAK
Sender Receiver • ACK packet carries
#Seq of the packet to
be acknowledged.
send pkt0 This number is called
pkt0 is acknowledgment
OK number
rcv ACK0
send pkt1
• An ACK with
acknowledgment
pkt1 is number n implicitly
OK
rcv ACK1 pkt2 is corrupted
confirms that all
send pkt2 packet with #seq
number < =n have
been well received
rcv ACK1
resend pkt2

Time
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

29
27

27 29

Stop-and-wait ARQ: When ACK is lost ARQ with timeout

• Data packet and ACK packet may be lost


• No ACK is received at sender side
• How a sender decides to resends data or not?
• Solution:
• After sending out a packet, sender starts a timer specifying
maximum waiting time (timeout) for an ACK of the packet.
• When timeout expired sender re-sends the packet
• How long a Timeout should be?
• At least 1 RTT (Round Trip Time)
• If a packet arrives at the destination but its ACK is lost, the
packet is still resent because associated timeout expired.
• The duplicated packets are eliminated at the receiver side
according to repeated #seq.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology
28
30

28 30

14 15
10/4/2024 10/4/2024

Stop-and-wait

• Principles
• Transmitter sends a single frame
• Receiver receives the frame, process and then
informs the transmitter that it is ready to receives
next frames by a clear acknowledgement (ACK).
• Transmitter waits until reception of the ACK before
Flow control sending next frames.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

31 33

31 33

What is flow control Stop-and-wait


transmitter
Emetteur receiver
Récepteur
• Goal: Make sure that the sender does not overload the receiver
Packet
Paquets Packet
Paquets
• Why overloading?
• The receiver stores data frame in buffer.
• Receiver performs some processing before deliver data to the upper frame
Trâme
level.
• Buffer could be full, leaving no space for receiving more frame  some Ack
data frame must be dropped.
• Problem of errors in transmission is excluded
• All frames are transmitted to correct receiver without error
frame
Trâme
• Propagation time is small and could be ignored
• Solution
• Stop-and-wait mechanism
• Sliding window mechanism
frame
Trâme
Trâme

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

32 34

32 34

16 17
10/4/2024 10/4/2024

Stop-and-wait Transmission time with Stop-and-wait


transmitter
Emetteur receiver
Récepteur

• Advantage Packet
Paquets Packet
Paquets

• Simple, suitable for transmission of big size T transmit


frames frame
Trâme

• Weakness RTT Ack

• When frames are small, the transmission


channel are not used efficiently.
frame
• Cannot use often for big size frame due to
Trâme

• Limitation in buffer size


• Big size frame prones to bigger error probability
• In shared medium, it is not convenient to leave
frame
Trâme
one station using medium for long time Trâme

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

35 37

35 37

Exercices Transmission time with Stop-and-wait

• T total= Nb.frame * (T_transmit + RTT)


• Given a link with rate R=100Mbps • T_transmit (F) = L(Frame)/ R
• We need to send a file over data link layer with file size L=100KB • Nb. frame = L/L(frame)
• Assume that the size of a frame is: 1KB, header size is ignored
• Round trip time (RTT) between 2 ends of the link is 3ms
• An ACK message is sent back from receiver whenever a frame is • With the given parametters
arrived. Size of ACK message is negligible • Nb. frame =100 KB/1KB =100
• What is the transmission time required if using Stop-and-wait
mechanism? • T_transmit (F) = 1KB/100 Mbps =10^3*8/10^8
• Transmission time with sliding window if the window size is =7? =8. 10^-5 (s)=0.08 (ms)
• Which size of window allow to obtain the fastest transmission? • T_total = 100 * (0.08 + 3) = 308 (ms)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

36 38

36 38

18 19
10/4/2024 10/4/2024

Classification of MAC protocol

• Chanel division:
• Resources of the media is divided into small parts (time -
TDMA, frequency- FDMA, Code- CDMA)
• Distribute a part to each nodes
• Random access:
• Chanel is not divided; all nodes are allowed to access
Media access control simultaneously with collision possibility
• Need a mechanism to avoid collision
• e.g. Pure Aloha, Slotted Aloha, CSMA/CD, CSMA/CA…
• Sequent access:
• Nodes can send data one after the other.
• Token Ring, Token Bus….

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

39 41

39 41

Connection types Channel division

• Point-to-point • FDMA: frequency division multiple access


• ADSL
• Telephone modem
• TDMA: time division multiple access
• Leased Line…. • CDMA: code division multiple access
• Broadcast
• LAN using bus topology
• Wireless LAN
• HFC:
• …
• Broadcast networks need media access control
protocol in order to avoid collision when nodes try
to send data.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

40 42

40 42

20 21
10/4/2024 10/4/2024

TDMA và FDMA CDMA (example)


example
4 stations
FDMA

frequency

time
TDMA:

frequency

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
time TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

43 45

43 45

CDMA Random access: Pure Aloha

• Several senders can share the same frequency on a


single physical channel. • Aloha is used in mobile network of
• Signals come from different senders are encoded 1G, 2.5G, 3G using GSM technology .
(multiplied) with different random code. Those code
must be orthogonal. • Pure Aloha:
• Encoded signals are mixed and then transmit on a • When one sender has data to send, just
common frequency. sends it
• If while sending, the senders receive data
• The signals are recovered at the receiver by using from other stations  there is collision.
finding the correlation with the same codes as at All stations need to resend their data.
sender side.
• There are possibility to have collision
• CDMA shows a lot of advantages that other when retransmit.
technology cannot achieve. For example, the same • Problem: Sender does not check to see if
frequency can be used in adjacent mobile cell the chanel is free before sending data
without interference as if TDMA or FDMA are used
• Grey package are having overlap in
time causing collision

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

44 47

44 47

22 23
10/4/2024 10/4/2024

Random access: Slotted Aloha CSMA

• Times axe is divided into


equal slots.
• Each station sends data only
at the beginning of a time
slot.
• CSMA: Sender listens before transmission:
•  Collision possibility is • If the channel is free, send all the data
reduced
• If the channel is busy, wait.
• Still have collision in grey
package • Why there are still collision?
• Due to propagation delay

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

48 50

48 50

Random access: CSMA Collision in CSMA

• CSMA: Carrier Sense Multiple Access


spatial layout of nodes
• CSMA idea is similar to what happens in a meeting. • Assume that there are 4
• CSMA: nodes in the channel
• The sender “Listen before talk” • The propagation of the
signal from one node to the
• If the channel is busy, wait other requires a certain
• If the chanel is free, transmit delay.
• Ex:
• Transmissions from B and D
cause collision

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

49 51

49 51

24 25
10/4/2024 10/4/2024

Comparison between channel division and


CSMA/CA (Collision Avoidance) random access
• CSMA/CA is used WIFI standard IEEE 802.11 • Channel division
• If two stations discover that the channel is busy, and • Efficient, treat stations equally.
both wait then it is possible that they will try to • Waste of resources if one station has much smaller data
resend data in the same time. to send than the others
•  collision
• Random access
• Solution CSMA/CA.
• When total load is small: Efficient since each station can
• Each station wait for a random period  reduce the
collision possibility
use the whole chanel
• When total load is large: Collision possibility increases.
• Token control: compromise between the two
above methods.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

52 54

52 54

CSMA/CD “Taking turns” MAC protocols

• Used in Ethernet
• CSMA with Collision
Detection:
• “Listen while talk”. polling:
• A sender listen to the  master node “invites” other nodes
channel, to transmit in turn data
poll
• If the channel is free then  typically used with “dumb”
transmit data devices master
• While a station transmit data, it
listens to the channel. If it  concerns: data
detects a collision then transmits
a short signal warning the
collision then stop
• polling overhead
• Do not continue the
transmission even in collision as
• latency
slaves
CSMA • single point of failure (master)
• If the channel is busy, wait
then transmit with
probability p
• Retransmit after a random
waiting time.
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

53 Link Layer: 6-55

53 55

26 27
10/4/2024 10/4/2024

Token Ring
 A “token” is passed from
T
one node to the other in
a ring topo
 Only the token holder can
transmit data (nothing
 After finishing sending to send) Point-to-Point forwarding
mechanism
data, the token need to T
be passed to next nodes.
 Some problem
 Time consuming in passing Hub, Switch, Bridge
token
 Loss of token due to some
reasons data

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

56 58

56 58

Summary on Media access control mechanisms Devices of LAN

• Channel division Repeater, Hub, bridge and switch


• Random access All are LAN devices with many ports

• Token Repeater:
Repeats the bits received in one port to the other
• What do you thinks about their advantages and port
weaknesses ? One network with repeaters = one collision domain
Repeater is a physical layer system.
Hub:
Receive the signal from one port (amplify ) and
forward to the remaining ports
Do not offer services of datalink layer
Layer 1 intermediate system
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

57 59

57 59

28 29
10/4/2024 10/4/2024

Hub Bridge

bridge

hub hub

Hub=Multiple port repeater


Single collision domain
Two ports systems
- Forward MAC frame from one port to the other based on MAC address Two ports systems
- Create two collision domains - Forward frames from one port to the other based on MAC address
- Create two collision domains
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

60 62

60 62

Devices of LAN (cont.) Switch: multiple simultaneous transmissions

Bridge
More intelligent than hub
Can store and forward data (Ethernet frame)  hosts have dedicated, direct
according to MAC address. connection to switch A
Bridge breaks the network into two collision  switches buffer packets C’ B
domains.  Ethernet protocol used on each 1 2
incoming link, so: 6
Layer 2 intermediate system • no collisions; full duplex 5
3
4
Switch • each link is its own collision
domain B’ C
A’
More ports than bridge  switching: A-to-A’ and B-to-B’ can transmit
Can store and forward data according to simultaneously, without collisions switch with six
interfaces (1,2,3,4,5,6)
MAC address
 Receive full frame, check error, forward

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

61 Link Layer: 6-63

61 63

30 31
10/4/2024 10/4/2024

Switch: multiple simultaneous transmissions Switch: self-learning

 hosts have dedicated, direct  switch learns which hosts Source: A


Dest: A’
connection to switch A can be reached through A A’
 switches buffer packets C’ B which interfaces A
C’ B
 Ethernet protocol used on each 1 2
• when frame received, switch
incoming link, so: 6 “learns” location of sender: 1 2
3
• no collisions; full duplex 5 4 incoming LAN segment
6
3
• each link is its own collision 5 4
domain B’ C • records sender/location pair
A’ B’
 switching: A-to-A’ and B-to-B’ can transmit in switch table A’
C
simultaneously, without collisions switch with six
Switch table
interfaces (1,2,3,4,5,6) MAC addr interface TTL
• but A-to-A’ and C to A’ can not happen (initially empty)
simultaneously A 1 60

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-64 Link Layer: 6-66

64 66

Switch forwarding table Switch: frame filtering/forwarding

Q: how does switch know A’ reachable via when frame received at switch:
interface 4, B’ reachable via interface 5? A 1. record incoming link, MAC address of sending host
C’ B
A: each switch has a switch table, each 2. index switch table using MAC destination address
entry: 1 2 3. if entry found for destination
 (MAC address of host, interface to reach
6
3 then {
5
host, time stamp) 4 if destination on segment from which frame arrived
 looks like a routing table! (Network layer) B’ C then drop frame
A’
else forward frame on interface indicated by entry
Q: how are entries created, maintained }
in switch table? else flood /* forward on all interfaces except arriving interface */
 something like an algorithm?

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-65 Link Layer: 6-67

65 67

32 33
10/4/2024 10/4/2024

Self-learning, forwarding: example Self-learning multi-switch example

Source: A
Dest: A’

 frame destination, A’, A A’


Suppose C sends frame to I, I responds to C
location unknown: flood A
S4
C’ B
1
3
 destination A location S1 4
2
4 1 S3
1 1
known: selectively send 6A A’
2 A S2 1
2
4
2 3 2 3 F
I
on just one link 3 D 3
B C
5 4
G H
E
B’ C
A’ A A’

MAC addr interface TTL


Q: show switch (MAC) tables and packet forwarding in S1, S2, S3, S4
A 1 60 switch table
A’ 4 60 (initially empty)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-68 Link Layer: 6-70

68 70

Interconnecting switches A typical LAN

self-learning switches can be connected together: mail server


Connect to
outside
1 S
3 4 router web server
2
S1
1
4 4 1 S3
A S2 1 4
2 3 2 3 F 2
D 3 I
IP subnet
B C
G H
E

Q: sending from A to G - how does S1 know to forward frame destined


to G via S4 and S3?
 A: self learning! (works exactly the same as in single-switch case!)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-69 71

69 71

34 35
10/4/2024 10/4/2024

Switches vs. routers Forward data to other LANs


❖ The frame is forwarded
from A to R
application
transport ❖ At R: the frame header is
both are store-and-forward: datagram network MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
removed and forwarded
frame link IP src: 111.111.111.111
 routers: network-layer devices (examine physical IP dest: 222.222.222.222
IP src: 111.111.111.111
to upper layer as an IP
link frame
IP dest: 222.222.222.222 packet
network-layer headers) physical
IP
 switches: link-layer devices (examine switch
Eth
IP
link-layer headers) Eth
network datagram
Phy Phy
link
both have forwarding tables: frame
B
physical
A
 routers: compute tables using routing application R
algorithms, IP addresses transport 111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
 switches: learn forwarding table using network
222.222.222.220
49-BD-D2-C7-56-2A

flooding, learning, MAC addresses link


1A-23-F9-CD-06-9B
physical

111.111.111.112 111.111.111.110 222.222.222.221


6-72
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-72 74

72 74

Router connects LANs

Example: Send data from A to B through


MAC src: 74-29-9C-E8-FF-55 router R
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
• A prepare an IP packet with original address of
IP dest: 222.222.222.222 A and destination address of B
• Forward the packet to datalink layer:
IP encapsulate it to a data-link frame with Original
Eth MAC Address of A and destination MAC
Phy address of R LAN: Local Area Network
A B
R
111.111.111.111
Switch
Switch 222.222.222.222
Reading: 4.3 Computer Networks, Tanenbaum
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

73 75

73 75

36 37
10/4/2024 10/4/2024

LAN topology LLC: IEEE802.2

• Roles:
• Connect with protocols of Network Layer: IPX, DCE, IP,
v.v..
• With different physical layers: cable, wireless, optical
WLAN • Functionalities:
• Multiplexing/ Demultiplexing
Traditional bus • Flow control with 3 different modes:
topo • Unacknowledged connectionless
• Acknowledged connectionless
• Connection mode
• Frame structure:
• DSAP & SSAP: Destination/Source SAP, for
Multiplexing/ Demultiplexing of the upper layer (which
entity of the Network Layer is sending/ receiving LLC
frames)
hub, switch • Control: define PDU to transfer and control:
• U-frame: send/receive in connectionless mode (U: Unnumbered)
• I-frame: frame with information (I: Information), used in
acknowledged mode
Ring Star • S-frame: for controlling (S: Supervisor)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

76 78

76 78

LAN standards: IEEE 802.x Practical LLC

• IEEE 802.1 Network Management • Error checking and flow control (I-frame and S-frame) are
• IEEE 802.2 Logical link control used by some upper protocols (NetBIOS).
• IEEE 802.3 Ethernet (CSMA/CD) • U-frame encapsulate PDU without numbering (unnumbered)
• IEEE 802.4 Token bus and therefore NO flow control or error checking are
• IEEE 802.5 Token Ring provided.
• IEEE 802.6 Metropolitan Area
Networks • Most upper protocols of LLC (TCP/TP) support error
• IEEE 802.7 Broadband LAN using checking and flow control
• IEEE 802.12 demand priority
Coaxial Cable
• Only use LLC as “Unacknowledged connectionless” with U-frame.
• IEEE 802.8 Fiber Optic TAG • IEEE 802.14 Cable modems
• IEEE 802.9 Integrated Services • IEEE 802.15 Wireless PAN
LAN
• IEEE 802.10 Interoperable LAN • IEEE 802.15.1 (Bluetooth)
Security
• IEEE 802.15.4 (ZigBee)
• IEEE 802.11 Wireless LAN
• IEEE 802.16 WiMAX
• V.v…

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

77 79

77 79

38 39
10/4/2024 10/4/2024

Ethernet LAN Ethernet frame


• Layer 2 technology for communication in LAN, invented in
1976
• Standardized in IEEE 802.3
• Preamble: Marking the starting of a frame
• Ethernet LAN could have different speeds: 3 Mbps – 10 Gbps
• Ethernet: 10BaseT, 10Base2… • Address: Physical addresses of source and destination
• Fast Ethernet: 100BaseT • 6 bytes
• Giga Ethernet
• Type: Upper layer protocol (IP, Novell IPX, AppleTalk, …)
• Checksum: Error detection code. CRC??
Metcalfe’s Ethernet
sketch

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

80 84

80 84

IEEE 802.3 and Ethernet Standards Switched Ethernet


 Switched Ethernet (popular nowdays):
 Datalink & Physical Layers  Star topology,
 Use a central switch Ethernet
 Datalink= LLC + MAC
 The switch outputs a frame only to the port linking to the
 MAC: CSMA/CD in classical Ethernet destination  independent connection for each pair of two nodes
 Several type of Ethernet  No collision
 Same MAC and frame structure  No media access control is needed.
 Different rate: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10G bps
 Different cable: Optical fiber, coaxial, twisted pair

MAC protocol
application and frame format
transport
network 100BASE-TX 100BASE-T2 100BASE-FX
link 100BASE-T4 100BASE-SX 100BASE-BX switch
physical
bus: coaxial cable star
copper (twister fiber physical layer
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology pair) physical layer TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

81 85

81 85

40 41
10/4/2024 10/4/2024

Standards

802.11b 802.11g
Band 2.4-5 GHz (unlicensed Band 2.4-5 GHz
spectrum) Maximum speed 54
Maximum speed 11 Mbps Mbps

Wireless LAN 802.11a 802.11n: use multiple


antennas (MIMO)
Band 5-6 GHz
Band 2.4-5 GHz
Maximum speed 54 Mbps
Maximum speed 200
Mbps

 Employ CSMA/CA for multiple access control


 Working in 2 modes : base-station and ad hoc
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

86 88

86 88

Overview of 802.11 LAN 802.11: Chanel and connection

Band is divided into 14 chanels spaced 5MHz


apart. Europe uses 13 channels, America uses 11
 Include base station = channels, Japan uses 14 channels.
Internet access point) and Admin chooses a working frequency for AP (may
stations with wireless leave AP to choose automatically)
network interfaces
Station: need to connect to an AP
hub, switch  Base station mode
Scan channels, listen to initial frames (beacon frames)
hay router  Basic Service Set (BSS)
AP containing the ID (SSID) and MAC address of the AP
 wireless hosts
Choose one AP.
BSS 1  access point (AP): base
AP station
 Ad hoc mode:
 Stations pay also the
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG BSS 2
School of Information and Communication Technology
role of AP TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

87 89

87 89

42 43
10/4/2024 10/4/2024

802.11: Chanel and connection IEEE 802.11: Multiple access control

• 802.11: CSMA
• 802.11: CA – Collision Avoidance
• It is difficult to implement Collision detection (CD) in
wireless environment.
• In some cases, it is even impossible to detect the collision :
hidden terminal, fading

A B C
C
A’s signal C’s signal
B strength strength
A

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
space
School of Information and Communication Technology School of Information and Communication Technology

90 92

90 92

Scanning mechanism: active/passive IEEE 802.11 MAC Protocol: CSMA/CA


Sender
1 If the channel is available during DIFS time then Sender Receiver
BBS 1 BBS 2 BBS 1 BBS 2
Send the entire frame (no CD)
2 if channel is busy then DIFS
AP 1 AP 2 AP 1 1 AP 2 Starting random back-off (waiting)
1 1 2 2
2 3 At the end of back-off time, send data
3 4 data
If no ACK is received, double the back-off
H1 H1
time and try again.
Passive Scanning: Active Scanning: Receiver SIFS
(1) Beacon frames are sent from APs (1) H1 broacast the request to find
an AP
- If receive well a frame then ACK
(2) H1 send a connection request to
AP2 (2) APs reply with their information reply by an ACK after SIFS
(3) AP2 accepts the request (3) H1 send a connection request to
AP2
(4) AP2 accepts the requests DIFS: Distributed Inter Frame Space Why need ACK?

SIFS: Short Inter Frame Space


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

91 93

91 93

44 45
10/4/2024 10/4/2024

Avoid Collision mechanism Example of CSMA/CA on 802.11

Idea: Sender can reserve channel without random access DIFS DIFS DIFS DIFS
avoid collision for long frame boe bor boe bor boe busy
station1
 Sender send frame RTS (request-to-send) to BS using CSMA
RTS may meet a collision (with low probability because station2
boe busy

the frame is short)


 BS broadcast the frame CTS (clear-to-send CTS) to answer busy
station3
 All stations receive CTS
boe bor
Sender send data frame station4
boe busy

All other stations has to cancel the intention to send


frames. boe bor boe busy boe bor
station5
t

Avoid collision thanks to the reservation busy Using channel boe backoff time (elapsed)
made by small size control frames
Request to send data bor backoff time (residual)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

94 96

94 96

Collision Avoidance using RTS-CTS 802.11 frame: Addressing

A B
AP

2 2 6 6 6 2 6 0 - 2312 4
frame address address address seq address
reservation collision duration payload CRC
control 1 2 3 control 4

Address 4: Using in
adhoc mode
Address 1: address of
the destination Address 3: MAC address of
the router attached to the
DATA (A) AP
defer
Address 2: address of the source

time

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

95 97

95 97

46 47
10/4/2024 10/4/2024

802.11 frame: Addressing

Internet
H1 R1 router
AP

Virtual LAN
R1 MAC addr AP MAC addr
dest. address source address

802.3 frame

AP MAC addr H1 MAC addr R1 MAC addr


address 1 address 2 address 3

802.11 frame
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

98 100

98 100

802.11 frame Virtual LANs (VLANs): motivation

frame seq #
Duration of the reservation (RTS/CTS) (ACK)
Q: what happens as LAN sizes scale, users change point of attachment?
2 2 6 6 6 2 6 0 - 2312 4
single broadcast domain:
frame address address address seq address
duration payload CRC  scaling: all layer-2 broadcast traffic
control 1 2 3 control 4
(ARP, DHCP, unknown MAC) must
cross entire LAN
Computer  efficiency, security, privacy issues
Science EE
2 2 4 1 1 1 1 1 1 1 1
Protocol To From More Power More
Type Subtype Retry WEP Rsvd
version AP AP frag mgt data

frame type
(RTS, CTS, ACK, data)
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

99 Link Layer: 6-101

99 101

48 49
10/4/2024 10/4/2024

Virtual LANs (VLANs): motivation Port-based VLANs

Q: what happens as LAN sizes scale, users change point of attachment?  traffic isolation: frames to/from ports
single broadcast domain: 1-8 can only reach ports 1-8
 scaling: all layer-2 broadcast traffic • can also define VLAN based on MAC
addresses of endpoints, rather than
(ARP, DHCP, unknown MAC) must switch port
cross entire LAN
 dynamic membership: ports can be
 efficiency, security, privacy, efficiency
Computer dynamically assigned among VLANs
issues
7 9 15
Science
1
EE 2 8 10 16

administrative issues:  forwarding between VLANS: done via … …

 CS user moves office to EE - physically routing (just as with separate EE (VLAN ports 1-8) CS (VLAN ports 9-15)

attached to EE switch, but wants to switches)


remain logically attached to CS • in practice vendors sell combined
switch switches plus routers

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-102 Link Layer: 6-104

102 104

Port-based VLANs VLANS spanning multiple switches

port-based VLAN: switch ports grouped (by


switch management software) so that
single physical switch ……
Virtual Local Area
Network (VLAN) 7 9 15 1 7 9 15 1 3 5 7
1

switch(es) supporting
2 8 10 16 2 4 6 8
2 8 10 16

… … … … …
VLAN capabilities can
EE (VLAN ports 1-8) CS (VLAN ports 9-15)
be configured to define EE (VLAN ports 1-8) CS (VLAN ports 9-15) Ports 2,3,5 belong to EE VLAN
Ports 4,6,7,8 belong to CS VLAN

multiple virtual LANS … operates as multiple virtual switches


trunk port: carries frames between VLANS defined over multiple
over single physical
physical switches
LAN infrastructure.
1 7 9 15  frames forwarded within VLAN between switches can’t be vanilla 802.1
2 8 10 16
frames (must carry VLAN ID info)
… …  802.1q protocol adds/removed additional header fields for frames
EE (VLAN ports 1-8) CS (VLAN ports 9-15)
forwarded between trunk ports

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-103 Link Layer: 6-105

103 105

50 51
10/4/2024 10/4/2024

802.1Q VLAN frame format Access networks

• Access networks gather data from users to


type
feed to core network
preamble dest.
address
source
address data (payload) CRC
802.1 Ethernet frame • Popular access networks for providing services
to users
type – Public telephone network
preamble dest.
address
source
address data (payload) CRC 802.1Q frame – TV Cable network
– Internet to home network.
2-byte Tag Protocol Identifier Recomputed
(value: 81-00) Tag Control Information CRC
(12 bit VLAN ID field, 3 bit priority field like IP
TOS)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-106

106 108

Architecture of access network

Access networks using


optical fiber

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

107 109

52 53
10/4/2024 10/4/2024

Architecture of access network Optical access network: FTTx

• Hub • Data is distributed on the fiber cable in the distribution


network until ONU (Optical Network Unit)
– Device on the service provider side receiving
data – Expectation: fiber approaches the customers
• FTTCab (Fiber To The Cabinet):
Optical fiber ends at a cabinet in
• Network Interface Unit (NIU) less than 1 km distance to the subscriber using copper
– Device on the user side connecting an user or an cable.
organization • ONU serves
FTTC (Fiber To The Curb) / FTTB(Fiber To The Building);
• Remote Node (RN) some subscribers (8 to 64); from ONU to NIU using copper
cable (< 100m)
– In broadcasting networks, RN distribute data
from Hub to NIUs • FTTH (Fiber To The Home); ONUs performs the
– In switched networks, RN receive data from Hub functionality of NIUs;
and distribute different flows to NIUs

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

110 112

Technologies for connecting to ISP using cable Optical access network: FTTx

• Dial-up: • ADSL technology:


• speed 56kbps, • Speed few Mbps,
• Using telephone line • Using telephone line
• Data is transmitted using • Data is transmitted in
the same frequency with different frequency than
voice  either data or voice, technology used in
voice communication 2000-2010
available • Technology using TV cable
• Obsolete technology, • FTTH technology:
used before 2000
• Speed dozens Mbps,
• Using optical fiber
• Popular technology
nowadays
An example of ONU: optical modem
Figure taken from book Optical Networks: A Practical Perspective, Rajiv Ramaswami, Kumar
Sivarajan
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

111

111 113

54 55
10/4/2024 10/4/2024

Optical access networks: FTTx EPON: Ethernet PON

• EPON: PON transport Ethernet frames


• Down stream
• Broadcast common data

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

114 116

AON vs. PON EPON

Remote Note (Distribution nodes) distribute


data toward destinations.
• Upstream: Mux Ethernet frames
AON: Active Optical Network from users to the common link OLT-
-Remote Node consume electricity RN using TDM
-Remote node analyse and forward packets to
destination according to addresses
-Cable distance can go up to 100 km.

PON: Passive Optical Network


-Remote Node does not consume electricity
-Remote node (Splitter) does not analyze but
repeat signal to all out ports
-Upstream: MUX from different sources using
TDM (TDM PON) or WDM (WDM PON)
-Cable distance is limited within 20km

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

115 117

56 57
10/4/2024
10/4/2024

GPON: Gigabit Capable PON

• GPON may be used to carry different data:


Ethernet, ATM, voice …
• Data from OLT to users share common chanel
between OLT or RN
• Downstream broadcast Chapter 4
• Upstream TDM Network Layer
• Data are encapsulated in GPON frames with ID of
the receiver (downstream direction), sender
(upstream direction)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology 1
118

1
118

WPON (WDM PON)


• Developed by compagnies and has not been standardized
• Each ONT use a wavelength to transmit data
• Remote note is AWG (arrayed waveguide grating). The AWG is
capable to MUX/DEMUX wavelengths from up and down
streams.

4.1 Introduction about


Network Layer

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

119
2

58
1
10/4/2024 10/4/2024

Network layer in the TCP/IP architecture Main functionalities

• Routing: Finding a path to send data from source to


Application Support network applications
destination
(HTTP, Mail, …)
• Forwarding: Sending a packet to the outgoing port
Transport along the established route
Control data transmission between processes
(UDP, TCP …) at the application layer
• Addressing: Identifying addresses for network
Network Controlling data transmission to another nodes
network
(IP, ICMP…)
• Encapsulating data: Packaging data for transmission
Datalink Facilitating communication for • Quality of Service (QoS): Ensuring appropriate
(Ethernet, ADSL…) subsequent components on the same parameters of the transmission path for each
network
Physical service
Transmitting and receiving bit streams
(bits…) on the physical transmission line

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

3 5

3 5

Network layer Routing and forwarding


application
transport Routing protocol determining
• Data transmission from host to network
data link Routing protocol the shortest path between two
host physical
network network communicating parties
data link data link
network
• Implemented on every end data link
physical physical
Forwarding table
physical Forwarding table
system and router
network network
data link data link dest address outgoing port
physical physical
net. address/net.mask 1 determining the outgoing
• Transmission unit: datagram net. address/net.mask 2 port to route data to the
network
data link
network
data link net. address/net.mask 1 destination
• Sender: receives data from the physical
network
physical

transport layer, encapsulates it data link


physical Packet (header contains
application
the destination address)
• Receiver: opens the package, network
data link network
transport
network

transfers the data portion in the network


data link
physical data link
physical
data link
physical 1
payload to the transport layer physical
3 2
• Router: routes and forwards
packets
Hình ảnh từ: “Computer Networking: A Top Down
Approach”, Jim Kurose
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

4 6

4 6

2 3
10/4/2024 10/4/2024

Network layer protocols Basic characteristics of IPv4

• Connectionless-oriented protocol
Transport layer: TCP, UDP
• Unreliable / Fast
Routing protocol ICMP
• Data transmission using 'best effort' method
• Routing • Notify errors • IP lacks error recovery mechanisms
Network • RIP, OSPF,
BGP
• Check network node status
• When needed, applications will use upper-layer
layer services to ensure reliability (TCP)
IP
• Identification • It is a routed protocol

Encapsulation • Requires routing protocols to pre-determine
• Forwarding
• QoS
paths for data.
link layer • Currently, there are 2 versions: IPv4 and IPv6.
physical layer

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

7 9

7 9

4.2. Internet Protocol v4 IPv4 address

8 10

8 10

4 5
10/4/2024 10/4/2024

IP address (IPv4) IPv4 representation

• Decimal representation with dots


• IP address: A 32-bit
number identifying 223.1.1.1
Example:
uniquely a network 223.1.2.1
203.178.136.63 o
interface 223.1.1.2
223.1.1.4 223.1.2.9 259.12.49.192 x
• Interface: 133.27.4.27 o
• Router’s typically have 223.1.1.3 223.1.3.27
223.1.2.2 8 bits
multiple interfaces 0 – 255 integer
• host may have multiple
interfaces
• IP addresses associated
223.1.3.1 223.1.3.2 Use 4 x 8 bits describing a 32 bits address
with interface, not host, 3417476964
router
223.1.1.1 = 11011111 00000001 00000001 00000001 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0

223 1 1 1 203 178 143 100


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

11 13

11 13

IPv4 address allocation Host address, network address

• Static IP allocation: • IP address contains two parts


• Windows: Control Panel 🡪 Network 🡪 • Host ID – identify a host in a network
Configuration 🡪 TCP/IP 🡪 Properties • Network ID – identify a network
• Linux: /etc/network/interfaces Network ID Host ID

• Dynamic allocation: DHCP- Dynamic Host


1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0
Configuration Protocol
203 178 143 100

● How to know which bits belong to network ID or host


ID parts?
● Use classful IP address
● Use classless IP address– CIDR
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

12 14

12 14

6 7
10/4/2024 10/4/2024

Address types Exercises

• Network Address: ●Determine which classes do these IP addresses


• Identification for a network belong to:
• All bits in the HostID part are set to 0 ● 10.10.10.9
• 0.0.0.0: Network-wide address, representing any ● 192.168.70.5
network
● 129.60.4.7
• Broadcast Address
• Address used to send data to all stations in the network
• All bits in the HostID part are set to 1
• 255.255.255.255: Broadcast address within a network
• Unicast Address
• Assign to a network interface
• Multicast address: Identification for a group

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

15 17

15 17

Classful addressing for IPv4 addresses Limitation of classful IP address


8bits 8bits 8bits 8bits
● Inefficient use of addressing space
● Hard classification of addressing space into classes (A, B,
C, D, E) makes it is difficult to use all the address space

Solution…
● CIDR: Classless Inter Domain Routing
● Network ID part will have variable length.
● Length of Network ID part is specified in Network mask
● Address notation: a.b.c.d/x, where x (mask) the number of
bit of Network ID part.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

16 18

16 18

8 9
10/4/2024 10/4/2024

Network mask Network mask and network size

● Network mask divides the IP address into two parts • Network mask: /n
● Part corresponding to Host ID
● Part corresponding to Network ID • Network size: The maximum nodes in a
• Representation: network
• Prefix: /n. Example: /27 • IP Address: NetworkID HostID
• n: Number of bits of NetworkID
• Binary representation:
n bit (32-n) bit

1 1 . . . . . . . . . . 1
0
0 . . . . . . . . . . . . . . . . 0
• The number of addresses for hosts (Unicast
Address):
n bits /27 = 11111111 11111111
• Example: (32 11111111
– n) bits 11100000 232-n - 2
• Decimal representation with dot: 255.255.255.224

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

19 21

19 21

Calculation of network address Exercice: IP address and network mask

Network part Host Part


● Which of the following IP addresses are host
203 . 178 . 142 . 130
IP Address address, network address, broadcast address?
11001011 10110010 10001110 10000010
(1) 203.178.142.128 /25
255 . 255 . 255 . 224 (2) 203.178.142.128 /24
Netmask (/27) 11111111 11111111 11111111 11100000
(3) 203.178.142.127 /25
AND
27 (bit) (4) 203.178.142.127 /24
203 . 178 . 142 . 128
● Attn: With CIDR addressing, IP address should
11001011 10110010 10001110 10000000
always coming with a network mask
Network address 203.178.142.128/27
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

20 22

20 22

10 11
10/4/2024 10/4/2024

Subnet Principle

● Subnet is a part of a ●Divide a IP range into sub-ranges of equal size


network 223.1.1.1

● Hosts of a subnet 223.1.2.1 ●Take some bits from HostID part to distinguish
communicate directly
223.1.1.2
223.1.1.4 223.1.2.9
subnets
without reaching to ● each subnet contains IP addresses with a fixed values
layer 3. 223.1.2.2 of subnet ID.
223.1.1.3 223.1.3.27
● Usually is one
department of an subnet Host ID
Network ID
organization
223.1.3.1 223.1.3.2
● Design question: How
to assign addresses of a subnetID
network to subnets
A network with 3 subnets.
● Use a longer netmask
network ID of each subnet
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

23 25

23 25

Example: Divide into 2 subnets Exercise: Dividing into subnets

●Given IP addresses in the range 200.23.16.0/24


1) Need to organize into 8 subnets
11001000 00010111 00010000 00000000
● Address of each subnetwork? Mask? Number of
200. 23. 16. 0 /24 hosts/network
● 200.23.16.0 /27
2) General question: Need to create N subnets.
11001000 00010111 00010000 00000000 Network address? Mask?
200. 23. 16. 0 /25 /28
● Each network contains 14 hosts
11001000 00010111 00010000 10000000 ● Each network contains 30 hosts /27
200. 23. 16. 128 /25 ● Each network contains 31 hosts /26
● Each network contains 70 hosts /25

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

24 26

24 26

12 13
10/4/2024 10/4/2024

Addressing space of IPv4 Management of public IP addresses

● In theory • Internet Corporation for Assigned Names and Numbers


● All between 0.0.0.0 ~ 255.255.255.255 (ICANN): Manages the entire IP address resources
● Some special IP address (RFC1918)
• Regional Internet Registries: Manage IP addresses by
10.0.0.0/8
regions (Asia-Pacific, Europe and the Middle East,
Private address 172.16.0.0/12 Africa, North America, South America)
192.168.0.0/16 • National management agencies
Loopback address 127.0.0.0 • Vietnam: VNNIC
224.0.0.0 • Internet Service Provider (ISP)
Multicast address
~239.255.255.255
• Agencies, organizations

● Self assigned IP address: 169.254.0.0/16 (self-configuration)


• Examples: ICANN 🡪 APNIC 🡪 VNNIC 🡪 HUST

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
30
28

28 30

Attention about IP

●Currently IPv4: 32 bits


● 133.113.215.10 (IPv4)
●IPv6 is also widely used: 128bits
● 2001:200:0:8803::53 (IPv6)
● Fix 64 first bit for subnet ID, 64 last bit belongs to
interface ID.
● Security feature is integrated 4.3. IP packet’s format

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

29 31

29 31

14 15
10/4/2024 10/4/2024

Header of IP IP header (2)


IP protocol version 32 bits total datagram
number length (words) • Length: total length including header (16 bits)
ver head. DS length • In bytes unit
header length len for • Max: 65536
(bytes) fragment
16-bit identifier flgs fragmentation/
offset
QoS support time to upper header
reassembly • 16 bits Identifier– ID of the packet
live layer checksum • Used for identifying all fragments of the same packet
max number 32 bit source IP address when it is fragmented
remaining hops
32 bit destination IP address
• Flag
(decremented at
each router)
• Fragmentation offset – offset of the first byte of the
Options (if any) E.g. timestamp,
record route fragment in its original packet
data taken, specify
upper layer protocol (variable length, list of routers
to deliver payload to typically a TCP to visit.
or UDP segment)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

32 34

32 34

IP header (1) IP header (3)

●Version (4 bits) • TTL, 8 bits – Time to live


● IPv4 • Maximum number of hops (router) the packet is allowed
● IPv6 to travel
• Max: 255
●Header length: 4bits • Router decreases TTL 1 unit when processing a packet
● In word unit (4 bytes) • The packet will be destroyed when TTL reaches to 0
● Min: 5 • Protocol – upper layer protocol
● Max: 60 • Transport protocol (TCP, UDP,…)
●DS (Differentiated Service : 8bits) • Other network layer protocols that are encapsulated in
● Old name: Type of Service IP packet (ICMP, IGMP, OSPF )
● Used for QoS management by some router
● Diffserv

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

33 35

33 35

16 17
10/4/2024 10/4/2024

IP header (4) Packet fragmentation (2)


●Checksum: to detect corruption in the header • Identification
of IPv4 data packets • ID is used to identify fragmentations of the same
packet
●Source IP address
● 32 bit, address of the sender • Flags – (3 bits)
• 1st bit: reverse
●Destination IP address
• 2nd bit: No more fragments
● 32 bit, address of the receiver.
• 3rd bit: Still fragments
• Offset
• Position of the fragments in the original packet
• In units of 8 bytes

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

36 38

36 38

Packet fragmentation (1) Packet fragmentation (3)

● Each link has a fixed MTU ●Offset


(Maximum transfering unit)
● Position of the fragment in the original packet
● Different media have ● In 8 bytes units
Fragmentation:
different MTU in: 1 big packet
out: 3 smaller packet
● If IP packet > MTU, it 0 1399

should be Offset = 0/8 = 0


● Divided into small fragments
● Gathered at the destination Merge 0 1400 2800 3999 1400 2799
Offset = 1400/8 = 175

2800 3999
Offset = 2800/8 = 350

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

37 39

37 39

18 19
10/4/2024 10/4/2024

Packet fragmentation (4) Chuyển tiếp gói tin IP

• Mỗi nút mạng sử dụng bảng chuyển tiếp


Example
length ID fragflag
=4020 =x =0
offset
=0
(Forwarding Table)
❖ Packet: 4020 byte • Là một phần của bảng định tuyến (Routing Table)
(header: 20 byte)
❖ MTU = 1500 bytes
• Các thông tin:
• Đích đến (Destination): Địa chỉ mạng/Mặt nạ (/n)
1480 bytes in length ID fragflag
data field
offset • Lối ra mặc định: Sử dụng địa chỉ 0.0.0.0/0 đại
=1500 =x =1 =0
diện cho một đích bất kỳ chưa biết
offset = length ID fragflag offset • Cổng ra (Outgoing port): địa chỉ của cổng ra trên
1480/8 =1500 =x =1 =185 router để chuyển tới nút kế tiếp trong đường đi
length ID fragflag offset
=1060 =x =0 =370

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
40 TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

42

40 42

Forwarding table

Forwarding table

Forwarding table
dest address outgoing port
net1. address/net.mask 1

4.4. Forwarding IP packet net2. address/net.mask


net3. address/net.mask
2
1

Packet (header contains


the destination address)

1
3 2

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

41 43

41 43

20 21
10/4/2024 10/4/2024

Example – Forwarding table on a host Routing table and forwarding mechanism (1)

C:\Documents and Settings\tungbt>netstat –r


Route Table
• Compare the first n bits of the destination packet
======================================================================== address with the corresponding bits on the destination
Interface List network address
Destination………MS TCP Loopback
0x1 ........................... Outgoing
interfaceport
• /n: Destination network mask
0x2 ...08 00 1f b2 a1 a3 ...... Realtek RTL8139 Family PCI Fast Ethernet NIC -
======================================================================== • If there is a match with the destination network, forward to
the corresponding port.
Network Netmask Gateway Interface Metric
• If no matching destination network is found, forward to the
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.34 20
default port (if available)
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.1.0 255.255.255.0 192.168.1.34 192.168.1.34 20 Destination Outgoing Port
192.168.1.34 255.255.255.255 127.0.0.1 127.0.0.1 20
192.168.1.255 255.255.255.255 192.168.1.34 192.168.1.34 20
Destination address of a packet: 11.0.0.0 /8 Se0/1
224.0.0.0 240.0.0.0 192.168.1.34 192.168.1.34 20 11.2.4.10
255.255.255.255 255.255.255.255 192.168.1.34 192.168.1.34 1
11.1.0.0 /16 Se0/2
11.1.2.0/24 Se0/3
Default Gateway: 192.168.1.1
========================================================================

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

44 46

44 46

Example – Forwarding table on a router (shorten) “Longest matching” rule (1)

● Assume that there are more than one entry


Destination Outgoing port matching with a destination network in routing
table.
Router# show ip route ● Destination address: 11.1.2.5
● What should be chosen as the next hop?
O 203.238.37.0/24 via 203.178.136.14, FastEthernet0/1
O 203.238.37.96/27 via 203.178.136.26, Serial0/0/0
C 203.238.37.128/27 is directly connected, Serial0/0/0 Network Next hop
O 192.68.132.0/24 via 203.178.136.14, FastEthernet0/1 11.0.0.0/8 A
C 203.254.52.0/24 is directly connected, FastEthernet0/1 11.1.0.0/16 B
C 202.171.96.0/24 is directly connected, Serial0/0/1
11.1.2.0/24 C

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

45 47

45 47

22 23
10/4/2024 10/4/2024

“Longest matching” rule (2)

Destination address:
11.1.2.5 = 00001011.00000001.00000010.00000101
Route 1:
11.1.2.0/24 = 00001011.00000001.00000010.00000000
4.5. Internet Control Message Protocol
Route 2:
11.1.0.0/16 = 00001011.00000001.00000000.00000000
Route 3: Packet format
11.0.0.0/8 = 00001011.00000000.00000000.00000000 Ping and Traceroute

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

48 50

48 50

Forwarding on a router Idea of ICMP (1)

• S1: If TTL = 1 (or TTL = 0), discard the packet and • IP is unreliable, connectionless
report an error. End. • Lack of supporting and error control mechanism
• S2: If TTL > 1, retrieve the destination address (DA) of
the packet. Mask the destination address of the packet • ICMP is used in network layer for providing
with the destination network masks. information exchange between sender and
• S3: Compare the masked result with the corresponding
receivers
destination network address. If a matching destination • Error information: inform that a packet cannot reach
network is found, forward to the corresponding a host, a network or a port.
outgoing port, and decrement TTL. • Also in network layer but is “above” IP
• S4: If no matching destination network is found, check • ICMP message is encapsulated in IP
the default outgoing port (corresponding to 0.0.0.0/0). • ICMP message: Type, Code, with 8 first bytes of the
• If there is a default port: Forward the packet to the default error IP message
port and decrement TTL.
• If there is no default port: Discard the packet and report an IP header ICMP message
error.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

49 51

49 51

24 25
10/4/2024 10/4/2024

IP header and Protocol field Some ICMP message types

3 Destination Unreachable

HLE 4 Source quench (nguồn giảm tốc độ)


Ver DS Total Length
N
Protocol: Error-reporting
5 Redirection

ICMP Message Type


Fragmentation messages
Identification Flags
offset 1: ICMP
11 Time exceeded
TTL Protocol Header Checksum 2: IGMP
6: TCP 12 Parameter problem
Source IP address
17: UDP 8 or 0 Echo reply or request
Destination IP address
89: OSPF 13 or 14 Time stamp request or reply
Query
Option
messages 17 or 18 Address mask request or reply

9 or 10 Router advertisement or solicitation

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

52 54

52 54

ICMP message format ICMP and debuging tools

●ICMP always works transparently for users


●Type: type of ICMP message
●Users can use ICMP by using some debuging
●Code: cause of error
tools
●Checksum ● ping
●Rest of header varies according
1
on type ● traceroute
7 5 3
0
8 1 1
Type Code 6 Checksum

Rest of the header

Data

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

53 55

53 55

26 27
10/4/2024 10/4/2024

Ping and ICMP Traceroute and ICMP


• Syntax:
• ping • Windows: tracert host_address
• Test a connection • Linux: traceroute host_address
• Sender sends packet “ICMP echo request” • Sender send many packets to receiver
• Receiver responses with “ICMP echo reply” • First packet has TTL =1
• Data field contains the time stamp when the • Second packet has TTL=2, …
packet is sent • When packet number n arrives to nth router:
• For calculating RTT (round-trip time) • Router destroys the packer
• Router send back an ICMP packet (type 11, code 0)
containing IP address of the router
• Based on the reply message, the sender can calculate RTT
3 probes 3 probes

3 probes

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

56 58

56 58

Ping: Example Traceroute and ICMP

C:\Documents and Settings\hongson>ping www.yahoo.co.uk

Pinging www.euro.yahoo-eu1.akadns.net [217.12.3.11] with 32 bytes of data:


Termination condition
• When ICMP echo packet arrive to the destination
Reply from 217.12.3.11: bytes=32 time=600ms TTL=237
Reply from 217.12.3.11: bytes=32 time=564ms TTL=237
• When source receives ICMP “host unreachable”
Reply from 217.12.3.11: bytes=32 time=529ms TTL=237
(type 3, code 3)
Reply from 217.12.3.11: bytes=32 time=534ms TTL=237

Ping statistics for 217.12.3.11:


Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 529ms, Maximum = 600ms, Average = 556ms

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

57 59

57 59

28 29
10/4/2024 10/4/2024

Traceroute: Example Basic concepts of NAT


C:\Documents and Settings\hongson>tracert www.jaist.ac.jp

• Data transmitted from the LAN (using local


addresses) to the Internet (using public addresses)
Tracing route to www.jaist.ac.jp [150.65.5.208]
over a maximum of 30 hops:

and vice versa needs address conversion


🡪 NAT(Network Address Translation) is performed
1 1 ms <1 ms <1 ms 192.168.1.1
2 15 ms 14 ms 13 ms 210.245.0.42
3 13 ms 13 ms 13 ms 210.245.0.97
4 14 ms 13 ms 14 ms 210.245.1.1 on the router
5 207 ms 230 ms 94 ms pos8-2.br01.hkg04.pccwbtn.net [63.218.115.45]
6 * 403 ms 393 ms 0.so-0-1-0.XT1.SCL2.ALTER.NET [152.63.57.50] • In practice, NAT can be used to convert IP
addresses from one LAN to another
7 338 ms 393 ms 370 ms 0.so-7-0-0.XL1.SJC1.ALTER.NET [152.63.55.106]
8 402 ms 404 ms 329 ms POS1-0.XR1.SJC1.ALTER.NET [152.63.55.113]
9 272 ms 288 ms 310 ms 193.ATM7-0.GW3.SJC1.ALTER.NET [152.63.49.29]
10 205 ms 206 ms 204 ms wide-mae-gw.customer.alter.net [157.130.206.42] • Benefits:
11 427 ms 403 ms 370 ms ve-13.foundry2.otemachi.wide.ad.jp [192.50.36.62]
12 395 ms 399 ms 417 ms ve-4.foundry3.nezu.wide.ad.jp [203.178.138.244]
• Conserves public IP addresses
13 355 ms 356 ms 378 ms ve-3705.cisco2.komatsu.wide.ad.jp [203.178.136.193] • Hides private addresses
14 388 ms 398 ms 414 ms c76.jaist.ac.jp [203.178.138.174]
15 438 ms 377 ms 435 ms www.jaist.ac.jp [150.65.5.208] • Reduces configuration costs when changing ISPs
Trace complete.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

60 62

60 62

Static NAT

• The simplest form of NAT


• One private IP address is assigned to a specific
public IP address
• The NAT router maintains a translation table in
memory
4.6. Network address translation • This table maps internal private addresses to
external Internet addresses
• Often used for servers within the LAN to
provide services to the public network

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
63
61

61 63

30 31
10/4/2024 10/4/2024

Static NAT - Example Dynamic NAT – Example


Src: a.b.c.d Src: 202.191.56.15 Src: 10.0.0.31
Src: a.b.c.d
Dst: 10.0.0.20 Dst: a.b.c.d Dst: a.b.c.d
Dst: 202.191.56.65

Src: a.b.c.d Src: a.b.c.d


Dst: 202.191.56.15 Dst: 10.0.0.31

Src: ? Src: 10.0.0.32


Src: 202.191.56.65 Src: 10.0.0.20 Dst: a.b.c.d Dst: a.b.c.d
Dst: a.b.c.d Dst: a.b.c.d

NAT Table Inside IP Outside IP NAT Table Inside IP Outside IP

10.0.0.10 202.191.56.11 10.0.0.31 202.191.56.15


10.0.0.32 202.191.56.16
10.0.0.20 202.191.56.65
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

64 66

64 66

Dynamic NAT Port Address Translation (PAT)

• The NAT router automatically maps a range of • Also known as NAT overloading
private IP addresses to a range of public IP • It is a special form of dynamic NAT to further
addresses so that computers can access the utilize the IPv4 address space
Internet when needed.
• Allows multiple private IP addresses to map to a
• In contrast to static NAT, the administrator single registered public IP address with
does not need to configure a specific private IP different port numbers
address to be associated with a specific public
IP address. • Thus, PAT uses unique sockets to map to each
device
• Any private IP address will be assigned and
automatically translated to one of the available
(idle) public IP addresses in the public address
pool by the NAT router.
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

65 67

65 67

32 33
10/4/2024 10/4/2024

Dynamic NAT – Port Address Translation - Example MAC address and ARP
Src: 202.191.56.15:2001 Src: 10.0.0.31:6000
Dst: a.b.c.d:443 Dst: a.b.c.d:443 • Address Resolution Protocol
Src: a.b.c.d:443 • Finding the MAC address (data link layer identifier)
Src: a.b.c.d:443
Dst: 202.191.56.15:2001 Dst: 10.0.0.31:6000 of a network node when the IP address is known
• Why is ARP needed?
• Communication on the network layer uses IP addresses
• Communication on the data link layer uses MAC
Src: ? Src: 10.0.0.32:7000 addresses
Dst: a.b.c.d:443 Dst: a.b.c.d:443 • During transmission: data moves from the network layer
to the data link layer.
• Data sent within a LAN: The source device needs to know the
MAC address of the destination device
NAT Table Inside IP Outside IP
• Data sent outside the LAN: The source device needs to know
10.0.0.31:6000 202.191.56.15:2001 the MAC address of the default router
10.0.0.32:7000 202.191.56.15: 2002

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
70
68

68 70

ARP: address resolution protocol

Question: how to determine interface’s MAC address, knowing its IP


address?
ARP table: each IP node (host,
router) on LAN has table
ARP

137.196.7.78
ARP
1A-2F-BB-76-09-AD • IP/MAC address mappings for
some LAN nodes:
4.7. Address resolution protocol
ARP

LAN < IP address; MAC address; TTL>


71-65-F7-2B-08-53
137.196.7.23
58-23-D7-FA-20-B0
137.196.7.14 • TTL (Time To Live): time after
ARP 0C-C4-11-6F-E3-98 which address mapping will be
137.196.7.88
forgotten (typically 20 min)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

69 71

69 71

34 35
10/4/2024 10/4/2024

ARP protocol in action ARP protocol in action

example: A wants to send datagram to B example: A wants to send datagram to B


• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address • B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address

A broadcasts ARP query, containing B's IP addr


Ethernet frame (sent to FF-FF-FF-FF-FF-FF)
1 • destination MAC address = FF-FF-FF-FF-FF-FF
• all nodes on LAN receive ARP query C Source MAC: 71-65-F7-2B-08-53 C
Source IP: 137.196.7.23
ARP table in A Target IP address: 137.196.7.14 ARP table in A

IP addr MAC addr TTLTTL IP addr MAC addr TTL TTL
A B 137.196.7.14 58-23-D7-FA-20-B0 500 A B
1
71-65-F7-2B-08-53 58-23-D7-FA-20-B0 71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14 137.196.7.23 137.196.7.14

3 A receives B’s reply, adds B


entry into its local ARP table
D D

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

72 74

72 74

ARP protocol in action Routing to another subnet: addressing

example: A wants to send datagram to B walkthrough: sending a datagram from A to B via R


• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address
▪ focus on addressing – at IP (datagram) and MAC layer (frame) levels
ARP message into Ethernet frame ▪ assume that:
(sent to 71-65-F7-2B-08-53)
• A knows B’s IP address
C Target IP address: 137.196.7.14
• A knows IP address of first hop router, R (how?)
Target MAC address:
ARP table in A 58-23-D7-FA-20-B0 • A knows R’s MAC address (how?)

IP addr MAC addr TTLTTL
A B
2
A B
71-65-F7-2B-08-53 58-23-D7-FA-20-B0 R
137.196.7.23 137.196.7.14 111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
2 B replies to A with ARP 222.222.222.220
1A-23-F9-CD-06-9B
response, giving its MAC address 111.111.111.112 111.111.111.110
D CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

73 75

73 75

36 37
10/4/2024 10/4/2024

Routing to another subnet: addressing Routing to another subnet: addressing

▪ A creates IP datagram with IP source A, destination B ▪ R determines outgoing interface, passes datagram with IP source A, destination B
▪ A creates link-layer frame containing A-to-B IP datagram to link layer
• R's MAC address is frame’s destination ▪ R creates link-layer frame containing A-to-B IP datagram. Frame destination
address: B's MAC address
MAC src: 74-29-9C-E8-FF-55 MAC src: 1A-23-F9-CD-06-9B
MAC dest: E6-E9-00-17-BB-4B MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111 IP src: 111.111.111.111
IP dest: 222.222.222.222 IP dest: 222.222.222.222

IP IP
Eth Et
Phy h
Ph
A B A y
B
R R
111.111.111.111 111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222 74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110 111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221 CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F 88-B2-2F-54-1A-0F

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

76 Link Layer: 6-78

76 78

Routing to another subnet: addressing Routing to another subnet: addressing

▪ frame sent from A to R ▪ R determines outgoing interface, passes datagram with IP source A, destination B
▪ frame received at R, datagram removed, passed up to IP to link layer
▪ R creates link-layer frame containing A-to-B IP datagram. Frame destination
address: B's MAC address
MAC src: 74-29-9C-E8-FF-55 MAC src: 1A-23-F9-CD-06-9B
IP src: 111.111.111.111
MAC dest: E6-E9-00-17-BB-4B
IP dest: 222.222.222.222
▪ transmits link-layer frame MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111 IP src: 111.111.111.111
IP dest: 222.222.222.222 IP dest: 222.222.222.222
IP
IP IP IP Eth
Eth Eth Eth Phy
Phy Phy Phy

A B A B
R R
111.111.111.111 111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222 74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110 111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221 CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F 88-B2-2F-54-1A-0F

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-77 Link Layer: 6-79

77 79

38 39
10/4/2024 10/4/2024

Routing to another subnet: addressing DHCP: Dynamic Host Configuration Protocol

• goal: host dynamically obtains IP address from


network server when it “joins” network
▪ B receives frame, extracts IP datagram destination B • can renew its lease on address in use
▪ B passes datagram up protocol stack to IP • allows reuse of addresses (only hold address while
connected/on)
IP src: 111.111.111.111
• support for mobile users who join/leave network
IP dest: 222.222.222.222
• Application layer services provide IP address
IP
IP
Eth configuration for network nodes:
Eth
Phy
Phy
• IP address
• Subnet mask
A B
R • Default router address (default router, default gateway)
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222 • May include DNS server address for domain name
222.222.222.220
49-BD-D2-C7-56-2A
resolution
111.111.111.112
1A-23-F9-CD-06-9B
111.111.111.110 • Operates on a client/server model: the client uses IP
address parameters assigned by the server
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Link Layer: 6-80 Network Layer: 4-82

80 82

Các thông điệp DHCP

Client Server
• DHCP Discover: find • DHCP Offer: Offer the
DHCP Server information of IP
• DHCP Request: address
4.8. Dynamic Host register to use an IP • DHCP ACK:
Configuration Protocol (DHCP) address Acknowlege the
• DHCP Release: release registration
the using IP address • DHCP NAK: Refuse
• DHCP Decline: Refuse the registration
the offered IP address

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
83
81

81 83

40 41
10/4/2024 10/4/2024

DHCP client-server scenario Extend using


DHCP Client DHCP Server
• Limit time 🡪 extend
Typically, DHCP server will be co- • t = 0.5*T, client sends
t = 0.5*T
DHCP located in router, serving all DHCP Request to DHCP
server subnets to which router is attached
Server to request
223.1.1.1
223.1.2.1

223.1.1.2
223.1.2.5 extension
• No DHCP ACK, then t =
223.1.1.4 223.1.2.9

Other Server
223.1.1.3 223.1.3.27 arriving DHCP client needs 0.875*T, client sends the t = 0.875*T
223.1.2.2 address in this network broadcast DHCP Request
223.1.3.1 223.1.3.2 • No DHCP ACK, while t =
T, client sends DHCP
Discover t=T

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 4-84 86

84 86

DHCP client-server scenario DHCP Relay


• DHCP Server stays on another subnet 🡪 broadcast
DHCP can return more DHCP server: 223.1.2.5 packets will be forwared by routers
🡪 DHCP Relay on routers
DHCP discover Arriving client
than just allocated IP src : 0.0.0.0, 68
Broadcast: is there a
address on subnet:
dest.: 255.255.255.255,67
DHCPyiaddr:
server 0.0.0.0
out there?
transaction ID: 654

▪ address of first-hop DHCP offer

router for client src: 223.1.2.5, 67


Broadcast: I’m a DHCP
dest: 255.255.255.255, 68 DHCP Client Router DHCP Server
server!
yiaddrr:Here’s an IP
▪ name and IP address of address
223.1.2.4
transaction
youID:can
654 use
The two steps above can
DNS sever DHCP request
lifetime: 3600 secs
be skipped “if a client DHCP Discover (broadcast) DHCP Discover (unicast)
remembers and wishes to
▪ network mask (indicating src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
Broadcast: OK. I would reuse a previously
network versus host
yiaddrr: 223.1.2.4
like totransaction
use this ID:
IP655
address! allocated network
DHCP Offer DHCP Offer
lifetime: 3600 secs address” [RFC 2131]
portion of address)
DHCP ACK
src: 223.1.2.5, 67 DHCP Discover (broadcast) DHCP Discover (unicast)
dest: 255.255.255.255,
Broadcast: 68
OK. You’ve
yiaddrr: 223.1.2.4
got that IPID:
transaction address!
655
lifetime: 3600 secs
DHCP ACK/NAK DHCP ACK/NAK

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 4-85 87

85 87

42 43
10/4/2024 10/4/2024

Cải tiến trên IPv6(tiếp)

• Tăng tốc độ xử lý
• Khuôn dạng header đơn giản hơn
• Không phân mảnh gói tin
• Hỗ trợ QoS tốt hơn
• Về an toàn an ninh
• Sử dụng IPSec như một chuẩn
4.9: Introduction about IPv6 • Tự động cấu hình
• Chuẩn hóa cơ chế tự động cấu hình

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

88 90

88 90

Giao thức IPv6

• Xuất phát từ nhu cầu thực tế: địa chỉ IPv4 cạn
kiệt, không đủ để cấp phát
• Cải ến trên IPv6:
• Mở rộng không gian địa chỉ
• Sử dụng địa chỉ có độ dài 128 bit
• Phân vùng địa chỉ(scope)
IPv6 address
Không gian địa chỉ IPv4 Không gian địa chỉ IPv6

1mm 84.000 lần đường kính của thiên hà


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

89 91

89 91

44 45
10/4/2024 10/4/2024

Representa on Address par oning

• 128 bits, represented in hexadecimal • Global address: Network prefix has


• Separated by ":" between groups, each • Global rou ng prefix: 48 bits with the first 3 bits
being 001
consisting of 4 hexadecimal digits
• SubnetID: 16 bits
• Example: 3ffe:501:100c:e320:2e0:18ff:fe98:936d
• Omit consecutive groups of zeros • Link-local address: Network prefix has
• First 10 bits as 1111 1110 10
• Example: 3ffe:501:100c:e320:0:0:0:1 →
• Remaining 54 bits set to 0
3ffe:501:100c:e320::1
• Using network mask notation /n • Local address: Network prefix has
• First 10 bits as 1111 1110 11
• Next 38 bits set to 0
• SubnetID: 16 bits

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

92 94

92 94

Structure of IPv6 addresses IPv6 address types

• 2 parts: Network prefix và Interface ID • Unicast Address: Assigned to a network


• Network prefix: 64 bit interface port.
• Host ID: 64 bit • Anycast Address: Assigned to a group of
• EUI-64 standard (extended unique iden fier ) network interface ports.
• In the case of Ethernet networks, the Host ID is • Packets sent to an anycast address are forwarded to
determined from the MAC address the nearest node determined by the routing
protocol.
• Multicast Address: Assigned to a group of
network interface ports within a scope.
• It begins with 1111 1111.
• Packets sent to a multicast address are delivered to
all nodes in the group.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

93 95

93 95

46 47
10/4/2024 10/4/2024

Header of IPv6 packet (1)

• Version: Protocol version (=110)


• Traffic Class: Protocol identifier for the upper
layer
• Flow Label: QoS control
• Payload Length: Size of the data portion
IPv6 packet format
• Next header: Next header extension
• Hop limit: Similar to TTL

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
98
96

96 98

Format of IPv6 packet Header of IPv6 packet (2)

Version Traffic Class Flow Label ● In IPv6, the extension header is put in the payload
(4 bit) (8 bit) (20 bit) section
Payload Length Next Header Hop Limit
(16 bit) (8 bit) (8 bit) Extension Extension Extension

Header Header Header

Source address ・
(128bit)
Fixed length (40byte) Extension headers if having
Destination address Main information
(128bit)
Next header Ext. header length
(8 bit) (8 bit)
Payload(including extension headers
if having and datagram of the upper layer protocol)

Renamed fields from IPv4


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
97 TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
99

97 99

48 49
10/4/2024 10/4/2024

4.10. Routing What is routing?


Routing principals
Reading 5.2 Forwarding mechanism
Computer Networks, Tanenbaum “Longest matching” rule

100 102

100 102

Contents Routing principles (1)

● When a host send an IP packet to another host


● If the destination and the source are in the same
● What is routing? physical medium: Transfer directly
● Static routing and dynamic routing ● If the destination is in a different network with the
● Routing algorithms and protocols source: Send through some other routers (need to
choose route)

Router Router

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

101 103

101 103

50 51
10/4/2024 10/4/2024

Routing principles (2) What is a router?

●Router is the device that forwards data


between networks
● Is a computer with particular hardware
● Connects multiple networks together, has multiple
network interfaces
Is it destination ? ( ● Forward packets according to routing table
Looking for route)

Destination? (
Looking for route)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

104 106

104 106

What is routing? Some examples of routers…

●A mechanism so that a host or a router decides


how to forward a packet from source to
destination. YAMAHA
RTX-1500 Cisco 2600

●Result of the routing is a routing table BUFFALO


BHR-4RV
PLANEX
GW-AP54SAG
●What to consider in routing Small Routers

● Building routing table


Cisco CRS-1
● Information need to calculating route
● Routing algorithm and protocol. Backbone Routers
Hitachi
Juniper M10 http://www.cisco.com.vn
GR2000-1B
Foundry Networks http://www.juniper.net/
NetIron 800
http://www.buffalotech.com

Cisco 3700 Middle Routers


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

105 107

105 107

52 53
10/4/2024 10/4/2024

Routing table Routing table and forwarding mechanism (2)

●Lists of possible routes, saved in the Internet


memory of router Router A Router B Router C
●Main components of routing table
● Destination network address/network mask 10.0.0.0/24 172.16.0.0/24
● Next router
#show ip route 10.0.0.0/24 192.168.0.0/24 172.16.0.0/24
Prefix Next Hop
203.238.37.0/24 via 203.178.136.14
203.238.37.96/27 via 203.178.136.26
203.238.37.128/27 via 203.178.136.26 Network Next-hop Q. What is the
203.170.97.0/24 via 203.178.136.14 routing table in C?
192.68.132.0/24 via 203.178.136.29 10.0.0.0/24 A
203.254.52.0/24 via 203.178.136.14 172.16.0.0/24 C Q: What if C is
202.171.96.0/24 via 203.178.136.14
connected to the
192.168.0.0/24 Direct Internet?
0.0.0.0/0 C
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

108 110

108 110

Routing table and forwarding mechanism (1) Default route

Network Next-hop ● If router does not find a route to a destination in its


10.0.0.0/24 A
routing table, default route is necessary
● Default route is defined for all destination networks that
172.16.0.0/24 C are not figured in the routing table.
● 0.0.0.0/0
Router A Router B Router C ● Is a special notation for all destination networks

10.0.0.0/24 172.16.0.0/24 Router A


Internet
10.0.0.0/24 192.168.0.0/24 172.16.0.0/24

Next router is always A


Rule: No routes, no reachability!

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

109 111

109 111

54 55
10/4/2024 10/4/2024

Route aggregation Example – Forwarding table on a host


● How many networks in the Internet? C:\Documents and Settings\tungbt>netstat –r
● There will be a lot of entries in the routing table? Route Table
========================================================================
● The entries to sub-networks of the same “big” network can be Interface List
aggregated in order to reduce the size of routing table. 0x1 ........................... ………MS TCP Loopback interface
0x2 ...08 00 1f b2 a1 a3 ...... Realtek RTL8139 Family PCI Fast Ethernet NIC -
========================================================================
200.23.0.0/24
200.23.0.0/23 Network Netmask Gateway Interface Metric

0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.34 20


200.23.1.0/24 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
200.23.0.0/22
192.168.1.0 255.255.255.0 192.168.1.34 192.168.1.34 20
192.168.1.34 255.255.255.255 127.0.0.1 127.0.0.1 20
192.168.1.255 255.255.255.255 192.168.1.34 192.168.1.34 20
200.23.2.0/24 224.0.0.0 240.0.0.0 192.168.1.34 192.168.1.34 20
255.255.255.255 255.255.255.255 192.168.1.34 192.168.1.34 1
200.23.2.0/23
Default Gateway: 192.168.1.1
200.23.3.0/24 ========================================================================

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

112 114

112 114

Route aggregation (2) Example – Forwarding table on a router

●Example of Viettel network


● Viettel own a big IP address space
● 203.113.128.0-203.113.191.255 Router# show ip route
● For connecting to a subnet (client) of Viettel, routing
table needs only to have a route to Viettel network. O 203.238.37.0/24 via 203.178.136.14, FastEthernet0/1
●Default route is a type of route aggregation O 203.238.37.96/27 via 203.178.136.26, Serial0/0/0
● 0.0.0.0/0 C 203.238.37.128/27 is directly connected, Serial0/0/0
O 192.68.132.0/24 via 203.178.136.14, FastEthernet0/1
C 203.254.52.0/24 is directly connected, FastEthernet0/1
C 202.171.96.0/24 is directly connected, Serial0/0/1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

113 115

113 115

56 57
10/4/2024 10/4/2024

Exercises

• A router has the following (CIDR) entries in its routing table:


Address/mask Next hop
135.46.56.0/22 Interface 0 0011 1000
135.46.60.0/22 Interface 1 0011 1100
192.53.40.0/23 Router 1 0010 1000
default Router 2
• For each of the following IP addresses, what does the router do if a packet with that
address arrives?
(a) 135.46.63.10 0011 1111
Static and dynamic routing
(b) 135.46.57.14
(c) 135.46.52.2 Static routing
(d) 192.53.40.7 Dynamic routing
(e) 192.53.56.7 0011 1000 Advantage – Weakness
Solution:
Apply longest matching rule.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

116 120

116 120

Exercise Updating routing table

• Network structure may change


• New network is added.
• Router failure due to power corruption …
●Assume that we have a • It’s necessary to update routing table
network with following • of all nodes (theory)
topology. What should • in pratice: some nodes
be routing table of Network Next- Network Next- Network Next-

routers B, C, D in order 192.168.0.0/24


hop
B 10.0.0.0/24
hop
A 10.0.0.0/24
hop
B
to assure that all hosts 172.16.0.0/24 B 172.16.0.0/24 C 192.168.0.0/24 B
can send data to each
172.16.1.0/24 B 172.16.1.0/24 C
other and to the
Internet. Router A Router B Router C New Network

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

118
10.0.0.0/24 192.168.0.0/24 172.16.0.0/24 172.16.1.0/24
118 121

58 59
10/4/2024 10/4/2024

How to update routing table? Dynamic Routing

• Static routing
• Entries in routing table are added manually by • When there is a failure: Internet

administrator • Alternative route is added


automatically

• Dynamic routing Routing table of 10.0.0.1 (extract)


10.0.0.3
• Automatically update routing table Prefix Next-hop Alternative route 10.0.0.2

• By mean of routing protocols 0.0.0.0/0 10.0.0.2 Next-hop 10.0.0.3

0.0.0.0/0 10.0.0.3 Unreachable route


10.0.0.1

Next-hop 10.0.0.1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

122 124

122 124

Static routing Static routing

• When there is a failure: Internet • Pros


• Problem happens even • Stable
there are alternative • Secure
routes. • It won’t be effected by other factors
• Network administrator
needs to change setting 10.0.0.3 10.0.0.2

Next-hop 10.0.0.3
• Cons
• Very stubborn
Routing table of 10.0.0.1 (extract)
• Back up link cannot be used
Prefix Next-hop 10.0.0.1 • Difficult to manage
0.0.0.0/0 10.0.0.3
Next-hop 10.0.0.1
Unreachable route

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

123 125

123 125

60 61
10/4/2024 10/4/2024

Dynamic routing Roles of routing algorithms and protocols

• Pros • It is necessary to autonomously construct a


• Easy to manage routing table at routers.
• Backup link can be utilized • Routing algorithms perform path calculations.
• During or before the calculation process, it is
• Cons essential to gather topology information or
• Insecure exchange information between network nodes.
• Difficult to understand the routing protocols • → Rou ng protocols facilitate this exchange.
• Routing protocols also define procedures for
maintaining the routing table.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

126

126 128

Routing protocols

Routing protocol goal:


determine “good” paths mobile network
(equivalently, routes), from national or global ISP

sending hosts to receiving


host, through network of applicatio

routers
4.12: Routing algorithm and
n
transport
network
link

• path: sequence of routers


physical networ networ

protocols
k k
link link

packets traverse from given


physica physica
l l

initial source host to final


networ
k networ
link k
physica link networ

destination host
physica datacenter

Dijkstra and Bellman-Ford Algo


l k
l link network
physica
l

link-state and distance-vector protocols • “good”: least “cost”, “fastest”, applicatio


n

“least congested”
transport
enterprise network
network link
physical

• routing: a “top-10”
networking challenge!
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

127 Network Layer: 5-129

127 129

62 63
10/4/2024 10/4/2024

Network as a graph Global or decentralized

• Graph with nodes (routers) and edges (links) • Routing information is needed for each node to
• Link “cost” c(x,y) build routing tables
• Bandwidth, delay, cost, congestion level… • Global or decentralized routing information?
• Determine least cost path from every node to • Global:
every other node • all routers have complete topology, link cost info
• “link state” algorithms
5
• Decentralized:
3 • router knows physically-connected neighbors, link costs to
v w
2 5 neighbors
u • iterative process of computation, exchange of info with
2 1 z neighbors
3
1 • “distance vector” algorithms
2
x y • “friend of friend is friend”
1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

130 132

130 132

Shortest path tree - SPT Dijkstra’s link-state routing algorithm

• A tree that links go out from root to leaves ▪ centralized: network topology, link notation
• The unique path from root to any node v is the costs known to all nodes ▪ cx,y: direct link cost from
shortest path from the root to v • accomplished via “link state node x to y; = ∞ if not direct
broadcast” neighbors
• Each node has a different SPT • all nodes have same info ▪ D(v): current estimate of
cost of least-cost-path from
▪ computes least cost paths from source to destination v
5 one node (“source”) to all other
▪ p(v): predecessor node
3 nodes
v w 5 v w along path from source to v
2 • gives forwarding table for that node ▪ N': set of nodes whose least-
u 2 1 z u z ▪ iterative: after k iterations, know cost-path definitively known
3
1 2 least cost path to k destinations
x 1
y x y

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

131 Network Layer: 5-133

131 133

64 65
10/4/2024 10/4/2024

Dijkstra’s link-state routing algorithm Dijkstra’s algorithm: an example

1 Initialization:
5
2 N' = {u} /* compute least cost path from u to all other nodes */
3 for all nodes v v 3
w
2 5
4 if v adjacent to u /* u initially knows direct-path-cost only to direct neighbors */
5 then D(v) = cu,v /* but may not be minimum cost! */ u 2 1 z
3
6 else D(v) = ∞ 1 2
x y
7 1

8 Loop resulting least-cost-path tree from u: resulting forwarding table in u:


9 find w not in N' such that D(w) is a minimum destination outgoing link
v w
10 add w to N' v (u,v) route from u to v directly
11 update D(v) for all v adjacent to w and not in N' : u z x (u,x)
12 D(v) = min ( D(v), D(w) + cw,v ) y (u,x) route from u
x y w (u,x)
13 /* new least-path-cost to v is either old least-cost-path to v or known to all other
14 least-cost-path to w plus direct-cost from w to v */ z (u,x)
destinations
15 until all nodes in N' via x

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-134 Network Layer: 5-136

134 136

Dijkstra’s algorithm: an example Dijkstra’s algorithm: another example

v w x y z
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z) v w x y z
D(v), D(w), D(x), D(y), D(z), x
0 u 2,u 5,u 1,u ∞ ∞ 9
Step N' p(v) p(w) p(x) p(y) p(z)
1 ux 2,u 4,x 2,x ∞
0 u 7,u 3,u 5,u ∞ ∞ 5 7
2 uxy 2,u 3,y 4,y 4
3 uxyv 3,y 4,y 1 uw 6,w 5,u 11,w ∞ 8
4 uxyvw 4,y
2 uwx 6,w 11,w 14,x 3 w z
5 uxyvwz u y
2
Initialization (step 0): For all a: if a adjacent to then 3 uwxv 10,v 14,x
3
5 D(a) = cu,a 4 uwxvy 12,y 7 4
3 v
v w 5 5 uwxvyz
2
u find a not in N' such that D(a) is a minimum
2 1 z
1
3 add a to N' notes:
x 2 update D(b) for all b adjacent to a and not in N' :
y ▪ construct least-cost-path tree by tracing predecessor nodes
1
D(b) = min ( D(b), D(a) + ca,b ) ▪ ties can exist (can be broken arbitrarily)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-135 Network Layer: 5-137

135 137

66 67
10/4/2024 10/4/2024

Distance vector algorithm Distance-vector algorithm (2)

Main ideas:
At each node:
Based on Bellman-Ford (BF) equation (dynamic programming): ● Distance vector: vector of all distance
from the current node to all other nodes Wait for a DV from
Bellman-Ford equation
● Each node send periodically the its neighbor
Let Dx(y): cost of least-cost path from x to y. distance vector to its adjacent nodes
Then:
● When a node x receives a distance Re-calculate its DV
Dx(y) = minv { cx,v + Dv(y) }
vector, it updates its distance vector by
using equation Bellman-ford
v’s estimated least-cost-path cost to y ● With some condition, the distance Dx(y) If DV changes, Inform its
min taken over all neighbors v of x direct cost of link from x to v in each vector will converge to the smallest neighbor
value of dx(y)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

140

138 140

Bellman-Ford Example Distance vector: example

Suppose that u’s neighboring nodes, x,v,w, know that for destination z:
DV in :
Dv(z) = 5 Dw(z) = 3 Bellman-Ford equation says: Da(a)=0
Da(b) = 8
5 Da(c) = ∞ a b c
Du(z) = min { cu,v + Dv(z), Da(d) = 1 8 1
3 w
v cu,x + Dx(z), Da(e) = ∞

u
2 5
cu,w + Dw(z) } t=0 Da(f) = ∞
2
3
1 z Da(g) = ∞ 1 1
1 2
= min {2 + 5, Da(h) = ∞
x 1
y 1 + 3,
Da(i) = ∞

d A few asymmetries:
5 + 3} = 4 ▪ All nodes have 1
e
1
f
▪ missing link
Dx(z) = 3 distance estimates to
nearest neighbors ▪ larger cost
node achieving minimum (x) is
(only) 1 1 1
next hop on estimated least-
cost path to destination (z) ▪ All nodes send their
local distance vector
to their neighbors g h i
1 1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-139 Network Layer: 5-141

139 141

68 69
10/4/2024 10/4/2024

Distance vector example: iteration Distance vector example: iteration

a b c a b c
8 1 8 1

t=1 1 1
t=1 1 1
All nodes: All nodes:
▪ receive distance vectors ▪ receive distance vectors
from neighbors from neighbors
d e f d e f
▪ compute their new local 1 1 ▪ compute their new local 1 1
distance vector distance vector
▪ send their new local ▪ send their new local
distance vector to 1 1 1 distance vector to 1 1 1
neighbors neighbors

g h i g h i
1 1 1 1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-142 Network Layer: 5-144

142 144

Distance vector example: iteration Distance vector example: iteration

a
compute 8 compute
b
1
compute
c a
8
b
1
c

t=1 1 1
t=2 1 1
All nodes: All nodes:
▪ receive distance vectors ▪ receive distance vectors
from neighbors from neighbors
d compute
e compute
f d e f
▪ compute their new local compute 1 1 ▪ compute their new local 1 1
distance vector distance vector
▪ send their new local ▪ send their new local
distance vector to 1 1 1 distance vector to 1 1 1
neighbors neighbors

g h i
compute g h i
compute 1 compute 1 1 1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-143 Network Layer: 5-145

143 145

70 71
10/4/2024 10/4/2024

Distance vector example: iteration Distance vector example: iteration

compute
a
2
compute
b
1
compute
c …. and so on
t=2 1 1 Let’s next take a look at the iterative computations at nodes
All nodes:
▪ receive distance vectors
from neighbors
▪ compute their new local d
compute 1
compute
e
1
compute
f
distance vector
▪ send their new local
distance vector to 1 1 1
neighbors

g
compute 8 compute
h 1 compute
i

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-146 Network Layer: 5-148

146 148

Distance vector example: iteration Distance vector example: computation


DV in b: DV in c:
Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
DV in : Dc(d) = ∞
Db(e) = 1 Db(i) = ∞
Da(a)=0
Dc(e) = ∞
Da(b) = 8
Dc(f) = ∞
a b c Da(c) = ∞ a b c Dc(g) = ∞
8 1 Da(d) = 1 8 1
Dc(h) = ∞
Da(e) = ∞
t=2 1 1
t=1 Da(f) = ∞
1 1
Dc(i) = ∞
Da(g) = ∞
All nodes: ▪ b receives DVs Da(h) = ∞ DV in e:
▪ receive distance vectors from a, c, e Da(i) = ∞ De(a) = ∞
from neighbors De(b) = 1
d e f d e f De(c) = ∞
▪ compute their new local 1 1 1 1 De(d) = 1
distance vector De(e) = 0
▪ send their new local De(f) = 1
distance vector to 1 1 1 1 1 1 De(g) = ∞
neighbors De(h) = 1
De(i) = ∞

g h i g h i
1 1 1 1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-147 Network Layer: 5-149

147 149

72 73
10/4/2024 10/4/2024

Distance vector example: computation Distance vector example: computation


DV in b: DV in c: DV in b: DV in c:
Db(a) = 8 Db(f) = ∞ Dc(a) = ∞ Db(a) = 8 Db(f) = ∞ Dc(a) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1 Db(c) = 1 Db(g) = ∞ Dc(b) = 1
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0 Db(d) = ∞ Db(h) = ∞ Dc(c) = 0
DV in : Dc(d) = ∞ Dc(d) = ∞
Db(e) = 1 Db(i) = ∞ Db(e) = 1 Db(i) = ∞
Da(a)=0
Dc(e) = ∞ Dc(e) = ∞
Da(b) = 8
Dc(f) = ∞ Dc(f) = ∞
Da(c) = ∞ a bb c a b c
Da(d) = 1 8 compute 1 Dc(g) = ∞ 8 1 compute Dc(g) = ∞
Dc(h) = ∞ Dc(h) = ∞
Da(e) = ∞
t=1 Da(f) = ∞
1 1
Dc(i) = ∞
t=1 1 1
Dc(i) = ∞
Da(g) = ∞
▪ b receives DVs Da(h) = ∞ DV in e: ▪ c receives
from a, c, e, Da(i) = ∞ e De(a) = ∞ DVs from b
computes: De(b) = 1
d f De(c) = ∞ computes: d b(a}} = 1 + 8 = 9
e e
DV in c: f
1 Dc(a) = min{cc,b+D
Db(a) = min{cb,a+Da(a), cb,c +Dc(a), cb,e+De(a)} = min{8,∞,∞} =8 1 De(d) = 1
Dc(b) = min{cc,b+Db(b)} = 1 + 0 = 1
Db(c) = min{cb,a+Da(c), cb,c +Dc(c), c b,e +De(c)} = min{∞,1,∞} = 1 De(e) = 0 Dc(a) = 9
De(f) = 1 Dc(d) = min{cc,b+Db(d)} = 1+ ∞ = ∞ Dc(b) = 1
Db(d) = min{cb,a+Da(d), cb,c +Dc(d), c b,e +De(d)} = min{9,2,∞} = 2
1 1 1 De(g) = ∞ Dc(e) = min{cc,b+Db(e)} = 1 + 1 = 2 Dc(c) = 0
Db(e) = min{cb,a+Da(e), cb,c +Dc(e), c b,e +De(e)} = min{∞,∞,1} = 1 Dc(d) = 2
De(h) = 1
Db(f) = min{cb,a+Da(f), cb,c +Dc(f), c b,e +De(f)} = min{∞,∞,2} = 2 DV in b: Dc(f) = min{cc,b+Db(f)} = 1+ ∞ = ∞
Dc(e) = ∞
De(i) = ∞
Db(a) = 8 Db(f) =2 Dc(g) = min{cc,b+Db(g)} = 1+ ∞ = ∞ Dc(f) = ∞
Db(g) = min{cb,a+Da(g), cb,c +Dc(g), c b,e+De(g)} = min{∞, ∞, ∞} = ∞
g
1 ∞, 2} = 2 h D (c) = 1
1Db(d) = 2
Dbi (g) = ∞ Dc(h) = min{cbc,bg+Db(h)} = 1+ ∞ = ∞ h Dc(g) = ∞ i
Db(h) = min{cb,a+Da(h), cb,c +Dc(h), c b,e+De(h)} = min{∞, Db(h) = 2
b Dc(i) = min{cc,b+Db(i)} = 1+ ∞ = ∞ Dc(h) = ∞
Db(i) = min{cb,a+Da(i), cb,c +Dc(i), c b,e+De(i)} = min{∞, ∞, ∞} = ∞ Db(e) = 1 Db(i) = ∞ Dc(i) = ∞

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-150 Network Layer: 5-152

150 152

Distance vector example: computation Distance vector example: computation


DV in b: DV in c: DV in b:
Db(a) = 8 Db(f) = ∞ Dc(a) = ∞ Db(a) = 8 Db(f) = ∞
Db(c) = 1 Db(g) = ∞ Dc(b) = 1 Db(c) = 1 Db(g) = ∞
Db(d) = ∞ Db(h) = ∞ Dc(c) = 0 Db(d) = ∞ Db(h) = ∞ DV in e:
DV in Dc(d) = ∞ DV in d:
Db(e) = 1 Db(i) = ∞ Db(e) = 1 Db(i) = ∞
Da(a)=0 De(a) = ∞
Dc(e) = ∞ Dc(a) = 1
Da(b) = 8 De(b) = 1
Dc(f) = ∞ Dc(b) = ∞
Da(c) = ∞ a b c Dc(g) = ∞ a b c De(c) = ∞
Da(d) = 1 8 1 Dc(c) = ∞ 8 1 De(d) = 1
Dc(h) = ∞ Dc(d) = 0
Da(e) = ∞ De(e) = 0
t=1 Da(f) = ∞
1
Dc(i) = ∞
t=1 Dc(e) = 1
Dc(f) = ∞
Q: what is new DV De(f) = 1
Da(g) = ∞ 1
DV in e:
1 computed1 in e at t=1? De(g) = ∞
▪ c receives Da(h) = ∞ ▪ e receives Dc(g) = 1 De(h) = 1
Dc(h) = ∞
DVs from b Da(i) = ∞ De(a) = ∞ DVs from b, Dc(i) = ∞
De(i) = ∞
De(b) = 1
d d, f, h d DV in f:
1
e
1
f De(c) = ∞
1 compute
e
1
f
De(d) = 1 DV in h: Dc(a) = ∞
De(e) = 0 Dc(a) = ∞ Dc(b) = ∞
De(f) = 1 Dc(b) = ∞ Dc(c) = ∞
1 1 1 De(g) = ∞ Dc(c) = ∞ 1 1 1 Dc(d) = ∞
De(h) = 1 Dc(d) = ∞ Dc(e) = 1
De(i) = ∞ Dc(e) = 1 Dc(f) = 0
Dc(f) = ∞ Dc(g) = ∞
g h i Dc(g) = 1 g h i Dc(h) = ∞
1 1 1 1
Dc(h) = 0 Dc(i) = 1
Dc(i) = 1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-151 Network Layer: 5-153

151 153

74 75
10/4/2024 10/4/2024

Distance vector: state information diffusion Distance vector: link cost changes

Iterative communication, computation steps diffuses information through network:


link cost changes: 60
y
4 1
▪ node detects local link cost change x z
t=0 c’s state at t=0 is at c only
a b c ▪ “bad news travels slow” – count-to-infinity 50

c’s state at t=0 has propagated to b, and may


8 1
problem:
t=1 influence distance vector computations up to • y sees direct link to x has new cost 60, but z has said it has a path at cost of 5. So y
1 hop away, i.e., at b 1 1 computes “my new cost to x will be 6, via z); notifies z of new cost of 6 to x.
t=1
c’s state at t=0 may now influence distance t=2 • z learns that path to x via y has new cost 6, so z computes “my new cost to x will be
vector computations up to 2 hops away, i.e., at 7 via y), notifies y of new cost of 7 to x.
t=2
b and now at a, e as well d e f • y learns that path to x via z has new cost 7, so y computes “my new cost to x will be
1 1
8 via y), notifies z of new cost of 8 to x.
c’s state at t=0 may influence distance vector
t=3 computations up to 3 hops away, i.e., at b,a,e • z learns that path to x via y has new cost 8, so z computes “my new cost to x will be
and now at c,f,h as well 1 1 1 t=3 9 via y), notifies y of new cost of 9 to x.

c’s state at t=0 may influence distance vector
t=4 computations up to 4 hops away, i.e., at b,a,e, c,
g h i
▪ Distributed algorithms are tricky!
f, h and now at g,i as well 1 1
t=4

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

154

154 156

Distance vector: link cost changes Comparison of Link-state and Distance vector

Number of exchange Reliability: If some routers


link cost changes: 1
provide incorrect information
▪ node detects local link cost change 4
y
1 messages
x z LS:
▪ updates routing info, recalculates local DV 50 ● LS: n nodes, E links, O(nE) ● The router may send out
▪ if DV changes, notify neighbors messages incorrect cost
● Each node calculate its
● DV: Exchange only with own routing table
t0 : y detects link-cost change, updates its DV, informs its neighbors.
neighbor DV:
“good news t1 : z receives update from y, updates its table, computes new least
travels fast” cost to x , sends its neighbors its DV. Convergent time ● Incorrect distance vector
may be sent out
t2 : y receives z’s update, updates its distance table. y’s least costs
● LS: Complexity O(n2) ● Each node calculate its
do not change, so y does not send a message to z.
DV based to what
● DV: Varies receives from the
neighbor
● Error propagates in the
network.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

157

155 157

76 77
10/4/2024 10/4/2024

1
Hierarchical structure of the Internet
• Internet = network of networks
• Such networks can select its own routing policy
(routing domain)
• Such networks are called autonomous system (AS)
AS 2
AS 5
4.13: Hierarchical routing AS 1
AS 4
AS 3
Autonomous System
Intra and Inter domain routing

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

158 160

158 160

2
Making routing scalable Autonomous System (AS)
• A set of routers with the same routing policy (routing protocol,
metric…) is aggregated into an AS
our routing study thus far - idealized
• Gateway: router connect between two ASes
• all routers identical
• Each AS has an unique number (ASN - 16 bits or 32 bits).
• network “flat”
… not true in practice
2914 NTT-COMMUNICATIONS-2914 - NTT America, Inc.
3491 BTN-ASN - Beyond The Network America, Inc.
scale: billions of destinations: administrative autonomy: 4134 CHINANET-BACKBONE No.31,Jin-rong Street
▪ can’t store all destinations in ▪ Internet: a network of networks 6453 GLOBEINTERNET Teleglobe America Inc.
routing tables! ▪ each network admin may want to 24087 VNGT-AS-AP Vietnam New Generation Telecom
▪ routing table exchange would control routing in its own network 24066 VNNIC-AS-VN Vietnam Internet Network Information Center
swamp links! 17981 CAMBOTECH-KH-AS ISP Cambodia
……………………………….

Source: http://www.cidr-report.org
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology
159
161

159 161

78 79
10/4/2024

Slide 160

1 Combine 5 and 6
sonnh, 3/8/2008 Number of AS by time
Slide 161

2 Explain about AS
sonnh, 3/9/2008

Source: http://www.potaroo.net/
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

162

162

Internet approach to scalable routing

aggregate routers into regions known as “autonomous


systems” (AS) (a.k.a. “domains”)

intra-AS (aka “intra-domain”): inter-AS (aka “inter-domain”):


routing among within same AS routing among AS’es
(“network”) ▪ gateways perform inter-domain routing
▪ all routers in AS must run same intra- (as well as intra-domain routing)
domain protocol
▪ routers in different AS can run different
intra-domain routing protocols
▪ gateway router: at “edge” of its own AS,
has link(s) to router(s) in other AS’es

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

Network Layer: 5-163

163

80
10/4/2024 10/4/2024

Interconnected ASes Intra-domain and Inter-domain routing


AS2

AS1 EGP
forwarding table configured by
intra- and inter-AS routing IGP OSPF domain
Intra-AS
Routing
Inter-AS
Routing algorithms IGP
forwarding ▪ intra-AS routing determine entries for
table
destinations within AS EGP
▪ inter-AS & intra-AS determine entries RIP domain EGP
for external destinations EGP
intra-AS
3c AS4 EGP IGP
routing3a inter-AS routing intra-AS
2c AS3
3b 2a routing IGP
1c
2b RIP domain
AS3 intra-AS
1a routing 1b AS2 IGP
1d OSPF domain
AS1
RIP domain
AS5

RIP domain
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

166

164 166

Hierarchical routing protocols

• Inside an AS: Intra-domain routing protocols


• Also named IGP: Interior Gateway Protocol
• RIP: Routing Information Protocol
• OSPF: Open Shortest Path First
• IS-IS, IGRP, EIGRP (Cisco)…
• Among ASes: Inter-domain routing protocols
• Also named EGP: Exterior Gateway Protocol Intra-domain routing protocol
• BGP (v4): Border Gateway Protocol

RIP
OSPF

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

165 167

165 167

81 82
10/4/2024 10/4/2024

RIP ( Routing Information Protocol) Review: DV routing (2)

• IGP • Friend of friend is friend


• RIP v.1, currently use RIP v.2
Net A
• Distance-vector algorithm 133.27.4.0/24

• Routing metric: # of hops (max = 15 hops)


Router A To 133.27.4.0/24 Router
From router A to subsets: 2 hop C

u destination hops
v To 133.27.4.0/24
u 1 1 hop
w Net B
A B v 2
w 2 Router
133.27.5.0/24
Router D
x 3 B To 133.27.4.0/24
x y 3 2 hop
z C D z 2
y

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

168 170

168 170

Review: DV routing (1) Review: DV routing (3)

• Friend of friend is friend • Friend of friend is friend


Net A Net A
133.27.4.0/24 133.27.4.0/24

Router A Router Router A To 133.27.4.0/24 Router


C 2 hop C
To 133.27.4.0/24
To 133.27.4.0/24 To 133.27.4.0/24 3 hop
1 hop 1 hop
Net B Net B
Router
133.27.5.0/24 Router
133.27.5.0/24
Router D Router D
B B To 133.27.4.0/24
2 hop

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

169 171

169 171

83 84
10/4/2024

Slide 172

4
4 Explain in opposite way: How B is annouced
3
Review: DV routing (4) sonnh, 3/9/2008

3 Expain that we announce networks address. not router id


sonnh, 3/9/2008
• Friend of friend is friend
Net A
133.27.4.0/24

Router A Router

To 133.27.4.0/24
1 hop
Net B
Router
133.27.5.0/24
Router D

To 133.27.4.0/24
2 hop

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

172

172

RIP: Exchange information

• Routing table of router is exchanged


• Periodic
• Node advertise its distance-vector with neighbors every
30s
• Each message contains up to 25 routing table entries
• In practice, multiple messages are sent
• Triggered
• When every entry changes, send copy of entry to
neighbors
• Neighbors use to update their tables

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

173

173

85
10/4/2024 10/4/2024

RIP timer (1) Ping-pong failure

• Update timer • If 192.168.0.0/24 is down…


• Exchange routing table every 30 sec • B can update 192.168.0.0 info to A
• Invalid timer • Packets to 192.168.0.0/24 become loop status
• Updated every time router receives information
• If it is time out (180sec), it becomes hold down status
• A will update 192.168.0.0 info to B
• Count up to infinity!
• Hold down timer
• Router keeps routing information for 180 sec
• Not refer the worse update (to avoid the loop)
• Possibly down status
• Flush timer
• Update every time router receives information
• If 240sec passed, routing entry will be deleted

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

174 176

174 176

5
RIP timer (2) RIP: to avoid this loop

• Limit the maximum hop count


no
update update
update
↓ ↓ ↓
When it is timeout, • 16
hold down timer starts
Invalid timer
When it is timeout,
• Split horizon
This info will be deleted
from RIP database
• The routing info will not return back to the sender

When it receives update, Hold down timer


• Poison reverse
Invalid timer restarts • When network is down, send update with metric 16
• That routing information become Hold-down status
Flush timer

When it is timeout,
Routing info will be deleted
from routing table

0 30 60 90 120 150 180 210 240 270 300 330 360 390 420

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

175 177

175 177

86 87
10/4/2024

Slide 177

5 16 TTL vs. this?


sonnh, 3/9/2008 OSPF (Open Shortest Path First) routing

▪ IGP
▪ “open”: publicly available - standard by IETF (current version, version
3, defined in RFC 2740)
▪ classic link-state
• each router floods OSPF link-state advertisements (directly over IP rather
than using TCP/UDP) to all other routers in entire AS
• multiple link costs metrics possible: bandwidth, delay
• each router has full topology, uses Dijkstra’s algorithm to compute
forwarding table (Shortest Path First)
▪ Advanced features
• security: all OSPF messages authenticated (to prevent malicious intrusion)
• Large AS: Hierarchical OSPF
• Classless routing (able to use Variable-Length Subnet Masking -VLSM )
• Different metric for each link based on TOS (is not used in practice)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
Network Layer: 5-178

178

6
Hierarchical OSPF

• Why we have to divide the network into small


area?
• If we have more than 100 routers….
• Link state update is delivered all the time
• Number of re-calculation increase
• Need more memory, need more CPU power
• Number of link state update become large
• Routing table become large

• Area
• Group of routers which share the same LSA
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

179

179

88
10/4/2024

Slide 179

6 Explain why we need to reduce the calculaiton


sonnh, 3/9/2008 Hierarchical OSPF

▪ two-level hierarchy: local area, backbone.


• link-state advertisements flooded only in area, or backbone
• each node has detailed area topology; only knows direction to reach
other destinations
area border routers: boundary router:
“summarize” distances to connects to other
backbone ASes
destinations in own area, backbone router:
advertise in backbone runs OSPF limited
to backbone
local routers:
• flood LS in area only area 3
• compute routing within
area
internal
• forward packets to outside routers
area 1
via area border router
area 2

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

Network Layer: 5-180

180

Which information is exchanged among routers?

• Link-State Advertisement (LSA): Contain the link and


the cost to the neighbor
• For example, node A
• link to B, cost 30
• link to D, cost 20 20
A
• link to C, cost 10 D
C
• For example, node D 30
10
50
20
• link to A, cost 20
• link to E, cost 20 B E
• link to C, cost 50

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

181

181

89
10/4/2024 10/4/2024

OSPF metric Link state flooding

• Default value is existing LSAX


100Mbps / bandwidth of interface LSAX
X A X A
• But these days administrator assign the original X has link to A, cost 10
value LSAX
X has link to C, cost 20
C B D C B D
• During the calculation of routing table
• Smallest cost to the one path will be selected (a
)
(b)

• If cost are same X A X A


• Router will do load balancing LSAX
LSAX
C B D C B D

LSAX
(c) (d)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

182 184

182 184

OSPF default cost Designated router (DR)

• To improving efficiency on exchanging link state


Link Bandwidth Default OSPF cost • Each router forms an adjacency with the designated
56Kbps serial link 1785 router (DR)
64Kbps serial link 1562 • Exchanging link state through DR
T1 (1.544Mbps) serial link 65 • If DR fails, use a BDR (Backup DR)
• How to select DR and BDR?
E1 (2.048Mbps) serial link 48
4Mbps Token Ring 25
B A C
Ethernet 10 B A C

16Mbps Token Ring 6


FDDI or Fast Ethernet 1
Gigabit Ethernet / 10G network 1
D E D E

Do not use DR Use DR


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

183 185

183 185

90 91
10/4/2024

Slide 187

7 Exchanged informatio
Neighbor & Adjacency Rip:
OSPF
sonnh, 3/9/2008
• Neighbor and adjacency are different concept!
• Adjacency: router which exchange the routing
information each other
• Neighbor: routers have a direct link
• Broadcast multi-access network (e.g Ethernet)
• Neighbor != Adjacency
• Point-to-point network
• Neighbor == Adjacency
• Non Broadcast Multi-access network (e.g. ATM)
• Exchanging data using unicast

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

186

186

7
RIP vs. OSPF

RIP OSPF
Characteristics • Flat relation • Support hierarchy
between routers • Implementation is
• Implementation is complicated
simple • Middle and large-scale
• Small-scale network network
Scalability x o
Computational little many
complexity
Convergence time Low speed high speed

Exchanged information Routing table Link-state information

Algorithm Distant vector type Link-state type


Neighbor discovery 30s 10s (Hello packet)
Metric number of hops Cost (band width)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

187

187

92
10/4/2024 10/4/2024

eBGP, iBGP connections

2b

2a 2c

1b 3b
2d
1a 1c ∂
3a 3c
AS 2
1d
Inter-domain routing protocol
3d

AS 1 eBGP connectivity AS 3
logical iBGP connectivity

1c gateway routers run both eBGP and iBGP protocols

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

188 Network Layer: 5-190

188 190

Internet inter-AS routing: BGP BGP basics

▪ BGP (Border Gateway Protocol): the de facto ▪ BGP session: two BGP routers (“peers”) exchange BGP messages over
inter-domain routing protocol semi-permanent TCP connection:
• “glue that holds the Internet together” • advertising paths to different destination network prefixes (BGP is a “path
vector” protocol)
▪ allows subnet to advertise its existence, and the ▪ when AS3 gateway 3a advertises path AS3,X to AS2 gateway 2c:
destinations it can reach, to rest of Internet: “I • AS3 promises to AS2 it will forward datagrams towards X
am here, here is who I can reach, and how” AS 3 3b
▪ BGP provides each AS a means to: AS 1b 3a 3c
• eBGP: obtain subnet reachability information from 1
1a 1c
neighboring ASes AS 2 2b 3d

• iBGP: propagate reachability information to all AS- 1d


2a 2c BGP advertisement:

internal routers.
AS3, X
X
2d
• determine “good” routes to other networks based on
reachability information and policy

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-189 Network Layer: 5-191

189 191

93 94
10/4/2024

Slide 192

8
8 Change the symbol of router into AS
BGP: Path vector routing sonnh, 2/29/2008

• Which routing protocol can be used to connect multiple ASes?


• No universal metric – policy decisions
• LS: No, Metric are not the same, LS database too large – entire
Internet
• DV: Bellman-Ford algorithm may not converge
• Solution: Path vector routing
1 2 A
A
A B B→A C
3 A
1 C→B→A
A

D E
2 A 4 A
D→A D→A best path
C→B→A ×

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

192

192

Path attributes and BGP routes

▪ BGP advertised route: prefix + attributes


• prefix: destination being advertised
• two important attributes:
• AS-PATH: list of ASes through which prefix advertisement has passed
• NEXT-HOP: indicates specific internal-AS router to next-hop AS
▪ policy-based routing:
• gateway receiving route advertisement uses import policy to
accept/decline path (e.g., never route through AS Y).
• AS policy also determines whether to advertise path to other other
neighboring ASes

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

Network Layer: 5-193

193

95
10/4/2024 10/4/2024

BGP path advertisement Loop free mechanism


• Detecting loop depending on whether that router is
included in path of received routing information or not
AS 3 3b • B will cancel the route to A, which B includes in path
AS 1b 3a 3c
1
1a 1c
B
AS 2 2b 3d X

1d AS3, X
AS2,AS3,X 2a 2c
C
2d A !!LOOP!!
A
▪ AS2 router 2c receives path advertisement AS3,X (via eBGP) from AS3 router 3a D→C→B→A

▪ based on AS2 policy, AS2 router 2c accepts path AS3,X, propagates (via iBGP) to A
all AS2 routers C→B→A

▪ based on AS2 policy, AS2 router 2a advertises (via eBGP) path AS2, AS3, X to
AS1 router 1c
D

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-194 196

194 196

BGP path advertisement (more) BGP messages

AS 3
▪ BGP messages exchanged between peers over TCP connection
3b
AS 1b AS3,X
3a 3c
▪ BGP messages:
AS3,X
1
1a
AS3,X
1c • OPEN: opens TCP connection to remote BGP peer and
AS 2 2b 3d X
AS3,X authenticates sending BGP peer
1d AS3, X
2a
AS2,AS3,X 2c
• UPDATE: advertises new path (or withdraws old)
2d • KEEPALIVE: keeps connection alive in absence of UPDATES; also
gateway router may learn about multiple paths to destination: ACKs OPEN request
▪ AS1 gateway router 1c learns path AS2,AS3,X from 2a • NOTIFICATION: reports errors in previous msg; also used to close
▪ AS1 gateway router 1c learns path AS3,X from 3a connection
▪ based on policy, AS1 gateway router 1c chooses path AS3,X and advertises path
within AS1 via iBGP

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-195 Network Layer: 5-197

195 197

96 97
10/4/2024 10/4/2024

BGP path advertisement Why different Intra-, Inter-AS routing ?

policy:
AS 3 3b
• inter-AS: admin wants control over how its
AS 1b AS3,X
traffic routed, who routes through its network
AS3,X 3a 3c
1
• intra-AS: single admin, so policy less of an
1
AS3,X
1a 1c AS 2 3d X
local link
2
2
1d
1
AS3,X
2b
AS3, X
issue
2a 2c
interfaces
scale:
AS2,AS3,X

at 1a, 1d 2d
• hierarchical routing saves table size, reduced
dest interface ▪ recall: 1a, 1b, 1d learn via iBGP from 1c: “path to X goes through 1c”
update traffic
… …
▪ at 1d: OSPF intra-domain routing: to get to 1c, use interface 1 performance:
1c 1
X

1

▪ at 1d: to get to X, use interface 1
• intra-AS: can focus on performance
• inter-AS: policy dominates over performance

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-198 Network Layer: 5-200

198 200

BGP path advertisement Hot potato routing

AS 3 3b AS 3 3b
AS 1b 3a 3c
AS 1b 3a 3c
1 1 1
1a 1c AS 2 3d X 1a 1c AS 2 3d X
2 2b 2b 112
1d 1d AS1,AS3,X AS3,X
2a 2c 2a 2c
201 263

2d 2d
OSPF link weights

dest interface
▪ recall: 1a, 1b, 1d learn via iBGP from 1c: “path to X goes through 1c”
… …
▪ 2d learns (via iBGP) it can route to X via 2a or 2c
1c 2 ▪ at 1d: OSPF intra-domain routing: to get to 1c, use interface 1
X 2 ▪ hot potato routing: choose local gateway that has least intra-domain
… … ▪ at 1d: to get to X, use interface 1 cost (e.g., 2d chooses 2a, even though more AS hops to X): don’t worry
▪ at 1a: OSPF intra-domain routing: to get to 1c, use interface 2 about inter-domain cost!
▪ at 1a: to get to X, use interface 2

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-199 Network Layer: 5-201

199 201

98 99
10/4/2024 10/4/2024

BGP: achieving policy via advertisements BGP route selection

A,w B provider • router may learn about more than one route to
x network
w A destination AS, selects route based on:
legend:
A,w C y customer 1. local preference value attribute: policy decision
network:
2. shortest AS-PATH
ISP only wants to route traffic to/from its customer networks (does not want 3. closest NEXT-HOP router: hot potato routing
to carry transit traffic between other ISPs – a typical “real world” policy) 4. additional criteria
▪ A advertises path Aw to B and to C
▪ B chooses not to advertise BAw to C!
▪ B gets no “revenue” for routing CBAw, since none of C, A, w are B’s customers
▪ C does not learn about CBAw path
▪ C will route CAw (not using B) to get to w

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-202

202 204

BGP: achieving policy via advertisements (more) Characteristic of the path

• ORIGIN
• Source of the information (IGP/EGP/incomplete)
B provider • AS_PATH
x network
w A legend: • NEXT_HOP
C y customer
network: • MED (MULTI_EXIT_DISCRIMINATOR)
ISP only wants to route traffic to/from its customer networks (does not want • LOCAL_PREF
to carry transit traffic between other ISPs – a typical “real world” policy)
• ATOMIC_AGGREGATE
▪ A,B,C are provider networks
▪ x,w,y are customer (of provider networks) • AGGREGATOR
▪ x is dual-homed: attached to two networks
▪ policy to enforce: x does not want to route from B to C via x • COMMUNITY
▪ .. so x will not advertise to B a route to C

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Network Layer: 5-203 205

203 205

100 101
10/4/2024 10/4/2024

Select the path Routing with AS_PATH Prepend

: NEXT_HOP?
• Step 1: Compare LOCAL_PREF AS2 AS3 AS5 AS4 AS5 AS5 AS5

• Step 2: Compare AS_PATH AS1


• Step 3: Compare ORIGIN
• Step 4: Compare MED
AS2
• Step 5: Compare EBGP/IBGP AS3 AS5
AS4
• Step 6: Compare cost to NEXT_HOP
• Step 7: Compare Router ID AS3

AS5 AS5 AS5


AS5

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology
AS5
206 208

206 208

Sử dụng LOCAL_PREF Example of AS PATH

• Select the larger value AS1 AS1


of LOCAL_PREF AS1

• Control the upbound Network Next Hop Metric LocPrf Weight Path
bandwidth AS2 4.79.201.0/26 203.178.136.29 700 500 0 7660 22388 11537 10886 40220
203.178.136.29 700 500 0 7660 22388 11537 10886 40220
AS1 AS2
AS4 203.178.136.29 700 500 0 7660 22388 11537 10886 40220
6.1.0.0/16 203.178.136.29 700 500 0 7660 22388 11537 668
AS3 203.178.136.29 700 500 0 7660 22388 11537 668
203.178.136.29 700 500 0 7660 22388 11537 668
6.2.0.0/22 203.178.136.29 700 500 0 7660 22388 11537 668
AS1 AS4
AS3 AS2 AS1

LOCAL_PREF 100 LOCAL_PREF 80


AS5

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

207 209

207 209

102 103
10/4/2024 10/4/2024

Example of AS PATH prepend Load balancing with MED

• Set MED for different paths


• Also control the bandwidth
Network Next Hop Metric LocPrf Weight Path
8.5.192.0/22 203.178.136.14 100 0 2516 209 13989 13989 13989 13989
203.178.136.14 100 0 2516 209 13989 13989 13989 13989 172.16.0.0/16、
203.178.136.14 100 0 2516 209 13989 13989 13989 13989 172.17.0.0/16
8.5.196.0/24 203.178.136.14 100 0 2516 209 13989 13989 13989 13989
203.178.136.14 100 0 2516 209 13989 13989 13989 13989 AS1
203.178.136.14 100 0 2516 209 13989 13989 13989 13989 Routing information of AS1 Routing information of AS1
8.5.200.0/22 203.178.136.14 100 0 2516 209 13989 13989 13989 13989 172.16.0.0/16 = MED 100 172.16.0.0/16 = MED 200
172.17.0.0/16 = MED 200
203.178.136.14 100 0 2516 209 13989 13989 13989 13989 172.17.0.0/16 = MED 100

Route used for Route used for


Some AS are repeated on the path to make it longer 172.16.0.0/16 172.17.0.0/16
and not being selected AS2

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

210 212

210 212

Routing with MED

• In case of 2 AS with many links


• Choose smaller MED
• Apply in controlling bandwidth

172.16.0.0/16
AS1
Routing information Routing information of AS1
of AS1 MED 200
MED 100 used route

How to see routing table at AS2


Prefix AS_PATH MED
AS2 172.16.0.0/16 AS1 100 ◎
172.16.0.0/16 AS1 200 211
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

211

104 105
11/22/2024 11/22/2024

Chapter 5
Transport layer Basic concepts

1 3

1 3

Contents Network layer in the TCP/IP architecture

Application Support network applications


Principles of transport layer
(HTTP, Mail, …)
UDP protocol
Reliable data transfer Transport
Control data transmission between processes
TCP protocol (UDP, TCP …) at the application layer

Network Controlling data transmission to another


(IP, ICMP…) network

Datalink Facilitating communication for


(Ethernet, ADSL…) subsequent components on the same
network
Physical Transmitting and receiving bit streams
(bits…) on the physical transmission line

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

2 4

2 4

1 2
11/22/2024 11/22/2024

Transport services and protocols Transport vs. network layer services and protocols

• Provide logical communication


between application
processes running on different
application
transport

hosts
network
mobile network
data link
physical
national or global ISP
household analogy:
• Sender: 12 kids in Ann’s house sending
• Receives data from application letters to 12 kids in Bill’s
player house:
• Breaks application messages  hosts = houses
into segments, passes to local or
network layer regional  processes = kids
• If data is too large, splits to
ISP
 app messages = letters in
smaller parts and puts to home network content
provider
envelopes
different datagrams network datacenter
application
 transport protocol = Ann and Bill
• Receiver: transport
network
network
who demux to in-house siblings
• Receive data from network
data link
physical  network-layer protocol = postal
layer service
enterprise
• Reassembles segments into network

messages, passes to
application layer

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

5 7

5 7

Transport services and protocols Transport vs. network layer services and protocols

• Install on end-to-end
hosts
application
transport
network
mobile network
data link

network layer: logical household analogy:


• No installation on
physical
national or global ISP

communication between 12 kids in Ann’s house sending


routers or switches letters to 12 kids in Bill’s
hosts house:
• Two transport
transport layer: logical  hosts = houses
protocols available to local or
regional
communication between  processes = kids
Internet applications  app messages = letters in
ISP
home network content processes envelopes
• Reliable and provider
network datacenter
application • relies on, enhances, network  transport protocol = Ann and Bill
connection oriented. transport
network
network
layer services who demux to in-house siblings
data link
 network-layer protocol = postal
For example: TCP physical

service
enterprise
• Unreliable and network

connectionless. For
example: UDP
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

6 8

6 8

3 4
11/22/2024 11/22/2024

Transport Layer Actions Why there are two kind of services?

• Various requirements about services from


applications
• Applications that need 100% reliable data transfer,
Sender: e.g. FTP, Mail…
application  is passed an application- application
app. msg
layer message • Uses TCP (reliable) as transport services
 determines segment
• Application that need fast data transfer but can
TThhtransport
app. msg
transport
header fields values
network (IP)  creates segment network (IP) tolerate with packet lost, e.g. VoIP, Video
link  passes segment to IP link Streaming
physical physical • Uses UDP (best-effort) as transport services

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

9 11

9 11

Transport Layer Actions Two principal Internet transport protocols

applicatio

 TCP: Transmission Control Protocol


n
transport
mobile network
network
data link

Receiver: • reliable, in-order delivery physical national or global ISP

application  receives segment from IP application • congestion control


 checks header values • flow control
app. msg
transport  extracts application-layer transport • connection setup
message  UDP: User Datagram Protocol
local or
regional
network (IP) network (IP)
 demultiplexes message up ISP

to application via socket link • unreliable, unordered delivery home network


link content

physical • no-frills extension of “best-effort” IP provider


network
physical datacenter
applicatio

 services not available:


network
Th app. msg n
transport
network
• delay guarantees data link
physical

• bandwidth guarantees enterprise


network

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

10 12

10 12

5 6
11/22/2024 11/22/2024

Applications and transport services Mux/Demux

Application Application protocols


Transport protocols Application
e-mail SMTP TCP protocols
remote terminal access Telnet TCP HTTP FTP Chat HTTP FTP Chat
Web HTTP TCP
file transfer FTP TCP Transport
Multiplexing Demultiplexing
streaming multimedia Specific protocols TCP or UDP protocols
(e.g. RealNetworks)
Internet telephony Specific protocols
(e.g., Vonage,Dialpad) Usually UDP

Network protocols

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

13 15

13 15

How demultiplexing works

• At network layer, IP packet


was identified by IP address 32 bits

• To distinguish the hosts source port # dest port #

• How to distinguish different other header fields


networking applications in
the same host
Functionalities
application
• Use port number (16-bit) data
• Each process is assigned a (payload)
unique port number
MUX/DEMUX • Socket: a couple of IP TCP/UDP segment format
addresses & port numbers
Error control
• Host uses IP addresses & port
numbers to direct segment to
appropriate socket
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

14 16

14 16

7 8
11/22/2024 11/22/2024

Connectionless demultiplexing: an example Error Control

• Use CRC or Checksum verify integrity


DatagramSocket
serverSocket = new • Checksum
DatagramSocket
DatagramSocket mySocket2
= new DatagramSocket (6428);
DatagramSocket mySocket1 =
new DatagramSocket (5775);
• Similar as checksum (16 bits) of IP
(9157);
• Mechanism
application
application P1 application
P3 P4
transport • Split data to 16-bit chunks sender: breaks down msg to smaller segments
transport transport
• These chunks are then added, any generated carry is
network
network link network
link
physical
physical link
physical
added back to the sum adds these blocks together using a binary sum
• Then, the 1’s complement of the sum is performed
source port: 6428
dest port: 9157
source port: ?
dest port: ? and put in the checksum field computes the 1's complement of the sum
checksum is appended to the data and transmitted to the receiver
source port: 9157 source port: ?
dest port: 6428 dest port: ?

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

18 21

18 21

Connection-oriented demultiplexing: example Example of checksum

application
application P4 P5 P6 application
P1 P2 P3
transport
transport transport
network
network link network
link physical link
physical physical
server: IP
address B

host: IP source IP,port: B,80 host: IP


address A dest IP,port: A,9157 source IP,port: C,5775 address
dest IP,port: B,80 C
source IP,port: A,9157
dest IP, port: B,80
source IP,port: C,9157
dest IP,port: B,80
Three segments, all destined to IP address: B,
dest port: 80 are demultiplexed to different sockets

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

20 22

20 22

9 10
11/22/2024 11/22/2024

Reliable data transfer

How to detect error?


Checksum
How to inform sender?
ACK (acknowledgements):
NAK (negative acknowledgements): tell sender that
pkt has error
Reliable data transfer Reaction of sender?
Retransmit the error packet once received NAK

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

24 26

24 26

Principles of reliable data transfer Error control

Sender Receiver

sending receiving
process process
dat dat
application
a
send pkt0
transport a
pkt1 is
sender-side of receiver-side
OK
Sender, receiver do not know reliable data
transfer protocol
of reliable data
transfer protocol rcv ACK
the “state” of each other, e.g., send pkt1
was a message received? transport
network pkt1 is
 unless communicated via a unreliable channel corrupted
message
reliable service implementation rcv NAK
resend pkt1

Time Time
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

25 27

25 27

11 12
11/22/2024 11/22/2024

Error in ACK/NAK Chanel with error and packet lost

Data and ACK can be lost


 ACK/ NAK may be
Sender Receiver If no ACK is received? How sender knows and
corrupted decides to resend data?
 Packet is resent Sender should wait for ACK for a certain time.
 How to solve packet send pkt0 Timeout!
repetition?
pkt0 is
 Use Seq.# OK How long should be timeout?
rcv ACK At least 1 RTT (Round Trip Time)
send pkt1
Need to start a timer each time sending a packet
pkt1 is
OK What if packet arrives and ACK is lost?
Rcv corrupted Packet should be numbered.
packet! resend pkt1 rcv pkt1
duplicate,

Time Time discard it


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

28 30

28 30

Error control without NAK Illustration


Sender Receiver

sender receiver sender receiver


send pkt0
send pkt0 pkt0 send pkt0 pkt0
pkt0 is rcv pkt0 rcv pkt0
send ack0 send ack0
OK ack
rcv ack0
ack0
rcv ack0 0
rcv ACK0 send pkt1 pkt1 send pkt1 pkt1
rcv pkt1 X
send pkt1 ack1 send ack1
loss
rcv ack1
pkt1 is send pkt0 pkt0
rcv pkt0 timeout
OK ack0 send ack0 resend pkt1 pkt1
rcv ACK1 rcv pkt1
send pkt0 ack1 send ack1
rcv ack1
send pkt0 pkt0
pkt0 is corrupted rcv pkt0
(a) no loss
ack0 send ack0
rcv ACK1
resend pkt0 (b) packet loss

Time Time
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

29 31

29 31

13 14
11/22/2024 11/22/2024

Illustration (2) Transmission in pipeline

sender receiver
sender receiver send pkt0
pkt0
rcv pkt0
send pkt0 pkt0 send ack0
ack
rcv pkt0 rcv ack0
ack send ack0 send pkt1 0
pkt 1 data pkt Data pkts
rcv ack0 0 1 rcv pkt1
send pkt1 pkt send ack1
1 rcv pkt1 ack1
ack1 send ack1
X timeout
loss resend pkt1
pkt1 rcv pkt1
timeout
resend pkt1 pkt1 rcv ack1 (detect duplicate)
rcv pkt1
send pkt0 pkt0 send ack1 Sender Receiver Sender Receiver
(detect duplicate)
ack1 send ack1 ack1 rcv pkt0
rcv ack1 rcv ack1 ACK
send pkt0 pkt0 (ignore) ack0 send ack0 ACKs
rcv pkt0
ack0 send ack0 pkt
1

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

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

32 34

32 34

Performance of reliable data transfer


(stop-and-wait) Comparison of efficiency
stop-and-wait Pipeline
 U sender: utilization – fraction of time sender busy sending sender sender receiver

 example: 1 Gbps link, 15 ms prop. delay, 8000 bit packet 0


L/R L/R
• time to transmit packet into channel:
L 8000 bits
Dtrans = R = 9 = 8 microsecs
10 bits/sec RTT RTT
sender receive
r
L/R L/R
Usender=
RTT + L / R RTT + L / R RTT + L / R
.008 RTT
=
30.008
time time
= 0.00027 L: Size of data pkt time time
R: Link bandwidth
 The performance stinks! RTT: Round trip time 3*L/R
Performance =
L/R
 Protocol limits performance of underlying infrastructure (channel) Performance = RTT + L / R
RTT + L / R
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

33 35

33 35

15 16
11/22/2024 11/22/2024

Pipelining: increased utilization Sliding windows: mechanism

• Consider two stations A and B connected by a simplex


sender receiver transmission line.
first packet bit transmitted, t = 0
last bit transmitted, t = L / R
• B has a buffer for n data frames.
• Thus, B can receive n data frames simultaneously without the
first packet bit arrives need for acknowledgment.
RTT last packet bit arrives, send ACK
last bit of 2nd packet arrives, send ACK
last bit of 3rd packet arrives, send ACK
• Acknowledgment:
ACK arrives, send next • To 'remember' the acknowledged frames, it is necessary to
packet, t = RTT + L / R number the frames.
3-packet pipelining increases
• B acknowledges a frame by indicating the frame number B is
utilization by a factor of 3!
waiting to receive, implicitly acknowledging all frames received
3L / R .0024
before.
U = 0.00081
sender = =
30.008 • One acknowledgment can be used for multiple data frames.
RTT + L / R

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

36 38

36 38

Sliding windows: mechanism Sliding window mechanism

• Send multiple segments/frames simultaneously to


reduce the waiting time
• Store transmitted frames while waiting for ACKs
• The number of transmitted frames is dependent on
buffer
• After receiving ACK
• Release the acknowledged (ACK) frame from the buffer
• Send the next frame

In the window are frames In the window are frames


waiting to be sent waiting to be received
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

37 39

37 39

17 18
11/22/2024 11/22/2024

Sliding window mechanism Sliding window mechanism

• Source managment
• Frames sent successfully.
• Frames sent but not acknowledged.
• Frames that can be sent immediately.
• Frames that cannot be sent immediately.
• Destination management
• Frames received.
• Frames waiting to be received.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

40 42

40 42

Sliding window mechanism Acknowledgment and Retransmission Techniques

• The frames being sent are numbered. • ARQ automatic repeat request
• The sequence number must be greater than or equal to
the window size.
• There are 3 standardized versions
• Stop-and-Wait ARQ
• Acknowledgments for received frames are sent
• Previously presented
with numbered acknowledgments.
• Go-Back-N ARQ
• Acknowledgments are cumulative. • Selective Reject/ Selective Repeat ARQ
• If frames 1, 2, 3, 4 are successfully received, only
acknowledgment for frame 4 is sent.
• Upon receiving an acknowledgment for frame k, it
implies that all frames k-1, k-2, and so on, have
been successfully received.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

41 43

41 43

19 20
11/22/2024 11/22/2024

Go-Back-N: sender Go-Back-N in action

sender window (N=4) sender receiver


012345678 send pkt0
 sender: “window” of up to N, consecutive transmitted but unACKed pkts 012345678 send pkt1
send pkt2 receive pkt0, send ack0
012345678
• k-bit seq # in pkt header 012345678 send pkt3 X loss receive pkt1, send ack1
(wait)
receive pkt3, discard,
012345678 rcv ack0, send pkt4 (re)send ack1
012345678 rcv ack1, send receive pkt4, discard,
pkt5 (re)send ack1
ignore duplicate ACK receive pkt5, discard,
(re)send ack1
pkt 2 timeout
012345678 send pkt2
012345678 send pkt3
 cumulative ACK: ACK(n): ACKs all packets up to, including seq # n 012345678
012345678
send
send
pkt4
pkt5
rcv
rcv
pkt2,
pkt3,
deliver,
deliver,
send
send
ack2
ack3
• on receiving ACK(n): move window forward to begin at n+1 rcv
rcv
pkt4,
pkt5,
deliver,
deliver,
send
send
ack4
ack5
 timer for oldest in-flight packet
 timeout(n): retransmit packet n and all higher seq # packets in window

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

44 46

44 46

Go-Back-N: receiver Selective repeat

receiver individually acknowledges all correctly received


 ACK-only: always send ACK for correctly-received packet so far, with
packets
highest in-order seq # • buffers packets, as needed, for eventual in-order delivery to
• may generate duplicate ACKs upper layer
• need only remember rcv_base sender times-out/retransmits individually for unACKed
 on receipt of out-of-order packet: packets
• can discard (don’t buffer) or buffer: an implementation decision • sender maintains timer for each unACKed pkt
• re-ACK pkt with highest in-order seq #
sender window
Receiver view of sequence number space: • N consecutive seq #s
received and ACKed • limits seq #s of sent, unACKed packets
… … Out-of-order: received but not ACKed

rcv_base
Not received

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

45 47

45 47

21 22
11/22/2024 11/22/2024

Selective repeat: sender, receiver windows 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 X loss receive pkt1, send ack1
(wait)
receive pkt3, buffer,
012345678 rcv ack0, send pkt4 send ack3
012345678 rcv ack1, send
receive pkt4, buffer,
pkt5
record ack3 arrived send ack4
receive pkt5, buffer,
pkt 2 timeout send ack5
012345678 send pkt2
012345678 (but not 3,4,5)
012345678 rcv pkt2; deliver pkt2,
012345678 pkt3, pkt4, pkt5; send ack2

Q: what happens when ack2 arrives?

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

48 50

48 50

Selective repeat: sender and receiver Selective repeat: a dilemma!


sender window receiver window
(after receipt) (after receipt)

0123012 pkt0

sender receiver 0123012


0123012
pkt1
pkt2
0123012
0123012
data from above: packet n in [rcvbase, rcvbase+N-1] example: 0123012
0123012 pkt3
X
 if next available seq # in  send ACK(n)  seq #s: 0, 1, 2, 3 (base 4 counting) 0123012

window, send packet  out-of-order: buffer


pkt0 will accept packet
 window size=3 (a) no problem
with seq number 0

timeout(n):  in-order: deliver (also deliver


buffered, in-order packets),
 resend packet n, restart timer
advance window to next not-yet-
ACK(n) in [sendbase,sendbase+N]: received packet 0123012 pkt0

 mark packet n as received packet n in [rcvbase-N,rcvbase-1] 0123012


0123012
pkt1
pkt2 X
0123012
0123012

 if n smallest unACKed packet,  ACK(n) X 0123012


X
advance window base to next otherwise: timeout
retransmit pkt0
unACKed seq #  ignore 0123012 pkt0
will accept packet
with seq number 0
(b) oops!

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

49 51

49 51

23 24
11/22/2024 11/22/2024

Selective repeat: a dilemma! “Best effort” protocols

sender window
(after receipt)
receiver window
(after receipt) Why UDP?
0123012 pkt0 No need to establish connection (cause delay)
pkt1 0123012
0123012
0123012 pkt2 0123012
Simple
example: 0123012 pkt3
0123012
Small header
X
 seq #s: 0, 1, 2, 3 (base 4 counting)  0receiver
123012
can’t
pkt0 will accept packet No congestion control  send data as fast as possible
 window size=3 see sender side with seq number 0
(a) no problem
 receiver
behavior  Main functionality of UDP?
identical in both
cases!  MUX/DEMUX
0something’s pkt0
Q: what relationship is needed
123012
0(very)
1 2 3 0 1wrong!
2 pkt1 0123012  Detect error by checksum
between sequence # size and 0123012 pkt2 X
X
0123012

window size to avoid problem


0123012
X
in scenario (b)? timeout
retransmit pkt0
0123012 pkt0
will accept packet
with seq number 0
(b) oops!

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

52 54

52 54

Datagram format

Data unit in UDP is 32 bits


called datagram source port # dest port #
length checksum
UDP Length of the
User Datagram Protocol datagram in
byte
Application
data
(message)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

53 55

53 55

25 26
11/22/2024 11/22/2024

Issues of UDP

No congestion control


Cause overload of the Internet
No reliability
Applications have to implement themselves
mechanisms to control errors
TCP
Transmission Control Protocol
TCP segment structure
Connection management
Flow control
Congestion control

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

58 60

58 60

Summary: UDP Overview of TCP

Connection oriented
 “no frills” protocol: 3 steps hand-shake
• segments may be lost, delivered out of order Data transmission in stream of byte, reliable
• best effort service: “send and hope for the best” Use buffer
 UDP has its plusses: Transmit data in pipeline
• no setup/handshaking needed (no RTT incurred) Increase the performance
• can function when network service is compromised Flow control
• helps with reliability (checksum) Sliding windows
 build additional functionality on top of UDP in application layer Congestion control
(e.g., HTTP/3) Detect congestion and solve

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

59 61

59 61

27 28
11/22/2024 11/22/2024

TCP segment Acknowledgment Mechanism in TCP


32 bits
URG: urgent data - For reliable
source port # dest port # outgoing segment from sender
transmission Sequence numbers: source port # dest port #

sequence number sequence number


ACK: ACK # • byte stream “number” of acknowledgement number

acknowledgement number first byte in segment’s data checksum


rwnd
urg pointer
head not
PSH: data needs to UAP R S F Receive window window size
len used
-For flow control Acknowledgements: N
be sent immediately checksum Urg data pnter -with sliding window • seq # of next byte expected
RST, SYN, FIN: from other side sender sequence number space
Options (variable length)
Flag for special • cumulative ACK sent sent, not- usable not
ACKed yet ACKed but not usable
segment
Q: how receiver handles out-of- (“in-flight”) yet sent

application order segments outgoing segment from receiver

data • A: TCP spec doesn’t say, - up


source port # dest port #
sequence number

(variable length) to implementor acknowledgement number


A rwnd
checksum urg pointer

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

62 64

62 64

How TCP provide reliable service? Acknowledgment Mechanism in TCP

In order to assure if data arrives to destination: Seq. #:


Host A Host B
Seq. # • Sequence number of
the first byte in the User
Ack message stream types
‘Helloworld’
TCP cycle life: ACK: host ACKs
receipt of
Connection establishing • Desired sequence ‘Helloworld’, replies
 3 steps number of the byte back ‘Bye’
to be received
Data transmission from the peer. host ACKs
Close connection • Implicitly receipt
acknowledges of echoed
‘C’
successful receipt
of previous bytes
time
Simple scenario

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

63 65

63 65

29 30
11/22/2024 11/22/2024

Acknowledgment Mechanism in TCP TCP: retransmission scenarios

Host A Host B
Host A Host B

Seq=92, 8 bytes of data


User types‘C’
Seq=42, ACK=79, data = ‘C’ Seq=100, 20 bytes of data
host ACKs receipt ACK=100
of‘C’, echoes back ‘C’ X
Seq=79, ACK=43, data = ‘C’ ACK=120
host ACKs receipt
of echoed ‘C’
Seq=43, ACK=80 Seq=120, 15 bytes of data

cumulative ACK covers


simple telnet scenario for earlier lost ACK

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

66 68

66 68

TCP: retransmission scenarios TCP fast retransmit

Host A Host B
Host A Host B Host A Host B
TCP fast retransmit
if sender receives 3 additional
SendBase=92 ACKs for same data (“triple
duplicate ACKs”), resend
Seq=92, 8 bytes of data Seq=92, 8 bytes of data

Seq=100, 20 bytes of data


unACKed segment with X
timeout

timeout

ACK=100
X
ACK=100
smallest seq #
ACK=120  likely that unACKed segment
lost, so don’t wait for timeout

timeout
Seq=92, 8 bytes of data Seq=92, 8
SendBase=100 bytes of data send cumulative
ACK for 120
ACK=100
SendBase=120
Receipt of three duplicate
ACK=120
ACKs indicates 3 segments Seq=100, 20 bytes of data
SendBase=120 received after a missing
lost ACK scenario premature timeout segment – lost segment is
likely. So retransmit!

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

67 69

67 69

31 32
11/22/2024 11/22/2024

Connection establishing in TCP: 3 steps (3-way handshake) Simplified life cycle of TCP

Step 1: A sends SYN to B Client application


A B  Indicate initial value of seq # of Initiates a TCP connection Server application
Creates a listen socket
A Wait 30 sec.
CLOSED
Receive ACK
CLOSED
 No data Send SYN
Send nothing

Step 2: B receives SYN, replies


by SYNACK TIME_WAIT SYN_SENT LAST_ACK LISTEN
 B initiates the buffer on its side
 Indicate initial value of seq. # of Receive FIN Receive SYN/ACK Receive SYN
Send ACK Send FIN Send SYN/ACK
B
Send ACK

Step 3: A receives SYNACK, FIN_WAIT_2 ESTABLISHED CLOSE_WAIT SYN_RCVD


replies ACK, maybe with data.
Send FIN
Receive ACK
Send nothing Receive FIN Receive ACK
FIN_WAIT_1 Send ACK ESTABLISHED Send nothing

Client application
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology Initiates close connection
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

70 72

70 72

Close connection

• Step 1: Send FIN to B A B


• Step 2: B receives FIN, replies
ACK, closes the connection and closing
sends FIN.
• Step 3: A receives FIN, replies
ACK, go to “waiting”. closing
Flow control in TCP
• Bước 4: B receives ACK. close
connection
timed wait

closed

closed

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

71 73

71 73

33 34
11/22/2024 11/22/2024

TCP flow control TCP flow control

application application
Q: What happens if network Application removing
process Q: What happens if network Application removing
process

layer delivers data faster data from TCP socket layer delivers data faster data from TCP socket
buffers buffers
than application layer TCP socket than application layer TCP socket
removes data from socket receiver buffers removes data from socket receiver buffers
buffers? buffers?
TCP TCP
code code
Network layer
delivering IP
datagram payload receive window
flow control: # bytes
into TCP socket IP receiver willing to accept IP
code code
buffers

from sender from sender

receiver protocol stack receiver protocol stack

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

74 76

74 76

TCP flow control TCP flow control

application application
Q: What happens if network Application removing
process Q: What happens if network Application removing
process

layer delivers data faster data from TCP socket layer delivers data faster data from TCP socket
buffers buffers
than application layer TCP socket than application layer TCP socket
removes data from socket receiver buffers removes data from socket receiver buffers
buffers? buffers?
TCP TCP
Network layer
code
flow control code

delivering IP
datagram payload receiver controls sender, so
into TCP socket IP
code
sender won’t overflow IP
code
buffers receiver’s buffer by
transmitting too much, too
from sender fast from sender

receiver protocol stack receiver protocol stack

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

75 77

75 77

35 36
11/22/2024 11/22/2024

TCP flow control Information exchanged on Rwnd

• Control the amount of data sent. A B


• Ensure efficiency is optimal.  Receiver inform
• Avoid overloading parties. regularly to senders
• Parties will have control windows. the value of Rwnd in
• Rwnd: Receive window. acknowledgment
• CWnd: Congestion window. segments
• The amount of data sent must be less than
min(Rwnd, CWnd).

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

78 80

78 80

TCP flow control

Congestion control in TCP


Size of free buffer
= Rwnd
= RcvBuffer-[LastByteRcvd
- LastByteRead]

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

79 81

79 81

37 38
11/22/2024 11/22/2024

Principles of congestion control TCP AIMD: more

Congestion: Multiplicative decrease detail: sending rate is


 Cut in half on loss detected by triple duplicate ACK (TCP Reno)
 informally: “too many sources sending too much data too fast for
network to handle”  Cut to 1 MSS (maximum segment size) when loss detected by
timeout (TCP Tahoe)
 manifestations:
• long delays (queueing in router buffers) Why AIMD?
• packet loss (buffer overflow at routers)  AIMD – a distributed, asynchronous algorithm – has been
• Network condition becomes worse shown to:
• optimize congested flow rates network wide!
 different from flow control! congestion • have desirable stability properties
 a top-10 problem! control: too many
senders, sending too fast

flow control: one sender


too fast for one receiver

Congestion
occur

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

82 84

82 84

TCP congestion control: AIMD TCP congestion control: details

 approach: senders can increase sending rate until packet loss sender sequence number space
(congestion) occurs, then decrease sending rate on loss event cwnd TCP sending behavior:
 roughly: send cwnd bytes,
Additive Increase Multiplicative Decrease wait RTT for ACKS, then
increase sending rate by 1 cut sending rate in half at send more bytes
maximum segment size every each loss event last byte
RTT until loss detected cwnd
ACKed sent, but not- available but
not used
TCP rate ~
~ bytes/sec
yet ACKed RTT
(“in-flight”) last byte sent

AIMD sawtooth
TCP sender Sending

behavior: probing  TCP sender limits transmission: LastByteSent- LastByteAcked < cwnd

for bandwidth  cwnd is dynamically adjusted in response to observed


network congestion (implementing TCP congestion control)
rate

time

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

83 85

83 85

39 40
11/22/2024 11/22/2024

TCP slow start Congestion control

• Timeout on the sender side:


Host A Host B
 when connection begins, • TCP sets the threshold (ssthresh) to half of the current
increase rate exponentially value of cwnd.
until first loss event: • TCP sets cwnd to 1 MSS.

RTT
• initially cwnd = 1 MSS • TCP transitions to slow start.
• double cwnd every RTT
• done by incrementing cwnd
for every ACK received • If receiving 3 identical ACKs:
 summary: initial rate is • TCP sets the threshold to half of the current value of
cwnd.
slow, but ramps up
exponentially fast time • TCP transitions to congestion avoidance state.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

86 88

86 88

TCP: from slow start to congestion avoidance Congestion control – illustration


cwnd

Q: when should the exponential


increase switch to linear? 22
Timeout
X
A: when cwnd gets to 1/2 of its 20

value before timeout. 18


Threshold=16 Threshold is set to half of cwnd (20)
16 And slow start starts

Implementation:
14
3 ACKs
12 SS
 variable ssthresh 10
Threshold=10 Threshold is set to half of cwnd (12)
AI And additive increase starts
 on loss event, ssthresh is set to 8
SS
1/2 of cwnd just before loss event 6
AI Threshold=6

4
AI
2

Step

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

87 89

87 89

41 42
11/22/2024

Exercise

Assume that we need transmit 1 file


File size O =100KB over TCP connection
S is the size of each TCP segment, S = 536 byte
RTT = 3 ms.
Assume that the congestion window size of Chapter 6:
TCP is fixed with value W. Application layer
• What is the transmission time if W=1 (stop-and-wait)?
• What is the transmission time if W=7?
• What is the minimum transmission time?
The transmission speed is
 R = 20 Mbit/s; and R = 100 Mbits/s.

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology 1
90

1
90

Solution (cont.) Contents


T transmit (W packet) = W * S/R
• Application layer
Transmit without waiting: • Fundamental concepts
=> (W-1)*S/R >= RTT • Case study: HTTP, Mail, FTP…
=> W >= RTT*R/S +1
 Time to transmit all data L = L/R + RTT
R=100 Mbps
W>= 100ms * 100 Mbps/ (536*8) + 1

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
92 School of Information and Communication Technology

92
2

43
1
Application and service?

MUSIC ONLINE
VoIP
GAME CHAT VoD
ON LINE e-Office
SMS e-BANK
MAIL
E-learning
WEB
YOUTUBE
Fundamental concepts VIDEO
CONFERENCE FTP
EBAY
GOOGLE SKYPE
Social
networks SSH

NEWS E-COMMERCE GRID


BITTORENT
e-Goverment
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology

3 5

3 5

Application layer in OSI model Application and application protocol


• Application protocol application
• Define communication rule
• Control and provide
transport
network
Application • Use service of transport layer data link

network services. (TCP/UDP…) physical

(HTTP, Mail, …) • Application:


• In the TCP/IP model, Transport • Is a process on the internet. They
communicate to each other by
there are no separate exchanging messages.
(UDP, TCP …)
presentation and • Runs on end systems
Network • Use application protocol for providing
session layers. service
(IP, ICMP…) • Two different process types
• Network applications • Server: provides services, response
application
transport

implement the Datalink requests from clients


network
data link
application
• Client: provides user interface, send physical
functions of these (Ethernet, ADSL…) requests to server
transport
network
data link
two layers. Physical • Example of application/protocol: physical

• Web (HTTP)
(bits…) • Mail (SMTP/POP/IMAP) …

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

4 6

4 6

2 3
Communication between application processes Application architecture

• Socket: an interface between application process and Client-server model


transport layer
P2P (Peer-to-peer) model
• Processes use services provided by transport layer to
exchange information Hybrid model
• Socket is identified by port number and IP address

application application
socket controlled by
process process app developer

transport transport
network network controlled
link by OS
link Network
physical physical

Image from: “Computer Networking: A Top Down


TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
Approach”, Jim Kurose TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

7 9

7 9

Communication between processes Client-server architecture


• Two kind of components:
• Client process: send requests client and server
client
• Server process: response requests • Client
• Standard model: 1 server – many clients client
• Client sends requests for service
to server
• Clients need to know server address: IP address • Clients do not contact directly to
and port number each other

client • Server
Server • Always online waiting for service
wait for result handles response
client requests from clients
request response • There may be backup servers for
assuring high availability in
server client failures
wait handle wait
request • e.g. Web, Mail, …
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

8 10

8 10

4 5
Pure Peer-to-peer architecture

Peer Peer
No center server, only
peers as components
Peers have equal role in
the system
Peer Any two peers can
Peer
communicate directly to
each other but only when Domain name service
both are online.
Peer does not need to be
online all the time
Peer Peer E.g. Gnutella, Bittorent

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

11 13

11 13

Hybrid architecture Introduction

Client
A center server for user • Domain name: identifier on application layer for
management, indexing for network node
search purpose. • Internet management should be centralised
Clients communicate • International: ICANN
directly to each other • Vietnam: VNNIC
Server after authentication • DNS(Domain Name System): the Internet's system for
process with server. mapping alphabetic names to numeric Internet Protocol
E.g. Skype (before 2016) (IP) addresses
Skype server manage user • Address resolution
lists, authentification
Client After authentification users • Users/ Clients use domain name to access services
Client
communicate directly to • Computers and network devices cannot use domain name but
each other IP address
P2P Comm. • How to translate domain name to IP address and
Client-Server Comm. reverse?
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

12 14

12 14

6 7
Example of address resolution DNS Server system

• Root server
• Computers use IP • Answer local DNS servers
I want to access
• Users use DN www.soict.hust.edu.vn • Manage zone and decentralize the management to lower-level
servers
User
• There are 13 root servers (http://www.root-servers.org)

Need address resolution


Please access to
202.191.56.65

Domain Name
Server

Web server
202.191.56.65 Image from : Wikipedia

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

15 17

15 17

Domain Name Space DNS Server system (cont.)

• Top Level Domain servers


 Architecture: Tree • Manage domain level 1
structure
 Root: Root node
• Authoritative DNS servers
 Divided into zones • Manage lower-level domains
 Each node is a set of • Servers of organisations: ISP
records describing the • Not belong to DNS hierarchy
corresponding domain
• Local server: for private network of institutes
for that node. For
• Not belong to DNS hierarchy
example:
 SOA (Start of Authority)
Hình ảnh từ: Wikipedia
 NS (Name Server)
 A (Address)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

16 18

16 18

8 9
Address resolution DNS Message

• Self-resolution • #Answer RRs: Number of Identification Flags


• File HOST: answered records
#Question #Answer RRs
• Windows: C:\WINDOWS\system32\drivers\etc\ • ANSWER: Answered
• Linux: /etc/hosts records #Authority RRs #Additional RRs

• Application cache • # Authority RRs: Number QUESTION


of records that servers
• DNS service: client/server are authorized ANSWER

• Application protocol: DNS • AUTHORITY: Records of AUTHORITY


• Use UDP/TCP with the port 53 authorized servers ADDITIONAL
• Recursive Query • #Additional RRs: Number
• Interactive Query of additional records
• ADDITIONAL: additional
records
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

19 21

19 21

DNS Message Example: dig linux.com

; <> DiG 9.9.2-P1 <> linux.com


• DNS Query and DNS Identification Flags ;; global options: +cmd
Reply: same format #Question #Answer RRs
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21655
• Identification ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2,
#Authority RRs #Additional RRs
• Response must have the ADDITIONAL: 3
;; QUESTION SECTION: TTL: timing in cache
same identification of the QUESTION
;linux.com. IN A
request ;; ANSWER SECTION:
ANSWER
• Flags: control flags linux.com. 1786 IN A 140.211.167.51
AUTHORITY linux.com. 1786 IN A 140.211.167.50
• #Question: number of ;; AUTHORITY SECTION:
ADDITIONAL linux.com. 86386 IN NS ns1.linux-foundation.org.
domain names requested linux.com. 86386 IN NS ns2.linux-foundation.org.
• QUESTION: requested ;; ADDITIONAL SECTION:
ns1.linux-foundation.org. 261 IN A 140.211.169.10
domain names ns2.linux-foundation.org. 262 IN A 140.211.169.11

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

20 22

20 22

10 11
Example: dig linux.com Interactive Query

; <> DiG 9.9.2-P1 <> linux.com


;; global options: +cmd
• Default mechanism on DNS
root
;; Got answer: server
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21655
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2,
ADDITIONAL: 3
;; QUESTION SECTION: Names of DNS servers answered the request
;linux.com. IN A If ANSWER is empty, DNS Resolver sends the soict.hust.edu.vn soict.hust.edu.vn
;; ANSWER SECTION: request to these DNS servers
TLD
linux.com. 1786 IN A 140.211.167.51 server
linux.com. 1786 IN A 140.211.167.50 202.191.56.65 Ask dns.hust.edu.vn
Default dns.vn
;; AUTHORITY SECTION:
server
linux.com. 86386 IN NS ns1.linux-foundation.org.
linux.com. 86386 IN NS ns2.linux-foundation.org.
;; ADDITIONAL SECTION:
ns1.linux-foundation.org. 261 IN A 140.211.169.10 Authoritative
ns2.linux-foundation.org. 262 IN A 140.211.169.11 DNS server
dns.hust.edu.vn
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

23 25

23 25

Example : dig linux.com Recursive Query

; <> DiG 9.9.2-P1 <> linux.com • Extensible option Root


;; global options: +cmd server
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21655
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, soict.hust.edu.vn
ADDITIONAL: 3 202.191.56.65
IP address of DNS servers. soict.hust.edu.vn
;; QUESTION SECTION:
;linux.com. IN A Information will be stored in cache TLD
;; ANSWER SECTION: 202.191.56.65 server
linux.com. 1786 IN A 140.211.167.51 Default
linux.com. 1786 IN A 140.211.167.50 server dns.vn
;; AUTHORITY SECTION: soict.hust.edu.vn
linux.com. 86386 IN NS ns1.linux-foundation.org. 202.191.56.65
linux.com. 86386 IN NS ns2.linux-foundation.org.
;; ADDITIONAL SECTION: Authoritative
ns1.linux-foundation.org. 261 IN A 140.211.169.10 DNS server
ns2.linux-foundation.org. 262 IN A 140.211.169.11
dns.hust.edu.vn
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

24 26

24 26

12 13
Uniform Resource Locator

• A reference to a web resource that specifies its


location on a computer network and a
mechanism for retrieving it
protocol://hostname[:port]/directory-path/resource

• protocol: http, ftp, https, smtp, rtsp…


3. Web service • hostname: domain name or IP address
• port: port number (might not need)
• directory path: path to the resource
• resource: name of the resource

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

27 29

27 29

HTTP and Web Web and HTTP

• Internet before 1990s:


• Limited using for government institutes, research centers, ... First, a quick review…
• Email or FTP services were not suitable for public data sharing
 web page consists of objects, each of which can be stored on
• No effective mechanism to link scattered resources in the different Web servers
Internet
 object can be HTML file, JPEG image, Java applet, audio
• In 1990, Tim Berners-Lee introduced World Wide Web: file,…
• Exchange information as hypertext using HTML (Hypertext
 web page consists of base HTML-file which includes several
Markup Language)
referenced objects, each addressable by a URL, e.g.,
• Objects are not needed to be packed as “all in one” as previous
ones www.someschool.edu/someDept/pic.gif
• Hypertexts only need to contain links to other objects (located host name path name
by URL)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

28

28 30

14 15
HTTP overview HTTP connections: two types

WWW: World Wide Web Non-persistent HTTP Persistent HTTP


• Exchange hypertext HTML
(HyperText Markup Language) 1. TCP connection • TCP connection opened
on the internet opened to a server
PC running
Firefox browser 2. at most one object • multiple objects can be
HTTP: hypertext transfer protocol sent over TCP sent over single TCP
• Web’s application layer protocol connection connection between
server running
• client/server model: Apache Web
3. TCP connection client, and that server
server
• client: browser that requests,
receives, (using HTTP protocol) and closed • TCP connection closed
iPhone running
“displays” Web objects Safari browser
• server: Web server sends (using
downloading multiple
HTTP protocol) objects in response
From the lecture: “Computer Networking: A Top
Down Approach”, Jim Kurose objects required
to requests multiple connections
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

31 33

HTTP overview (continued) Non-persistent HTTP: example

User enters URL: www.someSchool.edu/someDepartment/home.index


HTTP uses TCP: HTTP is “stateless” (containing text, references to 10 jpeg images)

 client initiates TCP connection  server maintains no


(creates socket) to server, port 80 information about past client 1a. HTTP client initiates TCP
requests connection to HTTP server 1b. HTTP server at host
 server accepts TCP connection (process) at www.someSchool.edu on www.someSchool.edu waiting for TCP
from client aside port 80 connection at port 80 “accepts”
 HTTP messages (application-layer protocols that maintain “state” connection, notifying client
are complex! 2. HTTP client sends HTTP
protocol messages) exchanged
 past history (state) must be request message (containing
between browser (HTTP client) and maintained 3. HTTP server receives request message,
URL) into TCP connection
Web server (HTTP server)  if server/client crashes, their views forms response message containing
socket. Message indicates
 HTTP Request: request message of “state” may be inconsistent, requested object, and sends message
time that client wants object
 HTTP Response: response message must be reconciled someDepartment/home.index into its socket
 TCP connection closed

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-32 Application Layer: 2-34

32 34

16 17
Non-persistent HTTP: example (cont.) Persistent HTTP (HTTP 1.1)

Non-persistent HTTP Persistent HTTP (HTTP1.1):


User enters URL: www.someSchool.edu/someDepartment/home.index
issues: server leaves connection
(containing text, references to 10 jpeg images) requires 2 RTTs per open after sending
object response
4. HTTP server closes TCP
OS overhead for each subsequent HTTP
connection.
TCP connection messages between same
5. HTTP client receives response client/server sent over
browsers often open
message containing html file,
displays html. Parsing html file, multiple parallel TCP open connection
finds 10 referenced jpeg objects connections to fetch client sends requests as
referenced objects in soon as it encounters a
6. Steps 1-5 repeated for parallel referenced object
each of 10 jpeg objects
time as little as one RTT for all
the referenced objects
(cutting response time in
half)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-35 Application Layer: 2-37

35 37

Non-persistent HTTP: response time Operation of HTTP/1.0


Web client Web server

Init TCP connection


Accept TCP connection
RTT (definition): time for a small
packet to travel from client to
server and back OK, send HTTP request
initiate TCP
connection Send HTTP response: index.html
HTTP response time (per object): RTT
 one RTT to initiate TCP connection Close TCP connection
request file
 one RTT for HTTP request and first few Parse index.html: has 10
RTT time to
bytes of HTTP response to return transmit reference to 10 images
 obect/file transmission time file received
file
Accept TCP connection
Repeat above steps 10
time
times!
time
Non-persistent HTTP response time = 2RTT+ file transmission time Send images 1
Close TCP connection
2xRTT

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


Time
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
Time
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-36 38

36 38

18 19
Operation of HTTP/1.1 HTTP request message
Web client Web server

Init TCP connection


Accept TCP connection
 two types of HTTP messages: request, response
 HTTP request message:
OK, send HTTP request • ASCII (human-readable format) carriage return character
line-feed character
request line (GET,
GET /index.html HTTP/1.1\r\n
Parse index.html: has 10 POST,
Send HTTP Host: www-net.cs.umass.edu\r\n
reference to 10 images HEAD commands) User-Agent: Firefox/3.6.10\r\n
response: index.html Accept: text/html,application/xhtml+xml\r\n
request images 1 header Accept-Language: en-us,en;q=0.5\r\n
lines Accept-Encoding: gzip,deflate\r\n
Send images 1 Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
Keep-Alive: 115\r\n
Connection: keep-alive\r\n
request images 2 carriage return, line \r\n
feed at start of line
Send images 2 indicates end of header
lines
Stop-and- Pipeline
request images 10 wait!
Time
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
Time TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

39 Application Layer: 2-41

39 41

HTTP/1.1 with pipeline


Other HTTP request messages
Web client Web server

POST method: HEAD method:


Init TCP connection  web page often includes form  requests headers (only) that
Accept TCP connection input would be returned if specified
 user input sent from client to URL were requested with an
server in entity body of HTTP HTTP GET method.
OK, send HTTP request
POST request message
Send HTTP
PUT method:
Parse index.html: has 10  uploads new file (object) to
reference to 10 images response: index.html GET method (for sending data to server
server):  completely replaces file that
request images 1 -10
 include user data in URL field of HTTP exists at specified URL with
Send images 1-10 GET request message (following a ‘?’): content in entity body of POST
HTTP request message
www.somesite.com/animalsearch?monkeys&banana

Time Time
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

40 Application Layer: 2-42

40 42

20 21
HTTP response message Trying out HTTP (client side) for yourself

1. Telnet to your favorite Web server:


status line (protocol HTTP/1.1 200 OK\r\n  opens TCP connection to port 80 (default HTTP server
telnet gaia.cs.umass.edu 80
status code status phrase) Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n port) at gaia.cs.umass. edu.
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02  anything typed in will be sent to port 80 at
GMT\r\n gaia.cs.umass.edu
ETag: "17dc6-a5c-bf716880"\r\n
header Accept-Ranges: bytes\r\n 2. type in a GET HTTP request:
lines Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n GET /kurose_ross/interactive/index.php HTTP/1.1
Connection: Keep-Alive\r\n Host: gaia.cs.umass.edu
 by typing this in (hit carriage return twice), you send
Content-Type: text/html; charset=ISO-8859-
1\r\n this minimal (but complete) GET request to HTTP
\r\n server
data, e.g., requested data data data data data ...
HTML file 3. look at response message sent by HTTP server!
(or use Wireshark to look at captured HTTP request/response)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-43 Application Layer: 2-45

43 45

HTTP response status codes Maintaining user/server state: cookies

 status code appears in 1st line in server-to-client response message. Recall: HTTP GET/response
a stateful protocol: client makes
two changes to X, or none at all
 some sample codes: interaction is stateless
200 OK  no notion of multi-step exchanges
X

• request succeeded, requested object later in this message of HTTP messages to complete a
301 Moved Permanently Web “transaction”
X

• requested object moved, new location specified later in this message (in • no need for client/server to track X’
Location: field) “state” of multi-step exchange t’
400 Bad Request • all HTTP requests are independent of X’’
• request msg not understood by server each other
404 Not Found • no need for client/server to “recover” X’’
from a partially-completed-but-never-
• requested document not found on this server completely-completed transaction
time time

505 HTTP Version Not Supported Q: what happens if network connection or


client crashes at t’ ?

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-44 Application Layer: 2-46

44 46

22 23
Maintaining user/server state: cookies HTTP cookies: comments

Web sites and client browser Example:


aside
use cookies to maintain  Susan uses browser on laptop, visits What cookies can be used for: cookies and privacy:
specific e-commerce site for first time
some state between  authorization  cookies permit sites to
 when initial HTTP requests arrives at learn a lot about you on
transactions site, site creates:
 shopping carts
their site.
 recommendations
four components: • unique ID (aka “cookie”)
 user session state (Web e-mail)
 third party persistent
cookies (tracking cookies)
1) cookie header line of HTTP • entry in backend database for ID
allow common identity
response message • subsequent HTTP requests from (cookie value) to be
Susan to this site will contain cookie Challenge: How to keep state: tracked across multiple
2) cookie header line in next ID value, allowing site to “identify”  protocol endpoints: maintain state at
HTTP request message web sites
Susan sender/receiver over multiple transactions
3) cookie file kept on user’s  cookies: HTTP messages carry state
host, managed by user’s
browser
4) back-end database at Web
site

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-47 Application Layer: 2-49

47 49

Maintaining user/server state: cookies Web caches (proxy servers)

client Goal: satisfy client request without involving origin server


server
ebay 8734 usual HTTP request msg Amazon server  user configures browser to
cookie file creates ID point to a Web cache proxy
usual HTTP response 1678 for user backend
create  browser sends all HTTP server
ebay 8734 set-cookie: 1678 entry database
amazon 1678
requests to cache Client 1
origin
usual HTTP request msg • if object in cache: cache server
cookie: 1678 cookie- access
specific returns object to client
usual HTTP response msg action • else cache requests object
from origin server, caches
one week later:
access received object, then Client 2
origin
ebay 8734 usual HTTP request msg returns object to client server
amazon 1678 cookie: 1678 cookie-
specific
usual HTTP response msg action
time time

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-48 Application Layer: 2-50

48 50

24 25
Web caches (proxy servers) Caching example: buy a faster access link

 Web cache acts as both Why Web caching?


client and server  reduce response time for client Scenario: 154 Mbps
• server for original request  access link rate: 1.54 Mbps origin
requesting client  RTT from institutional router to server: 2 sec servers
• cache is closer to client  Web object size: 100K bits public
• client to origin server Internet
 reduce traffic on an institution’s  Avg request rate from browsers to origin
 typically cache is access link servers: 15/sec
installed by ISP  avg data rate to browsers: 1.50 Mbps 154 Mbps
1.54 Mbps
(university, company,  Internet is dense with caches Performance: access link

residential ISP) • enables “poor” content providers  LAN utilization: .0015 institutional
network
to more effectively deliver content  access link utilization = .97 .0097 1 Gbps LAN

 end-end delay = Internet delay +


access link delay + LAN delay
= 2 sec + minutes + usecs
msecs
Cost: faster access link (expensive!)
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-51 Application Layer: 2-53

51 53

Caching example Caching example: install a web cache

Scenario: Scenario:
 access link rate: 1.54 Mbps origin
 access link rate: 1.54 Mbps origin
 RTT from institutional router to server: 2 sec servers  RTT from institutional router to server: 2 sec servers
 Web object size: 100K bits public
Internet
 Web object size: 100K bits public
Internet
 Average request rate from browsers to  Avg request rate from browsers to origin
origin servers: 15/sec servers: 15/sec
 average data rate to browsers: 1.50  avg data rate to browsers: 1.50 Mbps
1.54 Mbps 1.54 Mbps
Mbps
Performance: problem: large
access link Performance: access link

 LAN utilization: .0015 delays at high institutional


network
 LAN utilization: .? How to compute link
institutional
network
 access link utilization = .97 utilization! 1 Gbps LAN
 access link utilization = ? utilization, delay? 1 Gbps LAN

 end-end delay = Internet delay +  average end-end delay = ?


access link delay + LAN delay
= 2 sec + minutes + usecs Cost: web cache (cheap!) local web cache

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-52 Application Layer: 2-54

52 54

26 27
Caching example: install a web cache Conditional GET

client server
Calculating access link utilization, end-
end delay with cache: Goal: don’t send object if cache has
origin HTTP request msg
 suppose cache hit rate is 0.4: 40% requests servers up-to-date cached version If-modified-since: <date> object
satisfied at cache, 60% requests satisfied at not
public • no object transmission delay
Internet modified
origin • lower link utilization HTTP response
before
 access link: 60% of requests use access link HTTP/1.0
<date>
 data rate to browsers over access link  cache: specify date of cached copy 304 Not Modified

= 0.6 * 1.50 Mbps = .9 Mbps


1.54 Mbps
access link
in HTTP request
 utilization = 0.9/1.54 = .58 institutional
If-modified-since: <date>
HTTP request msg
 average end-end delay network
1 Gbps LAN  server: response contains no If-modified-since: <date> object
= 0.6 * (delay from origin servers) object if cached copy is up-to- modified
after
+ 0.4 * (delay when satisfied at cache) date: HTTP response
HTTP/1.0 200 OK <date>
= 0.6 (2.01) + 0.4 (~msecs) = ~ 1.2 secs local web cache HTTP/1.0 304 Not Modified <data>
lower average end-end delay than with 154 Mbps link (and cheaper too!)

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-55 Application Layer: 2-57

55 57

Local cache HTTP/2

Web pages could be stored in local server (local


cache) Key goal: decreased delay in multi-object HTTP requests
Using local cache for HTTP1.1: introduced multiple, pipelined GETs over single TCP
Reading web offline connection
Improve performance in accessing web pages  server responds in-order (FCFS: first-come-first-served scheduling) to
GET requests
 with FCFS, small object may have to wait for transmission (head-of-
line (HOL) blocking) behind large object(s)
 loss recovery (retransmitting lost TCP segments) stalls object
transmission

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

56 Application Layer: 2-58

56 58

28 29
HTTP/2 HTTP/2: mitigating HOL blocking

Key goal: decreased delay in multi-object HTTP requests HTTP/2: objects divided into frames, frame transmission interleaved
server
HTTP/2: [RFC 7540, 2015] increased flexibility at server in sending
objects to client: GET O4 GET O3 GET O2 GET O1 object data requested
client
 methods, status codes, most header fields unchanged from HTTP
1.1 O2
O4
 transmission order of requested objects based on client-specified O3 O1
object priority (not necessarily FCFS)
 push unrequested objects to client O2
O3
 divide objects into frames, schedule frames to mitigate HOL O1 O4
blocking
O2, O3, O4 delivered quickly, O1 slightly delayed

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-59 Application Layer: 2-61

59 61

HTTP/2: mitigating HOL blocking HTTPS

• Limitation of HTTP:
• No mechanism for users to check the reliability of web server
HTTP 1.1: client requests 1 large object (e.g., video file, and 3 smaller  security vulnerability for imposters or embed malicious code
objects) to HTML
server

GET O4
• No mechanism for data encryption  security vulnerability for
GET O3 GET O2 GET O1 object data requested attackers to sneak and steal sensitive information
client
• Secure HTTP: use SSL/TLS instead of TCP to send
O1 HTTP messages
• Authentication:
O2 • Users can access to the correct website
O1
O2 O3 • Communication data won’t be changed
O3
O4
O4
• Security: data are kept secretly during data transmission
objects delivered in order requested: O2, O3, O4 wait behind O1
• Port: 443
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

Application Layer: 2-60 62

60 62

30 31
HTTPS on the Web Electronic mail (E-mail)
Access Web with HTTPS
• MUA (Mail User Agent)  Protocols:
• Get emails from servers, send  Send emails: SMTP-Simple
emails to servers
Mail Transfer Protocol
• e.g. Outlook, Thunderbird…
 Receive emails
• MTA (Mail Transfer Agent): :
 POP – Post Office
• Contain the mail boxes of user
Protocol
• Queue to send emails
 IMAP – Internet Mail
• e.g. Sendmail, MS Exchange…
Access Protocol

- The whole content of website IMAP IMAP


(including images, CSS, Flash, scripts...) mail mail
POP
user POP server server user
has been verified by the browsers to agent
SMTP
agent
make sure the integrity and safe source. SMTP SMTP
- All exchanged information between the Mail box Message queue
browser and Vietcombank is kept secret.
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

63 65

63 65

SMTP – Simple Mail Transfer Protocol

• RFC 2821
• TCP, port 25: send emails from client to server and
between servers
• Interactive request/response
• Request: Command with ASCII
4. Email service • Response: state code and data

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

64 66

64 66

32 33
Web Mail MIME standard

• Use Web browser as MUA • Represent email content with multimedia data
• MUA and MTA exchange information through • MIME: multimedia mail extension, RFC 2045, 2056
HTTP • Add one line in the header to specify the sending data
• Mails are stored on servers type
• E.g. MIME version
From: [email protected]
To: [email protected]
• Gmail,
Subject: Picture of yummy crepe.
• Hotmail, method used MIME-Version: 1.0
• Yahoo! Mail, etc. to encode data Content-Transfer-Encoding: base64
Content-Type: image/jpeg
• Today, there are many MTA accessible through multimedia data
type, subtype,
web interface parameter declaration
base64 encoded data .....
.........................
• http://mail.hust.edu.vn ......base64 encoded data
• http://mail.soict.hust.edu.vn encoded data

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

68 70

68 70

Mail message format

SMTP: protocol for exchanging e-mail


messages, defined in RFC 531 (like HTTP)
RFC 822 defines syntax for e-mail message
itself (like HTML)
 header lines, e.g., header
blank
• To:
line

6. File Transfer Protocol


• From:
• Subject:
these lines, within the body of the email body
message area different from SMTP MAIL
FROM:, RCPT TO: commands!
 Body: the “message” , ASCII characters only

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

Application Layer: 2-69 71

69 71

34 35
FTP: File Transfer Protocol FTP client

Command line
TCP control
connection, port 21 C:\Documents and Settings\hongson>ftp
user FTP FTP ftp> ?
interface client server
Commands may be abbreviated. Commands are:
TCP data
user connection, port 20
! delete literal prompt send
? debug ls put status
local file system remote file system append dir mdelete pwd trace
ascii disconnect mdir quit type
• Client-server model  Out-of-band control: bell get mget quote user
FTP command : port 21 binary glob mkdir recv verbose
• File transfer between two 
bye hash mls remotehelp
hosts  Data: port 20
cd help mput rename
• RFC 959  Need user to log-in before close lcd open rmdir
data transfer
• Use TCP, port 20, 21 GUI FTP clients: IE, Firefox, GFTP, ….
 Some servers allow
anonymous user
TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG
School of Information and Communication Technology School of Information and Communication Technology

72 74

72 74

FTP commands, responses

Sample commands: Sample return codes


• USER username • 331 Username OK,
• PASS password password required
• 125 data connection already
• LIST return list of file in open; transfer starting
current directory
• 425 Can’t open data
• RETR filename retrieves connection
(gets) file
• 452 Error writing file
• STOR filename stores (puts)
file onto remote host

TRƯỜNG CÔNG NGHỆ THÔNG TIN VÀ TRUYỀN THÔNG


School of Information and Communication Technology

73

73

36 37

You might also like