Semester v - Computer Networks(Cs8591)_compressed
Semester v - Computer Networks(Cs8591)_compressed
UNIT – I
Unit - I
INTRODUCTION AND PHYSICAL LAYER
3
Figure 1.1 Components of a data communication system
4
Figure 1.2 Data flow (simplex, half-duplex, and full-duplex)
5
1-2 NETWORKS
Performance
Depends on Network Elements
Measured in terms of Delay and Throughput
Reliability
Failure rate of network components
Measured in terms of availability/robustness
Security
Data protection against corruption/loss of data due to:
Errors
Malicious users
7
Physical Structures
Type of Connection
Point to Point - single transmitter and receiver
Multipoint - multiple recipients of single
transmission
Physical Topology
Connection of devices
Type of transmission - unicast, mulitcast,
broadcast
8
Figure 1.3 Types of connections: point-to-point and multipoint
9
Figure 1.4 Categories of topology
10
Figure 1.9 A hybrid topology: a star backbone with three bus networks
11
Categories of Networks
Local Area Networks (LANs)
Short distances
Designed to provide local interconnectivity
Wide Area Networks (WANs)
Long distances
Provide connectivity over large areas
Metropolitan Area Networks (MANs)
Provide connectivity over areas such as a city, a campus
12
1-3 THE INTERNET
The Internet has revolutionized many aspects of our daily lives. It has
affected the way we do business as well as the way we spend our
leisure time. The Internet is a communication system that has brought
a wealth of information to our fingertips and organized it for our use.
13
1-4 PROTOCOLS
14
Elements of a Protocol
Syntax
Structure or format of the data
Indicates how to read the bits - field delineation
Semantics
Interprets the meaning of the bits
Knows which fields define what action
Timing
When data should be sent and what
Speed at which data should be sent or speed at which it is being
received.
15
Network Models
16
2-1 LAYERED TASKS
We use the concept of layers in our daily life. As
an example, let us consider two friends who
communicate through postal mail. The process of
sending a letter to a friend would be complex if
there were no services available from the post
office.
17
Figure 2.1 Tasks involved in sending a letter
18
2-2 THE OSI MODEL
Established in 1947, the International Standards
Organization (ISO) is a multinational body
dedicated to worldwide agreement on
international standards. An ISO standard that
covers all aspects of network communications is
the Open Systems Interconnection (OSI) model. It
was first introduced in the late 1970s.
Note
20
Figure 2.3 The interaction between layers in the OSI model
21
Figure 2.4 An exchange using the OSI model
22
2-3 LAYERS IN THE OSI MODEL
23
Figure 2.5 Physical layer
Note
24
Figure 2.6 Data link layer
Note
25
Figure 2.7 Hop-to-hop delivery
26
Figure 2.8 Network layer
Note
27
Figure 2.9 Source-to-destination delivery
28
Figure 2.10 Transport layer
Note
29
Figure 2.11 Reliable process-to-process delivery of a message
30
Figure 2.12 Session layer
Note
Note
32
Figure 2.14 Application layer
Note
33
Figure 2.15 Summary of layers
34
2-4 TCP/IP PROTOCOL SUITE
The layers in the TCP/IP protocol suite do not
exactly match those in the OSI model. The
original TCP/IP protocol suite was defined as
having four layers: host-to-network, internet,
transport, and application. However, when TCP/IP
is compared to OSI, we can say that the TCP/IP
protocol suite is made of five layers: physical,
data link, network, transport, and application.
Topics discussed in this section:
Physical and Data Link Layers
Network Layer
Transport Layer
Application Layer
35
Figure 2.16 TCP/IP and OSI model
36
2-5 ADDRESSING
Four levels of addresses are used in an internet
employing the TCP/IP protocols: physical, logical,
port, and specific.
Topics discussed in this section:
Physical Addresses
Logical Addresses
Port Addresses
Specific Addresses
37
Figure 2.18 Relationship of layers and addresses in TCP/IP
38
Example 2.1
39
Example 2.2
07:01:02:01:2C:4B
40
Example 2.3
41
Figure 2.20 IP addresses
42
Example 2.4
44
Example 2.5
Note
47
Example 3.42
48
Example 3.43
49
Example 3.44
51
Example 3.45
Solution
We can calculate the propagation time as
Note that in this case, because the message is short and the bandwidth is high,
the dominant factor is the propagation time, not the transmission time. The
transmission time can be ignored.
53
Example 3.47
Note that in this case, because the message is very long and the bandwidth is not
very high, the dominant factor is the transmission time, not the propagation time.
The propagation time can be ignored.
54
Figure 3.31 Filling the link with bits for case 1
55
Example 3.48
56
Figure 3.32 Filling the link with bits in case 2
57
Figure 3.33 Concept of bandwidth-delay product
Note
The bandwidth-delay product defines
the number of bits that can fill the link.
58
Transmission Media
59
Figure 7.1 Transmission medium and physical layer
60
Figure 7.2 Classes of transmission media
61
7-1 GUIDED MEDIA
Guided media, which are those that provide a conduit from one device
to another, include twisted-pair cable, coaxial cable, and fiber-optic
cable. Topics discussed in this section:
Twisted-Pair Cable
Coaxial Cable
Fiber-Optic Cable
62
Table 7.1 Categories of unshielded twisted-pair cables
63
Figure 7.5 UTP connector Figure 7.6 UTP performance
64
Figure 7.8 BNC connectors Figure 7.9 Coaxial cable performance
65
Figure 7.12 Propagation modes
66
Figure 7.13 Modes Figure 7.14 Fiber construction
67
Table 7.3 Fiber types
Figure 7.15 Fiber-optic cable connectors
68
7-2 UNGUIDED MEDIA: WIRELESS
69
Figure 7.18 Propagation methods
70
Table 7.4 Bands
71
Figure 7.19 Wireless transmission waves
Note
Infrared signals can be used for short-range communication
in a closed area using line-of-sight propagation.
72
Figure 7.20 Omnidirectional antenna
Note
73
Figure 7.21 Unidirectional antennas
74
Switching
75
8-1 CIRCUIT-SWITCHED NETWORKS
Note
78
Example 8.2
Note
Switching at the physical layer in the traditional
telephone network uses the circuit-switching approach. 79
Figure 8.6 Delay in a circuit-switched network
80
8-2 DATAGRAM NETWORKS
Note
82
Figure 8.8 Routing table in a datagram network
Note
Note
83
Figure 8.9 Delay in a datagram network
Note
Addressing
Three Phases
Efficiency
Delay
Circuit-Switched Technology in WANs
86
Figure 8.14 Setup request in a virtual-circuit network
87
Figure 8.15 Setup acknowledgment in a virtual-circuit network
Note
In virtual-circuit switching, all packets belonging to the same source
and destination travel the same path; but the packets may arrive at the
destination with different delays if resource allocation is on demand.
88
Figure 8.16 Delay in a virtual-circuit network
Note
92
Figure 8.20 Time-space-time switch
93
Figure 8.21 Packet switch components
94
Figure 8.23 Output port
95
Figure 8.25 Examples of routing in a banyan switch
96
Figure 8.26 Batcher-banyan switch
97
CS8591 COMPUTER NETWORKS
UNIT – II
Unit - II
DATA-LINK LAYER & MEDIA ACCESS
3
Perspectives on Connecting
4
Link Capacity & Shannon-Hartley
Theorem
❑Gives the upper bound to the capacity of a link in
terms of bits per second (bps) as a function of
signal-to-noise ratio of the link measured in
decibels (dB).
❑C = Blog2(1+S/N)
❑Where B = 3300 – 300 = 3000Hz, S is the signal power,
N the average noise.
❑The signal to noise ratio (S/N) is measured in decibels is
related to dB = 10 x log10(S/N). If there is 30dB of
noise then S/N = 1000.
❑Now C = 3000 x log2(1001) = 30kbps.
❑How can we get 56kbps?
5
Links
❑ All practical links rely on some sort of electromagnetic
radiation propagating through a medium or, in some cases,
through free space
❑ One way to characterize links, then, is by the medium they use
❑Typically copper wire in some form (as in Digital Subscriber
Line (DSL) and coaxial cable),
❑Optical fiber (as in both commercial fiber-to-the home
services and many long-distance links in the Internet’s
backbone), or
❑Air/free space (for wireless links)
❑ Another important link characteristic is the frequency
❑Measured in hertz, with which the electromagnetic waves
oscillate
6
Links
❑ Distance between the adjacent pair of maxima or minima of a wave
measured in meters is called wavelength
❑ Speed of light divided by frequency gives the wavelength.
❑ Frequency on a copper cable range from 300Hz to 3300Hz; Wavelength for
300Hz wave through copper is speed of light on a copper / frequency
❑ 2/3 x 3 x 108 /300 = 667 x 103 meters.
Electromagnetic
spectrum
7
Links
❑Placing binary data on a signal is called encoding.
❑Modulation involves modifying the signals in terms of
their frequency, amplitude, and phase.
8
Encoding
9
Encoding
❑Problem with NRZ
❑Baseline wander
❑The receiver keeps an average of the signals it has seen so far
❑Uses the average to distinguish between low and high signal
❑When a signal is significantly low than the average, it is 0, else it is 1
❑Too many consecutive 0’s and 1’s cause this average to change, making it
difficult to detect
❑Clock recovery
❑Frequent transition from high to low or vice versa are necessary to enable
clock recovery
❑Both the sending and decoding process is driven by a clock
❑Every clock cycle, the sender transmits a bit and the receiver recovers a bit
❑The sender and receiver have to be precisely synchronized
10
Encoding
❑NRZI
❑Non Return to Zero Inverted
❑Sender makes a transition from the current signal to encode 1
and stay at the current signal to encode 0
❑Solves for consecutive 1’s
❑Manchester encoding
❑Merging the clock with signal by transmitting Ex-OR of the
NRZ encoded data and the clock
❑Clock is an internal signal that alternates from low to high, a
low/high pair is considered as one clock cycle
❑In Manchester encoding
❑0: low→ high transition
❑1: high→ low transition 11
Encoding
12
Encoding
❑ Problem with Manchester encoding
❑ Doubles the rate at which the signal transitions are made on the link
❑Which means the receiver has half of the time to detect each pulse of the
signal
❑ The rate at which the signal changes is called the link’s baud rate
❑ In Manchester the bit rate is half the baud rate
❑ 4B/5B encoding
❑ Insert extra bits into bit stream so as to break up the long sequence of 0’s and
1’s
❑ Every 4-bits of actual data are encoded in a 5- bit code that is transmitted to
the receiver
❑ 5-bit codes are selected in such a way that each one has no more than one
leading 0(zero) and no more than two trailing 0’s.
❑ No pair of 5-bit codes results in more than three consecutive 0’s
13
Encoding
❑4B/5B encoding
14
Framing
❑ We are focusing on packet-switched networks, which means that
blocks of data (called frames at this level), not bit streams, are
exchanged between nodes.
❑ It is the network adaptor that enables the nodes to exchange
frames.
❑ When node A wishes to transmit a frame to node B, it tells its
adaptor to transmit a frame from the node’s memory. This results in
a sequence of bits being sent over the link.
15
Framing
❑The adaptor on node B then collects together the
sequence of bits arriving on the link and deposits the
corresponding frame in B’s memory.
❑Recognizing exactly what set of bits constitute a frame—
that is, determining where the frame begins and ends—is
the central challenge faced by the adaptor
❑Byte-oriented Protocols
❑To view each frame as a collection of bytes (characters) rather
than bits
❑BISYNC (Binary Synchronous Communication) Protocol
❑Developed by IBM (late 1960)
❑DDCMP (Digital Data Communication Protocol)
❑Used in DECNet
16
Framing
❑ BISYNC – sentinel approach
❑ Frames transmitted beginning with leftmost field
❑ Beginning of a frame is denoted by sending a special SYN (synchronize)
character
❑ Data portion of the frame is contained between special sentinel character STX
(start of text) and ETX (end of text)
❑ SOH : Start of Header DLE : Data Link Escape CRC: Cyclic Redund.Check
❑ Recent PPP which is commonly run over Internet links uses sentinel approach
❑ Special start of text character denoted as Flag
❑0 1 1 1 1 1 1 0
❑ Address, control : default numbers
❑ Protocol for demux : IP / IPX
❑ Payload : negotiated (1500 bytes)
❑ Checksum : for error detection
17
Framing
❑ Byte-counting approach
❑DDCMP
❑count : how many bytes are contained in the frame body
❑If count is corrupted
❑Framing error
❑ Bit-oriented Protocol
❑HDLC : High Level Data Link Control
❑Beginning and Ending Sequences
❑0 1 1 1 1 1 1 0
❑On the sending side, any time five consecutive 1’s have been
transmitted from the body of the message (i.e. excluding when the
sender is trying to send the distinguished 01111110 sequence)
❑The sender inserts 0 before transmitting the next bit
18
Framing
❑HDLC Protocol
❑On the receiving side
❑5 consecutive 1’s
❑Next bit 0 : Stuffed, so discard it
❑ 1 : Either End of the frame marker Or Error has been
introduced in the bitstream
❑ Look at the next bit
❑ If 0 ( 01111110 ) → End of the frame marker
❑ If 1 ( 01111111 ) → Error, discard the whole frame
❑The receiver needs to wait for next 01111110 before it can start
receiving again
19
Error Detection
❑ Bit errors are introduced into frames
❑ Because of electrical interference and thermal noises
❑ Detecting Error and Correction Error
❑ Two approaches when the recipient detects an error
❑ Notify the sender that the message was corrupted, so the sender can send
again.
❑If the error is rare, then the retransmitted message will be error-free
❑ Using some error correct detection and correction algorithm, the receiver
reconstructs the message
❑ Common technique for detecting transmission error
❑ CRC (Cyclic Redundancy Check)
❑Used in HDLC, DDCMP, CSMA/CD, Token Ring
❑ Other approaches
❑Two Dimensional Parity (BISYNC)
❑Checksum (IP) 20
Error Detection
❑ Basic Idea of Error Detection
❑To add redundant information to a frame that can be used to
determine if errors have been introduced
❑Imagine (Extreme Case)
❑Transmitting two complete copies of data
❑Identical → No error
❑Differ → Error
❑Poor Scheme ???
❑n bit message, n bit redundant information
❑Error can go undetected
❑In general, we can provide strong error detection technique
❑k redundant bits, n bits message, k << n
❑In Ethernet, a frame carrying up to 12,000 bits of data
requires only 32-bit CRC 21
Error Detection
❑ Extra bits are redundant
❑ They add no new information to the message
❑ Derived from the original message using some algorithm
❑ Both the sender and receiver know the algorithm
Sender Receiver
m r m r
22
Two-dimensional parity
❑Two-dimensional parity is exactly what the name suggests
❑It is based on “simple” (one-dimensional) parity, which
usually involves adding one extra bit to a 7-bit code to
balance the number of 1s in the byte. For example,
❑Odd parity sets the eighth bit to 1 if needed to give an odd
number of 1s in the byte, and
❑Even parity sets the eighth bit to 1 if needed to give an even
number of 1s in the byte
❑Two-dimensional parity does a similar calculation
for each bit position across each of the bytes
contained in the frame
23
Two-dimensional parity
❑This results in an extra parity
byte for the entire frame, in
addition to a parity bit for each
byte
❑Two-dimensional parity catches
all 1-, 2-, and 3-bit errors and
most 4-bit errors
24
Internet Checksum Algorithm
❑Not used at the link level
❑Add up all the words that are transmitted and then transmit
the result of that sum
❑The result is called the checksum
❑The receiver performs the same calculation on the received
data and compares the result with the received checksum
❑If any transmitted data, including the checksum itself, is
corrupted, then the results will not match, so the receiver
knows that an error occurred
❑Consider the data being checksummed as a sequence of 16-
bit integers.
25
Internet Checksum Algorithm
❑Add them together using 16-bit ones complement
arithmetic (explained next slide) and then take the ones
complement of the result.
❑That 16-bit number is the checksum
❑In ones complement arithmetic, a negative integer −x is
represented as the complement of x;
❑Each bit of x is inverted.
❑When adding numbers in ones complement arithmetic, a
carryout from the most significant bit needs to be added
to the result.
26
Internet Checksum Algorithm
❑Consider, for example, the addition of −5 and −3 in
ones complement arithmetic on 4-bit integers
❑+5 is 0101, so −5 is 1010; +3 is 0011, so −3 is 1100
❑If we add 1010 and 1100 ignoring the carry, we get
0110
❑In ones complement arithmetic, the fact that this
operation caused a carry from the most significant bit
causes us to increment the result, giving 0111, which is
the ones complement representation of −8 (obtained by
inverting the bits in 1000), as we would expect
27
Cyclic Redundancy Check (CRC)
❑ Reduce the number of extra bits and maximize protection
❑ Given a bit string 110001 we can associate a polynomial on a single
variable x for it.
❑1.x5+1.x4+0.x3+0.x2+0.x1+1.x0 = x5+x4+1 and the degree is 5.
❑A k-bit frame has a maximum degree of k-1
❑ Let M(x) be a message polynomial and C(x) be a generator
polynomial.
❑ Let M(x)/C(x) leave a remainder of 0.
❑ When M(x) is sent and M’(x) is received we have M’(x) =
M(x)+E(x)
❑ The receiver computes M’(x)/C(x) and if the remainder is nonzero,
then an error has occurred.
❑ The only thing the sender and the receiver should know is C(x).
28
Cyclic Redundancy Check (CRC)
❑Polynomial Arithmetic Modulo 2
❑Any polynomial B(x) can be divided by a divisor polynomial
C(x) if B(x) is of higher degree than C(x).
❑Any polynomial B(x) can be divided once by a divisor
polynomial C(x) if B(x) is of the same degree as C(x).
❑The remainder obtained when B(x) is divided by C(x) is
obtained by subtracting C(x) from B(x).
❑To subtract C(x) from B(x), we simply perform the exclusive-
OR (XOR) operation on each pair of matching coefficients.
❑Let M(x) be a frame with m bits and let the generator
polynomial have less than m bits say equal to r.
❑Let r be the degree of C(x). Append r zero bits to the
low-order end of the frame, so it now contains m+r bits
and corresponds to the polynomial xrM(x).
29
Cyclic Redundancy Check (CRC)
❑ Divide the bit string
corresponding to xrM(x) by
the bit string corresponding to
C(x) using modulo 2 division.
❑ Subtract the remainder (which
is always r or fewer bits) from
the string corresponding to
xrM(x) using modulo 2
subtraction (addition and
subtraction are the same in
modulo 2).
❑ The result is the CRC Calculation using
checksummed frame to be Polynomial Long Division
transmitted. Call it
polynomial M’(x). 30
Cyclic Redundancy Check (CRC)
❑ Properties of Generator Polynomial
❑ Let P(x) represent what the sender sent and P(x) + E(x) is the received string.
A 1 in E(x) represents that in the corresponding position in P(x) the message
the bit is flipped.
❑ We know that P(x)/C(x) leaves a remainder of 0, but if E(x)/C(x) leaves a
remainder of 0, then either E(x) = 0 or C(x) is factor of E(x).
❑ When C(x) is a factor of E(x) we have problem; errors go unnoticed.
❑ If there is a single bit error then E(x) = xi, where i determines the bit in error.
If C(x) contains two or more terms it will never divide E(x), so all single bit
errors will be detected.
❑ In general, it is possible to prove that the following types of errors can be detected
by a C(x) with the stated properties
❑ All single-bit errors, as long as the xk and x0 terms have nonzero coefficients.
❑ All double-bit errors, as long as C(x) has a factor with at least three terms.
❑ Any odd number of errors, as long as C(x) contains the factor (x+1).
❑ Any “burst” error (i.e., sequence of consecutive error bits) for which the length
of the burst is less than k bits. (Most burst errors of larger than k bits can also
be detected.) 31
Cyclic Redundancy Check (CRC)
32
Reliable Transmission
❑ CRC is used to detect errors.
❑ Some error codes are strong enough to correct errors.
❑ The overhead is typically too high.
❑ Corrupt frames must be discarded.
❑ A link-level protocol that wants to deliver frames reliably must
recover from these discarded frames.
❑ This is accomplished using a combination of two fundamental
mechanisms
❑Acknowledgements and Timeouts
❑ An acknowledgement (ACK for short) is a small control frame that
a protocol sends back to its peer saying that it has received the
earlier frame.
❑A control frame is a frame with header only (no data).
33
Reliable Transmission
❑The receipt of an acknowledgement indicates to the
sender of the original frame that its frame was
successfully delivered.
❑If the sender does not receive an acknowledgment after a
reasonable amount of time, then it retransmits the original
frame.
❑The action of waiting a reasonable amount of time is
called a timeout.
❑The general strategy of using acknowledgements and
timeouts to implement reliable delivery is sometimes
called Automatic Repeat reQuest (ARQ).
34
Stop and Wait Protocol
❑Idea of stop-and-wait
protocol is
straightforward
❑After transmitting one
frame, the sender waits
for an acknowledgement
before transmitting the
next frame.
❑If the acknowledgement
does not arrive after a
certain period of time,
Timeline showing four different scenarios for the stop-
the sender times out and and-wait algorithm. (a) The ACK is received before the
retransmits the original timer expires; (b) the original frame is lost; (c) the
ACK is lost; (d) the timeout fires too soon
frame
35
Stop and Wait Protocol
❑ If the acknowledgment is lost or delayed
in arriving
❑ The sender times out and retransmits the
original frame, but the receiver will think
that it is the next frame since it has correctly
received and acknowledged the first frame
❑ As a result, duplicate copies of frames will
be delivered
❑ How to solve this
❑ Use 1 bit sequence number (0 or 1)
❑ When the sender retransmits frame 0, the
receiver can determine that it is seeing a
second copy of frame 0 rather than the first
copy of frame 1 and therefore can ignore it Timeline for stop-and-wait
(the receiver still acknowledges it, in case with 1-bit sequence
the first acknowledgement was lost) number
36
Stop and Wait Protocol
❑ The sender has only one outstanding frame on the link at a
time
❑ This may be far below the link’s capacity
❑ Consider a 1.5 Mbps link with a 45 ms RTT
❑ The link has a delay bandwidth product of 67.5 Kb or approximately
8 KB
❑ Since the sender can send only one frame per RTT and assuming a
frame size of 1 KB
❑ Maximum Sending rate
❑ Bits per frame Time per frame = 1024 8 0.045 = 182 Kbps
❑ Or about one-eighth of the link’s capacity
❑ To use the link fully, then sender should transmit up to eight frames
before having to wait for an acknowledgement
37
Sliding Window Protocol
❑ Sender assigns a sequence
number denoted as SeqNum to
each frame.
❑ Assume it can grow infinitely large
❑ Sender maintains three variables
❑ Sending Window Size (SWS)
❑ Upper bound on the number of
outstanding (unacknowledged)
frames that the sender can transmit
❑ Last Acknowledgement Received
(LAR)
❑ Sequence number of the last
acknowledgement received Timeline for Sliding Window Protocol
❑ Last Frame Sent (LFS)
❑ Sequence number of the last frame
sent
38
Sliding Window Protocol
❑ Sender also maintains the following invariant
❑ LFS – LAR ≤ SWS
Sliding Window
on Sender
39
Sliding Window Protocol
❑ Receiver maintains three variables
❑ Receiving Window Size (RWS)
❑ Upper bound on the number of out-of-order frames that the receiver is willing to
accept
❑ Largest Acceptable Frame (LAF)
❑ Sequence number of the largest acceptable frame
❑ Last Frame Received (LFR)
❑ Sequence number of the last frame received
❑ Receiver also maintains the following invariant
LAF – LFR ≤ RWS
Sliding Window
on Receiver
40
Sliding Window Protocol
❑ When a frame with sequence number SeqNum arrives, what does the
receiver do?
❑ If SeqNum ≤ LFR or SeqNum > LAF
❑ Discard it (the frame is outside the receiver window)
❑ If LFR < SeqNum ≤ LAF
❑ Accept it
❑ Now the receiver needs to decide whether or not to send an ACK
❑ Let SeqNumToAck
❑ Denote the largest sequence number not yet acknowledged, such that all frames
with sequence number less than or equal to SeqNumToAck have been received
❑ The receiver acknowledges the receipt of SeqNumToAck even if high-
numbered packets have been received
❑ This acknowledgement is said to be cumulative.
❑ The receiver then sets
❑ LFR = SeqNumToAck and adjusts
❑ LAF = LFR + RWS 41
Sliding Window Protocol
❑ For example, suppose LFR = 5 and RWS = 4
❑ (i.e. the last ACK that the receiver sent was for seq. no. 5)
❑ LAF = 9
❑ If frames 7 and 8 arrive, they will be buffered because they are
within the receiver window
❑ But no ACK will be sent since frame 6 is yet to arrive
❑ Frames 7 and 8 are out of order
❑ Frame 6 arrives (it is late because it was lost first time and had to
be retransmitted)
❑ Now Receiver Acknowledges Frame 8
❑ and bumps LFR to 8
❑ and LAF to 12
42
Issues with Sliding Window Protocol
❑ When timeout occurs, the amount of data in transit decreases
❑ Since the sender is unable to advance its window
❑ When the packet loss occurs, this scheme is no longer keeping the
pipe full
❑ The longer it takes to notice that a packet loss has occurred, the more severe
the problem becomes
❑ How to improve this
❑ Negative Acknowledgement (NAK)
❑ Additional Acknowledgement
❑ Selective Acknowledgement
❑ Negative Acknowledgement (NAK)
❑ Receiver sends NAK for frame 6 when frame 7 arrive (in the previous example)
❑ However this is unnecessary since sender’s timeout mechanism will be sufficient to catch
the situation
❑ Additional Acknowledgement
❑ Receiver sends additional ACK for frame 5 when frame 7 arrives
❑ Sender uses duplicate ACK as a clue for frame loss
43
Issues with Sliding Window Protocol
❑ Selective Acknowledgement
❑ Receiver will acknowledge exactly those frames it has received, rather than the
highest number frames
❑Receiver will acknowledge frames 7 and 8
❑Sender knows frame 6 is lost
❑Sender can keep the pipe full (additional complexity)
❑ How to select the window size
❑ SWS is easy to compute
❑Delay Bandwidth
❑ RWS can be anything
❑Two common setting
❑RWS = 1
❑No buffer at the receiver for frames that arrive out of order RWS = SWS
❑The receiver can buffer frames that the sender transmits
❑It does not make any sense to keep RWS > SWS
❑WHY?
44
Issues with Sliding Window Protocol
❑Finite Sequence Number
❑Frame sequence number is specified in the header field
❑Finite size
❑ 3 bit: eight possible sequence number: 0, 1, 2, 3, 4, 5, 6, 7
❑It is necessary to wrap around
❑How to distinguish between different incarnations of the
same sequence number?
❑Number of possible sequence number must be larger than the
number of outstanding frames allowed
❑Stop and Wait: One outstanding frame
❑ 2 distinct sequence number (0 and 1)
❑Let MaxSeqNum be the number of available sequence numbers
❑SWS + 1 ≤ MaxSeqNum
❑ Is this sufficient?
45
Issues with Sliding Window Protocol
❑ SWS + 1 ≤ MaxSeqNum
❑Is this sufficient?
❑Depends on RWS
❑If RWS = 1, then sufficient
❑If RWS = SWS, then not good enough
❑ For example, we have eight sequence numbers 0, 1, 2, 3, 4, 5, 6, 7
❑ RWS = SWS = 7
❑ Sender sends 0, 1, …, 6
❑ Receiver receives 0, 1, … ,6
❑ Receiver acknowledges 0, 1, …, 6
❑ ACK (0, 1, …, 6) are lost
❑ Sender retransmits 0, 1, …, 6
❑ Receiver is expecting 7, 0, …., 5
46
Issues with Sliding Window Protocol
❑To avoid this,
❑ If RWS = SWS
❑ SWS < (MaxSeqNum + 1)/2
❑Serves three different roles
❑ Reliable
❑ Preserve the order
❑Each frame has a sequence number
❑The receiver makes sure that it does not pass a frame up to the next
higher-level protocol until it has already passed up all frames with a
smaller sequence number
❑ Frame control
❑Receiver is able to throttle the sender
❑ Keeps the sender from overrunning the receiver
❑ From transmitting more data than the receiver is able to process
47
HDLC and PPP
48
The Data Link Layer in the Internet
50
PPP Design Requirements [RFC 1557]
❑Functionality : (similar to link layer services +
extra management functions)
❑Packet framing - encapsulation of network-layer datagram in
data link frame
❑Multi-protocol - carry network layer data of any network
layer protocol (not just IP) at same time ability to demultiplex
upwards
❑Bit transparency - must carry any bit pattern in the data field
(even if underlying channel can't)
❑Error detection - not correction
51
PPP Design Requirements (cont.)
The extra stuff:
❑ Connection liveness: detect, signal link failure to
network layer
❑ Network layer address negotiation: endpoint can
learn/configure each other’s network address and other
characteristics.
❑ Authentication: who are you (or at least whose account
do I bill for your dial-in time?)
❑ This information is used by traffic management software to control
bandwidth to individual subscribers
❑ Management features: loopback detection
52
PPP non-requirements
❑No error correction/recovery
❑(modems do one layer FEC, one layer packetization +
retransmission “under the covers” anyway; other
technologies are pretty reliable)
❑No flow control
❑Out of order delivery OK
53
PPP Data Frame
54
PPP Data Frame
55
Byte Stuffing
flag byte
pattern
in data
to send
56
PPP Data Control Protocol
57
Where does PPP get used?
58
High-Level Data Link Control (HDLC)
59
HDLC Overview
Broadly HDLC features are as follows:
❑Reliable protocol
❑selective repeat or go-back-N
❑Full-duplex communication
❑receive and transmit at the same time
❑Bit-oriented protocol
❑use bits to stuff flags occurring in data
❑Flow control
❑adjust window size based on receiver capability
❑Uses physical layer clocking and synchronization to send
and receive frames
60
HDLC Overview
❑Defines three types of stations
❑Primary
❑Secondary
❑Combined
❑Defines three types of data transfer mode
❑Normal Response mode
❑Asynchronous Response mode
❑Asynchronous Balanced mode
❑Three types of frames
❑Unnumbered
❑information
❑Supervisory
61
HDLC
❑The three stations are :
❑Primary station
❑Has the responsibility of controlling the operation of data flow
the link.
❑Handles error recovery
❑Frames issued by the primary station are called commands.
❑Secondary station,
❑Operates under the control of the primary station.
❑Frames issued by a secondary station are called responses.
❑The primary station maintains a separate logical link with each
secondary station.
❑Combined station,
❑Acts as both as primary and secondary station.
❑Does not rely on other for sending data
62
HDLC
Unbalanced Mode
Commands
Primary
Responses
Secondary Secondary
Balanced mode
Combined Combined
commands/Responses
63
HDLC
❑ The three modes of data transfer operations are
❑Normal Response Mode (NRM)
❑Mainly used in terminal-mainframe networks. In this case,
❑Secondaries (terminals) can only transmit when specifically
instructed by the primary station in response to a polling
❑Unbalanced configuration, good for multi-point links
❑Asynchronous Response Mode (ARM)
❑Same as NRM except that the secondaries can initiate
transmissions without direct polling from the primary station
❑Reduces overhead as no frames need to be sent to allow
secondary nodes to transmit
❑Transmission proceeds when channel is detected idle , used
mostly in point-to-point-links
❑Asynchronous Balanced Mode (ABM)
❑Mainly used in point-to-point links, for communication
between combined stations
64
Non-operational Modes
❑Normal Disconnected Mode
❑Asynchronous Disconnected Mode
❑Initialization Mode
❑A node negotiates transmission parameters with the
other node E.g., flow control information
❑Parameters negotiated in this mode are used during
any of the data transfer modes
65
Data Link Control HDLC frame structure
66
Data Link Control
HDLC frame structure
67
HDLC
❑ Flag: 01111110- start and ending delimiter. Bits are stuffed for flags in data frames
❑ FCS: 16-bit CRC using generating polynomial
❑ G(x) = x16 + x12 + x5 + 1
❑ Address field:
❑ mainly used in multidrop link configuration, and not used in point-to-point
❑ In unbalanced configuration, every secondary is assigned a unique address.
Contains address of secondary station in both command and response frames
❑ In balanced mode, command frame has destination address and response frame
has sending node’s address
❑ Group addresses are also possible. E.g., One command sent to all the
secondaries
❑ In I-frames, N(s) is the sequence number of the frame being sent, and R(s) is the
sequence number of the frame being expected.
❑ The P/F bit, known as the poll/final bit, is used with different meaning in different
contexts.
❑ It is used to indicate polling, to indicate the final I-frame, etc
68
HDLC
69
HDLC
❑There are four different supervisory frames
❑SS=00, Receiver Ready (RR), and N(R) ACKs all frames
received up to and including the one with sequence number N(R)
-1
❑SS=10, Receiver Not Ready (RNR), and N(R) has the same
meaning as above
❑SS=01, Reject; all frames with sequence number N(R) or higher
are rejected, which in turns ACKs frames with sequence number
N(R) -1 or lower.
❑SS=11, Selective Reject; the receive rejects the frame with
sequence number N(R)
70
HDLC
71
Media Access Control
Ethernet
❑ Most successful local area networking technology of last 20 years.
❑ Developed in the mid-1970s by researchers at the Xerox Palo Alto
Research Centers (PARC).
❑ Uses CSMA/CD technology
❑ Carrier Sense Multiple Access with Collision Detection.
❑ A set of nodes send and receive frames over a shared link.
❑ Carrier sense means that all nodes can distinguish between an idle and a busy
link.
❑ Collision detection means that a node listens as it transmits and can therefore
detect when a frame it is transmitting has collided with a frame transmitted by
another node.
❑ Uses ALOHA (packet radio network) as the root protocol
❑ Developed at the University of Hawaii to support communication across the
Hawaiian Islands.
❑ For ALOHA the medium was atmosphere, for Ethernet the medium is a coax
cable.
73
Ethernet
❑ DEC and Intel joined Xerox to define a 10-Mbps Ethernet
standard in 1978.
❑ This standard formed the basis for IEEE standard 802.3
❑ More recently 802.3 has been extended to include a 100-Mbps
version called Fast Ethernet and a 1000-Mbps version called
Gigabit Ethernet.
❑ An Ethernet segment is implemented on a coaxial cable of up to 500 m.
❑ This cable is similar to the type used for cable TV except that it typically
has an impedance of 50 ohms instead of cable TV’s 75 ohms.
❑ Hosts connect to an Ethernet segment by tapping into it.
❑ A transceiver (a small device directly attached to the tap) detects when
the line is idle and drives signal when the host is transmitting.
❑ The transceiver also receives incoming signal.
74
Ethernet
❑ The transceiver is connected to an
Ethernet adaptor which is plugged
into the host.
❑ The protocol is implemented on the
adaptor.
❑ Multiple Ethernet segments can
be joined together by repeaters.
❑ A repeater is a device that
forwards digital signals.
❑ No more than four repeaters may
be positioned between any pair of
Ethernet transceiver and adaptor
hosts.
❑ An Ethernet has a total reach of only
2500 m.
75
Ethernet
❑Any signal placed on the
Ethernet by a host is
broadcast over the entire
network
❑Signal is propagated in both
directions.
❑Repeaters forward the signal
on all outgoing segments.
❑Terminators attached to the
end of each segment absorb
the signal. Ethernet repeater
Ethernet Hub
77
Access Protocol for Ethernet
❑ The algorithm is commonly called Ethernet’s Media Access Control
(MAC).
❑ It is implemented in Hardware on the network adaptor.
❑ Frame format
❑ Preamble (64bit): allows the receiver to synchronize with the signal
(sequence of alternating 0s and 1s).
❑ Host and Destination Address (48bit each).
❑ Packet type (16bit): acts as demux key to identify the higher level protocol.
❑ Data (up to 1500 bytes)
❑ Minimally a frame must contain at least 46 bytes of data.
❑ Frame must be long enough to detect collision.
❑ CRC (32bit)
78
Ethernet Addresses
❑ Each host on an Ethernet (in fact, every Ethernet host in the world)
has a unique Ethernet Address.
❑ The address belongs to the adaptor, not the host.
❑ It is usually burnt into ROM.
❑ Ethernet addresses are typically printed in a human readable format
❑ As a sequence of six numbers separated by colons.
❑ Each number corresponds to 1 byte of the 6 byte address and is given by a pair
of hexadecimal digits, one for each of the 4-bit nibbles in the byte
❑ Leading 0s are dropped.
❑ For example, 8:0:2b:e4:b1:2 is
❑ 00001000 00000000 00101011 11100100 10110001 00000010
❑ To ensure that every adaptor gets a unique address, each
manufacturer of Ethernet devices is allocated a different prefix that
must be prepended to the address on every adaptor they build
❑AMD has been assigned the 24bit prefix 8:0:20
79
Ethernet Addresses
❑ Each frame transmitted on an Ethernet is received by every adaptor
connected to that Ethernet.
❑ Each adaptor recognizes those frames addressed to its address and
passes only those frames on to the host.
❑ In addition, to unicast address, an Ethernet address consisting of all
1s is treated as a broadcast address.
❑ All adaptors pass frames addressed to the broadcast address up to the host.
❑ Similarly, an address that has the first bit set to 1 but is not the
broadcast address is called a multicast address.
❑ A given host can program its adaptor to accept some set of
multicast addresses. To summarize, an Ethernet adaptor receives all
frames and accepts
❑ Frames addressed to its own address
❑ Frames addressed to the broadcast address
❑ Frames addressed to a multicast addressed if it has been instructed
80
Ethernet Transmitter Algorithm
❑ When the adaptor has a frame to send and the line is idle, it transmits
the frame immediately.
❑ The upper bound of 1500 bytes in the message means that the adaptor can
occupy the line for a fixed length of time.
❑ When the adaptor has a frame to send and the line is busy, it waits
for the line to go idle and then transmits immediately.
❑ The Ethernet is said to be 1-persistent protocol because an adaptor
with a frame to send transmits with probability 1 whenever a busy
line goes idle.
❑ Since there is no centralized control it is possible for two (or more)
adaptors to begin transmitting at the same time,
❑ Either because both found the line to be idle,
❑ Or, both had been waiting for a busy line to become idle.
❑ When this happens, the two (or more) frames are said to be collide
on the network.
81
Ethernet Transmitter Algorithm
❑ Since Ethernet supports collision detection, each sender is able
to determine that a collision is in progress.
❑ At the moment an adaptor detects that its frame is colliding
with another, it first makes sure to transmit a 32-bit jamming
sequence and then stops transmission.
❑ Thus, a transmitter will minimally send 96 bits in the case of collision
❑ 64-bit preamble + 32-bit jamming sequence
❑ One way that an adaptor will send only 96 bit (called a runt
frame) is if the two hosts are close to each other.
❑ Had they been farther apart,
❑ They would have had to transmit longer, and thus send more bits,
before detecting the collision.
82
Ethernet Transmitter Algorithm
❑The worst case scenario happens when the two hosts are at
opposite ends of the Ethernet.
❑To know for sure that the frame its just sent did not collide
with another frame, the transmitter may need to send as
many as 512 bits.
❑Every Ethernet frame must be at least 512 bits (64 bytes) long.
❑14 bytes of header + 46 bytes of data + 4 bytes of CRC
❑Why 512 bits?
❑Why is its length limited to 2500 m?
❑The farther apart two nodes are, the longer it takes for a
frame sent by one to reach the other, and the network is
vulnerable to collision during this time
83
Ethernet Transmitter Algorithm
❑ A begins transmitting a frame at time t
❑ d denotes the one link latency
❑ The first bit of A’s frame arrives at B at
time t + d
❑ Suppose an instant before host A’s frame
arrives, host B begins to transmit its own
frame
❑ B’s frame will immediately collide with A’s
frame and this collision will be detected by
host B
❑ Host B will send the 32-bit jamming
sequence
❑ Host A will not know that the collision
occurred until B’s frame reaches it, which
will happen at t + 2 * d
❑ Host A must continue to transmit until this Worst-case scenario: (a) A sends a frame
at time t; (b) A’s frame arrives at B at time
time in order to detect the collision t + d; (c) B begins transmitting at time t +
❑ Host A must transmit for 2 * d to be d and collides with A’s frame; (d) B’s runt
sure that it detects all possible (32-bit) frame arrives at A at time t + 2d.
collisions 84
Ethernet Transmitter Algorithm
❑Consider that a maximally configured Ethernet is 2500 m
long, and there may be up to four repeaters between any two
hosts, the round trip delay has been determined to be 51.2
s
❑Which on 10 Mbps Ethernet corresponds to 512 bits
❑The other way to look at this situation,
❑We need to limit the Ethernet’s maximum latency to a fairly small
value (51.2 s) for the access algorithm to work
❑Hence the maximum length for the Ethernet is on the order of 2500 m.
❑ Once an adaptor has detected a collision, and stopped its transmission,
it waits a certain amount of time and tries again.
❑ Each time the adaptor tries to transmit but fails, it doubles the amount
of time it waits before trying again.
85
Ethernet Transmitter Algorithm
❑ This strategy of doubling the delay interval between each
retransmission attempt is known as Exponential Backoff.
❑ The adaptor first delays either 0 or 51.2 s, selected at random.
❑ If this effort fails, it then waits 0, 51.2, 102.4, 153.6 s (selected
randomly) before trying again;
❑ This is k * 51.2 for k = 0, 1, 2, 3
❑ After the third collision, it waits k * 51.2 for k = 0…23 – 1 (again
selected at random).
❑ In general, the algorithm randomly selects a k between 0 and 2n –
1 and waits for k * 51.2 s, where n is the number of collisions
experienced so far.
86
Experience with Ethernet
❑ Ethernets work best under lightly loaded conditions.
❑ Under heavy loads, too much of the network’s capacity is wasted by
collisions.
❑ Most Ethernets are used in a conservative way.
❑ Have fewer than 200 hosts connected to them which is far fewer than the
maximum of 1024.
❑ Most Ethernets are far shorter than 2500m with a round-trip
delay of closer to 5 s than 51.2 s.
❑ Ethernets are easy to administer and maintain.
❑ There are no switches that can fail and no routing and configuration tables
that have to be kept up-to-date.
❑ It is easy to add a new host to the network.
❑ It is inexpensive.
❑ Cable is cheap, and only other cost is the network adaptor on each host.
87
Wireless Links
❑ Wireless links transmit electromagnetic signals
❑ Radio, microwave, infrared
❑ Wireless links all share the same “wire” (so to speak)
❑ The challenge is to share it efficiently without unduly interfering with each other
❑ Most of this sharing is accomplished by dividing the “wire” along the
dimensions of frequency and space
❑ Exclusive use of a particular frequency in a particular geographic area
may be allocated to an individual entity such as a corporation
❑ Devices that use license-exempt frequencies are still subject to certain
restrictions
❑ The first is a limit on transmission power
❑ This limits the range of signal, making it less likely to interfere with another
signal
❑ For example, a cordless phone might have a range of about 100 feet.
88
Wireless Links
❑These allocations are determined by government agencies
such as FCC (Federal Communications Commission) in
USA
❑Specific bands (frequency) ranges are allocated to certain
uses.
❑Some bands are reserved for government use
❑Other bands are reserved for uses such as AM radio, FM radio,
televisions, satellite communications, and cell phones
❑Specific frequencies within these bands are then allocated to
individual organizations for use within certain geographical areas.
❑Finally, there are several frequency bands set aside for “license
exempt” usage
❑ Bands in which a license is not needed
89
Wireless Links
❑The second restriction requires the use of Spread
Spectrum technique
❑Idea is to spread the signal over a wider frequency band
❑ So as to minimize the impact of interference from other devices
❑ Originally designed for military use
❑Frequency hopping
❑Transmitting signal over a random sequence of frequencies
❑First transmitting at one frequency, then a second, then a third…
❑The sequence of frequencies is not truly random, instead computed
algorithmically by a pseudorandom number generator
❑The receiver uses the same algorithm as the sender, initializes it with
the same seed, and is
❑ Able to hop frequencies in sync with the transmitter to correctly receive
the frame
90
Wireless Links
❑ A second spread spectrum technique called Direct sequence
❑ Represents each bit in the frame by multiple bits in the transmitted signal.
❑ For each bit the sender wants to transmit
❑ It actually sends the exclusive OR of that bit and n random bits
❑ The sequence of random bits is generated by a pseudorandom number
generator known to both the sender and the receiver.
❑ The transmitted values, known as an n-bit chipping code, spread the
signal across a frequency band that is n times wider
91
Wireless Links
❑ Wireless technologies differ in a variety of dimensions
❑ How much bandwidth they provide
❑ How far apart the communication nodes can be
❑ Four prominent wireless technologies: Bluetooth, Wi-Fi (more formally
known as 802.11), WiMAX (802.16), 3G cellular wireless
92
Wireless Links
❑ Mostly widely used
wireless links today
are usually
asymmetric
❑ Two end-points are
usually different kinds
of nodes
❑ One end-point usually
has no mobility, but
has wired connection
to the Internet
(known as base
station)
❑ The node at the other
end of the link is often A wireless network using a base station
mobile
93
Wireless Links
❑ Wireless communication supports point-to-multipoint communication
❑ Communication between non-base (client) nodes is routed via the base
station
❑ Three levels of mobility for clients
❑ No mobility: the receiver must be in a fix location to receive a directional
transmission from the base station (initial version of WiMAX)
❑ Mobility is within the range of a base (Bluetooth)
❑ Mobility between bases (Cell phones and Wi-Fi)
❑ Mesh or Ad-hoc network
❑ Messages may be forwarded via a chain of peer nodes
❑ Nodes are peers
94
IEEE 802.11
❑ Also known as Wi-Fi
❑ Like its Ethernet and token ring siblings, 802.11 is designed for use
in a limited geographical area (homes, office buildings, campuses)
❑ Primary challenge is to mediate access to a shared communication medium –
in this case, signals propagating through space
❑ 802.11 supports additional features
❑ power management and
❑ security mechanisms
❑ Original 802.11 standard defined two radio-based physical layer standard
❑ One using the frequency hopping
❑ Over 79 1-MHz-wide frequency bandwidths
❑ Second using direct sequence
❑ Using 11-bit chipping sequence
❑ Both standards run in the 2.4-GHz and provide up to 2 Mbps
95
IEEE 802.11
❑Then physical layer standard 802.11b was added
❑Using a variant of direct sequence 802.11b provides up to
11 Mbps
❑Uses license-exempt 2.4-GHz band
❑Then came 802.11a which delivers up to 54 Mbps
using OFDM
❑802.11a runs on license-exempt 5-GHz band
❑Most recent standard is 802.11g which is backward
compatible with 802.11b
❑Uses 2.4 GHz band, OFDM and delivers up to 54 Mbps
96
IEEE 802.11 – Collision Avoidance
❑ Consider the situation in the following figure where each of four
nodes is able to send and receive signals that reach just the nodes to
its immediate left and right
❑ For example, B can exchange frames with A and C, but it cannot reach D
❑ C can reach B and D but not A
97
IEEE 802.11 – Collision Avoidance
❑ Suppose both A and C want
to communicate with B and
so they each send it a frame.
❑ A and C are unaware of each
other since their signals do not
carry that far
❑ These two frames collide with
each other at B
❑ But unlike an Ethernet,
neither A nor C is aware of The “Hidden Node” Problem. Although
this collision A and C are hidden from each
❑ A and C are said to hidden other, their signals can collide at B. (B’s
reach is not shown.)
nodes with respect to each
other
98
IEEE 802.11 – Collision Avoidance
❑ Another problem called exposed
node problem occurs
❑ Suppose B is sending to A. Node
C is aware of this communication
because it hears B’s transmission.
❑ It would be a mistake for C to
conclude that it cannot transmit to
anyone just because it can hear B’s
transmission.
❑ Suppose C wants to transmit to
node D. Exposed Node Problem. Although B and
C are exposed to each other’s signals,
❑ This is not a problem since C’s
there is no interference if B transmits to A
transmission to D will not interfere
while C transmits to D. (A and D’s reaches
with A’s ability to receive from B. are not shown.)
99
IEEE 802.11 – Collision Avoidance
❑802.11 addresses these two problems with an algorithm
called Multiple Access with Collision Avoidance (MACA).
❑Key Idea
❑Sender and receiver exchange control frames with each other
before the sender actually transmits any data.
❑This exchange informs all nearby nodes that a transmission is
about to begin
❑Sender transmits a Request to Send (RTS) frame to the receiver.
❑The RTS frame includes a field that indicates how long the sender wants to
hold the medium
❑ - Length of the data frame to be transmitted
❑Receiver replies with a Clear to Send (CTS) frame
❑This frame echoes this length field back to the sender
100
IEEE 802.11 – Collision Avoidance
❑Any node that sees the CTS frame knows that
❑it is close to the receiver, therefore
❑cannot transmit for the period of time it takes to
send a frame of the specified length
❑Any node that sees the RTS frame but not the
CTS frame
❑is not close enough to the receiver to interfere with
it, and
❑so is free to transmit
101
IEEE 802.11 – Collision Avoidance
❑ Using ACK in MACA
❑ Proposed in MACAW: MACA for Wireless LANs
❑ Receiver sends an ACK to the sender after successfully receiving a
frame
❑ All nodes must wait for this ACK before trying to transmit
❑ If two or more nodes detect an idle link and try to transmit an RTS
frame at the same time
❑ Their RTS frame will collide with each other
❑ 802.11 does not support collision detection
❑ So the senders realize the collision has happened when they do not receive the
CTS frame after a period of time
❑ In this case, they each wait a random amount of time before trying again.
❑ The amount of time a given node delays is defined by the same exponential
backoff algorithm used on the Ethernet.
102
IEEE 802.11 – Distribution System
❑802.11 is suitable for an ad-hoc configuration of nodes that
may or may not be able to communicate with all other
nodes.
❑Nodes are free to move around
❑The set of directly reachable nodes may change over time
❑To deal with this mobility and partial connectivity,
❑802.11 defines additional structures on a set of nodes
❑Instead of all nodes being created equal,
❑some nodes are allowed to roam
❑ some are connected to a wired network infrastructure
❑ they are called Access Points (AP) and they are connected to each other by a
so-called distribution system
103
IEEE 802.11 – Distribution System
❑ Following figure illustrates a distribution system that connects three access points,
each of which services the nodes in the same region
❑ Each of these regions is analogous to a cell in a cellular phone system with the
APIs playing the same role as a base station
❑ The distribution network runs at layer 2 of the ISO architecture
❑ Although two nodes can communicate directly with each other if they are within
reach of each other, the idea behind this configuration is
❑ Each nodes associates itself with one access point
❑ For node A to communicate with node E, A first sends a frame to its AP-1 which
forwards the frame across the distribution system to AP-3, which finally transmits the
frame to E
104
IEEE 802.11 – Distribution System
❑ How do the nodes select their access points
❑ How does it work when nodes move from one cell to another
❑ The technique for selecting an AP is called scanning
❑ The node sends a Probe frame
❑ All APs within reach reply with a Probe Response frame
❑ The node selects one of the access points and sends that AP an Association
Request frame
❑ The AP replies with an Association Response frame
❑ A node engages this protocol whenever
❑ it joins the network, as well as
❑ when it becomes unhappy with its current AP
❑ This might happen, for example, because the signal from its current AP has
weakened due to the node moving away from it
❑ Whenever a node acquires a new AP, the new AP notifies the old AP of the
change via the distribution system
105
IEEE 802.11 – Distribution System
❑ Consider the situation shown in the following figure when node C moves from the
cell serviced by AP-1 to the cell serviced by AP-2.
❑ As it moves, it sends Probe frames, which eventually result in Probe Responses
from AP-2.
❑ At some point, C prefers AP-2 over AP-1 , and so it associates itself with that
access point.
❑ This is called active scanning since the node is actively searching for an access point
❑ APs also periodically send a Beacon frame that advertises the capabilities of the
access point; these include the transmission rate supported by the AP
❑ This is called passive scanning
❑ A node can change to this AP based on the Beacon frame simply by sending it an
Association Request frame back to the access point.
Node Mobility
106
IEEE 802.11 – Frame Format
❑Source and Destinations addresses: each 48 bits
❑Data: up to 2312 bytes
❑CRC: 32 bit
❑Control field: 16 bits
❑Contains three subfields (of interest)
❑6 bit Type field: indicates whether the frame is an RTS or CTS frame or
being used by the scanning algorithm
❑A pair of 1 bit fields : called ToDS and FromDS
Frame Format
107
IEEE 802.11 – Frame Format
❑ Frame contains four addresses
❑ How these addresses are interpreted depends on the settings of
the ToDS and FromDS bits in the frame’s Control field
❑ This is to account for the possibility that the frame had to be
forwarded across the distribution system which would mean
that,
❑ the original sender is not necessarily the same as the most recent
transmitting node
❑ Same is true for the destination address
❑ Simplest case
❑ When one node is sending directly to another, both the DS bits are 0,
Addr1 identifies the target node, and Addr2 identifies the source node
108
IEEE 802.11 – Frame Format
❑Most complex case
❑Both DS bits are set to 1
❑Indicates that the message went from a wireless node onto the
distribution system, and then from the distribution system to
another wireless node
❑With both bits set,
❑Addr1 identifies the ultimate destination,
❑Addr2 identifies the immediate sender (the one that forwarded the
frame from the distribution system to the ultimate destination)
❑Addr3 identifies the intermediate destination (the one that accepted
the frame from a wireless node and forwarded across the
distribution system)
❑Addr4 identifies the original source
❑Addr1: E, Addr2: AP-3, Addr3: AP-1, Addr4: A
109
Bluetooth
❑ Used for very short range
communication between mobile
phones, PDAs, notebook
computers and other personal or
peripheral devices
❑ Operates in the license-exempt
band at 2.45 GHz
❑ Has a range of only 10 m
❑ Communication devices
typically belong to one
individual or group
❑ Sometimes categorized as Personal
Area Network (PAN) A Bluetooth Piconet
110
Bluetooth
❑ Version 2.0 provides speeds up to 2.1 Mbps
❑ Power consumption is low
❑ Bluetooth is specified by an industry consortium called the
Bluetooth Special Interest Group
❑ It specifies an entire suite of protocols, going beyond the link layer
to define application protocols, which it calls profiles, for a range of
applications
❑ There is a profile for synchronizing a PDA with personal computer
❑ Another profile gives a mobile computer access to a wired LAN
❑ The basic Bluetooth network configuration is called a piconet
❑ Consists of a master device and up to seven slave devices
❑ Any communication is between the master and a slave
❑ The slaves do not communicate directly with each other
❑ A slave can be parked: set to an inactive, low-power state
111
ZigBee
❑ZigBee is a new technology that competes with
Bluetooth
❑Devised by the ZigBee alliance and standardized as IEEE
802.15.4
❑It is designed for situations where the bandwidth
requirements are low and power consumption must be
very low to give very long battery life
❑It is also intended to be simpler and cheaper than
Bluetooth, making it financially feasible to incorporate in
cheaper devices such as a wall switch that wirelessly
communicates with a ceiling-mounted fan
112
CS8591 COMPUTER NETWORKS
UNIT – III
3
NETWORK LAYER SERVICES
In this section, we briefly discuss services provided by the network layer. Our discussion
is mostly based on the connectionless service, the dominant service in today’s Internet.
Logical Addressing
Services Provided at the Source Computer
Services Provides at the Each Router
Services Provided at the Destination Computer
At the conceptual level, we can think of the global Internet as a black box network that connects
millions (if not billions) of computers in the world together. At this level, we are only concerned that a
message from the application layer in one computer reaches the application layer in another
computer.
4
Logical Addressing: An imaginary part of the Internet
5
Services provided at the source computer
6
Processing at each router
7
Processing at the destination computer
8
ROUTING
Routing algorithm:: that part of the Network Layer responsible for
deciding on which output line to transmit an incoming packet.
Remember: For virtual circuit subnets the routing decision is made
ONLY at set up.
Algorithm properties:: correctness, simplicity, robustness,
stability, fairness, optimality, and scalability.
In packet switching, the message is first divided into manageable packets at the
source before being transmitted. The packets are assembled at the destination.
The NL is designed as a packet-switched network. This means that the packet at the source is divided into manageable
packets called datagrams. Individual datagrams are then transferred from S to D. The received datagrams are assembled at
the destination before recreating the original message. The packet-switched network layer of the Internet was originally
designed as a connectionless service, but recently there is a tendency to change this to a connection-oriented service.
10
Types of Services
Note Connectionless Service
Connection-Oriented Service
In a connectionless packet-switched network, the forwarding decision is
based on the destination address of the packet.
Network
A connectionless
packet-swtiched network
R1 R2
4 3 2 1 2 Delay in a connectionless network
Sender 1
Network
4 Destination
2
3 Souce
R4 1
3 3
4 1 3 4 2 1
R3 R5 Out of order Receiver
Total delay
2
Source D
Setup
4 3 2 1
2
4
Total delay
3 3 Transmission
time
2 4
1
5
4 3 2 1 4 3 2 1
Teardown
6
12
Forwarding of IP Packets
The network layer supervises the handling of the packets by the underlying physical networks. We
define this handling as the delivery of a packet. The delivery of a packet to its final destination is
accomplished using two different methods of delivery: direct and indirect. Direct Delivery
Direct delivery Indirect Delivery
Direct delivery
Direct delivery
Indirect delivery
A B
Indirect delivery
Indirect delivery 13
FORWARDING
Forwarding means to place the packet in its route to its destination. Since the Internet
today is made of a combination of links (networks), forwarding means to deliver the
packet to the next hop (which can be the final destination or the intermediate connecting
device). Although the IP protocol was originally designed as a connectionless protocol,
today the tendency is to use IP as a connection-oriented protocol.
4 types
Next – hop
Network Specific method
Host specific method
Default method
14
Figure 6.3 Next-hop method
15
Figure 6.4 Network-specific method
Network-specific
routing table for host S
Destination Next Hop
Host-specific
routing table for host S N2 R1
16
Figure 6.5 Host-specific routing
N1
R1 R3
Host B
N2 R2 N3
17
Figure 6.6 Default routing
Default
R2
router
18
ADDRESSING
The address in the network layer of the TCP/IP model is called Internet Address or
IP address, an IP address is a 32-bit address
The IP addresses are unique (each connection has a different address) and
universal (must be accepted by any host wants to connect to the internet).
Consists of 4 octets (bytes)
Network IP addresses are managed by a nonprofit organization called ICANN
(International Corporation for Assigned Names and Numbers) to avoid conflicts.
Assigns addresses to regional Authorities which assign numbers to ISPs
32
The address space of IPv4 is 2 or 4,294,967,296.
Example 1
Change the IP addresses from binary notation to dotted-decimal notation.
a. 10000001 00001011 00001011 11101111
b. 11111001 10011011 11111011 00001111
Solution
We replace each group of 8 bits with its equivalent decimal number and add dots for separation:
a. 129.11.11.239
b. 249.155.251.15
20
ADDRESSING
PROBLEM
Example 2 Change the IP addresses from dotted-decimal notation to binary notation.
a. 111.56.45.78
b. 75.45.34.78
Solution We replace each decimal number with its binary equivalent:
Note
22
Find the class of each address:
Example 3
a. 00000001 00001011 00001011 11101111
b. 11110011 10011011 11111011 00001111
See the procedure in Figure 19.11.
Solution a. The first bit is 0; this is a class A address.
b. The first 4 bits are 1s; this is a class E address.
Class B
Start with binary 10
Range 128.x.x.x to 191.x.x.x
230 class B complete IP addresses
214=16384 blocks (network addresses)
Number of addresses in each block is 216=65536 – (all zeros host, and all ones)
All allocated
24
Classful Addressing
Class C
229 Class C complete IP addresses
221=2097152 blocks (network addresses)
Start with binary 110
Number of addresses in each block is 256 – (all zeros host, and all ones) class
25
Figure 19.14 Blocks in class A
Note
Note:
Note
The number of addresses in class C block is
28
smaller than the needs of most organizations.
Figure 19.17 Network address
29
Example 6 Given the address 132.6.17.85, find the network address.
The class is B. The first 2 bytes defines the netid. We can find the network address by
Solution replacing the hostid bytes (17.85) with 0s. Therefore, the network address is 132.6.0.0.
Sample internet
Class C
Note
In Dotted-
Class In Binary Using Slash
Decimal
31
Figure A network with two levels of hierarchy
Note
A class B “Flat Network”, more than
16
The network address can be found by 2 =65536 hosts
applying the default mask to any address How to manage?
in the block (including itself).It retains the
Performance? Too many hosts on the
netid of the block and sets the hostid to 0s. same LAN (single broadcast domain) will
slowdown the LAN performance
Solution: Subnetting
32
Figure 19.23 Subnet mask
Class B
Reduces
the routing
table
entries and
size 33
Subnetting
Dividing the network into several smaller groups (subnets) with each
group having its own subnet IP address
Site looks to rest of internet like single network and routers outside
the organization route the packet based on the main Network address
Local routers route within subnetted network using subnet address
Host portion of address partitioned into subnet number (most
significant part) and host number (least significant part)
In this case, IP address will have 3 levels (Main network, subnet, host)
Subnet mask is a 32-bit consists of zeros and ones that indicates
which bits of the IP address are subnet number and which are host
number
Subnet mask when ANDed with the IP address it gives the
subnetwork address
34
Figure 19.20 A network with three levels of hierarchy
(subnetted)
Example 9 A router inside the organization receives the same packet with D address
190.240.33.91 /19. Show how it finds the subnetwork address to route the packet.
Solution
The router follows three steps:
The router must know the mask. Is 255.255.224.0 or /19
The router applies the mask to the address, 190.240.33.91. The subnet address is 190.240.32.0.
The router looks in its routing table to find how to route the packet to this destination. Later, we will
see what happens if this destination does not exist.
36
Obtaining Host IP Address
Once a network administrator in an organization obtained a block of
addresses from its ISP, it can then assign individual IP addresses to
the host and router interfaces
It can be done in two ways:
Manual configuration: IP address is stored manually by the
another?
Solution is using a protocol called Dynamic Host Configuration
Protocol (DHCP)
DHCP is a client-server program
37
Dynamic Host Configuration Protocol
Dynamic Host Configuration Protocol (DHCP)
A protocol that provide IP address, subnet mask, IP address of a
temporary Addresses.)
Static IP addresses database maps physical addresses (MAC) to
database first.
If no address match is found, DHCP will select the dynamic IP
39
Four cases using ARP
40
ARP operation
Note
An ARP request is
broadcast; an ARP
reply is unicast.
41
Figure 20.5 IPv4 datagram format
+ Padding
42
IPv4 datagram fields
Minimum Header length is 20 bytes without options.
With options the maximum can go to 60 bytes
Largest data that can be carried in the datagram is 65535 – 20 = 65515
Version field: will carry the version number which is 4 = (0100)2
Header length: the length of the header in bytes after dividing it by 4. Min is 20/4 = 5 =
(0101)2 and the max is 60/4 = 15 = (1111 )2
Total length: total length of the packet: header + data. Max = 65535 bytes
Identification, flags, and offset used for fragmentation and reassembly at the D
Packet can be fragmented at any node between the source and the destination but
reassembly is done ONLY at the destination node.
Time to Live is used to prevent lost packets from circulating between routers forever. This
field is set to certain value depending on the device operating system. Each router will
decrement this field by one and check the value. If the value is zero the packet will be
dropped.
Protocol: contains a code for what is being carried in the data field.
Header checksum used for checking if there is error in the header only. The checksum is
recomputed at each router between the source and the destination.
43
Protocol field and encapsulated data
44
Internet Control Message Protocol
used by hosts & routers to
communicate network-level Type Code description
0 0 echo reply (ping)
information
3 0 dest. network unreachable
error reporting: 3 1 dest host unreachable
unreachable host, network, 3 2 dest protocol unreachable
port, protocol 3 3 dest port unreachable
echo request/reply (used by
3 6 dest network unknown
3 7 dest host unknown
ping)
4 0 source quench (congestion
network-layer “above” IP: control - not used)
ICMP msgs carried in IP 8 0 echo request (ping)
datagrams 9 0 route advertisement
10 0 router discovery
ICMP message: type, code 11 0 TTL expired
plus first 8 bytes of IP 12 0 bad IP header
datagram causing error
45
Traceroute and ICMP
source sends series of UDP segments to dest
first set has TTL =1
second set has TTL=2, etc.
unlikely port number
when nth set of datagrams arrives to nth router:
router discards datagrams
and sends source ICMP messages (type 11, code 0)
stopping criteria:
UDP segment eventually arrives at destination host
destination returns ICMP “port unreachable” message (type 3, code 3)
source stops
3 probes 3 probes
3 probes 46
IPv6: Motivation
initial motivation: 32-bit address space soon to be completely
allocated.
additional motivation:
header format helps speed processing/forwarding
how will network operate with mixed IPv4 and IPv6 routers?
tunneling: IPv6 datagram carried as payload in IPv4 datagram among IPv4 routers
IPv4 header fields IPv6 header fields
IPv4 payload
IPv4 source, dest addr IPv6 source dest addr
UDP/TCP payload
IPv6 datagram
IPv4 datagram
Tunneling
IPv4 tunnel
A B connecting IPv6 routers
E F
logical view: IPv6 IPv6 IPv6 IPv6
A B C D E F
physical view:
IPv6 IPv6 IPv4 IPv4 IPv6 IPv6
flow: X flow: X
src: A src:B src:B src: A
dest: F dest: F
dest: E dest: E
Flow: X Flow: X
data Src: A data
Src: A
Dest: F Dest: F
data data
A-to-B: E-to-F:
IPv6 B-to-C: B-to-C: IPv6
IPv6 inside IPv6 inside
IPv4 IPv4
49
Interplay between routing, forwarding
routing algorithm routing algorithm determines
end-end-path through network
local forwarding table
IP destination address in
arriving packet’s header
1
3 2
50
Unicast Routing basics
graph: G = (N,E) 5
v 3 w
N = set of routers = { u, v, w, x, y, z } 5
2
u z
2 1
E = set of links ={ (u,v), (u,x), (v,x), (v,w), (x,w), 3
1 x y 2
(x,y), (w,y), (w,z), (y,z) }
1
aside: graph abstraction is useful in other network contexts, e.g., P2P, where
N is set of peers and E is set of TCP connections
Graph abstraction: costs
c(x,x’) = cost of link (x,x’) e.g., c(w,z) = 5
cost could always be 1, or inversely related to bandwidth, or inversely
related to congestion
cost of path (x1, x2, x3,…, xp) = c(x1,x2) + c(x2,x3) + … + c(xp-1,xp)
key question: what is the least-cost path between u and z ?
routing algorithm: algorithm that finds that least cost path
51
Routing algorithm classification
Q: global or decentralized information?
global: all routers have complete topology, link cost info “link state”
algorithms
decentralized:
router knows physically-connected neighbors, link costs to neighbors
iterative process of computation, exchange of info with neighbors
“distance vector” algorithms
Q: static or dynamic?
static: routes change slowly over time
dynamic: routes change more quickly
periodic update
53
Dijsktra’s Algorithm D(v) D(w) D(x) D(y) D(z)
p(v) p(w) p(x) p(y) p(z)
Step N'
1 Initialization:
2 N' = {u} 0 u 7,u 3,u 5,u ∞ ∞
3 for all nodes v 1 uw 6,w 5,u 11,w ∞
4 if v adjacent to u
5 then D(v) = c(u,v) 2 uwx 6,w 11,w 14,x
7 4 uwxvy 12,y
8 Loop 5 uwxvyz
9 find w not in N' such that D(w) is a minimum
10 add w to N' x
11 update D(v) for all v adjacent to w and not in N' : 9
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known 5 7
14 shortest path cost to w plus cost from w to v */ 4
15 until all nodes in N'
8
notes:
u 3 w y z
node x:
maintains Dv = [Dv(y): y є N ]
key idea:
from time-to-time, each node sends its own distance vector estimate
to neighbors
when x receives new DV estimate from neighbor, it updates its own
57
Distance vector algorithm
iterative, asynchronous: each each node:
local iteration caused by:
local link cost change
DV update message from wait for (change in local link cost or
neighbor msg from neighbor)
distributed:
each node notifies neighbors only recompute estimates
when its DV changes
neighbors then notify their
neighbors if necessary
if DV to any dest has changed, notify
neighbors
58
Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} Dx(z) = min{c(x,y) +
= min{2+0 , 7+1} = 2 Dy(z), c(x,z) + Dz(z)}
= min{2+1 , 7+0} = 3
node x cost to cost to
cost to
table x y z x y z x y z
x 0 2 7 x 0 2 3 x 0 2 3
from
from
y ∞∞ ∞ y 2 0 1
from
y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
node y cost to cost to
cost to
y
table x y z x y z x y z 2 1
x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z
from
from
y y 2 7
from
2 0 1 0 1 y 2 0 1
z ∞∞ ∞ z 7 1 0 z 3 1 0
cost to cost to
node z cost to
table x y z x y z x y z
x ∞∞ ∞ x 0 2 7 x 0 2 3
from
from
from
y y 2 0 1 y 2 0 1
∞∞ ∞
z z 3 1 0 z 3 1 0
71 0
time 59
Comparison of LS and DV algorithms
message complexity robustness: what happens if router
LS: with n nodes, E links, O(nE)
malfunctions?
msgs sent LS:
DV: exchange between neighbors node can advertise incorrect
only link cost
convergence time varies
each node computes only its
network
60
Hierarchical routing
scale: with 600 million destinations:
3c
can’t store all dest’s in routing tables! 3a 2c
3b 2a
AS3 2b
routing table exchange would swamp links! 1c
1a 1b AS1 AS2
gateway router: 1d
each network admin may want to control routing in its own network
61
Inter-AS tasks
suppose router in AS1 receives datagram destined outside of AS1:
router should forward packet to gateway router, but which one?
AS1 must: 1.learn which dests are reachable through AS2, which through AS3
2.propagate this reachability info to all routers in AS1
job of inter-AS routing!
suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3
router 1d determines from intra-AS routing info that its interface I is on the least
cost path to 1c
installs forwarding table entry (x,I)
x
3c
3a
3b
AS3 2c other
1c networks
2a
other
1a 2b
networks 1b
AS1 1d AS2 62
Intra-AS Routing
also known as interior gateway protocols (IGP)
most common intra-AS routing protocols:
RIP: Routing Information Protocol
OSPF: Open Shortest Path First
IGRP: Interior Gateway Routing Protocol(Cisco prop.)
RIP: example z
w x y
A D B
transport transprt
(UDP) (UDP)
network forwarding forwarding network
(IP) table table (IP)
link link
65
physical physical
OSPF (Open Shortest Path First)
OSPF advertisement carries one entry per neighbor
advertisements flooded to entire AS
carried in OSPF messages directly over IP (rather than TCP / UDP
66
OSPF “advanced” features (not in RIP)
security: all OSPF messages authenticated (to prevent malicious intrusion)
multiple same-cost paths allowed (only one path in RIP)
for each link, multiple cost metrics for different TOS (e.g., satellite link cost
set “low” for best effort ToS; high for real time ToS)
integrated uni- and multicast support:
Hierarchical OSPF
two-level hierarchy: local area, backbone.
each nodes has detailed area topology; only know direction (shortest
AS3 2c other
prefix + attributes = “route” 1c 2a networks
other
1a 2b
networks 1b
two important attributes: AS1 1d AS2
e.g., AS 67, AS 17
NEXT-HOP: indicates specific internal-AS router to next-hop AS. (may
policy-based routing 69
BGP route selection
router may learn about more than 1 route to destination AS, selects
route based on:
local preference value attribute: policy decision
shortest AS-PATH
closest NEXT-HOP router: hot potato routing
additional criteria
BGP messages : msg exchanged between peers over TCP connection
BGP messages:
close connection
70
Multicast Basics
goal: find a tree connecting routers having local mcast group members
tree: not all paths between routers used, 2 types
legend
group
member
not group
member
router
with a
group
member
router
shared tree source-based trees without
group
member
71
Approaches for building mcast trees
Approaches
source-based tree: one tree per sources: source
R1 2
shortest path trees R4
1
reverse path forwarding
R2 5
group-shared tree: group uses one tree 3 4 R5
minimal spanning (Steiner) R3 6
R6 R7
center-based trees
LEGEND
router with attached
Shortest path tree group member
mcast forwarding tree: tree of shortest router with no attached
group member
path routes from source to all receivers i link used for forwarding,
Dijkstra’s algorithm
i indicates order link
added by algorithm
72
Reverse path forwarding
rely on router’s knowledge of unicast shortest path from it to sender
each router has simple forwarding behavior:
s: source LEGEND
R1 router with attached
R4 group member
R2 router with no attached
group member
R5
datagram will be
R3 forwarded
R6 R7 datagram will not be 73
forwarded
Reverse path forwarding: pruning
forwarding tree contains subtrees with no mcast group
members
no need to forward datagrams down subtree
s: source
R1
R4
LEGEND
R2 P P
prune message
R5
links with multicast
R3 P forwarding
R6
R7
74
Shared-tree: steiner tree
steiner tree: minimum cost tree connecting all
routers with attached group members
problem is NP-complete
excellent heuristics exists
not used in practice:
computational complexity
join/leave
75
Center-based trees
single delivery tree shared by all
one router identified as “center” of tree
to join:
edge router sends unicast join-msg addressed to center router
join-msg either hits existing tree branch for this center, or arrives at
center
path taken by join-msg becomes new branch of tree for this router
R1
3 R4
LEGEND
R2 2 1 path order in which join
R5 messages generated
R3
1 R6 76
R7
Internet Multicasting Routing: DVMRP
DVMRP: distance vector multicast routing protocol, RFC1075
flood and prune: reverse path forwarding, source-based tree
RPF tree based on DVMRP’s own routing tables constructed by
78
PIM: Protocol Independent Multicast
not dependent on any specific underlying unicast routing algorithm
(works with all)
two different multicast distribution scenarios :
dense: sparse:
group members densely packed, in networks with group members small wrt
“close” proximity. interconnected networks
bandwidth more plentiful group members “widely dispersed”
bandwidth not plentiful
Consequences of sparse-dense
dense sparse:
group membership by routers no membership until routers
assumed until routers explicitly prune explicitly join
data-driven construction on mcast receiver- driven construction of
tree (e.g., RPF) mcast tree (e.g., center-based)
bandwidth and non-group-router bandwidth and non-group-router
processing profligate processing conservative
79
PIM- dense mode
80
PIM - sparse mode
center-based approach
router sends join msg to rendezvous point (RP)
intermediate routers update state and forward join
sender(s):
unicast data to RP, which distributes down RP-rooted tree
RP can extend mcast tree upstream to source
RP can send stop msg if no attached receivers
“no one is listening!”
81
Questions?
82
CS8591 COMPUTER NETWORKS
UNIT – IV
Unit - IV
TRANSPORT LAYER
Note
5
Figure 23.3 IP addresses versus port numbers
6
Figure 23.7 Error control
7
Figure 23.8 Position of UDP, TCP, and SCTP in TCP/IP suite
8
23-2 USER DATAGRAM PROTOCOL (UDP)
10
Example 23.1
SNMP uses two port numbers 161&162, each for a different purpose.
11
Figure 23.9 User datagram format
UDP length
Note
= IP length – IP header’s length
12
Figure 23.10 Pseudoheader for checksum calculation
13
Example 23.2
Figure shows the checksum calculation for a very small user datagram
with only 7 bytes of data. Because the number of bytes of data is odd,
padding is added for checksum calculation. The pseudoheader as well
as the padding will be dropped when the user datagram is delivered to
IP.
15
23-3 TCP
17
Figure 23.13 Stream delivery
Note
18
Figure 23.14 Sending and receiving buffers
19
Figure 23.15 TCP segments
20
Example 23.3
The following shows the sequence number for
each segment:
Note
Note
23
Figure 23.18 Connection establishment using three-way handshaking
Note
A SYN segment cannot carry data,
but it consumes one seq. no.
24
Figure 23.19 Data transfer
Note
25
Figure 23.20 Connection termination using three-way handshaking
26
Figure 23.21 Half-close Figure 23.22 Sliding window
Note
A sliding window is used to make
transmission more efficient as
well as to control the flow of data
so that the destination does not
become overwhelmed with data.
TCP sliding windows are byte-
oriented.
27
Example 23.4
What is the value of the receiver window (rwnd) for host A if
the receiver, host B, has a buffer size of 5000 bytes and 1000
bytes of received and unprocessed data?
Solution
The value of rwnd = 5000 − 1000 = 4000. Host B can receive only
4000 bytes of data before overflowing its buffer. Host B advertises this
value in its next segment to A.
Example 23.5 : What is the size of the window for host A if the
value of rwnd is 3000 bytes and the value of cwnd is 3500 bytes?
Solution
The size of the window is the smaller of rwnd and cwnd, which is
3000 bytes.
28
Example 23.6
Figure shows an unrealistic example of a sliding window. The
sender has sent bytes up to 202. We assume that cwnd is 20 (in
reality this value is thousands of bytes). The receiver has sent an
acknowledgment number of 200 with an rwnd of 9 bytes (in reality this
value is thousands of bytes). The size of the sender window is the
minimum of rwnd and cwnd, or 9 bytes. Bytes 200 to 202 are sent, but
not acknowledged. Bytes 203 to 208 can be sent without worrying
about acknowledgment. Bytes 209 and above cannot be sent.
29
Note
31
Figure 23.24 Normal operation
32
Figure 23.25 Lost segment
33
Figure 23.26 Fast retransmission
Note
34
23-4 SCTP
36
Figure 23.27 Multiple-stream concept
Note
Note
38
Note
39
Figure 23.29 Comparison between a TCP segment and an SCTP packet
Note
40
Figure 23.30 Packet, data chunks, and streams
Note
Data chunks are identified by three items: TSN, SI, and SSN.
TSN is a cumulative number identifying the association; SI
defines the stream; SSN defines the chunk in a stream.
41
Figure 23.31 SCTP packet format Note
42
Figure 23.32 General header Figure 23.33 Four-way handshaking
43
Table 23.5 Chunks
44
Note
A connection in SCTP is called an association.
45
Figure 23.34 Simple data transfer
Note
The
acknowledgment
in SCTP defines
the cumulative
TSN, the TSN of
the last data
chunk received in
order.
46
Figure 23.35 Association termination
47
Figure 23.36 Flow control, receiver site
48
Figure 23.38 Flow control scenario
49
Figure 23.39 Error control, receiver site
50
Figure 23.40 Error control, sender site
51
CS8591 COMPUTER NETWORKS
UNIT – V
3
26.3
World Wide Web
Architectural Overview
The parts of the Web model.
4
The Client Side
5
The Server Side
6 6
26.26.1 World Wide Web
7
Example 26.1
Assume we need to retrieve a scientific document that
contains one reference to another text file and one reference
to a large image. Figure 26.1 shows the situation.
8
Figure 26.1: Example 26.1
9
Figure 26.2: Browser
10
26.26.2 HyperText Transfer Protocol
11
The World Wide Web - HTTP
❑ Hypertext Transfer Protocol (HTTP) is a
communications protocol used to transfer or convey
information on intranets and the World Wide Web. Its
original purpose was to provide a way to publish and
retrieve hypertext pages, mainly scientific paper. Created in
CERN, Geneva.
❑ Development of HTTP was coordinated by the W3C
(World Wide Web Consortium) and the IETF (Internet
Engineering Task Force), culminating in the publication of a
series of RFCs, most notably
RFC 2616 (June 1999), which defines HTTP/1.1, the
current version.
❑ HTTP is a request/response protocol between a client and
a server. It works on the well known TCP port 80.
12
Example 26.3
Figure 26.3 shows an example of a nonpersistent connection. The client needs to
access a file that contains one link to an image. The text file and image are located
on the same server. Here we need two connections. For each connection, TCP
requires at least three handshake messages to establish the connection, but the
request can be sent with the third one. After the connection is established, the object
can be transferred. After receiving an object, another three handshake messages are
needed to terminate the connection.
13
Example 26.4
Figure 26.4 shows the same scenario as in Example 26.3, but using a
persistent connection. Only one connection establishment and
connection termination is used, but the request for the image is sent
separately.
14
Figure 26.5: Formats of the request and response messages
15
Table 26.1: Methods
16
Table 26.2: Request Header Names
17
Table 26.3: Response Header Names
18
Example 26.5
This example retrieves a document (see Figure 26.6). We use the GET method to
retrieve an image with the path /usr/bin/image26. The request line shows the method
(GET), the URL, and the HTTP version (26.1). The header has two lines that show that
the client can accept images in the GIF or JPEG format. The request does not have a
body. The response message contains the status line and four lines of header. The
header lines define the date, server, content encoding (MIME version, which will be
described in electronic mail), and length of the document. The body of the document
follows the header..
Figure 26.6:
Example 26.5
19
Example 26.6
In this example, the client wants to send a web page to be posted on the server.
We use the PUT method. The request line shows the method (PUT), URL, and
HTTP version (26.1). There are four lines of headers. The request body
contains the web page to be posted. The response message contains the status
line and four lines of headers. The created document, which is a CGI
document, is included as the body (see Figure 26.7).
Figure 26.7:
Example 26.6
20
Example 26.8
Figure 26.8 shows a scenario in which an electronic store
can benefit from the use of cookies. Assume a shopper
wants to buy a toy from an electronic store named BestToys.
The shopper browser (client) sends a request to the BestToys
server. The server creates an empty shopping cart (a list) for
the client and assigns an ID to the cart (for example, 12343).
The server then sends a response message, which contains
the images of all toys available, with a link under each toy
that selects the toy if it is being clicked. This response
message also includes the Set-Cookie header line whose
value is 12343. The client displays the images and stores the
cookie value in a file named BestToys.
22
Figure 26.8: Example 26.8
23
Example 26.9
Figure 26.9 shows an example of a use of a proxy server in a local network, such as
the network on a campus or in a company. The proxy server is installed in the local
network. When an HTTP request is created by any of the clients (browsers), the
request is first directed to the proxy server If the proxy server already has the
corresponding web page, it sends the response to the client. Otherwise, the proxy
server acts as a client and sends the request to the web server in the Internet. When
the response is returned, the proxy server makes a copy and stores it in its cache
before sending it to the requesting client.
24
HTML – HyperText Markup Language
❑ In 1980, physicist Tim Berners-Lee, who was an
independent contractor at CERN, proposed and
prototyped ENQUIRE, a hypertext system for CERN
researchers to use to share documents.
❑ In 1989, Berners-Lee and CERN data systems
engineer Robert Cailliau each submitted separate
proposals for an Internet-based hypertext system
providing similar functionality.
❑ In 1990, they collaborated on a joint proposal, the
World Wide Web (W3) project, which was accepted
by CERN.
25
HTML
A selection of common HTML tags. some can have additional
parameters (attributes).
26
26-2 FTP
Control
connection
Data
connection
27
File Transfer Protocol (FTP)
❑ File Transfer Protocol (FTP) is the standard mechanism
provided by TCP/IP for copying of any kind of files from one
host to another.
28
26.2.1 Two Connections
29
Table 26.4: Some FTP commands
30
Table 26.4 : Some FTP commands (continued)
31
26.2.3 Data Connection
The data connection uses the well-known port 20 at the
server site. However, the creation of a data connection is
different from the control connection. The following shows
the steps:
Figure 26.11:
Example 26.12
33
Example 26.11
The following shows an actual FTP session that lists
the directories.
34
26.2.4 Security for FTP
35
26-3 ELECTRONIC MAIL
26.3.1 Architecture
To explain the architecture of e-mail, we give a common scenario, as
shown in Figure 26.12. Another possibility is the case in which Alice
or Bob is directly connected to the corresponding mail server, in which
LAN or WAN connection is not required, but this variation in the
scenario does not affect our discussion.
36
Figure 26.12: Common scenario
1 9
2
8
3 7
4 5 6
37
Figure 26.13: Format of an e-mail
38
Figure 26.14: E-mail address
39
Table 26.6: SMTP Commands
40
Table 26.7: SMTP responses (Continued)
41
Table 26.7: SMTP responses (continued)
42
Example 26.12
To show the three mail transfer
phases, we show all of the steps
described above using the
information depicted in Figure
26.16. In the figure, we have
separated the messages related to
the envelope, header, and body in
the data transfer section. Note that
the steps in this figure are repeated
two times in each e-mail transfer:
once from the e-mail sender to the
local mail server and once from
the local mail server to the remote
mail server. The local mail server,
after receiving the whole e-mail
message, may spool it and send it
to the remote mail server at
another time. Fig. 26.16:Example 26.12
43
Figure 26.17: POP3
44
Figure 26.18: MIME
45
Data
Types and
Subtypes
in MIME
47
Table 26.10: Base64 Converting Table
48
Figure 26.21: Quoted-printable
49
26.3.2 E-Mail Security
The protocol
discussed in this
section does not
provide any security
provisions. However,
e-mail exchanges can
be secured using two
Figure 26.22: Web-based e-mail, cases I and II
application-layer
securities designed in
particular for e-mail
systems. Two of these
protocols, Pretty
Good Privacy (PGP)
and
Secure/Multipurpose
Internet Mail
Extensions
50
(S/MIME).
26-4 TELNET
51
Trivial FTP (TFTP)
❑A very simple file transfer protocol, with the functionality of a very basic
form of FTP. Defined in 1980.
❑TFTP uses UDP port 69 (not TCP!)
❑An ex. of TFTP usage for remote boot through BOOTP protocol in a LAN:
52
FTP pros and cons
❑ Advantages:
❑ Simple implementation
❑ Universal application
❑ Wide used and standartized
❑ Disadvantages:
❑ Clear text passwords, unencrypted data.
❑ Multiple TCP/IP connections are used = > Firewalls problems.
❑ Hard to filter active mode FTP traffic on the client side by using a
firewall.
❑ It is possible to abuse the protocol's built-in proxy features to tell a server
to send data to an arbitrary port of a third computer;
❑ High latency.
❑ No integrity check on the receiver side.
❑ No date/timestamp attribute transfer.
53
26.4.1 Local versus Remote Logging
We first discuss the concept of local and remote logging as
shown in Figure 26.23.
54
Figure 26.24: Concept of NVT
55
26-5 SECURE SHELL (SSH)
56
26.5.1 Components
SSH is an application-layer protocol with three
components, as shown in Figure 26.25.
57
26.5.2 Applications
Although SSH is often thought of as a replacement for
TELNET, SSH is, in fact, a general-purpose protocol that provides a
secure connection between a client and server. Fig 26.26: Port Forwarding
Example:
www.acad.bg 194.141.0.9
59
DNS
❑ Host name to address mappings were maintained by the Network
Information Center (NIC) in a single file (HOSTS.TXT) which was
transferred to all hosts using FTP (about 25 years ago).
Disadvantages:
Delegation
com edu bg eu info
3
rd Level Domains physics amigo val www
mary joe kevin test book
64
Up to 127 levels
mail sigma
Top Level Domains
❑ Generic domains (gTLD): com, org, net, int (all around the world);
edu, gov, mil (located in USA only); aero, biz, coop, info,
museum, name, pro(new domains,since 2000)
❑ Country code domains (ccTLD): bg, uk, fr, it, ...
Resource Records
❑ Special infrastructure domain: arpa
❑ Loopback domains: localhost, localdomain
❑ And the domain eu for European Union!
These tasks are described in the DNS protocol (RFC 1035) located on
the Application Layer of the “TCP/IP reference model”.
Delegation:
Source: http://k.root-servers.org 68
DNS servers
Primary DNS server for a given domain – holds resource records for the zone.
The zone configuration is written by the system administrator.
Secondary DNS server for a given domain – it exists for the case when the
Primary DNS server is failed or overloaded. The Secondary server
downloads the zone information from the Primary periodically or by
notification.
➢ Every domain must have one Primary DNS server and at least one
Secondary.
The Primary and Secondary DNS servers are also called authoritative for
their domain and non-authoritative for the rest of domains in the world.
E.g. the authoritative servers always hold up to date zone information for
the domain.
➢ Caching only DNS servers – they cache DNS queries and answers for
speed-up the service. These servers are not authoritative for any domain.
2. The local resolver opens a special file called hosts and looks in case the
answer is already written here. If not then next:
4. If the DNS server knows (or already cached) the answer, then returns it.
5. If the DNS server doesn’t know the answer, it sends a recursive query
through the DNS hierarchy, starting from the root domain. The recursive
query consists of several sub-queries to the corresponding DNS servers.
6. The DNS servers returns the result – the answer or error message.
70
Reverse DNS query
❑ The reverse query uses the special infrastructure domain in-
addr.arpa
❑ The IP is written before this special domain in reverse order of
numbers separated with dots.
❑ Example: 194.141.0.0 corresponds to 0.0.141.194.in-
addr.arpa
❑ The reverse query starts from a root DNS server and follows the
delegation path.
❑ Example in Unix/Linux:dig 0.0.141.194.in-addr.arpa +trace
❑ (It traces and shows the delegation path from the root name
servers down to SOA DNS server)
71
DNS protocol details
❑ The protocol uses two transport protocols from the lower layer:
❑ The queries and answers are transferred using the unreliable protocol
UDP for speed. But it is preferred because the OS configured DNS
servers are near, usually in the same LAN.
❑ The zone transfers between the DNS servers are performed through
TCP, because it must be reliable.
acad.bg. IN A 194.141.0.9
acad.bg. IN MX 10 mx-a.acad.bg.
IN MX 20 mx-b.acad.bg.
IN NS amigo.acad.bg.
IN NS unicom.acad.bg.
localhost IN A 127.0.0.1
poseidon IN A 194.141.0.1
backbone IN A 194.141.252.2
iris IN A 194.141.0.2
amigo IN AAAA 2001:4b58:acad::3
unicom IN AAAA 2001:4b58:acad::9
bis-21++ IN CNAME unicom.acad.bg.
3 IN PTR amigo.acad.bg.
... 74
DNS protocol details
Message in binary format
(RR means Resource Record)
75
DNS protocol details
DNS message data fields
❑ The IDENTIFICATION field is set by the client and returned by the server.
❑ 5-th bit field - Authoritative answer. The name server is authoritative for the
domain in the question section.
❑ 6-th bit field is set if message truncated. With UDP this means that the total size
of the reply exceeded 512 bytes, and only the first 512 bytes the of the reply
were returned.
❑ 7-th bit field - Recursion Desired. This bit can be set in a query and is then
returned in the response.
❑ 8-th bit field - Recursion Available.
79
Simple Network Management Protocol (SNMP)
❑ Agents
Network
❑ Managed objects Management
Application
❑ MIB’s (Management Information Bases) SNMP SNMP SNMP
❑ Syntax notation
❑ SMI (Structure of Management Info) Agent Agent Agent
83
83
SNMP v1 Packet Format
84
SNMP v2 Packet Format
❑ Like SNMP v1, SNMP v2 contain two parts:
❑ First part is called a wrapper which contains authentication,
privacy information and a context.
❑ Second contains a PDU with similarities to SNMP v1.
85
85
SNMP v1 and v2
Advantages and Disadvantages
❑ Advantages ❑ Disadvantages
❑ Simple design. ❑Security holes.
❑ Easy implementation ❑Old technology.
❑ Wide spread usage.
❑ Expandability.
86
The new SNMP v3
❑ Structure, components and architecture similar to v1 and v2.
❑ New features include:
❑ Authentication and privacy.
❑ Naming of entities.
❑ Notification destinations.
87
SNMP Conclusion
❑ The goals: Integrated network management,
Interoperability, Standards.