Professional Documents
Culture Documents
Network Layer
Computer
Networking: A Top
Down Approach
6th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2012
call setup, teardown for each call before data can flow
each packet carries VC identifier (not destination host
address)
every router on source-dest path maintains “state” for
each passing connection
link, router resources (bandwidth, buffers) may be
allocated to VC (dedicated resources = predictable
service)
Network Layer 4-4
VC implementation
a VC consists of:
1. path from source to destination
2. VC numbers, one number for each link along path
3. entries in forwarding tables in routers along path
packet belonging to VC carries VC number
(rather than dest address)
VC number can be changed on each link.
new VC number comes from forwarding table
1 3
2
VC number
interface
forwarding table in number
northwest router:
Incoming interface Incoming VC # Outgoing interface Outgoing VC #
1 12 3 22
2 63 1 18
3 7 2 17
1 97 3 87
… … … …
application application
transport transport
network 1. send datagrams 2. receive datagrams network
data link data link
physical physical
IP destination address in
arriving packet’s header
1
3 2
otherwise 3
examples:
DA: 11001000 00010111 00010110 10100001 which interface?
DA: 11001000 00010111 00011000 10101010 which interface?
Network Layer 4-11
Datagram or VC network: why?
Internet (datagram) ATM (VC)
data exchange among evolved from telephony
computers human conversation:
“elastic” service, no strict strict timing, reliability
timing req. requirements
need for guaranteed service
many link types “dumb” end systems
different characteristics telephones
uniform service difficult complexity inside
“smart” end systems network
(computers)
can adapt, perform control,
error recovery
simple inside network,
complexity at “edge”
physical layer
…
in: one large datagram
different link types, out: 3 smaller datagrams
different MTUs
large IP datagram divided
(“fragmented”) within net reassembly
one datagram becomes
several datagrams
“reassembled” only at …
final destination
IP header bits used to
identify, order related
fragments
Network Layer 4-15
IP fragmentation, reassembly
length ID fragflag offset
example: =4000 =x =0 =0
4000 byte datagram
one large datagram becomes
MTU = 1500 bytes several smaller datagrams
data
32 bits
Network Layer 4-18
Other changes from IPv4
checksum: removed entirely to reduce processing
time at each hop
options: allowed, but outside of header, indicated
by “Next Header” field
ICMPv6: new version of ICMP
additional message types, e.g. “Packet Too Big”
multicast group management functions
IP destination address in
arriving packet’s header
1
3 2
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 10.
Note
10.23
Note
10.24
Figure 10.1 Single-bit error
10.25
Note
10.26
Figure 10.2 Burst error of length 8
10.27
Note
10.28
Figure 10.3 The structure of encoder and decoder
10.29
Note
10.30
Note
10.31
Figure 10.4 XORing of two single bits or two words
10.32
10-2 BLOCK CODING
10.34
Example 10.1
10.35
Figure 10.6 Process of error detection in block coding
10.36
Example 10.2
10.37
Example 10.2 (continued)
10.38
Table 10.1 A code for error detection (Example 10.2)
10.39
Note
10.40
Figure 10.7 Structure of encoder and decoder in error correction
10.41
Example 10.3
10.42
Example 10.3 (continued)
1. Comparing the received codeword with the first
codeword in the table (01001 versus 00000), the
receiver decides that the first codeword is not the one
that was sent because there are two different bits.
10.44
Note
10.45
Example 10.4
10.46
Note
10.47
Example 10.5
10.48
Example 10.6
Solution
We first find all the Hamming distances.
10.49
Note
10.50
Example 10.7
10.51
Example 10.8
10.52
Note
10.53
Example 10.9
Solution
This code guarantees the detection of up to three errors
(s = 3), but it can correct up to one error. In other words,
if this code is used for error correction, part of its capability
is wasted. Error correction codes need to have an odd
minimum distance (3, 5, 7, . . . ).
10.54
10-3 LINEAR BLOCK CODES
10.55
Note
10.56
Example 10.10
10.58
Note
10.59
Table 10.3 Simple parity-check code C(5, 4)
10.60
Figure 10.10 Encoder and decoder for simple parity-check code
10.61
Example 10.12
10.63
Note
10.64
Note
10.65
Figure 10.11 Two-dimensional parity-check code
10.66
Figure 10.11 Two-dimensional parity-check code
10.67
Figure 10.11 Two-dimensional parity-check code
10.68
Table 10.4 Hamming code C(7, 4)
10.69
Figure 10.12 The structure of the encoder and decoder for a Hamming code
10.70
Table 10.5 Logical decision made by the correction logic analyzer
10.71
Example 10.13
10.73
10-4 CYCLIC CODES
10.75
Figure 10.14 CRC encoder and decoder
10.76
Figure 10.15 Division in CRC encoder
10.77
Figure 10.16 Division in the CRC decoder for two cases
10.78
Figure 10.21 A polynomial to represent a binary word
10.79
Figure 10.22 CRC division using polynomials
10.80
Note
10.81
Note
In a cyclic code,
If s(x) ≠ 0, one or more bits is corrupted.
If s(x) = 0, either
a. No bit is corrupted. or
b. Some bits are corrupted, but the
decoder failed to detect them.
10.82
Note
10.83
Note
10.85
10-5 CHECKSUM
10.86
Example 10.18
10.87
Example 10.19
10.88
Example 10.20
Solution
The number 21 in binary is 10101 (it needs five bits). We
can wrap the leftmost bit and add it to the four rightmost
bits. We have (0101 + 1) = 0110 or 6.
10.89
Example 10.21
Solution
In one’s complement arithmetic, the negative or
complement of a number is found by inverting all bits.
Positive 6 is 0110; negative 6 is 1001. If we consider only
unsigned numbers, this is 9. In other words, the
complement of 6 is 9. Another way to find the
complement of a number in one’s complement arithmetic
is to subtract the number from 2n − 1 (16 − 1 in this case).
10.90
Example 10.22
10.92
Figure 10.24 Example 10.22
10.93
Note
Sender site:
1. The message is divided into 16-bit words.
2. The value of the checksum word is set to 0.
3. All words including the checksum are
added using one’s complement addition.
4. The sum is complemented and becomes the
checksum.
5. The checksum is sent with the data.
10.94
Note
Receiver site:
1. The message (including checksum) is
divided into 16-bit words.
2. All words are added using one’s
complement addition.
3. The sum is complemented and becomes the
new checksum.
4. If the value of checksum is 0, the message
is accepted; otherwise, it is rejected.
10.95
Example 10.23
10.97
Chapter 3
Transport Layer
Computer
Networking: A Top
Down Approach
7th edition
Jim Kurose, Keith Ross
Pearson/Addison Wesley
April 2016
2-98
Chapter 3: Transport Layer
our goals:
understand learn about Internet
principles behind transport layer protocols:
transport layer • UDP: connectionless
services: transport
• multiplexing, • TCP: connection-oriented
demultiplexing reliable transport
• reliable data transfer • TCP congestion control
• flow control
• congestion control
network
delay guarantees
bandwidth guarantees
application
107
UDP: User Datagram Protocol [RFC 768]
“no frills,” “bare bones” UDP use:
Internet transport streaming multimedia
protocol apps (loss tolerant, rate
“best effort” service, sensitive)
UDP segments may be: DNS
lost SNMP
delivered out-of-order reliable transfer over
to app
UDP:
connectionless:
add reliability at
no handshaking application layer
between UDP sender,
receiver application-specific error
recovery!
each UDP segment
handled independently
of others
Transport Layer 3-108
Figure 22.10 UDP segment format
UDP: segment header
length, in bytes of
32 bits UDP segment,
source port # dest port # including header
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
125
Figure 22.13 TCP segments
126
Reading Task:
Transmission modes:
https://www.geeksforgeeks.org/transmission-
modes-computer-networks/
Point-to-point&multi point connection
https://www.geeksforgeeks.org/differences-
between-point-to-point-and-multi-point-
communication/
data
checksum urg pointer
window size
acknowledgements: N
User
types
‘C’ Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80
timeout
ACK=100
X
ACK=100
ACK=120
ACK=100
ACK=120
ACK=100
X
ACK=120
cumulative ACK
Transport Layer 3-136
TCP ACK generation [RFC 1122, RFC 2581]
ACK=100
timeout
ACK=100
ACK=100
ACK=100
Seq=100, 20 bytes of data
IP
flow control code
receiver controls sender, so
sender won’t overflow
receiver’s buffer by transmitting from sender
too much, too fast
receiver protocol stack
no retransmission
Host B
R/2
delay
lout
Host A
lout
sender sends only when
router buffers available
lin R/2
A
no buffer space!
Host B
Transport Layer 3-147
Causes/costs of congestion: scenario 2
Idealization: known loss R/2
packets can be lost,
dropped at router due when sending at R/2,
some packets are
lout
to full buffers retransmissions but
A
free buffer space!
Host B
Transport Layer 3-148
Causes/costs of congestion: scenario 2
Realistic: duplicates R/2
packets can be lost, dropped at
router due to full buffers when sending at R/2,
some packets are
lout
sender times out prematurely, retransmissions
lin
timeout
copy l'in lout
A
free buffer space!
Host B
Transport Layer 3-149
Causes/costs of congestion: scenario 2
Realistic: duplicates R/2
packets can be lost, dropped at
router due to full buffers when sending at R/2,
some packets are
lout
sender times out prematurely, retransmissions
“costs” of congestion:
more work (retrans) for given “goodput”
unneeded retransmissions: link carries multiple copies of pkt
• decreasing goodput