Recap-Midterm Computer Network
Recap-Midterm Computer Network
Some of the slides in this presentation has been adopted from the resources provided by the book Computer Networking: A
Top-Down Approach by Jim Kurose and Keith Ross
[Link]
Internet
Inter-net
A network of networks
4
The Internet != The Web
• The Internet is a worldwide network of interconnected computers.
• ARPANET adopted TCP/IP protocol in 1983 (birth of the modern Internet)
• The Web is a worldwide network of interconnected hypertext pages.
• Web browser app connects to web server apps.
• Web is just one of many applications built on top of the Internet and DNS.
• Uses HTTP protocol (first version, 0.9, was released in 1991)
• Invented at CERN on the France/Switzerland border.
• Apart from the Web, many other applications use the Internet:
• Email, SSH, BitTorrent, Voice-over-IP telephony, FTP, Remote Desktop,
VNC, Skype, Telnet, Snapchat, FaceTime, Netflix … you name it!
• Any smartphone app that communicate with a backend service
5
The Internet is distributed and loosely coupled
• No one entity manages all the hosts, routers, and links on the Internet.
• Hosts join by building a physical connection to an existing host.
• Hardware and software come from many different vendors.
• Standard Internet protocols define how devices should interoperate.
• Network core:
• Routers connecting various Internet parts
• These are like hosts with multiple links and
living only to relay others’ packets.
Machines are connected by physical media: institutional
• Wired and wireless communication links network
And links
link
phone
lines
end-system switch
fibers
wireless
cable TV links
lines
7
Transfers data
link
end-system switch
path
data
8
A federated system
• The Internet ties together different networks by the IP protocol
➢One interface to bind them all together
9
Massive Scale
10
Component Names
Node 1 Node 2
14
Protocols and Layers (3)
• A protocol is a set of rules or conventions that allow peer layers to communicate
• The key features of a protocol are:
• Format of data
Syntax blocks
• Control
information for
Semantics coordination and
error handling
• Speed matching
Timing and sequencing
15
Layered Network Stack
Modularity
Applications
16 Does not specify an implementation
Instead, tells us how to organize
Layer N functionality
Encapsulation
…
Switch
Base
Router
driver among several transmitters/receivers
• Network layer: routes from source to
destination, along many hops.
Operating
System
• Transport layer:
• Multiplexing (>1 connection / machine)
• Ordering, • Acknowledgement, • Pacing
Language
User- • HTTP layer:
/Libraries
level • Resource urls, • Response codes,
application • Caching, • Content-types, • Compression
The ISO OSI Model
18
Layer Features
Application
Presentation Service
Session What does this layer do?
Transport Interface
How do you access this layer?
Network
Protocol
Data Link
How is this layer implemented?
Physical
19
Physical Layer
Service
Application Move information between two
systems connected by a physical link
Presentation
Interface
Session Specifies how to send one bit
Transport Protocol
Encoding scheme for one bit
Network
Voltage levels
Data Link Timing of signals
20
Data Link Layer
Service
Application Data framing: boundaries between
packets
Presentation
Media access control (MAC)
Session Per-hop reliability and flow-control
Transport Interface
Send one packet between two hosts
Network connected to the same media
Data Link Protocol
Physical addressing (e.g. MAC address)
Physical Examples: Ethernet, Wifi, DOCSIS
21
Network Layer
Service
Application Deliver packets across the network
Handle fragmentation/reassembly
Presentation
Packet scheduling
Transport Interface
Send one packet to a specific
Network destination
Data Link Protocol
Define globally unique addresses
Physical
Maintain routing tables
22
Transport Layer
Service
Application Multiplexing/demultiplexing
Congestion control
Presentation
Reliable, in-order delivery
Session Interface
Send message to a destination
Transport
Protocol
Network Port numbers
Data Link Reliability/error correction
Flow-control information
Physical
Examples: UDP, TCP
23
Session Layer
Service
Application
Accessmanagement
Presentation Synchronization
Session Interface
Transport It depends…
Network Protocol
Token management
Data Link
Insert checkpoints
Physical
Examples: none
24
Presentation Layer
Service
Application Convert data between different
representations
Presentation E.g. big endian to little endian
Transport Interface
It depends…
Network
Protocol
Data Link Definedata formats
Physical Apply transformation rules
Examples: none
25
Application Layer
Application Service
Presentation Whatever you want
Interface
Session
Whatever you want
Transport
Protocol
Network Whatever you want
Data Link Examples: turn on your smartphone
Physical and look at the list of apps
26
Encapsulation
Matryoshka dolls (stacking dolls)
Matryoshka dolls (Russian: матрёшка) are a set of wooden dolls of decreasing size, each one fitting inside the next larger one
Credit: [Link]
Services, Layering and Encapsulation
Hl Hn Ht Hl Hn Ht link
link frame M M
physical physical
source destination
Encapsulation
Data Application
Presentation
Session
Transport
Network
Data Link
Physical Data
LAYERED TASKS
Label contains
Un-packing
routing info
Doesn’t know
contents of letter
Postal Service 32
Example: organization of air travel
33
Introduction: 1-33
Example: organization of air travel
Q: describe in words
the service provided
in each layer above
Network Stack in Practice
Ethernet Frame
Summary of Layers
Common functionality & problems
✓Circuit Switching
✓Message Switching (Store and Forward)
✓Packet Switching (Store and Forward)
Circuit Switching
Packet Multiplexing
Internet Structure: A “network of networks”
access access
net net
access
net
access
access net
net
IXP access
access net
net ISP A
access
net
IXP ISP B access
net
access ISP C
net
access
net
access
net regional ISP access
net
access access
net access net
net
Internet Structure: A “network of networks”
… and content provider networks (e.g., Google, Microsoft, Akamai) may run
their own network, to bring services, content close to end users
access access
net net
access
net
access
access net
net
IXP access
access net
net ISP A
access
net
Content provider
IXP network
ISP B access
net
access ISP C
net
access
net
access
net regional ISP access
net
access access
net access net
net
Internet Structure: A “network of networks”
Telecommunication
networks
Circuit-switched Packet-switched
networks networks
Networks Datagram
FDM TDM
with VCs Networks
Delay
(sec)
1-56
Network Bandwidth, Throughput and Goodput
Throughput
Goodput
Example: Network Layer Goodput
❑ Goodput:
(recieved packets - recieved replica) payload length per packet [bit]
Goodput [b / s] =
recieving time duration [sec]
❑ Efficiency:
goodput [bps]
Efficiency = 100
optimum goodput [bps]
Optimum goodput = goodput in condition of :
no - loss packet, no - corupted packet, and no - congestion link.
Data Link Layer
Function:
Application ◦ Send blocks of data (frames) between
physical devices
Presentation ◦ Regulate access to the physical media
Session Key challenge:
Transport ◦ How to delineate frames?
◦ How to detect errors?
Network ◦ How to perform media access control
Data Link (MAC)?
◦ How to recover from and avoid
Physical collisions?
• LLC
– Logical Link Control
– Refers upward to higher layers
• MAC
– Media Access Control
– Refers downward to lower layers
Addressing Routing
Network
Framing and
Switching Flow Control Error Control
Access Control
Data Link
MAC LLC
Flow Control:
pacing between adjacent sending and receiving nodes
Error Detection:
errors caused by signal attenuation, noise.
receiver detects presence of errors:
• signals sender for retransmission or drops frame
Error Correction:
receiver identifies and corrects bit error(s) without resorting
to retransmission
Half-duplex and full-duplex
with half duplex, nodes at both ends of link can transmit,
but not at same time
The DLL translates the physical layer's raw bit stream into discrete units
(messages) called frames. How can frame be transmitted so the receiver can
detect frame boundaries? That is, how can the receiver recognize the start and
end of a frame? We will discuss four ways:
Character Count:
Bit Stuffing:
Character stuffing:
Encoding Violations:
71
History : Protocol Stack
DLL Design History : Protocol Stack
FRAMING
• First try:
• Let’s start each frame with a length field!
• It’s simple, and hopefully good enough …
Character Count:
• Make the first field in the frame's header be the length of the frame. That way
the receiver knows how big the current frame is and can determine where the
next frame ends.
• Although checksum will detect the frames are incorrect, the receiver will have
difficulty re-synchronizing to the start of a new frame. This technique is not
used anymore, since better techniques are available.
72
History : Protocol Stack
DLL History : Protocol Stack
Design Protocols
Multi-access FRAMING
Bit Stuffing:
IDEA: Use reserved bit patterns to indicate the start and end of a frame. For
instance, use the 4-bit sequence of 0111 to delimit consecutive frames. A frame
consists of everything between two delimiters.
Problem: What happens if the reserved delimiter happens to appear in the frame
itself? If we don't remove it from the data, the receiver will think that the
incoming frame is actually two smaller frames!
Solution: Use bit stuffing. Within the frame, replace every occurrence of two
consecutive 1's with 110. E.g., append a zero bit after each pair of 1's in the
data. This prevents 3 consecutive 1's from ever appearing in the frame.
Chap. 3- DLL 73
History : Protocol Stack
DLL History : Protocol Stack
Design Protocols
Multi-access FRAMING
Bit Stuffing:
The receiver converts two consecutive 1's followed by a 0 into two 1's, but
recognizes the 0111 sequence as the end of the frame.
Example: The frame "1 0 1 1 1 0 1" would be transmitted over the physical layer as
"0 1 1 1 1 0 1 1 0 1 0 1 0 1 1 1".
Note: When using bit stuffing, locating the start/end of a frame is easy, even when
frames are damaged. The receiver simply scans arriving data for the reserved
patterns.
The main disadvantage with bit stuffing is the insertion of additional bits into the
data stream, wasting bandwidth.
Chap. 3- DLL 74
History : Protocol Stack
DLL History : Protocol Stack
Design Protocols
Multi-access FRAMING
Character stuffing:
Use reserved characters to indicate the start and end of a frame. For instance, use the two-
character sequence DLE STX (Data-Link Escape, Start of TeXt) to signal the beginning of
a frame, and the sequence DLE ETX (End of TeXt) to flag the frame's end.
Problem: What happens if the two-character sequence DLE ETX happens to appear in the
frame itself?
Solution: Use character stuffing within the frame, replace every occurrence of DLE with the
two-character sequence DLE DLE. The receiver reverses the process, replacing every
occurrence of DLE DLE with a single DLE.
Example: If the frame contained "A B DLE D E DLE", the characters transmitted over the
channel would be "DLE STX A B DLE DLE D E DLE DLE DLE ETX".
Chap. 3- DLL 75
DLL History : Protocol Stack
Design Protocols
Multi-access FRAMING
Encoding Violations:
Send a signal that doesn't conform to any legal bit representation. In Manchester
encoding, for instance, 1-bits are represented by a high-low sequence, and 0-
bits by low-high sequences. The start/end of a frame could be represented by
the signal low-low or high-high.
Finally, some systems use a combination of these techniques. IEEE 802.3, for
instance, has both a length field and special frame start and frame end
patterns.
76
History
Dealing with Noise : Protocol Stack
77
Error Detection History : Protocol Stack
and Correction
• Some bits will be received in error due to noise.
• What can we do?
▪ Error-Detecting Codes
▪ Error-Correcting Codes
80
History
Error Correcting Codes: Protocol Stack
• Hamming code: 1-bit ECC
• How to use Hamming code to correct Data bits = m; Check bits = r
burst errors? Each code of size n = (m+r)
• Hamming distance between two codes (D1 D2) (n+1)2m 2n or (m+r+1) 2r
is the number of bit flips needed to change D1
to D2
b1 b2b3b4b5b6b7b8b9b10b11
0 0 1100 10 0 0 0
8421
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
History
Error Correcting Codes: Protocol Stack
➢ Divide the bit string corresponding to G(x) into the bit string
corresponding to xrM(x). using modulo 2 division.
Generator polynomial
x4+x+1
r=4
History : Protocol Stack
CRC codes (Proof)
Where Q(x) is the quotient obtained by dividing XrM(x) by G(x). Also we have
T(x) defined as per our algorithm
Case 2 : E(x) = xi + xj
= xi(1+xj-i) where j > i.
from case 1, G(x) cannot divide xi. E(x) will be divisible
by G(x) only if G(x) divides (1+xj-i).
We are interested in having (1+xj-i) not to be divisible by G(x).
CRC codes History : Protocol Stack
If G(x) is a primitive polynomial:
Burst error will also be of the form xid(x) where deg(d(x)) = L-1
Burst error
00000 11000…….011
L
CRC-12 = x12+x11+x3+x2+x+1
CRC-16 = x16+x15+x2+1
CRC-CCITT = x16+x12+x5+1
CRC-32 = x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1.
using shift left register, and modulo 2 can be implemented using XOR gates.
• Error correction:
• Needed when errors are expected
• Or when no time for retransmission
• Error detection:
• More efficient when errors are not expected
• And when errors are large when they do occur
DLL Design History : Protocol Stack
ERROR CONTROL
Must insure that all frames are eventually delivered (possibly in order) to a
destination. Three components are required to do this:
Acknowledgments:
92
DLL Design History : Protocol Stack
ERROR CONTROL
Timers:
• One problem that simple ACK/NACK schemes fail to address is recovering
from a frame that is lost, and as a result, fails to solicit an ACK or NACK.
• What happens if an ACK or NACK becomes lost?
• Retransmission timers are used to resend frames that don't produce an ACK.
When sending a frame, schedule a timer to expire at some time after the ACK
should have been returned. If the timer goes off, retransmit the frame.
Sequence Numbers:
• Retransmissions introduce the possibility of duplicate frames.
• To suppress duplicates, add sequence numbers to each frame, so that a receiver
can distinguish between new frames and repeats of old frames.
• Bits used for sequence numbers depend on the number of frames that can be
outstanding at any one time.
93
DLL Design History : Protocol Stack
FLOW CONTROL
Flow control deals with throttling the speed of the sender to match that of the
receiver. Usually, this is a dynamic process, as the receiving speed depends on
such changing factors as the load, and availability of buffer space.
One solution is to have the receiver extend credits to the sender. For each credit,
the sender may send one frame. Thus, the receiver controls the transmission
rate by handing out credits.
94
DLL ProtocolsHistory : Protocol Stack
Overview
The DLL provides these services to the Network Layer above it:
Data handed to a DLL by a Network Layer on one module, are handed to the
Network Layer on another module by that DLL.
95
DLL ProtocolsHistory : Protocol Stack
AN UNRESTRICTED SIMPLEX
PROTOCOL
Assumptions:
Sender ships one frame and then waits for acknowledgment (stop and wait.)
Data transmission is one directional, but must have bi-directional line. Could have
a half-duplex (one direction at a time) physical channel.
97
History
Sliding Window : srotocol Stack
Protocols
FEATURES
Assumptions:
1. Data
2. ACK containing (sequence number of last correctly received frame).
Piggybacking issue: For better use of bandwidth, how long should we wait for
outgoing data frame before sending the ACK on its own.
98
History
Sliding Window : Protocol Stack
Protocols
100
History
Should We Error Check: in
Protocol
the Data Stack
Link?
101
History : Protocol Stack
Multi-access Protocols
CD = Collision Detection
Improvement: Stop ongoing transmission if
CSMA/CD
a collision is detected (e.g. Ethernet)
103
103
History
Collisions in (Pure) : Protocol Stack
ALOHA
2.1 2.2
Station 2
3.1 3.2
Station 3
Complete Partial
Collision Collision
Broadcast
channel
Frame
t0-F t0 t0+F
Vulnerable
Period of red frame
Time
• Notation:
Let t = + r ------------------ Eq - 1
t = total number of packets received per sec over the channel
r = total number of packets rejected
= number of packets transmitted successfully
106
PerformanceHistory : Proto (col Stack
of (Pure) ALOHA(2)
107
History
Performance of (Pure) ALOHA(3)
: Proto((33)col Stack
k!
The traffic arrival rate over the channel
t = + r
The probability of successful transmission T = 2
Pt 2 = e -t 2 (t2)k
k!
108
History
Performance of : Protocol Stack
(Pure) ALOHA(4)
= e-t 2 ( for k = 0 )
= t e-t 2
( = / and t = G/ )
From (Eq-6 and Eq-7)
/ = G/ e - 2G
= G e - 2G
The maximum value of throughput () would be when G = ½
= 1/2e
0.18
At best using ALOHA we can have the maximum channel utilization of 18%.
109
History
Slotted ALOHA : Protocol Stack
(S-ALOHA)
• As a consequence:
– Frames either collide completely or do not collide at all
– Vulnerable period = ?
110
History
Collisions in Slotted : Protocol
ALOHA : Stack
2.1 2.2
Station 2
3.1 3.2
Station 3
Complete
Collision
Broadcast
channel
11
1
History
Performance of Slotted: ALOHA
Protocol: Stack
= G e -G
max = e −1 = 0.37
• Performance gain but requires nodes to have
synchronized frame boundaries
11
2
History
Comparison of : Protocol
Pure ALOHA Stack
& Slotted ALOHA
Protocol
◦ Same as ALOHA, except time is divided into slots
◦ Hosts may only transmit at the beginning of a slot
Thus, frames either collide completely, or not at all
◦ 37% throughput vs. 18% for ALOHA
◦ But, hosts must have synchronized clocks
Throughput
Load
type
dest. source data
• Preamble is 8 bytes, 1010…1011
preamble MAC
MAC
addres
addres
s
(IP payload) CRC Inter-packet gap
s
• Used to synchronize bit-clock of the receiver to the sender.
• Type (2 bytes) usually indicates IP payload (ARP has a different type).
• CRC (4 bytes) is added after the payload, for bit-error detection.
Remember
this number
119
Flow DiagramHistory : Protocol
of Persistent Stack
Methods
120
History
Minimum Packet Sizes :and
Protocol Stack
Cable Length
A B
1. Time t + 2*d: Host
A detects the Propagation Delay (d)
collision
A B
2. Must transmit bits
for longer than 2*d
• 10 Mbps Ethernet
1. Time t: Host A starts Aand cable lengths change
transmitting • Packet B
2. Time t + d: Host B starts for faster Ethernet standards
Propagation Delay (d)
transmitting
3. Time t + 2*d: collision
detected
min_frame_size*light_speed/(2*bandwidth) = max_cable_length
(64B*8)*(2.5*108mps)/(2*107bps) = 6400 meters
Signal Encoding
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
0011 0011000111000110001110
0 1 1 0 1 1 0 0 0 1
Frequency
Frequency
Optical
Splitter
Frequency
NRZ
Clock
0 1 1 1 1 1 1 1 1 0
NRZ
0 1 1 1 1 1 1 1 0
Transitions Receiver
signify misses a 1
clock ticks due to skew
0 0 1 0 1 0 1 1 0 0
NRZI
Clock
0 0 1 1 0
NRZI
Clock
141
History : Protocol
4B/5B EncodingStack
Data coded as symbols of 5 line bits => 4 data bits, so 100
Mbps uses 125 MHz.
» Uses less frequency space than Manchester encoding
Uses NRI to encode the 5 code bits
We convert 4bits to 5bits, ensuring at least one transition in
them. The basic idea here is that 5bit code selected must
have :
✓ one leading 0
✓ No more than two trailing 0s
Each valid symbol has at least two 1s: get dense transitions.
16 data symbols, 8 control symbols
» Data symbols: 4 data bits
» Control symbols: idle, begin frame, etc.
Example: FDDI (Fibre Distributed Data Interface)
• Physical Topology
– Bus
– Star
– Mesh
– Ring
institutional link
to ISP (Internet)
institutional router
Ethernet
institutional mail,
switch
web servers
148
Position of ARP and RARP in TCP/IP protocol suite
149
7.1 ARP
ARP associates an IP address with its physical address. On a
typical physical network, such as a LAN, each device on a link is
identified by a physical or station address that is usually imprinted
on the NIC.
150
ARP operation
151
Figure 5 Encapsulation of ARP packet
152
ARP Request / Reply
153
Figure 6 Four cases using ARP
154
Figure 7.7 Example 1
155
Figure 7.8 Proxy ARP
A proxy ARP, running in a router, can respond to an ARP request for any of its
proteges (supported by old entries). The proxy ARP replies with its own MAC
address. When the packet arrives, the router delivers it to the appropriate host.
156
7.2 ARP PACKAGE
In this section, we give an example of a simplified ARP software package
to show the components and the relationships between the components.
This ARP package involves five modules: a cache table, queues, an output
module, an input module, and a cache-control module.
157
ARP Cache
Maintain a cache of recently acquired pairs
◼ Keep IP, PhyAddr pairs to reduce comm costs
Looks in cache before sending packet
◼ If have a binding, use it
◼ If not, broadcast an ARP request
Since most communications involve multiple packets, even a small cache
helps
Mapping
◼ If have binding in cache, use it
◼ If not, send broadcast
May not get reply (lost or machine down)
Must store outgoing packets
If other programs run, must not generate multiple requests for the
same address currently waiting on
◼ When ARP reply arrives
Update ARP cache
158
The Cache Table
159
Figure 7.9 ARP components
160
The Cache Table Contents(1)
161
The Cache Table Contents(2)
162
How Does the Cache Work?(1)
163
How Does the Cache Work?(2)
164
How Does the Cache Work? (3)
165
How Does the Cache Work? (4)
166
How Does the Cache Work? (5)
167
How Does the Cache Work? (6)
168
How Does the Cache Work? (7)
169
Example 2
170
Table 7.1 Original cache table used for examples
171
Example 3
172
Table 7.2 Updated cache table for Example 3
173
Example 4
Fifteen seconds later, the ARP input module receives an ARP packet
with target protocol (IP) address [Link]. The module checks the
table and finds this address. It changes the state of the entry to
RESOLVED and sets the time-out value to 900. The module then
adds the target hardware address (E34573242ACA) to the entry.
Now it accesses queue 18 and sends all the packets in this queue, one
by one, to the data link layer. The new cache table is shown in Table
7.3.
174
Table 7.3 Updated cache table for Example 4
175
Example 5
176
Table 7.4 Updated cache table for Example 5
177
7.3 RARP
RARP finds the logical address for a machine that only knows its physical
address.
178
Figure 7.10 RARP operation
179
Figure 7.12 Encapsulation of RARP packet
180
Huffman Coding
Link Deficit Algorithm
Traffic Matrix Calculation, hopcount etc
181