Networks and Security Lecture Notes 1
Networks and Security Lecture Notes 1
Page 1 of 131
UNITI
NETWORK MODELS AND DATALINK LAYER
SYLLABUS:
Overview of Networks and its Attributes Network Models - OSI, TCP/IP, Addressing
-
Introduction to Data link Layer Error Detection and Correction Ethernet(802.3)- Wireless
LAN – IEEE 802.11,Bluetooth - Flow and Error Control Protocols - HDLC - PPP.
Buildinga network:
g
in
A computer network or data network is a telecommunications network which allows computers to
exchange data. In computer networks, networked computing devices pass data to each other along
er
network links (data connections).
e
Data is transferred in the form of packets. The connections between nodes are established using either
in
cable media or wireless media. The best known computer network is the Internet.
To build a computer network is defining what a network is and understanding how it is used to helpa
ng
business meet its objectives. A network is a connected collection of devices and end systems, such as
computers and servers, which can communicate with each other.
fE
These are the four major categories of physical components in a computer network:
Personal computers (PCs): The PCs serve as endpoints in the network, sending and receiving
O
data.
Interconnections: The interconnections consist of components that provide a means for data to
e
Network media, such as cables or wireless media, that provides the means by which the
C
Switches: Switches are devices that provide network attachment to the end systems and intelligent
ad
Network User Applications: The key to utilizing multiple resources on a data network is having
m
applications that are aware of these communication mechanisms. Although many applications are
available for users in a network environment, some applications are common to nearly all users.
Ta
E-mail: E-mailis a valuable application for most network users. Users can communicatee
information (messages and files) electronically in a timely manner, to not only other users in the
same network but also other users outside the network (suppliers, information resources, and
1
<br>
Page 2 of 131
customers, for example). Examples of e-mail programs include Microsoft Outlook and Eudora by
Qualcomm.
Web browser: A web browser enables access to the Internet through a common interface. The
Internet provides a wealth of information and has become vital to the productivity of both home
and business users. Communicating with suppliers and customers, handling orders and fulfillment,
and locating information are now routinely done electronically over the Internet, which saves time
and increases overall productivity. The most commonly used browsers are Microsoft Internet
Explorer, Netscape Navigator, Mozilla, and Firefox.
g
Instant messaging : Instant mnessaging started in the personal user-to-user space;• however, it
in
soon provided considerable benefit in the corporate world. Now many instant messaging
er
applications, such as those provided by AOL and Yahoo!, provide data encryption and logging.
features essential for corporate use.
e
in
Collaboration: Working together as individuals or groups is greatly facilitated when the
ng
collaborators are on a network. Individuals creating separate parts of an annual report or a business
plan, for example, can either transmit their data files to a central resource for compilation or use a
workgroup software application to create and modify the entire document, without any exchange
fE
of paper. One of the best-known traditional collaboration software programs is Lotus Notes. A
more modern web-based collaboration application is a wiki.
O
Database: This type of application enables users on a network to store information ine central
e
locations (such as storage devices) so that others on the network can easily retrieve selected
g
information in the formats that are most useful to them. Some of the most common databases used
le
Requirements:
u
An application programmer would list the services that his or her application needs- -for example, a
ad
guarantee that each message the application sends will be delivered without error within a certain amount
of time or the ability to switch gracefully among different connections to the network as the user moves
iln
around.
m
A network operator would list the characteristics that is easy to administere and manage
of a system
Ta
for example, in which faults can be easily isolated, new devices can be added to the network and
configured correctly. and it is easy to account for usage.
A network designer would list the properties of a cost-effective designfor example, that network
resources are efficiently utilized and fairly allocated to different users. Issues of performance are also
likely to be important. This section attempts to distill these different perspectives into a high-level.
2
<br>
Page 3 of 131
7 Application
Sender
-- Receiver
g
in
6 Presentation
er
The letter is written, The letter is picked up.
put in an envelope, and Higher layers removed from the
e
5 Session dropped in a mailbox. envelope, and read.
in
ng
Transport The letter is carried The letter is carried
from the mailbox Middle layers from the post office
to a post office. to the mailbox.
3 Network fE
The letter is delivered The letter is delivered
O
to a carrier by the post Lower layers from the carrier
2 Data link office. to the post office.
g e
3
<br>
Page 4 of 131
g
internetworking
To organize bitsinto frames;
in
Data link
to provide hop-to-hop delivery
To transmit bits over a medium;
er
Physical to provide mechanical and
electrical specifications
e
in
ng
:
Organization of the layers
aspects of moving data from one device to another such as electrical specifications, physical addressing, transport
g
2. Transport Layer:
ol
Layer4, transport layer, ensures end-to-end reliable data transmission ona single link.
C
Layers 5,6,7 -Session, presentation and application are the user support layers.They allow Interoperability
ad
4
<br>
Page 5 of 131
H7 D7 H7
D7
H6 D6 D6
HS D5 DS
|H4 D4 D4
g
H3 D3 H3 D3
in
H2 D2 T2 D2
er
o1o 010101010101101010000010000 o10 010101010101101010000010000
e
Transmission medium
in
ng
Functions of the Layers
1. Phvsical Laver: fE
The physical layer coordinates the functions required to transmit a bit stream over a physical medium.
O
From data link layer To data link layer
g e
le
Physical Physical
layer 110 10101000000010111 110 10101000000010111 layer
ol
C
Transmission medium
u
ad
-
Physical characteristics of interfaces and media The physical layer defines the characteristics of the
m
Page 6 of 131
-
$ Physical Topology The physical topology defines how devices are connected to make a network.
Devices can be connected using a mesh, bus, star or ring topology.
Transmission Mode - The physical layer also defines the direction of transmission– between two
devices: simplex, half-duplex or full-duplex.
2. Data Link Laver
Relationship of the Data link layer to the Network and Physical layer:
g
From network layer
in
To network layer
L3 data L3 data
er
Data Frame Pata
Iink Frame
e
layer T2 link
H2 T2 H2 layer
in
ng
10101000000010 10101000000010
To physical layer fEFrom physical layer
The other responsibilities of this layer are :
O
Framing - Divides the stream of bits received into data units called frames.
e
* Physical addressing - If frames are to be distributed to different systems on the n/w, data link layer adds
g
Flow control- If the rate at which the data are absorbed by the receiver is less than the rate produced in
the sender ,the Data link layer imposes a flow ctrl mechanism.
ol
* -
Error control- Used for detecting and retransmitting damaged or lost frames and to prevent duplication
C
of frames. This is achieved through a trailer added at the end of the frame.
Access control -Used to determine which device has control over the link at any given time.
u
ad
3. NETWORK LAYER
It is mainly required, when it is necessary to send information from one network to another.
iln
Relationship of the Network layer to the Transport and Data link layer:
m
Ta
6
<br>
Page 7 of 131
g
L3 data L3 data
in
To data link layer From data link layer
er
The other responsibilities of this layer are :
e
Logical addressing - Ifa packet passes the n/w boundary, we need another addressing system for source
in
and destination called logical address.
ng
$ Routing- The devices which connects various networks called routers are responsible for delivering
packets to final destination.
4. TRANSPORT LAYER
fE
O
It is responsible for Process to Process delivery. It also ensures whether the message arrives in order or
not.
g e
L5 data L5 data
ol
Transpoft Transpor
C
layer H4layer
H4 H4 H4 H4 H4
u
ad
L4 data L4 data
L4 data L4data
iln
L4 data L4 data
To network layer From network layer
m
Port addressing- The header in this must therefore include a address calledport address. This layer gets
Ta
Page 8 of 131
* Flow and error control - Similar to data link layer, but process to process take place.
g
P
P Network Data-1ikA
Data-l JTkA layer
AP
in
layer Data-2] j k
Data link
er
Data-2|l i kAP layer Data link A P
layer Data-1||i k
Data-1ikAP
e
P
Data-2jkA
in
ng
5.
SESSION LAYER fE
This layer establishes, manages and terminates connections between applications.
O
Relationship of the session layer to the transport and presentation layer:
e
L6 data L6 data
le
ol
Session Session
C
layer layer)
H5 H5
u
L5 data L5 data
To transport layer From transport
m
layer
Dialog control - This session allows two systems to enter into a dialog either in half duplex or full
duplex.
Synchronization-This allows to add checkpoints into a stream of data.
Page 9 of 131
It is concerned with the syntax and semantics of information exchanged between twO systems.
Presentation Presentation
layer
Encoded, encrypted, and
layer Decoded, decrypted, and
compressed data H6 decompressed data H6
g
in
er
L6 data L6 data
To session layer From session layer
e
The other responsibilities of this layer are:
in
Translation - Different computers use different encoding system, this layer is responsible for
ng
*
interoperability between thesee different encoding methods. It will change the message into some common
format. fE
Encryption and decryption-It means that sender transforms the original information to another form
and sends the resulting message over the n/w. and vice versa.
O
Compression and expansion-Compression reduces the number of bits contained in the information
particularly in text, audio and video.
g e
7. APPLICATION LAYER
le
This layer enables the user to access the nw. This allows the user to log on to remote user.
ol
Relationship of the application layer to the user and the presentation layer:
C
User User 4
u
ad
Application Application
layer layer
X.500 FTAM X.400 X.500 FTAM X.400
iln
m
Ta
L7data L7 data
To presentation layer From presentation layer
Page 10 of 131
Directory services - Provides database sources to access information about various sources and objects.
Intermnediate Intermediate
node node
g
Peer-to-peer protocol (5th layer)
Session Session
in
S4 interface 5-4 interface
Peer-to-peer protocol (4th layer)
A Transport Transport
er
4-3 interface 4-3 interface
3rd 3rd
Network Network Network Network
3-2 interface 3-2 interface
e
2 Data link 2nd Data link 2nd Data link 2nd Data link
in
2-1 interface 2-1 interface
1 Physical 1st Physical
1st
Physical
1st
Physical
ng
Physical communication
model
Internet Architecture: fE
The Internet architecture, which is also sometimes called the TCP/IP architecture after its two main
O
protocols,TCP/IP& UDP.
The Internet architecture evolved out of experiences with an earlier packet-switched network called the
e
ARPANET. Both the Internet and the ARPANET were funded by the Advanced Research Projects
g
Agency (ARPA), one of the research and development funding agencies of the U.S. Department of
le
Defense.
The Internet and ARPANET were around before the OSI architecture, and the experience gained from
ol
*
building them was a major influence on the OSI reference model. Internet architecture is by definition a
C
The Internet's architecture is described in its name, a short from of the compound word "inter
ad
networking". This architecture is based in the very specification of the standard TCP/IP protocol, designed
to connect any two networks which may be very different in internal hardware, software, and technical
iln
design.
Once two networks are interconnected, communication with TCP/IP is enabled end-to-end, so that any
m
node on the Internet has the near magical ability to communicate with any other no matter where they are.
This openness of design has enabled the Internet architecture to grow to a global scale.
Ta
TCP/IP was developed prior to the OSI model. It is developed with four layers:
Host-to-network layer (Physical & data link)
V Internet layer (network)
Transport layer (Part of session & Transport)
Application layer (Session, Presentation & Application)
TCPIP and OSI model
10
<br>
Page 11 of 131
Application Applications
Session
g
ICMP IGMP
in
Network IP
(internet)
er
RARP ARP
e
in
Data link
Protocols defined by
ng
the underlying networks
Physical (host-to-network)
1.Host-t0-network layer
fE
O
It does not define any specific protocol. It supports all the standard and proprietary protocols. A network
in a TCP/IP internetwork can be a LAN or a WAN.
g e
TCP/IP supports the Internetworking Protocol. IP, uses four supporting protocols:ARP,RARP, ICMP, and
ol
IGMP
C
The IP is the transmission mechanism used by the TCP/IP protocols. It is an unreliable and
ad
can travel along different routes and can arrive out of sequence
Ta
11
<br>
Page 12 of 131
$ The ICMP is a mechanism used by hosts and gateways to send notification of datagram problems
back to the sender. ICMP sends query and error reporting messages.
Internet Group Message Protocol:
$ The IGMP is used to facilitate the simutaneous transmission of a message to a group of recipients.
3.Transport layer (Part of session & Transport)
The transport layer was represented in TCP/IP by two protocols: TCP and UDP.UDP and TCP are
transport level protocols responsible for delivery of a message from a process to another process
User Datagram Protocol
g
The UDP is the simpler of the two standard TCP/IP transport protocols. It is a process-to
in
process protocol that adds only port addresses, checksum error control, and length information to the data
from the upper layer.
er
Transmission Control Protocol
e
TCP divides a stream of data into smaller units called segments. Each segment includes a sequence
in
number for reordering after receipt, together with an acknowledgment number for the segments received.
Segments are carried across the internet inside of IP datagram.
ng
Stream Control Transmission Protocol
The SCTP provides support for newer applications such as voice over the Internet. It is a
fE
transport layer protocol that combines the best features of UDP and TCP.
Network software:
ol
Networking software, in the most basic sense, is software that facilitates, enhances or interacts
with a computer network. One type of networking software allows computers to communicate with
C
one another, while another type of networking software provides users access to shared programs.
Networking software is a key component of today's computer networks, including the Internet.
u
Understanding the types of networking software is the first step in understanding how your
ad
Performance:
m
Network performance is measured in two fundamental ways: bandwidth (also called throughput) and
latency (also called delay). The bandwidth of a network is given by the number of bits that can be
Ta
transmitted over the network in a certain period of time. Bandwidth and throughput are two of the most
confusing terms used in networking.
* Latency = Propagation+Transmit+Queue +Processing Propagation = Distance/SpeedOfLight Transmit =
Size/Bandwidth
12
<br>
Page 13 of 131
Network delay is an important design and performance characteristic of a computer network; it specifies how
long it takes for a bit of data to travel across the network from one node to another. It is typically measured in
multiples or fractions of seconds.
g
Thus, we can calculate the total delay of a network using the following formula:
in
Delay (or latency) = propagation delay + transmission delay
er
+ processing delay + queuing delay.
e
in
Link layer Services:
ng
The main task of the data link layer is that it transfers data from the network layer of one machine to the
network layer of another machine. This is a part of the services it gives to the upper layer. If you
fE
remember, above the data link layer, we have the network layer.
The data link layer gives a service to the network layer, and this service is the transfer of data from one
O
network layer to the other, and this in turn uses the physical layer. It converts the raw bit stream of the
physical layer into groups of bits or frames.
e
acknowledgement from the other side. It is suited for low error rate networks or for fault tolerant
applications such as voice. By voice tolerant application, we mean that even if some of the bits in a
ol
digitized voice stream drop, there will be some degradation on the other side. But to the human ear, it is
C
oriented service ensures that all frames are received and each is received exactly once and these services
are accomplished using simplex not the usual, but half-duplex or full-duplex channels. These are some
iln
connectionless `service.
Framing:
13
<br>
Page 14 of 131
To transmit frames over the node it is necessary to mention start and end of each frame. There are three
techniques to solve this frame
1.
Byte Oriented protocols:
In this, view each frame as a collection of bytes (characters) rather than a collection of bits. Such
g
a byte
in
oriented approach is exemplified by the BISYNC (Binary Synchronous Communication) protocol and the
DDCMP (Digital Data Communication Message Protocol)
er
Sentinel Approach: (a) BISYNC (Binary Synchronous Communication) : The BISYNC protocol illustrates
e
the sentinel approach toframing:; its frame format is
in
8 16
ng
¿Hondor Body
4CRC
fE
The beginning of a frame is denoted by sending a special SYN (synchronization) character.
O
The data portion of the frame is then contained between special sentinel characters: STX (start of text) and
ETX (end of text).
The SOH (start of header) field serves much the same purpose as the STX field. The frame format also
e
includes a field labeled CRC (cyclic redundancy check) that is used to detect transmission errors.
g
The problem with the sentinel approach is that the ETX character might appear in the data portion of the
le
frame.
ol
BISYNCovercomes this problem by -escaping the ETX character by preceding it with a DLE (data
link-escape)character whenever it appears in the body of a frame; the DLE character is also escaped (by
C
preceding it with an extra DLE) in the frame body. This approach is called character stuffing.
u
ad
The more recent Point-to-Point Protocol (PPP). The format of PPP frame is
iln
m
16 16
Ta
14
<br>
Page 15 of 131
g
The number of bytes contained in a frame can he included as a field in the frame header. DDCMP
in
protocol is used for this approach. The frame format is
er
8 8 14 42 J6
e
SYN SYN Class
in
Count Header Body CRC
ng
DDCMP frame fomat
fE
COUNT Field specifies how many bytes are contained in the frame's body. Sometime count field will be
corrupted during transmission, so the receiver will accumulate as many bytes as the COUNT field
O
indicates. This is sometimes calleda framing error. The receiver will then wait until it sees the next SYN
e
character.
g
In this, frames are viewed as collection of bits. High level data link protocol is used. The format is
ol
8 16 16
Beginning Header Ending
C
HDLCdenotes both the beginning and the end of a frame with the distinguished bit sequence 011 111 10.
ad
This sequence might appear anywhere in the body of the frame, it can be avoided by bit stuffing.
On the sending side, any time five consecutive l's have been transmitted from the body of the message (i.e.,
excluding when the sender is trying to transmit the distinguished 01111110 sequence), the sender inserts a 0 before
iln
things is true, either this is the end-of-frame marker or an error has been introduced into the bit stream.
By looking at the next bit, the receiver can distinguish between these two cases:
If it sees a 0 (i.e., the last eight bits it has looked at are 01111110), then it is the end-of- frame marker.
If it sees a 1 (i.e., the last eight bits it has looked at are 01111111), then there must have been an error and the whole
frame is discarded.
3. Clock-Based Framing
$ (SONET) Synchronous Optical Network Standard is used for long distance transmission of data over
optical network. It supports multiplexing of several low speed links into one high speed links.
15
<br>
Page 16 of 131
9 rows
g
in
90 columns
It is arranged as nine rows of 90 bytes each, and the first 3 bytes each row are overhead, with the rest
er
of
e
The first 2 bytes of the frame contain a special bit pattern, and it is these bytes that enable the receiver to
in
determine where the frame starts.
The receiver looks for the special bit pattern consistently, once in every 810 bytes, since each frame is 9 x
ng
90 = 810 bytes long.
STS-1 STS-1
fE Hdr
STS-1
O
g e
Hdr STS-3C
le
ol
The STS-N frame can he thought of as consisting of N STS-1 frames, where the bytes from these frames
C
are interleaved; that is, a byte from the first frame is transmitted, then a byte from the second frame is
transmitted, and so on.
u
Payload from these STS-1 frames can he linked together to form a larger STS-N payload,¬ such a link is
ad
denoted STS-Nc. One of the bit in overhead is used for this purpose.
iln
corrected.
Ta
Types of Errors :
1.Single-bit error
2. Burst Error
Single-bit error
16
<br>
Page 17 of 131
The term Single-bit error means that only one bit of a given data unit (such as byte, character, data unit or
packet) is changed from 1 to 0 or from 0 to 1.
0 changed to 1
ooooio10oooooo10
Received Sent
Burst Error
g
The term Burst Error means that two or more bits in the data unit have changed from 1
to 0 or from 0 to 1.
in
Length of burst
error (5 bits)
er
Sent
O||oo|o|1|0lo [o|1|o|o|o|oI|]
e
Bits corrupted by burst error
in
o1|0TiIIoi|o|1|OooTo|1||
Received
ng
Redundancy:
fE
One method is to send every data twice, so that receiver checks every bit of two copies and detect error.
Drawbacks
O
Sends n-redundant bits for n-bit message.
e
Instead of adding entire data, some bits are appended to each unit. This is called redundant bit because
the bits added will not give any new information. These bits are called error detecting codes.
ol
* Parity check
u
Parity Check
iln
Only one redundant bit, called parity bit is added to every data unit so that the total number of l's in unit become
Ta
TwoDimensional Parity
It is based on simple parity. It performs calculation for each bit position across each byte in the frame. This adds
extra parity byte for entire frame, in addition to a parity bit for each byte.
17
<br>
Page 18 of 131
Parity
bits
O1010011
1101001o
1011110 1
Data
0001110
Two-dimensional parity
01101001
10111110
g
in
Parity
byte 1111011o
er
For example frame containing 6 bytes of data. In this third bit of the parity byte is I since there are an odd
e
number of l's is in the third bit across the 6 bytes in the frame. In this case, 14 bits of redundant information are
in
added with original information.
ng
Check sum algorithm:
fE
* In the sender side all the words are added and then transmit the result of sum called checksum with the
data. The receiver performs the same calculation on the received data and compares the result with the
O
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. Instead of sending the checksum as such, one's complement of
e
If the receiver gets the result as zero then it will be the correct one. In this, we can represent unsigned
le
If the number has more than n bits, the extra leftmost bits need to be added to the n rightmost bits. Data
can be divided in to 16 bit word and the Checksum is initialized to zero.
C
u
ad
iln
m
Ta
18
<br>
Page 19 of 131
Sender
Receiver
5 7
9
5
Sum 21
Check Sum
Sum 30
Check Sum
1010
o
g
in
1
1111 0
er
6 0110
e
1001
in
15 1111
ng
0000
19
<br>
Page 20 of 131
:
Steps
Quotient
1
11 1 0 1
g
Data plus
in
o
Divisor 1 1 0 1
) 1 0 0 1 0
o00 extra zeros
er
1 1 0 1
1
00 0
e
1
10 1
in
ng
1
0 1
0
1
1
10
1110
fE 1
1
10
O
When the leftmost bit 0 1 1
0
of the remainder is zero,
e
1
10 1
ol
( |0 0 1
Remainder
C
Error Correction:
u
ad
When an error is discovered, the receiver can have the sender to retransmit the entire data
iln
1. unit.
2. A receiver can use an error correcting code, which automatically correct certain errors.
m
Error correcting codes are more sophisticated than error-detection codes and require more redundancy
Ta
bits.
1) error
2) no error
20
<br>
Page 21 of 131
Two states are not enough to detect an error but not to correct it.
Redundancy Bits:
To calculate the number of redundancy bit(r) required to correct a given number of data bits (m), we must
find a relationship between m and r.
Add m bits of data with r bits. The length of the resulting code is m+r.
g
Data and Redundancy bits
Redundancy
in
Data(nn) bits () bits
e er
in
Total m
+rbits
ng
fE
If the total number of bitsare m+r, then r must be able to indicate at least m+r+1 different states. r bits can
indicate 2" different states. Therefore, 2° must be equal to or greater than m+r+1
O
m
2> +rt1
g e
le
ol
C
u
ad
iln
m
Ta
21
<br>
Page 22 of 131
g
4 3 7
in
5 4 9
er
6 4 10
e
4 11
in
ng
Hamming Code:
R.W. Hamming provides a practical solution for the error correction.
fE
Positioning the Redundancy Bits
O
For example, a seven-bit ASCIl code requires four redundancy bits that can be added to the end of the
data or intersperse with the original data bits. These redundancy bits are placed in positions 1, 2, 4 and 8. We refer
e
11 10 9 8 7 6 5 4 3 2 1
dd rd rr
iln
dd |drd
m
Ta
Redundancy bits
The combination used to calculate each of the four r values for a seven-bit data sequence are as follows
22
<br>
Page 23 of 131
* The rl bit is calculated using all bits positions whose binary representation include a in the rightmost 1
position.
r2 is calculated using all bit position with a l in the second position and so on rl:bits 1,3,5,7,9, 1 1
g
the se bits
in
101| 1001 O01 1
er
O101 O001
11 7 5 3 1
d d dd d
d
e
2
r4
in
r2of will take care
ng
the se bits
of these bits
g
le
dd d r8 d d d r4 d r2
C
u
rg willtake care
ad
of these bits
iln
101110101001 1000
11 10 9 8
m
dd d r8 ddd r4 d r2
Ta
Page 24 of 131
For example,
> The value rl is calculated to provide even parity for a combination of bits 3,5,7,9 and 11.
of
> The value of r2 is calculated to provide even parity with bits 3, 6, 7, 10 and 11.
The value of r3 is calculated to provide even parity with bits 4,5,6 and 7.
> The value of r4 is calculated to provide even parity with bits 8,9,10 and 11.
g
Data: 1001I01
in
Data 1o0 11o 1
e er
Adding ri
in
ng
Adding rz 1|0|
o 1
fE
Adding r4 1
0
O
e
Adding r8 OO|0TIT100TI
O
g
le
ol
1
Code: 00i1100101
C
Now imagine the received data has 7th bit changed from 1 to 0.
ad
Single-bit error
iln
Sent Received
Ioo1Ioo1o1oo10oo10
m
Ta
Error
The receiver takes the transmission and recalculates four new data using the same set of bits used by the
sender plus the relevant parity (r) bit for each set.
24
<br>
Page 25 of 131
Error detection
11 10 9 8 7 6 5 4 3 2
II I0 9 8 7 6 5 4 2
1
10 9 8
7 6 5 4 3 2
g
in
11 10 9 8 7 6 5 4 3
e er
in
The bit in position
is in error.
ng
fE
Then it assembles the new parity values into a binary number in order of r position (r8,r4,r2,rl ).
This step gives us the binary number 0111(7 in decimal) which is the precise location of the bit in error.
O
Once the bit is identified, the receiver can reverse its value and correct the error.
e
Hamming Distance:
g
le
One of the central concepts in coding for error control is the idea of the Hamming distance.
ol
The Hamming distance between two words (of the same size) is the number of differences
C
between the corresponding bits. The Hamming distance between two words x and y is d(x, y).
The Hamming distance can be found by applying the XOR operation on the two words and count
u
In a set of words, the minimum Hamming distance is the smallest Hamming distance between all
possible pairs. We use dmin to define the minimum Hamming distance in a coding scheme.
iln
m
Ta
Flow control:
25
<br>
Page 26 of 131
Flow control is the management of data flow between computers or devices or between nodes in a
network so that the data can be handled at an efficient pace.
Too much data arriving before a device can handle it causes data overflow, meaning the data is either lost
or must be retransmitted.
For serial data transmission locally or in a network, the Xon/Xoff protocol can be used. For modem
connections, either Xon/Xoff or CTS/RTS (Clear to Send/Ready to Send) commands can be used to
control data flow.
Any time an error is detected in an exchange, specified frames are retransmitted. This process is called
automatic repeat request (ARQ).
g
PROTOCOLS:
in
The protocols are normally implemented in software by using one of the common programming
languages.
er
Protocols
e
in
For noiseless For noisy
channel
ng
channel
In a real-life network, the data link protocols are implemented as bidirectional; data flow in both
g
directions.
le
In these protocols the flow and error control information such as ACKs and NAKs is included in the data
frames in a technique called piggybacking.
ol
C
NOISELESS CHANNELS:
Let us first assume we have an idealchannel in which no frames are lost, duplicated, or corrupted. We
introduce two protocols for this type of channel. The first is a protocol that does not use flow control; the second
u
Simplest Protocol:
iln
m
Ta
26
<br>
Page 27 of 131
Sender Receiver
Network Get data Deliver data Network
Request from
Event:
network layer
Repeat forever Repeat forever
g
in
Algorithm for sender site Algorithm for receiver site
er
Notification from
Event:
physical layer
e
The Simplest Protocol is one that has no flow control. It is a unidirectional protocol in which data frames
in
are traveling in only one direction-from the sender to receiver.
ng
The data link layer at the sender site gets data from its network layer, makes a frame out of the data, and
sends it. The data link layer at the receiver site receives a frame from its physical layer, extracts data from
the frame, and delivers the data to its network layer. fE
The data link layers of thesender and receiver provide transmission services for their network layers. The
O
data link layers use the services provided by their physical layers for the physical transmission of bits.
e
The sender sends a sequence of frames without even thinking about the receiver. To send three frames,
g
three events occur at the sender site and three events at the receiver site.
Note that the data frames are shown by tilted boxes; the height of the box defines the transmission time
le
difference between the first bit and the last bit in the frame.
ol
Sender Receiver
A B
C
Request Frame
Arrival
u
Request Frame
Arrival
ad
Request | Frame
Arrival
iln
Time Time
Stop-and-Wait Protocol:
m
The Stop-and-Wait Protocol sender sends one frame, stops until it receives confirmation from the receiver
Ta
27
<br>
Page 28 of 131
Sender Receiver
Deliver
Network Get data data Network
Request from
Event:
network layer
g
Repeat forever Repeat forever
in
Algorithm for sender site Algorithm for receiver site
er
Notification from Event: Notification from
Event: physical layer physical layer
e
in
NOISY CHANNELS
ng
Although the Stop-and-Wait Protocol gives us an idea howto add flow control to its predecessor,
of
noiseless channels are nonexistent. We can ignore the error (as we sometimes do), or we need to add error
fE
control to our protocols. We discuss three protocols in this section that use error control.
Stop-and-Wait Automatic Repeat Request
Go-Back-N Automatic Repeat Request
O
Selective Repeat Automatic Repeat Request
e
* This is the simplex protocol with sequence numbers and the ack frame indicating the sequence number of
ol
since the sender transmits a frame and waits for its acknowledgement before sending the next one.
The sending device keeps a copy of the last frame transmitted until it receives an acknowledgement.
u
If the acknowledgement frame gets lost and data link layer on A eventually times out.Not having received
ad
an ACK, it assumes that its data frame was lost or damaged and sends the frame containing packet 1
iln
again.
Operation:
28
<br>
Page 29 of 131
,
The sender transmits the frame when frame arrives at receiver it checks for damage
and acknowledges to the sender accordingly. While transmitting a frame there can be four
situations.
Normal Operation
Frame lost
Acknowledgement lost
* Acknowledgement delayed
g
Normal operation
in
In normal operation the sender sends frame 0 and waits for acknowledgement ACK 1.After receiving
er
ACK 1, sender sends next frame l and waits for its acknowledgement ACKO. This operation is repeated.
$ The sender will not send the next piece of data until it is sure that the current one is correctly received
e
in
Sender Receiver
ng
S=0 Frame O
R= 0
S= 1
ACK 1
Frame 1
fE R=1
ACK 0
O
S= 0
g e
Time Time
le
Sender Receiver
C
S= 0 Frame 0
R=0
u
ACK I
S= 1
Frame R= 1
ad
Lost
Time-out Frame R= 1
1
S- 1
iln
ACK 0
S=0
R=0
m
Time Time
Ta
When a receiver receives a data frame that is out of order, this means that frames were either lost or
duplicated.
When sender does not receive its acknowledgement then the Corrupted and lost frames need to resent in
this protocol.
29
<br>
Page 30 of 131
Sender Receiver
S= 0 Frame o R=0
ACK 1
S= 1
Frame1 R= 1
ACK 0
Lost
Time-out S= 1
Frame 1 R=0
g
S= 0
in
Time Time
er
When an
e
,
acknowledgement is lost the sender does not know whether the frame is received by receiver.
in
After the timer
expires, the sender re-transmits the same frame. On the other hand, receiver has already received this
ng
frame earlier hence the second copy of the frame is discarded.
R=0
g
ACK
le
S=1 Frame 1
frame 0 discarded
ACK 1
C
Discarded|
S= 1 Frame 1
Time-out R=1
u
ACK 0
ad
iln
Time Time
be delayed due to some link problem.The ACK is received after the timer is elapsed. While the sender has
Ta
.
already transmitted the same frame
Again second ACK is
initiated by receiver for the retransmitted frame, hence the second ACK is discarded.
To avoid duplication
the ACK must be numbered.
Bidirectional Transmission
30
<br>
Page 31 of 131
R= 0 Frame 0,
S= 0 ACK 0 R=0
1
Frame 0, ACK S= 0
R=0
S= 1 Frame 1, ACK 1
R=1
Frame 1, ACK 0 S= 1
R=1
S=0
g
in
er
Time Time
e
maintain S and R to track frames sent and expected.Piggybacking (hooking ack with next outgoing data
in
frame)can be used to save bandwidth
ng
Drawbacks of stop and wait
Only one frame can be in transit at a time
fE
after each frame sent the host must wait for an ACK.
O
inefficient use of bandwidth
e
g
Sliding window
ol
if the number of bits in the header is m then sequence number goes from O to l
Protocols
iln
Go back -N
Selective Repeat
m
Go Back -N
Ta
Page 32 of 131
Control variables:
S- holds the sequence number of the recently sent frame
g
SL- holds the sequence number of the last frame
in
R-sequence number of the frame expected to be received
er
Window size W = S, -S + 1
e
Sender sliding window
in
Window size =7
ng
•..5670123|45670-..
a. Before sliding
fE
O
Window size =7
•..567012345670
g e
•.56701|2|345 |67o
u
a. Before sliding
ad
•.5 67 o 1
234567|o.
iln
b. After sliding
m
32
<br>
Page 33 of 131
Sender Receiver
SF S
Frame 0 o123|012)
S
Frame 1
ACK 2
Frame 2 R
ACK 3
S
Frame3
g
R
in
Time Time
er
The sender sends
e
frames and update the control variables. S,, Sp,S and receiver updates the control variable R.
in
Go-Back-N ARQ, lost frame
ng
Sender Receiver
S,
S
S
Frame 0
fE o23|o]1|2)
R
Frane 1
O
opaao||2 CK 2 o23|0o|1|2)
R
Framne 2
e
LOst o123|o|1|2]
Framne 3
g
Reseent Frane 2
Time-out oTa|o12]
NCK 3
ol
Frane 3
Resent o|2o|2)
C
Time Time
u
Suppose frame 2 is
ad
damaged or lost and of receiver frame 3, it will be discarded since it is expecting frame 2.Sender
retransmits frame 2 and frame 3.
iln
In Go-Back-N ARO, the size of the sender window must be less than 2"; the size of the receiver window
m
is always 1.
Ta
33
<br>
Page 34 of 131
Frame Frame0
o123 0 o230 on23o
R R
Frame Frame 1
1
S R
o230R
Frame Frame
2 2
R
Frame Frame
Time-out 0 3
g
R R
Correctly Frame
in
Time-out 0
discarded
R
er
Erroneously
accepted
e
a. Window size < 2m b. Window size = 2m
in
ng
Selective Repeat ARQ:
fE Processing at the
receiver is more complex.
O
In Selective Repeat
ARQ, the size of the sender and receiver window must be at most one-half of 2m,
e
Receiver expects
frames within the range of the sequence numbers
ol
Sp S S,
Ta
34
<br>
Page 35 of 131
Sender Receiver
Frame 0
23|o|1|2]
Frame l
O23o12]
ACK 2
Frame 2
Lost
Frame 3
g
[O12Bo1|2) NAK 2 [o12sol1|2
in
Resent
Frame 2
e er
Time Time
in
In sequential
transmission of frame 0,1,2,3 suppose frame 2 is lost and the next frame
ng
3 is already received sends NAK
2 frame to sender. The sender retransmits frame 2 only.
fE
O
g e
Sender Receiver
ol
Frame
Sender Receiver 0
C
S
Frame Framel
0
u
S
ad
Frame 1 Frame2
iln
Frame Frame
Time-out 0 Time-out 0
m
Correctly Erroneously
|Discarded accepted
Ta
35
<br>
Page 36 of 131
Ethernet (802.3)
IEEE 802.3 standard in detail.
D Digital Equipment and Intel Corporation joined Xerox to define Ethernet standard in
1978. It then formed the basis for IEEE standard 802.3
Standard Ethernet has a data rate of 10 Mbps. It is easy to administer and maintain.
D
D Ethernet has evolved to Fast Ethernet (100 Mbps), Gigabit Ethernet (1 Gbps) and Ten
g
Physical Properties
in
Transceiver
er
Ethernet cable
e
,Adaptor
in
ng
fE
Host
O
Ethernet uses Manchester encoding scheme and digital signaling (baseband) at 10 Mbps.
Hosts connect to the Ethernet segment by tapping, each at least 2.5 m apart.
e
D
The transceiver is responsible for transmitting/receiving frames and collision detection.
g
le
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 hosts. An Ethernet has a total reach
iln
of only 2500 m.
m
Ta
Repeater
Host
It's also possible to create a multiway repeater, sometimes called a hub. Any signal placed on the Ethernet
by host is broadcast over the entire network; that is, the signal is propagated in both directions, and repeaters
a
36
<br>
Page 37 of 131
and hubs forward the signal on all outgoing segments. Terminators attached to the end of each segment absorb the
signal.
Hub Hub
The various forms of Standard Ethernet are 10Base5, 10Base2, 10Base-T & 10Base-F
g
10Base5 (Thick Ethernet)
in
Thick Ethernet uses bus topology with an external transceiver
D
er
The maximum length of the cable must not exceed 500m.
D
e
10Base2 (Thin Ethernet)
Thin Ethernet also uses bus topology, but the cable is much thinner and more flexible.
D
in
The transceiver is part of the network interface card (NIC).
O
The length of each segment should not exceed 185m and is less expensive.
ng
D
D
The maximum length of the twisted cable is 100m
fE
The stations are connected to a hub via two pairs of twisted cable.
D
Collision happens in the hub only.
O
10Base-F (Fiber Ethernet)
10Base-F uses star topology to connect stations to a hub.
D
e
Stations are connected to the hub using two fiber-opticcables with a max. length of
D
g
2000m.
le
“Base" refers to the fact that the cable is used in a baseband system,
*2" means that a given segment can be no longer than 200 m.
C
"T" stands for twisted pair, limited to less than 100 m in length
u
Frame Format
ad
64 48 48 16 32
contains alternating Os and Is that alerts the receiving system and enables it to synchronize
D
Preamble
m
D
Source addresscontains the physical address of the sender.
D
Type/Length -It may contain either type of the upper layer protocol or frame length.
D
Data carries data (46-1500 bytes) encapsulated from the upper-layer protocols.
D
CRC the last field contains error detection information (CRC-32).
Addressing
D
Each host on the Ethernet network has its own network interface card (NIC).
O NIC provides a globally unique 6-byte physical address (in hex, delimited by colon).
Each manufacturer is given a unique prefix (3 bytes).
37
<br>
Page 38 of 131
IfLSB of the first byte in adestination address is 0, then it is unicast else multicast.
O
Transmitter algorithm
Ethernet is a working example of CSMA/CD.
D
D
Minimum frame length (64 bytes) is required for operation of CSMA/CD.
Signals placed on the ethernet propagate in both directions and is broadcasted over the
D
entire network.
Ethernet is said to be a 1-persistent protocol. When the adaptor has a frame to send:
D
g
o In such case, the frames collide
in
o A 96-bit runt frame (64-bit preamble + 32-bit jamming sequence) is sent and
er
transmission is aborted.
O
Retransmission is attempted after a back-off procedure (k x 51.2us)
e
This protocol is applicable to a bus topology.
in
Before a station can transmit, it listens to the channelto see if any other station is already transmitting.
ng
If the station finds the channel idle, it attempt to transmit;
Otherwise, it waits for the channel to become idle.
If two or more stations find the channel idle and simultaneously attempt to transmit.
fE
This is called a collision. When collision occurs, the station should suspend transmission and re-attempts
after a random period of time.
Use of a random wait period reduces the chance of the collision recurring.
O
The following flow chart depicts this technique.
g e
Network access
le
Node is ready-to
ol
transmit
C
no Wait according
Transmission Backoff strategy
mediunm free?
u
yes
Send
ad
yes
Colision?
m
no
no End of
Ta
transmnission
yes
Network access
finished
Receiver algorithm
D Each frame transmitted on an Ethernet is received by every adaptor on that network.
38
<br>
Page 39 of 131
D
Ethernet does not provide any mechanism for acknowledging received frames, making it as an
unreliable medium.
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
g
multicast addresses.
in
For example,
8:0:2b:e4:b1:2 is the human-readable representation of Ethernet address00001000 00000000 00101011 11100100
er
10110001 00000010 To ensure that every adaptor gets a unique address,
Tosummarize, an Ethernet adaptor receives all frames and accepts
e
Frames addressed to its own address
in
Frames addressed to the broadcast address
Frames addressed to a multicast addressed if it has been instructed
ng
When this happens, the two (or more) frames are said to be collide on the network.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
fE
farther apart, they would have had to transmit longer, and thus send more bits, before detecting the collision. The
worst case scenario happens when the two hosts are at opposite ends of the Ethernet.
If the frame it's just sent did not collide with another frame, the transmitter may need to send as many as
O
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 mThe farther apart two nodes are, the longer it
e
takes for a frame sent by one to reach the other, and the network is vulnerable to collision during this
g
Consider the following worst case scenario in which hosts A and B are at either ends.
D
ol
B
C
(a) (b)
u
ad
BR
A
iln
(c) (d
m
D
begins transmitting a frame at time t, as shown in (a).
Host A
Ta
takes one link latency (say d) for the frame to reach host B. Thus, the first bit of A's
frame arrives at B at time t + d, as shown in (b).
D
Suppose an instant before host A's frame arrives, B senses it idle line, host B begins to
transmit its own frame.
B's frame will immediately collide with A's frame, and this collision willbe detected by host B (C).
D
39
<br>
Page 40 of 131
On a maximally configured Ethernet, round-trip delay is 51.2 us, i.e., 512 bits (64 bytes)
Fast ethernet
D
Fast Ethernet is IEEE 802.3u standard and was invented compete with LAN protocols
such as FDDI.
D
The data rate in Fast ethernet is 100 Mbps.
D Fast ethernet uses star topology.
g
in
wireless Technologies:
er
Four prominent wireless technologies:
Bluetooth (802.15.1)
e
Wi-Fi (802.11)
WiMAX (802.16)
in
Third generation or 3G cellular wireless
ng
WIRELESSLAN (802.11)
fE
Wireless links transmit electromagnetic signals (Radio, microwave, infrared). Wireless links all shares 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.
O
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
e
for government use Other bands are reserved for uses such as AM radio, FM radio, televisions, satellite
g
communications, and cell phones Specific frequencies within these bands are then allocated to individual
organizations for use within certain geographical areas.
le
Devices that use license-exempt frequencies are still subject to certain restrictions.
ol
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.
C
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
u
military use.
ad
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 are not truly
iln
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
m
transmitter to correctly receive the frame 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
Ta
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
40
<br>
Page 41 of 131
1
Data stream: 1010
g
in
er
Client node
e
Wired
in
network
Base station
ng
Client node
fE
Key
Wireless "link"
between 2 nodes
O
Wireless communication supports point-to-multipoint communication
Communication between non-base (client) nodes is routed via the base station
e
No mobility: the receiver must be in a fix location to receive a directional transmission from the base
le
We
discussthree prominent wireless technologies:
Bluetooth (802.15.1) Wi-Fi (802.11) 3G Cellular
u
analogy
An alternative topology that is seeing increasing interest is the mesh or ad hoc network. In a wireless
mesh, nodes are peers; that is, there is no special base station node. Messages may be forwarded via a chain of
peer nodes as long as each node is within range of the preceding node.
41
<br>
Page 42 of 131
Mobile node
Mobile
node
Wireless
ransmission
Mobile
node
Mobile node
g
Mobile node
in
Mobile node
er
IGURE 2.29 Awiteless ad ho or mesh network
e
IEEE 802.11(wireless network, Wi-Fi)
in
Wireless network based on the IEEE 802.11 standards, often referred to as Wi-Fi (wireless fidelity). It is
technically a trademark, owned by a trade group called the Wi-Fi Alliance, which certifies product compliance
ng
with 802.11. Like Ethernet, 802. 11 is designed for use in a limited geographical area (homes, office buildings,
campuses), and its primary challenge is to mediate access to a shared communication medium -in this case,
signals propagating through space.
Physical Properties
fE
802.11define a number of different physical layers that operate in various frequency
O
Band provides a range of different data rates.
The original 802.11 standard defined two radio-based physical layers standards
e
1. 802.11b provides up to 11 Mbps which is sufficient for most home networks with broadband cable,
operated in the license 2.4-GHz frequency band of the electromagnetic spectrum.
C
2. 802.11a which delivers up to 54 Mbps using a variant of FDM called orthogonal frequency
division multiplexing (0FDM); it runs in the license 5-GHz band. On one hand, this band is less used, so
u
there is less interference. On the other hand, there is more absorption of the signal and it is limited to almost
ad
line of sight.
3. 802.11g followed; 802.11g also uses OFDM, delivers up to 54 Mbps, and is backward compatible
with 802. 11b (and returns to the 2.4-GHz band).
iln
4. 802.l In has appeared on the scene, it achieves considerable advances in maximum possible data
rate using multiple antennas and allowing greater wireless channel bandwidths. The use of multiple antennas
m
The 802.11 standards define a maximum bit rate that can be supported, they mostly support lower bit rates as well;
for example, 802.1 la allows for bit rates of 9, 12, 18, 24, 36, 48 and 54 Mbps. At lower bit rates, it is easier to
6,
decode transmitted signals in the presence of noise in the form of error-correcting codes is varied.
The 802.11standards do not specify a particular approach but leave the algorithms to the various vendors.
The basic approach to picking a bit rate is to estimate the bit error rate either by directly measuring the signal-to
noise ratio (SNR)at the physical layer or by estimating the SNR by mneasuring how often packets are successfully
transmitted and acknowledged.
42
<br>
Page 43 of 131
Collision Avoidance
A wireless protocol would follow the same algorithm as the Ethernet-wait until the link becomes idle
before transmitting and a
back off should collision occur.
Ethernet receives every other node's transmissions and can transmit and receive at the same time, neither
of these conditions holds for wireless nodes. This makes detection of collisions rather more complex.
The reason why wireless nodes cannot usually transmit and receive at the same time (on the same
frequency) is that the power generated by the transmitter is much higher than any received signal swamps the
receiving circuitry.
The reason why a node may not receive transmissions from another node is because that node may be too
far away or blocked by an obstacle.
g
in
e er
in
A B
ng
fE
O
IFIGURE 2.30 The hidden node problem. Although A and Care hidden from each other, their signals can collide at B.
Consider the situation in the following figure (2.30) where each of three nodes is able to send and receive signals
le
that reach just the nodes to its immediate left and right.
1. A andC are both within range of
ol
2. Suppose both A and C want to communicate with B and so they each send it a frame.
C
3. 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 this collision. A
u
43
<br>
Page 44 of 131
A D
g
in
e er
IFIGURE 2.31 The exposed node problem. Although B and Care exposed to each other's signals, there is no
in
interference ifB transmits to A while C transmits to D. (A and D's reaches are not shown.)
ng
Where each of the four nodes is able to send and receive signals that reach just the nodes to its immediate left and
right.
1. B
can exchange frames with A andC but it cannot reach D
2. While C can reach B and D but not A.
fE
3. Suppose B is sending to A. Node C is aware of this communication because it hears B's transmission.
O
However, for to conclude that it cannot transmit to anyone just because it can hear B's transmission.
C
4. For example, suppose C wants to transmit to node D. This is not a problem since C's transmission to
e
willnot interfere with A's ability to receive from B. (It would interfere with A sending to B, but B is
g
802.11addresses these problems by using CSMA/CA, where the CA stands for collision avoidance, in contrast to
the collision detection of CSMA/CD used on Ethernets.
ol
Key Idea
Sender and receiver exchange control frames with each other before the sender actually transmits
C
any data.
V This exchange informs all nearby nodes that a transmission is about to begin
u
V Sender transmits a Request to Send (RTS) frame to the receiver. The RTS frame includes a field
ad
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
iln
sender
Any node that sees the CTS frame knows that
m
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
Using ACK in MAC AProposed in MACAW: MACA for Wireless LANS Receiver sends an ACK to the sender
after successfully receiving a frame AIl 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
44
<br>
Page 45 of 131
g
some are connected to a wired network infrastructure
in
- are
They called Access Points (AP) and they are connected to each other by a so-called distribution system
Figure below illustrates a distribution system that connects three access points, each of which services the
er
nodes in some region.
e
in
Distribution systerm
ng
AP-1
fE AP-3
O
AP-2 F
A B G
e
H
g
le
E
D
ol
Each access point operates on some channel in the appropriate frequency range, and each AP will
typically be on a different channel than its neighbors.
u
> The only important point is that the distribution network operates at the link layer, the same protocol layer
ad
Page 46 of 131
Distribution system
AP-1 AP-3
AP-2
g
A B G
in
H
er
C
E
e
D
in
Node mobility
ng
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.
Atsome point, C
fE
As it moves, it sends Probe frames, which eventually result in Probe Responses from AP-2.
prefers AP-2 over AP-1, and so it associates itself with that access point.
V This is called active scanning since the node is actively searching for an access point
O
APs also periodically send a Beacon frame that advertises the capabilities of the access point; these
include the transmission rate supported by the AP
e
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.
le
Frame Format
ol
bytes of data.
V a 32-bit CRC.
u
6 bit Type field: indicates whether the frame is an RTS or CTS frame or being used by the
scanning algorithm
pair of 1bit fields : called ToDS and FromDS
iln
16 16 48 48 48 16 48 0-18,496 32
m
46
<br>
Page 47 of 131
When one node is sending directly to another, both the DS bits are 0, Addrl identifies the
target node, and Addr2 identifies the source node
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
V ADDRESS REFERS
Addrl 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
g
in
BLUETO0TH802.15.1)
er
Bluetooth fills the niche of very short range communication between mobile phones, PDAs, notebook
computers, and other personal or peripheral devices.
e
For examnple, Bluetooth can be used to connect a mobile phone to a headset or a notebook computer to a
in
keyboard.
Bluetooth radios can use quite low power transmission, since transmission power is one
ng
Of the main factors affecting bandwidth and range of wireless links
Bluetooth operates in the license-exempt band at 2.45 GHz.
10 m.
fE
Bluetooth links have typical bandwidths around 1 to 3 Mbps and a range of about
For example, there is a profile for synchronizing a PDA with a personal computer.
The basic Bluetooth network configuration, called a piconet, consists of a master device and up to seven
le
slave devices.
ol
interference in the band. It uses frequency-hopping with 79 channels (frequencies), using each for 625 us
ad
at a time.
Only the master can start to transmit in odd-numbered slots. A slave can start to transmit in an even
numbered slot
iln
A slave device can be parked; that is, it is set to an inactive, low-power state. A parked device cannot
communicate on the piconet; it can only be reactivated by the master.
m
A piconet can have up to 255 parked devices in addition to its active slave devices.
Ta
47
<br>
Page 48 of 131
Slave
ocoooooo (parked)
Slave Slave
(active) (active)
OOCC0000 Master
g
in
Slave
Slave (active)
(parked)
e er
Slave
in
(active)
A Bluetooth Piconet
ng
ZigBee
IEEE 802.15.4. fE
> It is designed for situations where the bandwidth requirements are low and power consumption must be
very low to give very long battery life.
O
> It is also intended to be simpler and cheaper than Bluetooth, cheaper devices such as sensors.
g e
le
ol
C
u
ad
iln
m
Ta
48
<br>
Page 49 of 131
UNIT II
NETWORK LAYER PROTOCOLS
Network Layer - IPy4 Addressing – Network Layer Protocols (IP, ICMP and Mobile IP) Unicast and
Multicast Routing Intradomain and Interdomain Routing Protocols - IPv6 Addresses - IPv6
-
Datagram Format Transition from IPv4 to IPv6.
ROUTING:
Routers have enough knowledge of the network topology so they can choose the right port onto which each
packet should be output
g
Forwarding versus Routing
in
Forwarding:
to select an output port based on destination address and routing table
er
Routing:
process by which routing table is built.
e
Process of finding a path from source to destination to deliver the packets. It is n/w layer
in
responsibility for deciding o/p lines for an incoming packet.
ng
Forwarding table VS Routing table
Forwarding table
Used when a packet is being forwarded and so must contain enough information
to accomplish the forwarding function fE
A row in the forwarding table contains the mapping from a network number to an
outgoing interface and some MAC information, such as Ethernet Address of the
O
next hop
Routing table
e
(a)
ol
18/8 171.69.245.10
(b)
u
Network as a Graph
Ta
1
<br>
Page 50 of 131
The nodes of the graph, labeled Athrough F, may be hosts, switches, routers, or networks. For our
initialdiscussion, we will focus on the case where the nodes are routers.
Theedges of the graph correspond to the network links. Each edge has anassociated cost, which gives
some indication of the desirability of sendingtraffic over that link.
The basic problem of routing is to find the lowest-cost path between any two nodes, where the cost of a
path equals the sum of the costs of all the edges that make up the path.
Routing is the process by which routing tables are built. The routing tables are used to find the path
between every pair of nodes in a network.
The routing depends on complex distributed algorithms.There are two types of routing protocols. They
g
are
1. Intra domain routing protocol or Interior Gateway Protocol all the routers are under the same
in
administrative control.
er
2. Inter domain routing protocol controlled by different administrative control.
> For a simple network, we can calculate all shortest paths and load them into some nonvolatile storage
e
on each node.
in
Such a static approach has several shortcomings
It does not deal with node or link failures
ng
It does not consider the addition of new nodes or links
It implies that edge costs cannot change
> Need a distributed and dynamic protocol
Two main classes of protocols
fE
• Distance Vector(RIP)
O
• Link State (OSPF)
Routing protocols
le
ol
Intradomain Interdomain
C
u
This is one of the most widely used IGP. It was developed at Berkeley. This is also known by the name
Ta
of the program that implements it, routed .This implements Distance Vector algorithm.
Distance Vector Routing:
The distance vector routing algorithm is sometimes called as Bellman-Ford algorithm.
Every T seconds each router sends its table to its neighbor each router then updates its table based on
the new information.
Problems include fast response to good new and slow response to bad news. Also too many messages
to update.
2
<br>
Page 51 of 131
Each node constructs a one dimensional array (a vector) containing the distances" (costs) to all other
nodes and distributes that vector to its immediate neighbors
Initialization
The tables are stable; each node knows how to reach any other node and the cost. Each node can know
only the distance between itself and its immediate neighbors, those directly connected to it.
So for the moment, we assume that each node can send a message to the immediate neighbors and find
the distance between itself and these neighbors. The distance for any entry that is not a neighbor is
marked as infinite.
g
in
e er
in
ng
Information Distance to Reach Node
B
0
1
1
1
fE
8-8 8
1 1
C 1 1
8
O
8
1
0 1
m
0 0
e
F 1
g
G 8 1 1
0
le
ol
1 C
ad
E 1 E
iln
F F
m
Ta
Sharing
The whole idea of distance vector routing is the sharing of information between neighbors.
Node A does not know about node G, node F does. So if node F shares its routing table with A, node A
can also know how to reach node G.
Nodes A and F, as immediate neighbors, can improve their routing tables if they help each other.
3
<br>
Page 52 of 131
There is only one problem. How much of the table must be shared with each neighbor?A node
is not aware of a neighbor's table.
The best solution for each node is to send its entire table to the neighbor and let the neighbor
decide what part to use and what part to discard. However, the third column of a table (next
stop) is not useful for the neighbor.
When the neighbor receives atable, this column needs to be replaced with the sender's name. If
any of the rows can be used, the next node is the sender of the table.
A node therefore can send only the first two columns of its table to any neighbor. Sharing here
means sharing only the first twocolumns.
means sharing only the first twocolumns.
g
Updating
* Whena node receives a two-column table from a neighbor, it needs to update its routingtable. Updating
in
takes three steps:
er
1.The receiving node needs to add the cost between itself and the sending node to each value in the
second column.
e
2. The receiving node needs to add the name of the sending node to each row as the third column if the
receiving node uses information from any row. The sending node is the next node in the route.
in
3. The receiving node needs tocompare each row of its old table with the coresponding row of the
ng
modified version of the received table.
a. If the next-node entry is different, the receiving node chooses the row with the smaller cost. If
there is a tie, the old one is kept. fE
b. If the next-node entry is the same, the receiving node chooses the new row.
c. Node A must not ignore this value even though its old entry is smaller. The old route does
not exist anymore. The new route has a distance of infinity.
O
e
B 1
B
ol
C 1 C
D 2
C
E 1 E
F 1
F
u
G F
ad
Information
Stored at Node A B D E F G
m
A 1 1 NN-O
2 1
2
B 1 1
2 2 2 3
Ta
C 1 1 1
2 2 2
2 1
3 2 1
E 1
2 2 m 3 2 3
2 2 2 2 1
G 2 3 2 1 3 1
Page 53 of 131
Count-to-lnfinity problem:
Slightly different circumstances can prevent the network from stabilizing
g
in
Suppose the link from A to E goes down
In the next round of updates, A advertises a distance of infinity to E, but B and C advertise a
er
distance of 2 to E
e
Depending on the exact timing of events, the following might happen
Node B, upon hearing that E can be reached in 2 hops from C, concludes that it can
in
reach E in 3 hops and advertises this to A
ng
Node A concludes that it can reach E in 4 hops and advertises this to C
Node C concludes that it can reach E in 5 hops; and so on.
This cycle stops only when the distances reach some number that is large enough to be
fE
considered infinite
O
Partial solutions to this problem are
1) Touse some relatively small number as an approximation of infinity.
2) Split horizon.
e
When a node sends a routing update to its neighbors, it does not send those routes itlearned from each
g
Solution
split horizon:If B has the route (E, 2, A) in its table, then it knows it must have learned this route from
ol
A, and so whenever B sends a routing update to A, it does not include the route for E
split horizon with poison reverse:B actually sends that route back to A., but it puts negative
C
information in the route to ensure that A will not eventually use B to get to
E.ie (E, o ) to A.
u
ad
This is one of the most widely used IGP. It was developed at Berkeley. This is also known by the name of the
iln
program that implements it, routed .This implements Distance Vector algorithm.
m
Features of RIP:
Ta
RIP uses a hop count metric to measure the distance to a destination. To compensate for differences in
technologies, many RIP implementations allow managers to configure artificially high hop counts
when advertising connections to slow networks. Allrouting updates are broadcast. This allows all hosts
on the network to know about the routes.
To prevent routes from oscillating between two or more equal cost paths, RIP specifies that existing
routes should be retained until a new route has strictly lower cost. Since RIP does not explicitly detect
5
<br>
Page 54 of 131
routing loops, RIP must either assume participants can be trusted (being part of one autonomous
system) or take precautions to prevent such loops.
To prevent instabilities, RIP must use a low value for the maximum possible distance.RIP uses 16 as
the maximum hop count. This restricts the maximum network diameter of the system to l16.
To solve the slow convergence problem arising due to slow propagation of routing information, RIP
uses Hold Down. If a particular link is down, any new information about that link is not accepted till
some time. This is because the router must wait till the information about the link being down
propagates to another router before accepting information from that router about that down link.
g
in
RIP runs on top of TCP/IP. RIP allows addresses to be of a maximum size of 14 Bytes. The Distance
varies from 1 to 16 (where 16 is used to signify infinity). RIP address 0.0.0.0 denotes a default route.
er
There is no explicit size of the RIP message and any number of routes can be advertised.
e
in
ng
fE
O
g e
8 16 31
Command Version Must be zero
u
Mask of net 1
iln
Distance to net 1
m
Distance to net 2
6
<br>
Page 55 of 131
g
A link state packet can carry a large amount of information. For the moment, however, we assume that
it carries a minimum amount of data:
in
o ID of the node that created the LSP
er
cost of link to each directly connected neighbor
sequence number (SEQNO)
e
o time-to-live (TTL) for this packet
in
The first two, node identity and the list of links, are needed to make the topology. The third, sequence
number, facilitates flooding and distinguishes new LSPs from old ones. The fourth, age,prevents old
ng
LSPs from remaining in the domain for a long time.
LSPs are generated on two occasions:
fE
1. When there is a change in the topology of the domain. Triggering of LSP dissemination is the main
way of quickly informing any node in the domain to update its topology.
2. On a periodic basis. The period in this case is much longer compared to distance vector routing. As a
O
matter of fact, there is no actual need for this type of LSP dissemination. It is done to ensure that old
information is removed from the domain.
g e
Flooding of LSPs
$ Aftera node has prepared an LSP, it must be disseminated to all other nodes, not only to its neighbors.
le
1. The creating node sends a copy of the LSP out of each interface.
2. A node that receives an LSP compares it with the copy it may already have. If the newly
C
arrived LSP is older than the one it has (found by checking the sequence number), it discards
the LSP. If it is newer, the node does the following:
u
b. It sends a copy of it out of each interface except the one from which the packet
arrived. This guarantees that flooding stops somewhere in the domain
iln
(b)
m
Ta
D D
B B
(c) (d)
7
<br>
Page 56 of 131
g
The Dijkstra algorithm creates a shortest path tree from a graph. The algorithm divides the nodes into
in
two sets: tentative and confirmed .It finds the neighbors of a current node, makes them tentative,
examines them, and if they pass the criteria, makes them permanent.
er
Inpractice, each switch computes its routing table directly from the LSP's it has collected using a
e
realization of Dijkstra's algorithm called the forward search algorithm. Specifically each switch maintains two
in
lists, known as Tentative and Confirmed. Each of these lists contains a set of entries of the form (Destination,
ng
Cost, NextHop)
Algorithm:
Initialize the Confirmed list with an entry for myself; this entry has a cost of 0
fE
Next = node just added to the Confirmed list in the previous step, select its LSP
For each neighbor (Neighbor) of Next,
O
calculate the cost (Cost) to reach this Neighbor as the sum of the cost from myself to
Next and from Next to Neighbor
e
If Neighbor is currently on neither the Confirmed nor the Tentative list, then add
g
(Neighbor, Cost, Nexthop) to the Tentative list, where Nexthop is the direction I go to
le
reach Next
ol
If Neighbor is currently on the Tentative list, and the Cost is less than the currently listed
cost for the Neighbor, then replace the current entry with (Neighbor, Cost, Nexthop)
C
Example:
B
iln
10
m
Ta
D
<br>
Page 57 of 131
g
4 (D,0,-) (C,2,C)
C's LSP tells us that we can reach A at cost 12.
in
(D,0,-) (C,2,C) (8,5,C) (A,12,C) Move lowest-cost member of Tentative (B) to
er
Confirmed, then look at its LSP.
6 (D,0,-) (C,2,C) (B,5,C) (A,10,c) Since we can reach A at cost 5 through B, replace
e
the Tentative entry.
in
7 (D,o,-) (C,2,C) (B,5,C) (A, 10,C) Move lowest-cost member of Tentative (A) to
Confirmed, and we are all done.
ng
OSPF(Open Shortest Path First )
fE
O
This is an Interior Gateway Protocol designed by the Internet Engineering Task Force (IETF). This
algorithm scales better than the vector distance algorithms. This Protocol tackles several goals:
e
OSPF includes type of service(ToS) routing. So, you can install multiple routers to a given destination,
g
one for each type of service. When routing a datagram, a router running OSPF uses both the destination
le
OSPF provides load balancing. If there are multiple routes to a given destination at the same cost,
C
makes the network at a site easier to manage. Each area is self-contained, so, multiple groups within a
ad
of authentication schemes, and even allows one area to choose a different scheme from the other areas.
To accommodate multi-access networks like ethernet, OSPF allows every multi-access network to have
m
To permit maximum flexibility, OSPF allows the description of a virtual network topology that
abstracts away from details of physical connections.
OSPF also allows for routers to exchange routing information learned from other sites. The message
format distinguishes between information acquired from external sources and information acquired
from routers interior to the site, so there is no ambiguity about the source or reliability of routes.
Messages in OSPF
There are 5 types of messages in OSPF:
<br>
Page 58 of 131
1. Hello message
Allow routers to test if a node is reachable
2. Link State Advertisement (LSA)
Topology information from a router (iLe. LSPs)
•
g
Special Features of OSPF
in
Authentication of routing messages: Routing updates is to be authenticated. Early versions of
er
OSPF used a simple 8- byte password for authentication.
Additional hierarchy:OSPF introduces another layer of hierarchy into routing by allowing a
e
domain to be partitioned into areas.
• Load balancing:OSPF allows multiple routes to the sample place to be assigned the same cost
in
and will cause traffic to be distributed evenly over those routes.
ng
OSPF Header Format
8
16 31
Version Type
SourceAddr
fE
Message length
O
Areald
Authentication
g
le
•The entire packet, except the authentication data, is protected by a 16-bit checksum.
C
•Authentication type is
0 if no authentication is used;
1, implying a simple password is used
u
10
<br>
Page 59 of 131
Link data
g
Link type Num _TOS Metric
in
Optional TOS information
More links
er
LS Age is the equivalent of a time to live, expect that it counts up and the LSA expires when the age
e
reaches a defined maximum value.
in
Type field tells us that is a type 1 LSA.
Link stateand the Advertising router field are identical.
ng
LS Sequence numberis used to detect old or duplicate LSAs.
LS Checksumis for error control
Length is the length in bytes of the complete LSA
TOS --type of service information
fE
LSA is represented by a Link ID, some Link Data and a metric. The first two of these fields identify
O
the link
Metric is the cst of the link.
e
METRICS:
ol
> Link costs, or metrics, are known when we execute the routing algorithm. Routers use various metrics
and calculations to determine the best route for a packet to reach its final network destination. One
C
example, which is quite reasonable and very simple, is to assign a cost of 1 to all links-the least-cost
route will then be the one with the fewest hops.
u
The original ARPANET routing metric measured the number of packets queued for transmission on
Ta
each link.
The second version of ARPANET took both bandwidth and latency as a measure of load. This was done
as follows.
First, cach incoming packet was timestamped with its time of arrival at the router
(ArrivalTime); its departure time from the router (DepartTime) was also recorded.
Second, when the link-level ACK was received from the other side, the sender node computed
the delay for that packet as
Delay = (depart time - arrival time) + transmissiontime+ link propagation delay
11
<br>
Page 60 of 131
whereTransmission Time and Latency were statically defined for the link and captured the
link's bandwidth and latency, respectively.
(DepartTime- ArrivalTime) represents the amount of time the packet was delayed (queued) in
the node due to load. If the ACK did not arrive, but instead the packet timedout, then
DepartTime was reset to the time the packet was retransmitted.
In this case,DepartTime- ArrivalTime captures the reliability of the link the more frequent
the retransmission of packets, the less reliable the link, and the mnore we want to avoid it.
Finally, the weight assigned to each link was derived from the average delay experiencedby the
packets recently sent over that link.(Depart time - arrival time) captures queuing length.
If the packet was retransmitted the depart time' is updated with the new one.Repcated
g
transmissions declare the link is unreliable.
> Measurements are averaged over 10 seconds
in
o Update is sent if difference>threshold, or for every 50 seconds
er
> Achieves better network utilization
e
Problems with New Metric:
in
Works well for light to moderate load
ng
Static values dominate
Oscillates under heavy load
Queuing dominates fE
Congested link advertising high cost pushes traffic away => some links temporarily
underutilized during heavy load – 50% given 2 links between 2 nodes
O
Range is too wide
9.6 Kbps highly loaded link can appear 127 times costlier than 56 Kbps lightly loaded link
e
Satellite links penalized, though they'd better suit playback video (high BW, non-delay
le
sensitive)
ol
Revised ARPANET:
The major changes were to compress the dynamic range of the metric considerably, to account for the
C
link type, and to smooth the variation of the metric with time.The smoothing was achieved by several
mechanisms.
u
• First, the delay measurement was transformed to a link utilization, and this number was
ad
By smoothing the changesin the cost, the likelihood that all nodes would abandon a route at
once is greatly reduced.
m
• The compression of the dynamic range was achieved by feeding the measured utilization, the
link type, and the link speed into a function that is shown graphically inFigure 4.21. Observe
Ta
the following:
A highly loaded link never shows a cost of more than three times its cost whenidle:
The most expensive link is only seven times the cost of the least expensive;
A high-speed satellite link is more attractive than a low-speed terrestrial link;
Cost is a function of link utilization only at moderate to high loads.
12
<br>
Page 61 of 131
> All these factors mean that a link is much less likely to be universally abandoned, since
a threefold increase in cost is likely to make the link unattractive for some paths while letting it remain
the best choice for others.
The slopes, offsets, and breakpoints for the curves in Figure 4.21 were arrived at by a great deal of trial
and error, and they werecarefully tuned to provide good performance.
225
g
uns)
in
9.6-kbps satellite link
(rouing
140
er
9.6-kbps terrestrial link
56-kbps satelite link
metric |56-kbps terrestrial link
e
90
in
New 75
8
60
ng
30
25% 50%
Utilization
75% 100% fE
O
Revised ARPANET routing metric vs Link Utilization
e
SWITCH BASICS
g
Switch
le
A 4 x4 Switch
u
ad
Control
processor
iln
m
Switch
Ta
The control processor is responsible for running the routing protocols(in case of router) and generally
acts as the central point of control of the switch/router. The switching fabric transfers packets from input ports
to output ports. It may have internal buffer space and the ports provide a range of functionality to allow the
router to interface to links of various types (e.g. Ethernet, SONET, etc.).
13
<br>
Page 62 of 131
Shared bus
VObus is shared
Bus bandwidth determines the throughput of the switch
A
conventional workstation can be used as a switch
g
A workstation used as a packet switch
in
A general purpose processor used as a packet switch
er
VO bus
e
in
tnterface1
ng
CPU
Memory buslnterface 2 fE
O
Interface 3
Main memory
g e
le
Shared memory
ol
Packets are written into a memory location by an input port and then read from memory by
output ports
u
ad
Crossbar Switch
A crossbar switch is a matrix of pathways configured to connect any input port to output pot.
4 X 4 crossbar switch
iln
m
Ta
Self-routing fabrie
A special 'selfrouting header is appendedto the packet by the input port after it has determined which
output the packet needs to go to.
14
<br>
Page 63 of 131
g
in
Self-routing header
eer
Input Switch Output
in
port fabric port
ng
GLOBAL INTERNET fE
ADDRESSING :
An Internet Address is made of four bytes (32 bits) that define a host's connection to a network.
O
NETWORK HOST
e
32 Bits
g
8
8 Bits -8 Bits 8
Bits Bits
ol
1 Byte 1
Byte 1 Byte 1
Byte
C
.
(i)) Limited Broadcast: It consists of all l's, i.e., the address is 255.255.255.255 It is used only
ad
router corresponding to the network number, and from there it broadcasts to all the nodes in the
network.
m
2. Network ID =0
It means we are referring to this network and for local bro adcast we make the host ID zero.
Ta
3. Host ID =0
This is used to refer to the entire network in the routing table.
4. Loop-back Address
Here we have addresses of the type 127.0.0.1. It goes down way upto the IP layer and comes back to
the application layer on the same host.
Address Classes
:
The IP specifications divide addresses into the following classes
15
<br>
Page 64 of 131
-
Class B For medium networks
1
0 14 bits of the network address 16 bits of host address
g
Class D - For multi-cast messages ( multi-cast to a "group" of networks )
in
111 0
28 bits for some sort of group address
er
Class E - Currently unused, reserved for potential uses in the future
e
111|1 28 bits
in
There are currently 5 different field lengths patterns, each define a class of addresses. These are designed to
ng
cover the needs of different types of organizations, class A, B, C, D, E.
fE
Class A Range :0.0.0. Oto 127.255.255.255Addresses are numerically the lowest.
Class B Range :128.0.0.0 to 191.255.255.255
O
Class C Range :192.0.0.0 to 223.255.255.255
Class D Range : 224.0.0.0 to 239.255.255.255Itis reserved for multicast address, it allows copy's of a
e
datagram to be passed to a selected group of hosts rather than to a individual host. It is similar to broadcasting.
g
Class E Range : 240.0.0.0 to 255.255.255.255Addresses are reserved for further use the structure of each IP
le
address class.
ol
*
The O octet is forbidden in the RFC, and 127 is reserved for loopback testing.
Ta
SUBNETTING :
IP address is 32 bits long.
One portion is net id, another portion is host id.
There exists 2 levels of hierarchy.
Toreach host, first search for network with netid, then search host with host id. So in any organization, if
hosts are to be grouped, it is not possible. Hence the solution for this program is subnetting.
16
<br>
Page 65 of 131
g
Masking is a process that extracts sub network address from an IP Address ifit is a sub network.
in
Determines which part of an IP address is the network field and which part is the host field
er
Follow these steps to determine the subnet mask:
1. Express the subnetwork IP address in binary form.
e
2. Replace the network and subnet portion of the address with all 1s.
in
3. Replace the host portion of the address with all Os.
4. Convert the binary expression back to dotted-decimal notation.
ng
IP address Class Network fE
Subnetted
O
IP Class Network Subnet Host
g e
Subnet
11 11 11 00000
le
Mask
ol
C
Examples
Boundary level Mask with subnetting
u
Calculating the subnet id from IP address and subnet mask by performing “and' function
17
<br>
Page 66 of 131
IP Host Address
172.16.2.120 10101100 00010000 o0000010 01111000
Subnet Mask
255.255.255.0 11111111 11111111 11111111 o0000000
or /24
g
101011o0 00010000 00000010 o000000o
in
Subnet 172 16 2
er
• = 172.16.2.0
e
Subnet Address
+ Host Address Range = 172.16.2.1 -
172.16.2.254
in
Broadcast Address = 172.16.2.255
Eight bits of subnetting
ng
Subnet mask: 255.255.255.128
Subnet number: 128.96.34.0
fE
128.96.34.15
O
128.96.34.1
e
R1
H1
g
le
128.96.34.139
C
128.96.34.129
H3
u
R2
ad
H2
128.96.33.1
128.96.33.14
iln
Example of Subnetting
18
<br>
Page 67 of 131
PROBLEM
Design a subnet addressing scheme for our college with one class B address. Individual networks to be
g
supported CSE 2 networks with 300 systems each. Computer center - 2 networks with 500 systems each,
in
ECE-1network with 100 systems, EEE - 1 network with 100 systems, Science Block -1 network with
-
er
100 systems, other Engg faculty 2 networks with 100 systems each, Hostel - 2 networks with 100
systems each. Show the entries to be used at the routers.
e
(16)
in
ng
Selecting any B class address from 128.0.0.0 to 191.255.255.255 as 130.5.0.0 (2)
Subnet Mask for B class: 255.255.0.0 (2)
Given in the problem: Number of subnets = 11
fE
Max number of hosts in a single n/w = 500
So subnet mask: 255.255. 11111100.00000000 (4)
O
(So that the number of subnets can be increased to 64 in future and each can have a maximum of 1024 hosts
with best performance)
g e
Mask connecting
CSE - I: 130.5.0.0 to 130.5.3.255 130.5.0.0
C
CSE
CSE– II: 130.5.4.0 to 1 30.5.7.255 130.5.4.0
CC-I: 130.5.8.0 to 130.5.11.255 130.5.8.0
u
Compute Center
CC-II: 130.5.12.0 to 130.5.15.255 130.5.12.0
ad
:
Sci 130.5.24.0 to 130.5.27.255 130.5.24.0 Science block
Engg– I: 130.5.28.0 to 130.5.3 1.255 255.255.252.0
m
Routing Areas
19
<br>
Page 68 of 131
As a first example of using hierarchy to scale up the routing system, we'll examine how link-state
routing protocols (such as OSPF and IS-IS)can be used to partition a routing domain into subdomains called
areas. (Theterminology varies somewhat among protocols-we use the OSPF terminologyhere.) By adding
this extra level of hierarchy, we enable singledomains to grow larger without overburdening the routing
protocols orresorting to the more complex interdomain routing protocols describedbelow.An area is a set of
routers that are administratively configured toexchange link-state information with each other. There is one
specialarea-the backbone area, also known as area 0. An example of a routingdomain divided into areas is
shown in Figure Routers R1, R2, and R3are members of the backbone area. They are also members of at least
onenonbackbone area; RI is actually a member of both area 1 and area 2.A router that is a member of both the
backbone area and a nonbackbonearea is an area border router (ABR).
Note that these are distinct from therouters that are at the edge of an AS, which are referred to as AS
g
borderrouters for clarity.Routing within a single area is exactly as described .All the routers in the area send
in
link-state advertisements to each otherand thus develop a complete, consistent map of the area. However, the
link-state advertisements of routers that are not area border routers do
er
not leave the area in which they originated. This has the effect of makingthe flooding and route calculation
processes considerably more scalable.For example, router R4 in area 3 will never see a link-state
e
advertisementfrom router R8 in area 1. As a consequence, it will know nothing about thedetailed topology of
in
areas other than its own.
ng
How, then, does a router in one area determine the right next hopfor a packet destined to a network in
another area? The answer to thisbecomes clear if we imagine the path of a packet that has to travel fromone
nonbackbone area to another as being split into three parts. First, it fE
travels from its source network to the backbone area, then it crosses thebackbone, then it travels from the
backbone to the destination network.To make this work, the area border routers summarize routing
informationthat they have learned from one area and make it available in theiradvertisements to other areas.
O
For example, Rl receives link-state advertisements
from all the routers in area l and can thus determine the cost ofreaching any network in area 1. When RI sends
e
link-state advertisementsinto area 0, it advertises the costs of reaching the networks in area 1 muchas if all
g
those networks were directly connected to R1This enables all the area O routers to learn the cost to reach all
le
networks in area 1. The areaborder routers then summarize this information and advertise it into
thenonbackbone areas. Thus, allrouters learn how to reach all networks inthe domain.
ol
C
u
Area 3
Area 1
ad
R9 R7 Area 0
R1 R3
R8
R4
iln
R2
m
Area 2
Ta
RE RS|
A
domain divided into areas
20
<br>
Page 69 of 131
Autonomous system
An autonomous system (AS) is a network or a collection of networks that are all managed and
supervised by single entity or organization.
An AS is a a
heterogeneous network typically governed by large enterprise. An AS has many different
subnetworks with combined routing logic and common routing policies. Each subnetwork is assigned a
globally unique 16 digit identification number (known as the AS number or ASN) by the Internet Assigned
Numbers Authority (IANA).
g
Large corporation
in
"Consumer" ISP
er
Peering
e
point
Peering
in
Backbone service provider
point
ng
"Consumer" ISP
"Consumer ISP
Large corporation fE
Small
O
corporation
e
Some large corporations connect directly to one or more of the backbone, while others connect to
g
Many service providers exist mainly to provide service to "consumers" (individuals with PCs in their
homes), and these providers must connect to the backbone providers
ol
Often many providers arrange to interconnect with each other at a single "peering point"
C
Internet is organized as autonomous systems (AS) each of which is under the controlof a single
administrative entity.
corporation's internal network might be a single AS, as may the network of a single Internet service provider
A
21
<br>
Page 70 of 131
S9R1 R3
R2
Autonomous system 1
g
R4
in
Autonomous system 2
er
9R6
e
in
ng
A network with two autonomous systems
fE
Inter-domain Routing Protocols
O
Exterior Gateway Protocol (EGP)
Forced a tree-like topology onto the Internet
e
Tree like structure: there is a single backbone and autonomous systems are
le
used. Similarly, instead of periodically giving each neighbour its estimated cost to cach destination, each BGP
Ta
router tells its neighbours the path it is using. Every BGP router contains a module that examines routes to a
given destination and scores them returning a number for destination to each route. Any route violating a
policy constraint automatically gets a score of infinity. The router adapts a route with shortest distance. The
scoring function is not a part of the BGP protocol and can be any function that the system managerswant.BGP
easily solves the count to infinity problem that plagues other distance-vector algorithms as whole path is
known.
22
<br>
Page 71 of 131
The Border Gateway Protocol(BGP) is the routing protocol used to exchange routing information
across the Internet. It makes it possible for ISPs to connect to each other and for end-users to connect to more
than one ISP. BGP is the only protocol that is designed to deal with a network of the Internet's size, and the
only protocol that can deal well with having multiple connections to unrelated routing domains.
The goal of Inter-domain routing is to find any path to the intended destination that is loop free
We are concerned with reachability than optimality
Finding path anywhere close to optimal is considered to be a great achievement
Scalability: An Internet backbone router must be able to forward any packet destined anywhere in the
Internet
g
Having a routing table that will provide a match for any valid IP address
in
Autonomous nature of the domains
er
It is impossible to calculate meaningful path costs for a path that crosses multiple ASs
A cost of 1000 across one provider might imply a great path but it might mean an unacceptable
e
bad one from another provider
in
Issues of trust
ng
Provider A might be unwilling to believe certain advertisements from provider B
Each AS has:
One BGP speaker that advertises:
local networks
fE
other reachable networks (transit AS only)
O
gives path information
In addition to the BGP speakers, the AS has one or more border "gateways" which need not be the
e
The border gateways are the routers through which packets enter and leave the AS
le
BGP advertises complete paths as an enumerated lists of ASs to reach a particular network
ol
C
u
ad
23
<br>
Page 72 of 131
Customer P 128.96
(AS 4) 192.4.153
Regional provider A
(AS 2)
Customer Q 192.4.32
(AS 5) 192.4.3
Backbone network
(AS 1)
Customer R
192.12.69
(AS 6)
g
Regional provider B
in
(AS 3)
er
Customer S 192.4.54
(AS 7) 192.4.23
e
in
For this example, let AS1-AS3 be transit AS's and AS4-AS7 are stubs AS's.AS2 would advertise the
networks of P andQ. ASI would advertise all networks received from AS2 to all other AS's it had connection
ng
to. AS3 would then get an advertisement of network 128.96 as being ASI,AS2 Note that in addition to
advertising the routes, the AS also includes other transits AS's in the path. This helps to avoid loops since two
fE
paths to a network with a common AS in the center would not be confused as separate routes. The transit AS's
identifying numbers are thus not random and are assigned by a global authority. Current AS numbers are 16
O
bits in length. Only transit AS's need these unique, non-duplicated numbers. The AS number space was
expanded to 32 bits in 2009 and usage has started so address space will not be a problem.
g e
Networks 128.96, 192.4.153, 192.4.32, and 192.4.3 can be reached along the path <AS 1, AS
2>.
C
For example, AS 2 can only recognize itself in the AS path in the example if no other AS identifies
ad
routers within the domain.The border router is the only choice for knowing all routes that are outside the AS
and informing the same within the domain.
Ta
24
<br>
Page 73 of 131
A B
g
in
er
D
e
in
ng
To/from other autonomous
systems
fE
Here is a small example ofa domain with three border routers(A, D, and E). All routers(A,B,C,D & E)
run both iBGP and an intradomain routing protocol. Border routers (A, D, E) also run eBGP to use a unified
picture of the external network so packets destined outside the domain use the best available border router.
O
BGP routing table for AS, IGP routing table of router B, and combined table at router B are shown
below.
g e
le
ol
C
u
ad
iln
m
Ta
25
<br>
Page 74 of 131
18.0/16 E A A
12.5.5/24 A
128.34/16 D D
128.69./16 A E
g
B
in
Prefix IGP Path
e er
18.0/16
in
12.5.5/24 A
ng
128.34/16 C
128.69./16
fEA
IPv6
ol
Internet Protocol version 6 (IPv6) is the latest revision of the Internet Protocol (IP), the
C
communication protocol that provides an identification and location system for computers on networks and
routes traffic across the Internet. IPv6 was developed by the Internet Engineering Task Force (IETF) to deal
u
Every device on the Internet must be assigned an IP address in order to communicate with other
devices. With the ever-increasing number of new devices being connected to the Internet, the need arose for
iln
more addresses than IPv4 is able to accommodate. IPv6 uses a 128-bit address, allowing 22, or approximately
3.4x10*8 addresses, or more than 7.9x1028 times as many as IPv4, which uses 32-bit addresses. IPv4 allows
m
only approximately 4.3 billion addresses. The two protocols are not designed to be interoperable, complicating
the transition to IPv6.
Ta
Page 75 of 131
The IPv6 subnet size is standardized by fixing the size of the host identifier portion of an address to 64
bits to facilitate an automatic mechanism for forming the host identifier from link layer addressing information
(MAC address). Network security was a design requirement of the IPv6 architecture, and included the original
specification of IPsec.
IPv6 does not specify interoperability features with IPv4, but essentially creates a parallel, independent
network. Exchanging traffic between the two networks requires translator gateways or other transition
technologies, such as the tunneling protocolsóto4, 6in4, and Teredo.
g
Historical Perspective
in
The IETF began looking at the problem of expanding the IP address spacein 1991, and several alternatives
were proposed. Since the IP address iscarried in the header of every IP packet, increasing the size of the
er
addressdictates a change in the packet header. This means a new version of thelnternet Protocol and, as a
consequence, a need for new software for everyhost and router in the Internet In addition to the need to
e
accommodate scalable routing and addressing, someof the other wish list items for IPng included:
in
Support for real-time services
ng
->Security support
->Autoconfiguration (i.e., the ability of hosts to automaticallyconfigure themselves with such
information as their own IPaddress and domain name) fE
->Enhanced routing functionality, including support for mobile hosts
The IETF appointed a committee called the IPng Directorate to collectall the inputs on IPng requirements and
O
to evaluate proposals for aprotocol to become IPng. Over the life of this committee there were numerous
proposals, some of which merged with other proposals, andeventually one was chosen by theDirectorate to be
e
the basis for IPng. Thatproposal was called Simple Internet Protocol Plus (SIPP). SIPP originallycalled for a
doubling of the IP address size to 64 bits. When the Directorateselected SIPP, they stipulated several changes,
g
one of which wasanother doubling of the address to 128 bits (16 bytes).
le
First and foremost, IPv6 provides a 128-bit address space, as opposedto the 32 bits of version 4. Thus, while
C
version 4 can potentially address4 billion nodes if address assignment efficiency reaches 100%, IPv6
canaddress 3.4x10% nodes, again assuming 100% efficiency. As we haveseen, though, 100% efficiency in
u
address assignment is not likely. Someanalysis of other addressing schemes, such as those of the French
ad
andU.S. telephone networks, as well as that of IPy4, have turned up someempirical numbers for address
assignment efficiency. Based on the mostpessimistic estimates of efficiency drawn fromthis study, the IPv6
addressspace is predicted to provide over 1500 addresses per square foot of theEarth's surface, which certainly
iln
seems like it should serve us well evenwhen toasters on Venus have IP addresses.
m
Ta
27
<br>
Page 76 of 131
g
Everything elsze Global Unicast Addresses
in
e er
Address Notation
in
Just as with IPy4, there is some special notation for writing down IPv6addresses. The standard representation
ng
is x:x:x:x:X:X:X:X, where each "x" isa hexadecimal representation of a 16-bit piece of the address. An
examplewould be
47CD:1234:4422:ACO2:0022:1234:A456:0124 fE
Any IPv6 address can be written using this notation. Since there are afew special types of IPv6 addresses, there
are some special notations thatmay be helpful in certain circumstances. For example, an address with alarge
O
number of contiguous Os can be written more compactly by omittingall the 0 fields. Thus,
47CD:0000:0000:0000:0000:0000:A456:0124
e
could be written
47CD::A456:0124
g
Clearly. this formof shorthand can only be used for one set of contiguousOs in an address to avoid
le
ambiguity.The two types of IPv6 addresses that contain an embedded IPv4address have their own special
notation that makes extraction of thelPy4 address easier. For example, the IPy4-mapped IPv6 address of a
ol
::FFFF:128.96.33.81
That is, the last 32 bits are written in IPv4 notation, rather than as a pairof hexadecimal numbers separated by a
u
colon.Note that the double colonat the front indicates the leading Os.
ad
By far the most important sort of addressing that IPv6 must provide isplain old unicast addressing. It must do
this in a way that supports therapid rate of addition of new hosts to the Internet and that allows routingto be
m
done in a scalable way as the number of physical networks in theInternet grows. Thus, at the heart of IPv6 is
the unicast address allocationplan that determines how unicast addresses will be assigned to serviceproviders,
Ta
autonomous systems, networks, hosts, and routers.In fact, the address allocation plan that is proposed for IPv6
unicastaddresses is extremely similar to that being deployed with CIDR in IPv4.To understand how it works
and how it provides scalability, it is helpfulto define some new terms. We may think of a nontransit AS (i.e.,
astub or multihomed AS) as a subscriber, and we may think of a transit AS
as a provider. Furthermore, we may subdivide providers into direct andindirect. The former are directly
connected to subscribers. The latter primarilyconnect other providers, are not connected directly to
subscribers,and are often known as backbone networks.of routing information to reduce the burden on
intradomainrouters. Again, the key idea is to use an address prefixa set of contiguousbits at the most
28
<br>
Page 77 of 131
significant end of the address-to aggregate reachabilityinformation to a large number of networks and even to
a large number ofautonomous systems. The main way to achieve this is to assign an addressprefix to a direct
provider and then for that direct provider to assign longerprefixes that begin with that prefix to its subscribers
3 125-m-0p
010 Rogistyl| D
ProviderlD SubscriberlD SubnetlD InterfacelD
g
in
As with many headers, this one starts with a Version field, which is setto 6 for IPv6. The Version field is in the
er
same place relative to the start ofthe header as IPv4's Version field so that header-processing software
canimmediately decide which header format to look for. The TrafficClass andFlowLabel fields both relate to
e
quality of service issues The PayloadLen field gives the length of the packet, excluding the IPv6header,
in
measured in bytes. The NextHeader field cleverly replaces boththe IP options and the Protocol field of IPy4. If
options are required, then they are carried in one or more special headers following the IP header, and this is
ng
indicated by the value of the NextHeader field. If there areno special headers, the NextHeader field is the
demux key identifyingthe higher-level protocol running over IP (e.g., TCP or UDP); that is, it
fE
serves the same purpose as the IPv4 Protocol field. Also, fragmentation isnow handled as an optional header,
which means that the fragmentationrelatedfields of IPy4 are not included in the IPv6 header. The
HopLimitfield is simply the TTL of IPv4, renamed to reflect the way it is actuallyused.
O
Finally, the bulk of the header is taken up with the source and destinationaddresses, each of which is 16 bytes
(128 bits) long. Thus, the IPvheader is always 40 bytes long. Considering that IPv6 addresses are fourtimes
e
longer than those of IPv4, this compares quite well with the IPv4header, which is 20 bytes long in the absence
g
of options.The way that IPvó handles options is quite an improvement over IPv4.In IPv4, if any options were
present, every router had to parse the entireoptions field to see if any of the options were relevant. This is
le
because the options were all buried at the end of the IP header, as an unorderedcollection of htype, length,
ol
valueituples. In contrast, IPv6 treats optionsas extension headers that must, if present, appear in a specific
order. Thismeans that each router can quickly determine if any of the options are relevantto it; in most cases,
C
they will not be. Usually this can be determinedby just looking at the NextHeader field. The end result is that
option processingis much more efficient in IPv6, which is an important factor inrouter performance. In
u
addition, the new formatting of options as extensionheaders means that they can be of arbitrary length, whereas
in IPv4they were limited to 44 bytes at most
ad
iln
m
Ta
29
<br>
Page 78 of 131
4 12 16 24 31
Version TrafficClans FlwLabel
SourceAddress
DesinationAddress
g
in
er
Next headerdata
e
in
ng
IPv6 packet header.
fE
Consider the example of the fragmentation header, shown inFigure. This header provides functionality similar
tothefragmentationfields in the IPy4 header described in Section 3.2.2, but it is onlypresent if fragmentation is
O
necessary. Assuming it is the only extensionheader present, then the NextHeader field of the IPv6 header
wouldcontain the value 44, which is the value assigned to indicate the fragmentationheader. The NextHeader
e
field of the fragmentation header itselfcontains a value describing the header that follows it. Again,
g
assumingno other extension headers are present, then the next header mightbe the TCP header, which results in
le
NextHeader containing the value 6,just as the Protocol field would in IPy4.
ol
16 29 31
NextHeader Reseved Ofset RES M
C
Ident
u
ad
Autoconfiguration
m
While the Internet's growth has been impressive, one factor that hasinhibited faster acceptance of the
technology is the fact that getting connectedto the Internet has typically required a fair amount of
Ta
Page 79 of 131
is attached.
2. Obtain the correct address prefix for this subnet.
The first part turns out to be rather easy, since every host on a link musthave a unique link-level address. For
example, all hosts on an Ethernethave a unique 48-bit Ethernet address. This can be turned into a validlink
local use address by adding the appropriate prefix from Table 4.1
(1111 1110 10) followed by enough Os to make up 128 bits. For somedevices for example, printers or hosts
on a small routerless network thatdo not connect to any other networks this address may be perfectly
adequate.Those devices that need a globally valid address depend on a routeron the same link to periodically
advertise the appropriate prefix for thelink. Clearly, this requires that the router be configured with the
correctaddress prefix, and that this prefix be chOsen in such a way that there isenough space at the end (e.g., 48
bits)to attach an appropriate link-leveladdress.The ability to embed link-level addresses as long as 48 bits into
g
IPv6addresses was one of the reasons for choosing such a large addresssize. Not only does 128 bits allow the
in
embedding, but it leaves plentyof space for the multilevel hierarchy of addressing
Advanced Routing Capabilities
e er
Another of IPv6's extension headers is the routing header. In the absenceof this header, routing for
IPv6 differs very little from that of IPy4 underCIDR. The routing header contains a list of IPv6 addresses that
in
representnodes or topological areas that the packet should visit en routeto its destination. A topological area
ng
may be, for example, a backboneprovider's network. Specifying that packets must visit this network wouldbe a
way of implementing provider selection on a packet-by-packet basis.Thus, a host could say that it wants some
packets to go through aprovider that is cheap, others through a provider that provides high reliability,
fE
and still others through a provider that the host trusts to providesecurity.
To provide the ability to specify topological entities rather than individualnodes, IPv6 defines an
O
anycastaddress. An anycast address isassigned to a set of interfaces, and packets sent to that address will go
tothe "nearest" of those interfaces, with nearest being determined by therouting protocols. For example, all the
routers of a backbone providercould be assigned a single anycast address, which would be used in therouting
e
header.
g
le
ol
Addressing
Compared to IPv4, the most obvious advantage of IPv6 is its larger address space. IPv4 addresses are
u
32 bits ong and number about 4.3x10 (4.3 billion). IPv6 addresses are 128 bits long and number about
ad
3.4x10% (340 undecillion). IPv6's addresses are deemed enough for the foreseeable future.
IPv6 addresses are classified by three types of networking methodologies:
iln
The broadcast method is not implemented in IPv6. Each IPv6 address has a scope, which specifies in
which part of the network it is valid and unique. Some addresses are unique only on the local (sub-network).
Others are globally unique.
Address representation
31
<br>
Page 80 of 131
The 128 bits of an IPv6 address are represented in 8 groups of 16 bits each. Each group is written as 4
hexadecimal digits and the groups are separated by colons (:). The address
2001:0db8:0000:0000:0000:ff00:0042:8329 is an example of this representation.
For convenience, an IPv6 address may be abbreviated to shorter notations by application of the following
rules, where possible.
1. One or more leading zeroes from any groups of hexadecimal digits are removed; this is usually done to
either all or none of the leading zeroes. For example, the group 0042 is converted to 42.
2. Consecutive sections of zeroes are replaced with a double colon (::). The double colon may only be
used once in an address, as multiple uses would render the address indeterminate. RFC 5952
g
recommends that a double colon should not be used to denote an omitted single section of zeroes.
in
An example of application of these rules:
Initial address: 2001:0db8:0000:0000:0000: ff00:0042:8329
er
After removing all leading zeroes: 2001:db8:0:0:0:ff00:42:8329
After omitting consecutive sections of zeroes: 2001:db8::ff00:42:8329
e
The loopback address, 0000:0000:0000:0000:0000:0000:0000:000 1l, may be abbreviated to ::1 by using
in
both rules.
ng
As an IPv6 address may have more than one representation, the IETF has issued a proposed standard
for representing them in text.
IPv6 features
fE
O
128-bit addresses
Multicast
e
I Real-time service
Authentication and security
g
Auto-configuration
le
I End-to-end fragmentation
ol
IPy4 vs IPv6:
u
hexadecimal
Class D
32
<br>
Page 81 of 131
g
dotted decimal notation or prefix length length notation only
in
DNS name resolution: IPv4 host address (A) DNS name resolution: IPvó host
er
resource record address (AAAA) resource record
e
DNS reverse resolution: IN-ADDR.ARPA DNS reverse resolution: IP6.ARPA
in
domain domain
ng
IPy4 vs IPv6 Header
fE
IPv4 Header IPv6 Header
O
Type of Total Length
Version IHL Service
Version Traffic Class Flow Label
e
Fragment
Indentification Flags
g
Offset
le
Next Hop
Time to Live Protocol Header Checksum Payload Length
Header Limit
ol
Source Address
C
Destination Address
-
New field in IPv6
Destination Address
m
Ta
33
<br>
Page 82 of 131
g
3. Packet Header Checksum was eliminated in IPv6 and is in turn enforced at upper layers.
in
IPv6 header fields:
er
1. Version (4 bits)
e
in
2. Traffic Class (8 bits)
same function as the Type of Service field in the IPv4 header.
ng
3. Flow Label (20 bits)
identifies a flow and it is intended to enable the router to identify packets that should be
fE
treated in a similar way without the need for deep lookups within those packets.
set by the source and should not be changed by routers along the path to destination.
unique & powerful tool to IPv6
O
Can be used with differentiated services (DiffServ) as well as integrated services
e
MULTICAST:
Multicast is grossly defined as sending a single packet to multiple selected destinations. Multicast
supports one to many or many to many communications. Each group has its own IP multicast address. A single
copy of the packet is addressed to group's multicast address.
34
<br>
Page 83 of 131
g
A source needs to send a separate packet with the identical data to each member of the group
in
This redundancy consumes more bandwidth
Redundant traffic is not evenly distributed, concentrated near the sending host
er
Source needs to keep track of the IP address of each member in the group
Group may be dynamic
e
in
Uses of multicasting:
ng
i Sender has no need to know each host's individual Unicast IP address
i. Sender has no need to send multiple copies of packet
iii.
iv.
It eliminates redundant traffic. fE
Routing information can be distributed among routers in internetwork.
Protocols used for maintaining groups:
O
A host signals its desire to join or leavea multicast group by communicating with its local router using
a special protocol
g e
Therefore local routers are responsible for multicasting. So it periodically polls the LAN to determine
ol
groups.
C
MULTICAST ADDRESSES
IP has a subrange of its address space reserved for multicasting. IP provides an IP-level multicastto
u
support many-to-many and one-t0-many communication. Class D IP addresses are used for multicasting. There
ad
are 28 bits of possible multicast addresses in IPv4. Among these 28 bits, lower order 23 bits are mapped to
Ethernet 23 bit multicast addresses. Therefore high order 5 bits are remaining. So only 32(2^5) IP addresses
iln
map into each one of Ethernet addresses. Some subranges of the multicast ranges are reserved for intradomain
multicast, so they can be reused independently by different domains.
m
Ta
MULTICAST ROUTING
It is a process of building multicast forwarding tables, which is otherwise known as multicast
distribution trees.
A router's unicast forwarding tables indicate for any IP address, which link to use to forward the
unicast packet
To support multicast, a router must additionally have multicast forwarding tables that indicate, based on
multicast address, which links to use to forward the multicast packet
35
<br>
Page 84 of 131
g
DVMRP(Distance Vector Multicast Routing Protocol)
in
This is the first multicast routing protocol. Distance Vector Routing for unicast is extended to support
multicast. Since distance vector routers only have NEXTHOP type of data they do not have the full network
er
picture provided by link state routing. It works as a two stage process.
e
Stage 1: Flood
Stage 2:Prune
in
Flood stage:
ng
The packets are first broadcasted to all downstream ports.Each router already knows that shortest path
to source S goes through router NextHop(N) by means of unicast routing table.Whenever it receives multicast
The path is reverse because we consider the shortest path toward the source when making forwarding
C
decisions.
Prune stage:
Goal: Prune networks that have no hosts in group G
u
Page 85 of 131
problem space into two modes, depending on the proportion of routers that will want the multicast. The two
modes are
i
dense mode (PIM-DM)
ii. sparse mnode. (PIM-SM)
In PIM-SM, routers explicitly join the multicast distribution tree by sending Join'
messagestoRendezvouspoint (RP)using normal IP unicast transmission.RP is a special router assigned for a
group to manage that group. All routers in a domain know the unicast IP address of RP.A multicast forwarding
tree is built as a result of routers sending 'Join' messages to the RP. Two types of tree are constructed.
i) Shared tree - used by all senders
g
A Join' message clearly must pass through some routers before reaching RP.
in
Each router along the path creates a forwarding table entry (*, G) for the shared tree. *
indicates all senders.
er
ii) -
Source specific tree used only by a specific sending host
Each router along the path also creates a forwarding table entry (S, G) to create
e
sender-specific tree. S indicates the source identified.
in
ng
(a) RP (b) RP
fE
Join
O
R3 R2 R4 R3 R2 R4
e
Join
g
R1,
R5 R1 R5
le
ol
C
(c) RP (d) RP
u
ad
R3 R2 R4 R3/ R2 R4
Join
iln
1Join
Join
R1
m
R1 R5 IR5
Ta
RP=Rendezvous point
Shared tree
-Source-specific tree for source R1
37
<br>
Page 86 of 131
When a router sends a Join message toward the RP for a group G,it is sent using normal IP unicast
transmission. This is illustrated in Figure(a), inwhich router R4 is sending a Join to the rendezvous point for
some group. The initial Join message is wildcarded"; that is, it applies to all senders. A Join message clearly
g
must pass through some sequence of routers before reaching the RP (e.g., R2). Each router along the path looks
in
at the Join and creates a forwarding table entry for the shared tree, called a (*, G) entry (where * means all
senders"). To create the forwarding table entry, it looks at the interface on which the Join arrived and marks
er
that interface as one on which it should forward data packets for this group. It then determines which interface
it will use to forward the Join toward the RP. This will be the only acceptable interface for incoming packets
e
sent to this group. It then forwards the Join toward the RP. Eventually, the message arrives at the RP,
in
completing the construction of the tree branch. The shared tree thus constructed is shown as a solid line from
ng
the RP to R4.
As more routers send Joins toward the RP, they cause new branches to be added to the tree, as illustrated in
Figure (b).Note that, in this case,the Join only needs to travel to R2, which can add the new branch to the tree
fE
simply by adding a new outgoing interface to the forwarding table entry created for this group. R2 need not
forward the Join on to the RP.Note also that the end result of this process is to build a tree whose root is the
RP.At this point, suppose a host wishes to send a message to the group. To do so, it constructs a packet with
O
the appropriate multicast group address as its destination and sends it to a router on its local network known as
the designated router (DR).
e
An important detail to note at this stage is that the Join message sent by the RP to the sending host is
g
specific to that sender, whereas the previous ones sent by R4 and R5 applied to all senders. Thus, the effect
le
ofthe new Join is to create sender-specific state in the routers between the identified source and the RP. This is
referred to as (S, G) state, since it applies to one sender to one group, and contrasts with the (*, G) state
ol
thatwas installed between the receivers and the RP that applies to all senders. Thus, in Figure (c), we see a
source-specific route from RI to the RP (indicated by the dashed line) and a tree that is valid for all senders
C
destination and sends it to local router. Then the local router encapsulates the multicast packet inside a PIM
ad
'Register' message and sends to RP. RP receiving this packet looks at the payload of the Register message
and finds inside an IP packet addressed to the multicast address of a group. It transmits the IP packet to all
members of the group.
iln
m
Ta
38
<br>
Page 87 of 131
RP
G
RPG
R3 R2 R4
RPG
R1
g
R5
in
er
G
e
in
ng
Host
Delivery of a packet along a shared tree
fE
Host sends a multicast packet to its local router(Rl). RI tunnels that packet to the RP, which forwards it along
O
the shared tree to R4 and R5.The complete delivery of a packet fromRI to R4 and R5 is shown in Figure.
g e
le
In the early days of the Internet, the IANA (Internet Assigned Numbers Authority) defined five classes of public
C
B
128.0.0.0 to 191.255.255.255 10 Medium networks
Ta
39
<br>
Page 88 of 131
Class B IP addresses, where the 1st two bits are 10, are in the range of 128.0.0.0 to
191.255.255.255. This class is for medium networks and has 16 bits for network and
16 bits for hosts.
g
in
Class C IP addresses, where the 1 three bits are 110, are in the range of 192.0.0.0
er
to 223.255.255.255. This class is for smaller networks and has 24 bits for network
and 8 bits for hosts.
e
in
Class D or multicast IP addresses, where the 1*four bits are 1110 are in the range of
ng
224.0.0.0 to 239.255.255.255.
fE
Class E or experimental IP addresses, where the 1sfour bits are 11110, are in the
range of 192.0.0.0 to 254.255.255.255.
O
g e
le
ol
C
u
ad
iln
m
Ta
40
<br>
Page 89 of 131
UNIT
II
TRANSPORT AND APPLICATION LAYERS
Transport Layer Protocols -UDP and TCP Connection and State Transition Diagram -
Congestion Control and Avoidance (DEC bit, RED)- QoS - Application Layer Paradigms
- -
Client Server Programming Domain Name System – World Wide Web, HTTP, Electronic
Mail
Overview of Transport laver:
The following are some of the common properties that a transport protocol can be expected to provide:
guarantees message delivery
g
delivers messages in the same order they are sent
delivers at most one copy of each message
in
supports arbitrarily large messages
er
supports synchronization between the sender and the receiver
allows the receiver to apply flow control to the sender
e
supports multiple application processes on each host
in
Some of the more typical limitations of the network are that it may
ng
drop messages
reorder messages
deliver duplicate copies of a given message
limit messages to some finite size
fE
deliver me ssages after an arbitrarily long delay
O
The transport protocols provide the following services
e
End-to-End Protocols
C
The simplest possible transport protocol is one that extends the host-to-host delivery service of the
ad
The common approach, and the one used by UDP, is for processes to indirectly identify each other using
Ta
Page 90 of 131
0 16 31
SrcPort DstPort
Length Checksum
Data
g
in
Figure 4.1.1 Format for UDP Header
er
How does a process learns the port for the process to which it wants to send a message?
A client process initiates a message exchange with a server process.
e
Once a client has contacted a server, the server knows the client's port (it was contained in the message
in
header) and can reply to it.
How does the client learn the server's port in the first place?
ng
A common approach is for the server to accept messages at a well-known port.
That is, each server receives its messages at some fixed port that is widely published.
fE
For example, the Domain Name Server (DNS) receives messages at well-known port 53 on each host, the
mail service listens for messages at port 25, and the Unix talk program accepts messages at well-known
port 517, and so on.
O
An alternative strategy is to use only a singlewell-known port the one at which the "Port Mapper"
service accepts messages.
e
Aclient would send a message to the Port Mapper's well-known port asking for theport it
g
should use to talk to the "whatever" service, and the Port Mapper returnsthe appropriate
le
port.
This strategy makes it easy to change the port associated withdifferent services over time,
ol
and for each host to use a different port for the sameservice.
A port isimplemented by a message queue, as illustrated in Figure 4.1.2.
C
u
Ports
iln
m
Queues
Ta
Packets
demultiplexed
UDP
Packets arrive
Page 91 of 131
When a message arrives,the protocol (e.g., UDP) appends the message to the end of the queue. If
thequeue is full, the message is discarded. There is no flow-control mechanism that tellsthe sender to
slow down.
When an application process wants to receive a message,one is removed from the front of the queue.
If the queue is empty, the process blocksuntil a message becomes available.UDP does not implement
flow control or reliable/ordered delivery,
UDP ensures the correctness of the message by the use ofa checksum.
UDP computes its checksum over the UDP header, the contents of the messagebody, and
something called the pseudoheader.
The pseudoheader consists of three fieldsfrom the IP header
1. protocol number
g
2. source IP address
in
3. destination IP address + the UDP length field.
The pseudoheader is to verify that this message has beendelivered between the correct two
er
endpoints.
e
4.2 Reliable Byte Stream (TCP)
in
ng
The Internet's Transmission Control Protocol (TCP) is probably the most widely used transport protocol
TCP guarantees the reliable, in-order delivery of a stream of bytes.
It is a full-duplex protocol, meaning that each TCP connection supports a pair of byte streams, one
flowing in each direction.
fE
It also includes a flow-control mechanism for each of these byte streams that allows the receiver to limit
how much data the sender can transmit at a given time.
O
Finally, like UDP, TCP supports a demultiplexing mechanism that allows multiple application programs
on any given host to simultaneously carry on a conversation with their peers.
g e
End-to-End Issues
le
Even though this is the same basic algorithm because TCP runs over the Internet rather than a point-to
point link, there are many important differences.
C
The sliding window algorithm we already learnt runs over a single physical link that always connects the
same two computers.
u
TCP supports logical connections between processes that are running on any two computers in the
ad
Internet.
This means that TCP needs an explicit connection establishment phase during which the two sides of the
iln
What this means to the sliding window algorithm is that the timeout mechanism that triggers
retransmissions must be adaptive
Packets may be reordered as they cross the Internet, but this is not possible on a point -to-point link where
the first packet put into one end of the link must be the first to appear at the other end.
Packets that are slightly out of order do not cause a problem since the sliding window
algorithm can reorder packets correctly using the sequence number.
The real issue is how far out-of-order packets can get, or said another way, how late a
packet can arrive at the destination.
TCP also implements a highly tuned flow control and congestion-control mechanisms.
Flow control involves preventing senders from overrunning the capacity of receivers.
<br>
Page 92 of 131
Congestion control involves preventing too much data from being injected into the network, thereby
causing switches or links to become overloaded.
Thus, flow control is an end-to-end issue, while congestion control is concerned with how hosts and
networks interact.
g
Write Read
in
bytes bytes
er
TCP TCP
e
Send buffer Receive buffer
in
ng
Segment SegmentSegment
Transmit segments
fE
Figure 4.2.1 How TCP manages a byte stream.
O
How TCP manages a byte stream?
e
TCP is a byte-oriented protocol, which means that the sender writes bytes into a TCP connection and the
g
TCP on the source host buffersenough bytes from the sending process to fill a reasonably sized packet
ol
4 10 16 31
ad
SrcPort DstPort
SequenceNum
iln
Acknowledgment
m
Checksum UrgPtr
Options (variable)
Data
Page 93 of 131
TCP on the destination host then empties the contents of the packet into a receive buffer., and the
receiving process reads from this buffer at its leisure.
This situation is illustrated in Figure 4.2.1, which, for simplicity, shows data flowing in only one
direction.
A single TCP connection supports byte streams flowing in both directions.
The packets exchanged between TCP peers are called segments since each one carries a segment of the
byte stream.
Each TCP segment contains theheader schematically depicted in Figure 4.2.3.
The SrcPort and DstPort fields identify the source and destination ports, respectively,just as in UDP.
The Acknowledgment, SequenceNum, and Advertised Window fields are all involvedin TCP's sliding
g
window algorithm.
in
Each byte of data has a sequence number; the SequenceNum field contains the sequencenumber for the
er
first byte of data carried in that segment.
The Acknowledgment andAdvertised Windowfields carry information about the flow of data going in the
e
otherDirection
The 6-bit Flags field is used to relay control information between TCP peers.
in
Thepossible flags include SYN, FIN, RESET, PUSH, URG, and ACK.
ng
The SYN and FIN flagsare used when establishing and terminating a TCP connection, respectively.
The ACK flag is set any time the Acknowledgment field isvalid, implying that the receiver should pay
attention to it. fE
The URG flag signifies thatthis segment contains urgent data. When this flag is set, the UrgPtr field
indicates wherethe nonurgent data contained in this segment begins.
O
The PUSH flag signifies that the sender invoked the push operation, whichindicates to the receiving side
of TCP that it should notify the receiving process ofthis fact.
e
The RESETflag signifies that the receiver has become confused-for example, because it receiveda
segment it did not expect to receive-and so wants to abort the connection.
g
le
A TCP connection begins with a client (caller) doing an active open to a server (callee).
C
Assuming that the server had earlier done a passive open, the two sides engage in an exchange of
messages to establish the connection.
u
Only after this connection establishment phase is over do the two sides begin sending data.
ad
As soon as a participant is done sending data, it closes one direction of the connection, which causes TCP
to initiate a round of connection termination messages.
iln
m
Ta
<br>
Page 94 of 131
g
ACK,
Acknowledgment
in
=y +
er
1
e
Figure 4.3.1 Timeline for three-way handshake algorithm.
in
Three-Way Handshake
ng
The algorithm used by TCP to establish and terminate a connection is called a three- way handshake.
fE
The three-way handshake involves the exchange of three messages between the client and the server, as
illustrated by the timeline given in Figure 4.3.1.
First, the client (the active participant)sends a segment to the server (the passive participant) stating the
O
initial sequencenumber it plans to use (Flags = SYN, SequenceNum = x).
The server then respondswith a single segment that both acknowledges the client's sequence number
e
(Flags =ACK, Ack = x+ 1) and states its own beginning sequence number (Flags = SYN,
g
SequenceNum = y). That is, both the SYN and ACK bits are set in the Flags field of this second message.
Finally, the client responds with a third segment that acknowledges the server's sequence number
le
The reason that each side acknowledges a sequence number that is one larger than the one sent is that the
Acknowledgment field actually identifies the next sequence number expected."
C
connectionis open--that is, the operation of the sliding window algorithm-is hidden inthe
ESTABLISHED state.
m
Ta
<br>
Page 95 of 131
CLOSED
Active open/SYN
Passive open Close
Close
LISTEN
g
SYN_RCVD
SYN/SYN+ ACK
SYN_SENT
in
ACK SYN + ACK/ACK
e er
Close/FIN ESTABLISHED
in
FIN/ACK
ng
Close/FIN
FIN_WAIT_1 CLOSE_WAIT
FIN/ACK
|ACK ACK
+FINACK
fE CloseFIN
TIME_WAIT CLOSED
g
le
Each circle denotesa state that one end of a TCP connection can find itself in.
Allconnections start in theCLOSED state.
C
set), the connection makes a transition to the SYN RCVD state and takesthe action of replying with an
ad
When opening a connection, the server first invokes a passive openoperation on TCP, which causes TCP
to move to the LISTEN state.
m
At some later time,the client does an active open, which causes its end of the connection to send a
SYNsegment to the server and to move to the SYN SENT state.
Ta
When the SYN segmentarrives at the server, it moves to the SYN RCVD state and responds with a
SYN+ACKsegment.
The arrival of this segment causes the client to move to the ESTABLISHEDstate and to send an ACK
back to the server.
When this ACK arrives, the server finallymoves to the ESTABLISHED state. In other words, we have
just traced the three-wayhandshake.
Now to the process of terminating a connection, the importantthing to keep in mind is that the application
process on both sides of theconnection must independently close its half of the connection.
If only one side closesthe connection, then this means it has no more data to send, but it is still
availableto receive data from the other side.
<br>
Page 96 of 131
Thus, on any one side there are threecombinations of transitions that get a connection from the
ESTABLISHED state to theCLOSED state:
This side closes first:
ESTABLISHED FIN WAIT 1 FIN WAIT 2 TIME WAIT CLOSED.
The other side closes first:
ESTABLISHED CLOSE WAIT LAST ACK CLOSED.
Both sides close at the same time:
ESTABLISHED FIN WAIT 1 CLOSING TIME WAIT CLOSED.
g
1. 4.4 Adaptive Flow Control : TCP sliding window algorithm for flow control.
in
er
Flow control is preventing the sender from overrunning the capacity of the receiver.
We go back to our sliding window algorithm.
e
in
Sending application
ng
fE
O
TCP TCP
LastByteVWritten LastByteRead
g e
le
Relationship between TCP send buffer (a) and receive buffer (b).
u
Sending side :
ad
LastByteAcked< = LastByteSent
LastByteSent< = LastByteWritten
Buffers bytes between LastByteAcked and LastByteWritten
iln
Receiving Side:
LastByteRead<NextByteExpected
m
NextByteExpected< = LastByteRcvd+1
Buffers bytes between NextByteRead and LastByteRcvd.
Ta
Both buffers are of some finite size, denotedMax SendBuffer and MaxRevBuffer,
The size of the window sets the amountof data that can be sent without waiting for acknowledgment from
the receiver.
Thus,the receiver throttles the sender by advertising a window that is no larger than theamount of data
that it can buffer.
Observe that TCP on the receive side must keep
<br>
Page 97 of 131
-
LastByteRevd LastByteRead<MaxRevBuffer
to avoid overflowing its buffer.
It therefore advertises a window size of
Advertised Window = MaxRevBuffer-LastByteRevd-LastByteRead)
which represents the amount of free space remaining in its buffer. TCP on the sender side must then
adhere to the advertised window it gets fromthe receiver.
This means that at any given time, it must ensure that
LastByteSent -LastByteAckedsAdvertised Window
g
The sender computes an effective window that limits how much datait can send:
-
in
EffectiveWindow = AdvertisedWindow (LastByteSent -LastByteAcked)
The sender side must also make sure that the localapplication process does not overflow the send buffer,
er
that is,
e
LastByte Written-LastByteAcked<MaxSendBuffer
in
ng
4.5 Adaptive Retransmission
TCP guarantees the reliable delivery of data,hence it retransmits each segment if an ACK is not received
fE
in a certain period of time.
TCP sets this timeout as a function of the RTT it expects between the two ends of the connection. Since
O
TCP can have a wide variety of RTTs, it uses an adaptive retransmission mechanism.
e
Original Algorithm
g
To compute a timeout value between a pair of hosts. This is the algorithm that was originally
le
this RTT.
C
Specifically, every time TCP sends a data segment, it records the time. When an ACK for that
segment arrives, TCP reads the time again and then takes the difference between these two times as a
u
SampleRTT.
TCP then computes an EstimatedRTT as a weighted average between the previous estimate and this
ad
Karn/Partridge Algorithm
A flaw was discovered in the above simple algorithm.
The problem was that an ACK does not really acknowledge a transmission; it actually acknowledges
the receipt of data.
It is necessary to know which transmission to associate the ACK with so as to compute an accurate
SampleRTT.
Asillustrated in Figure 4.5, if you assume that the ACK is for the original transmissionbut it was
really for the second, then the SampleRTT is too large (a),
<br>
Page 98 of 131
10
while if youassume that the ACK is for the second transmission but it was actually for the first,then
the SampleRTT is too small (b)
Sender Receiver Sender Receiver
Original Original
transmission transmission
SampleRTT
SampleRTT
Retransmission ACK
Retransmission
ACK
g
in
er
(a) (b)
Figure 4.5 Associating the ACK with (a) original transmission versus(b) retransmission.
e
in
The solution is simple.
Whenever TCP retransmits a segment, itstops taking samples of the RTT; it only measures
ng
SampleRTT for segments that havebeen sent only once.
This solution known as the Karn/Partridge algorithm, after itsinventors.
fE
Their proposed fix also includes a second small change to TCP's timeoutmechanism.
Each time TCP retransmits, it sets the next timeout to be twice the lasttimeout, rather than basing it
on the last EstimatedRTT.
O
That is, Karn and Partridgeproposed that TCP use exponential backoff, similar to what the Ethernet
does.
g e
Jacobson/Karels Algorithm
le
The Karn/Partridge algorithm was introduced at a time when the Internet was sufferingfrom high
levels of network congestion.
ol
Their approach was designed to fix some ofthe causes of that congestion, and although it was an
C
It should be clear how the timeout mechanism is related tocongestion-if you time out too soon, you
ad
may unnecessarily retransmit a segment, which only adds to the load on the network.
The main problem with the original computation is that does not take thevariance of the sample
iln
In the new approach, the sender measures a new SampleRTT as before. It thenfolds this new sample
into the timeout calculation as follows:
Ta
TCP then computes the timeout value as a function of both EstimatedRTT and
Deviation as followS:
TimeOut = u xEstimatedRTT + Q x Deviation
u is typically set to land p is set to 4.
<br>
Page 99 of 131
11
Thus, whenthe variance is small, TimeOut is close to EstimatedRTT; a large variance causes
theDeviation term to dominate the calculation.
> The idea of TCP congestion control is for each source to determinehow much capacity is available in
the network, so that it knows how manypackets it can safely have in transit.
Once a given source has this many packets intransit, it uses the arrival of an ACK as a signal that one
of its packets has left thenetwork, and that it is therefore safe to insert a new packet into the network
withoutadding to the level of congestion.
By using ACKs to pace the transmission of packets,TCP is said to be self-clocking.
g
in
Congestion Control Mechanisms
er
1. Additive Increase/Multiplicative Decrease
e
TCP maintains a new state variable for each connection, called CongestionWindow, Which is used by
in
the source to limit how much data it is allowed to have in transitat a given time.
The congestion window is congestion control's counterpart to flowcontrol's advertised window. TCP is
ng
modified such that the maximum number of bytes of unacknowledged data allowed is now the minimum
of the congestion window and the advertised window.
A Effective window is revised as follows: fE
MaxWindow = MIN(Congestion Window, Advertised Window)
EffectiveWindow = MaxWindow - (LastByteSent-LastByteAcked).
O
That is, MaxWindow replaces Advertised Window in the calculation of Effective Window.Thus, a TCP
e
source is allowed to send no faster than the slowest component-thenetwork or the destination hostcan
g
accommodate.
le
The AdvertisedWindow, is sent by the receiving sideof the connection.The TCP source sets the
CongestionWindow based onthe level of congestion it perceives to exist in the network.
ol
This involves decreasing thecongestion window when the level of congestion goes up and increasing the
congestionwindow when the level of congestion goes down.
C
How does the source deternmine that the network iscongested and that it should decrease the
ad
congestion window?
TCP interprets timeouts as a signof congestion and reduces the rate at which it is transmitting.
Specifically, each time atimeout occurs, the source sets Congestion Window to half of its previous value.
iln
Thishalving of the CongestionWindow for cach timeout corresponds to the multiplicativedecrease" part
m
of AIMD.
Although Congestion Window is defined in terms of bytes, it is easiest to understandmultiplicative
decrease if we think in terms of whole packets.
Ta
12
A Every time the source successfully sends a Congestion Window's worth of packets that is, each packet
sent out during the last RTT has been ACKedit adds the equivalent of one packet to
Congestion Window.
A This linear increase is illustrated in Figure 4.6.1.
A Specifically, the congestion window is incremented as follows each time an ACK arrives:
Increment = MSS x (MSS/Congestion Window)
Congestion Window+= Increment
Source Destination
g
in
e er
in
ng
fE
O
g e
le
ol
C
u
Figure 4.6.1 Packets in transit during additive increase, with one packet being addedeach RTT.
ad
That is, rather than incrementing Congestion Window by an entire MSS bytes each RTT, we increment it
iln
MSS/CongestionWindow.
Ta
70
60
-
50
gy
40
30
20
10
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0
Time (seconds)
<br>
13
A This pattern of continually increasing and decreasing congestion window continues throughout life time
of the connection. If we draw congestion window as a function of time, the curve saw tooth form.
A The two main things to remnember about thatmechanismn are that
(1) timeouts are set as a function of both the averageRTT and the standard deviation in
that average, and
(2) due to the cost ofmeasuring each transmission with an accurate clock, TCP only
samplesthe round-trip time once per RTT (rather than once per packet) using a
coarse-grained (500-ms) clock.
2. Slow Start
g
in
The additive increase mechanism is used whenthe source is operating close to the available capacity
of the network.
er
It takestoo long to ramp up a new TCP connection.
e
Source Destination
in
ng
fE
O
g e
le
ol
C
u
ad
iln
m
Slow start is used to increasethe congestion window rapidly from a cold start.
Slow start effectively increases thecongestion window exponentially, rather than linearly.
Specifically, the source starts out by setting CongestionWindow to one packet.
When the ACK for this packet arrives, TCP adds l to CongestionWindow and then
sends two packets.
Upon receiving the corresponding two ACKs, TCP incrementsCongestionWindow by 2-one for
each ACK-and next sends four packets.
The endresult is that TCP effectively doubles the number of packets it has in transit every RTT.
Figure 4.6.2 shows the growth in the number of packets in transit during slow start.
<br>
14
Compare this to the linear growth of additive increase illustrated in Figure 4.6.1.
Fast retransmit is a heuristic that sometimes triggers the retransmissionof a dropped packet sooner
than the regular timeout mechanism.
The fastretransmit mechanism does not replace regular timeouts; it just enhances that facility.
g
The idea of fast retransmit is straightforward.
in
Every time a data packet arrives atthe receiving side, the receiver responds with an acknowledgment,
even if this sequencenumber has already been acknowledged.
er
Thus, when a packet arrives out of order that is, TCP cannot yet acknowledge the data the packet
contains because earlier datahas not yet arrivedTCP resends the same acknowledgment it sent the last
e
time.
in
Thissecond transmission of the same acknowledgment is called a duplicate ACK.
ng
Whenthe sending side sees a duplicate ACK, it knows that the other side must have receiveda packet out
of order, which suggests that an earlier packet might have been lost.
Since it is also possible that the earlier packet has only been delayed rather than lost,the sender waits until
fE
it sees some number of duplicate ACKs and then retransmitsthe missing packet.
In practice, TCP waits until it has seen three duplicate ACKs beforeretransmitting the packet.
O
e
Sender Receiver
g
le
Packet 1
Packet 2
ol
1
Packet 3 ACK
C
Packet 4 ACK 2
u
ad
Packet 5 ACK 2
Packet 6
iln
ACK 2
ACK 2
m
Ta
Retransmit
packet 3
ACK 6
15
g
between when fast retransmitdetects a lost packet and additive increase begins.
in
For example, fast recovery avoidsthe slow and instead simply cutsthe congestion window in half and
resumes additive increase.
er
In other words, slow start is only used at the beginning ofa connection
e
At all other times, the congestion window is followinga pure additive increase/multiplicative decrease
in
pattern.
ng
4.7 Congestion-Avoidance Mechanisms
fE
Congestion Avoidance is to predict whencongestion is about to happen and then to reduce the rate at
which hosts send data justbefore packets start being discarded.
O
This section describes three different congestion-avoidance mechanisms.
They are DECbit, RED and Source-based Congestion Avoidance.
e
The first two take a similar approach: They put a small amount of additional functionality into the
router to assist the end node in the anticipation of congestion.
g
The third mechanism is very different from the first two: It attempts to avoid congestion purely from
le
1.
DECbit
C
The first mechanism was developed for use on the Digital Network Architecture (DNA), a
u
Each router monitors the load it is experiencing and explicitly notifies the end nodes when congestion
is about to occur.
This notification is implemented by setting a binary congestion bit in the packets that flow through
iln
the router.
The destination host then copies this congestion bit into the ACK it sends back to the source.
m
16
If less than 50% of the packets had the bit set, then the source increases its congestion window by one
packet.
If50%or more of the last window's worth of packets had the congestion bit
set, then the source decreases its congestion window to 0.875 times the previous value.
The "increase by 1, decrease by 0.875" rule was selected because additive increase/multiplicative
decrease makes the mechanism stable.
g
it detects that congestion is imminent, to notify the source to adjust its congestion window.
in
RED differs from the DECbit scheme in two major ways.
1. The first is that rather than explicitly sending a congestion notification mnessage to the
er
source, RED is most commonly implemented such that it implicitly notifies thesource
of congestion by dropping one of its packets. The source is, therefore, effectively
e
notified by the subsequent timeout or duplicate ACK.
in
2. The second difference between RED and DECbit is in the details of how RED decides
when to drop a packet and what packet it decides to drop.
ng
When to drop a packet and what packet it to drop?
fE
o Drop each arriving packet with some drop probabilitywhenever the queue length exceeds
some drop level.
This idea is called early randomdrop.
O
The RED algorithm defines the details of how to monitor the queue length andwhen to
drop a packet.
e
Second, RED has two queue length thresholds that trigger certain activity:
C
ifAvgLensMinThreshold
queue the packet
iln
ifMinThreshold<AvgLen<MaxThreshold
calculate probability P
m
ifMaxThresholdsAvgLen
drop the arriving packet
3.
Source-Based Congestion Avoidance
The general idea of these techniques is to watch for some sign from the networkthat some router's
queue is building up and that congestion will happen soon if nothingis done about it.
For example, the source might notice that as packet queues build upin the network's routers,
there is a measurable increase in the RTT for each successivepacket it sends.
<br>
17
Algorithm 1:
For every two round-trip delays thealgorithm checks to sece
o if the current RTT is greater than the average of the minimumand
maximum RTTs seen so far.
If it is, then the algorithm decreases thecongestionwindow by one-eighth.
Algorithm 2:
The window is adjusted once every tworound-trip delays based on the product
(CurrentWindow - OldWindow) x (CurrentRTT -OldRTT)
If the result is positive, the source decreasesthe window size by one-eighth.
g
If the resultis negative or zero, the source increases thewindow by one maximum packet size.
in
Algorithm 3:
er
For every RTT, the source increasesthe window size by one packetand compares the throughput
achieved tothe throughput when the window was onepacket smaller.
e
If the difference is less thanone-half the throughput achieved when onlyone packet was in
in
transit ,thendecreases the window by one packet.
The throughput is calculated bydividing the number of bytes outstanding inthe
ng
network by the RTT.
There is more to transmitting audioand video over a network than just providingsufficient bandwidth.
,
For example participants in a telephone conversation, expect to be able to converse in such a way that
g
one person can respond to something said by the other and be heard almost immediately.
le
We refer to applications that are sensitive to the timeliness of data as real-time applications.
The distinguishing characteristic of real-time applications is that they need some sort of assurance
C
Timely arrival must be provided by the network itself (the routers), not just at thenetwork edges (the
hosts).
Hence the best-effort model, in whichthe network tries to deliver your data but makes no promises is not
iln
networkfor them.
The network may then respondby providing an assurance that it willdo better.
Ta
This impliesthat the network will treat some packetsdifferently from otherssomething thatis not done in
the best-effort model.
A networkthat can provide these different levelsof service is often said to support quality ofservice
(QoS).
18
Applications
g
Intolerant Tolerant
in
e er
Nonadaptive Adapive
in
ng
Rate adapive fE Delay adaptive
The first characteristic by which we can categorize applications is their tolerance of loss of
g
data, where "loss might occur because a packet arrived too late to be played back as well
as arising from the usual causes in the network.
le
For example, one lost audio sample can be interpolated from the surrounding samples
ol
with relatively little effect on the perceived audio quality(can tolerate loss) whereas a
robot control program is likely to be an example of a real-time application that cannot
C
tolerate losslosing the packet that contains the command instructing the robot arm to
stop is unacceptable.
u
If we notice that packets are almostalways arriving within 300 ms of being sent, then we
can set our playback pointaccordingly.
Suppose that wesubsequently observe that all packets are arriving within 100 ms of being
sent.
If wemoved up our playback point to 100 ms, then the users of the application
wouldprobably perceive an improvement.
The process of shifting the playback point wouldactually require us to play out samples at
an increased rate for some period of time.
Thus, playback point adjustment is fairlyeasy in this case, and it has been effectively
implemented for several voice applications.
<br>
19
g
two broad categories:
in
fine-grained approaches, which provide QoS to individual applications orflows
coarse-grained approaches, which provide QoS to large classes of data oraggregated
er
traffic.
e
in
Integrated Services (RSVP)
ng
The term "Integrated Services" (often called IntServ for short) refers to a body ofwork that was produced
by the IETF around 1995-97.
fE
The IntServ working group developed specifications of a number of service classes designed to meet the
needs of some of the application types described above.
It also defined how RSVP could be usedto make reservations using these service classes.
O
1. Service Classes
One of the service classes is designed for intolerant applications.
e
The network should guarantee that the maximumdelay that any packet will experience has some
specified value.
le
o The applicationcan then set its playback point so that no packet will ever arrive after its
ol
playbacktime.
We assume that early arrival of packets can always be handled by buffering.
C
2. Overview of Mechanisms
a) Flowspec
o We need to tell the network something about what we are going to inject into it, since a low
iln
the part that describes the flow's traffic characteristics (called the TSpec)
and the part that describes the service requested from the network (the RSpec).
o The RSpec is very service specific.
o The TSpec is a little more complicated. We needto give the network enough information about
the bandwidth used by the flow to allowintelligent admission control decisions to be made.
For Example,
• Suppose that we have 10 flows that arrive at a switch on separate input ports and that all leave on
the same 10-Mbps link.
Assume that over some suitably long interval each flow can be expected to send no more than 1
Mbps.
<br>
20
g
Such a filter isdescribed by two parameters: a token rate r and a bucket depth B. It works as
in
follows.
er
o To be able to send a byte, Imust have a token.
e
To send a packet of length n, I needn tokens.
I start with no tokens
andIaccumulate them at a rate of r per second.
in
Ican accumulate no more than B tokens.
ng
What this means is that I can send a burstof as many as B bytes into the network as fast as
Iwant, but over a sufficiently longinterval, I can't send more than r bytes per second.
It turns out that this informationis very helpful to the admission control algorithm when it
fE
tries to figure out whetherit can accommodate a new request for service.
b) Admission Control
O
For example, if 10 usersask for a service in which each will consistently use 2 Mbps of link
capacity, and theyall share a link with 10-Mbps capacity, the network will have to say no to
some ofthem.
e
o When some new flow wants to receive a particular level of service, admission control looks at
the TSpec and RSpec of the flow and tries to decide if the desired service can be provided to
ol
that amount of traffic, given the currently available resources, without causing any previously
admitted flow to receive worse service than it had requested.
C
If it can provide the service, the flow is admitted; if not, then it is denied.
The hard part is figuring out when to say yes and when to say no.
u
o Admission control is very dependent on the type of requested service and on the queuing
ad
c) Resource Reservation
o The mechanism by which the users of the network and the components of the network itself
m
exchange information such as requests for service, flowspecs, and admission control decisions
is called resource reservation.
Ta
d) Packet Scheduling
Finally, when flows and their requirements have been described, and admissioncontrol
decisions have been made, the network switches and routers need to meet therequirements of
the flows.
<br>
21
o A key part of meeting these requirements is managing theway packets are queued and
scheduled for transmission in the switches and routers.
This last mechanism is packet scheduling.
Differentiated Services
The Integrated Services architecture allocates resources to individual flows, the Differentiated Services
model (often called DiffServ for short) allocates resources to a small number of classes of traffic.
• In fact, some proposed approaches to DiffServ simply divide traffic into two classes.
Suppose that we have decided to enhance the best-effort service model by adding
g
• just one new class, which we'll call “premium."
in
Clearly, we will need some way to figure out which packets are premium and which are regular old best
effort.
er
This could obviously be done by using a bit in the packet headerif that bit is a 1, the packet is a
premium packet; if it's a 0, the packet is best effort.
e
in
Who sets the premium bit, and under what circumstances?
ng
The router at the edge of anlnternet service provider's network might set the bit for
packets arriving on an interfacethat connects to a particular company's network. The
fE
Internet service provider mightdo this because that company has paid for a higher level of
service than best effort.
O
What does a router do differently when it sees a packet with the bit set?
e
end-to-end services.
ol
C
u
ad
iln
m
Ta
<br>
22
TRADITIONAL APPLICATIONS
* First distinguish between application programs and application protocols. For example, the Hyper Text Transport
Protocol (HTTP) is an application protocol that is used to retrieve Web pages from remote servers. There can be
many different application programs--that is, Web clients like Internet Explorer, Mosaic, and Netscape-that
provide users witha different look and feel, but all of them use the same HTTP protocol to communicate with Web
servers over the Internet.
The most popular applications that are directly invoked by users are the World Wide Web and email.
* Request / Reply paradigm is used by applications (i-e) users send requests to servers, which then respond
accordingly.
3 Applications need their own protocols. Widely-used, standardized application protocols are:
SMTP: Simple Mail Transfer Protocol is used to exchange electronic mail.
g
MIME: (Multipurpose Internet Mail Extensions) define the format of email messages.
in
HTTP: Hyper Text Transport Protocol is used to communicate between Web browsers and Web
er
servers. It is a protocol for fetching Web pages.
HTML: (Hyper Text Markup Language) is a companion specification that defines the form of those pages.
e
I DNS: Domain Name System protocol is used to query name servers and send the responses.
in
I SNMP: Simple Network Management Protocol is used to query (and Sometimes modify) the state of
remote network nodes.
ng
MIB: Management information base defines the variables that can be queried.
ELECTRONIC MAIL (SMTP, POP3, IMAP, MIME) fE
Email is one of the oldest network applications. It is important to
(1) Distinguish the user interface (i.e. your mail reader) from the underlying message transfer protocol
O
(SMTP or IMAP)
(2) Distinguish between this transfer protocol and a companion protocol (RFC 822 and MIME) that
e
This is still the case, although RFC 822 has been augmented by MIME to allow the message body to carry all
sorts of data.
This data is still represented as ASCII text, but because it may be an encoded version of, say a JPEG image, it's
u
The message header is a series of <CRLF> terminated lines.(<CRLE> stands for carriage-return + line-feed,
which are a pair of ASCII control characters often used to indicate the end of a line of text.)
The header is separated from the message body by a blank line. Each header line contains type and value
iln
separated by a colon. Many of these header lines are familiar to users since they are asked to fill them out when
they compose an email message.
m
For example, the To: header identifies the message recipient, and the Subject: header says something about the
purpose of the message.
Ta
Other headers are filled in by the underlying mail delivery system. Examples include Date: (when the message
was transmitted).From: (what user sent the message), and Received: (each mail server that handled this message).
There are, of course ,many other header lines; These header lines describe, in various ways, the data being
carried in the message body. They include
a. MIME-Version: (the version of MIME being used),
b. Content-Description: (a human readable description of what's in the message, analogous to the Subject:
line),
c. Content-Type: the type of data contained in the message), and
d. Content-Transfer-Encoding (how the message body is encoded)
<br>
23
The second piece is definitions for a set of content types (and subtypes).For example; MIME defines two
different still-image types, denoted image/gif and image/jpeg, each with the obvious meaning.
As another example, text/plain refers to simple text you might find in a vanilla 822-style message, while text/
richtext denotes a message that contains marked up" text (text using special fonts, italics, etc).
As a third example, MIME defines an application type, where the subtypes correspond to the output of different
application programs (e.g., application/postscript and application/'msword).
MIME also defines a multipart type that says how a message carrying more than one data type is structured. This
is like a programming language that defines both base types (e.g., integers and floats) and compound types (e.g..
structures and arrays).
One possible multipart subtype is mixed ,which says that the message contains a set of independent data pieces
in a specified order. Each piece then has its own header line that describes the type of that piece.
The third piece is a way to encode the various data types so they can be shipped in an ASCII email message. The
g
problem is that for some data types(a JPEG image, for example),any given 8-bit byte in the image might contain
one of 256 different values. Only a subset of these values are valid ASCII characters .
in
It is important that email messages contain only ASCII, because they might pass through a number of
er
intermediate systems (gateways, as described below) that assume all email is ASCII and would corrupt the
message if it contained non-ASCII characters.
e
To address this issue, MIME uses a straightforward encoding of binary data into the ASCII character.
The encoding is called base64.The idea is to map every three bytes of the original binary data into four ASCII
in
characters .This is done by grouping the binary data into 24-bit units, and breaking each such unit into four 6-bit
ng
pieces
Each 6-bit piece maps onto one of 64 valid ASCII character; for example, 0 maps onto A, 1 maps onto B, and so
on. If you look at a message that has been encoded using the base 64 encoding scheme, you will notice only the 52
fE
uppercase and lowercase letters ,the 10 digits through 0 to9 ,and the special characters + and /.These are the first 64
values in the ASCII character set.
O
Message Transfer:
SMTP is the protocol used to transfer messages from one host to another. To place SMTP in the right
e
context, we need to identify the key players. First, users interact with a mail reader when they compose, file,
g
search, and read their email. There are countless mail readers available, just like there are many web browsers
le
now include a mail reader. Second, there is a mail daemon running on each host.
You can think of this process as playing the role of a post office: mail readers give the daemon
ol
messages they want to send to others users, the daemon uses SMTP running over TCP to transmit the message
C
into a daemon running on another machine, and the daemon puts incoming messages into the user's mailbox.
Since SMTP is a protocol that anyone could implement, in theory there could be many different implementations
u
of the mail daemon. It runs out, though that the mail daemon running on most hosts is derived from the send mail
ad
MAIL MAIL
READER READER
m
MAIL
GATEWAY
Ta
24
While it is certainly possible that the send mail program on a sender's machine establishes an
SMTP/TCP connection to the send mail program on the recipient's machine, in many cases the mail traverses
one or more mail gateways on its route from the sender's host to the receiver's host. Like the end hosts, these
gateways also run a send-mail process. It's not an accident that these intermediate nodes are called "gateways"
since their job is to store and forward email messages.
Mail Reader:
g
The final step is for the user to actually receive her messages from the mail box, read them, reply to
in
them, and possibly save a copy for future reference .The user performs all the actions by interacting with a mail
er
reader. In many cases ,this reader is just a program running on the same machine as the user's mailbox resides, in
which case it simply reads and writes the file that implements the mailbox
.
e
In other cases ,the user accesses her mailbox from aremote machine using yet another protocol, such as
in
the Post Office Protocol(POP) or the Internet Message Access Protocol(IMAP).
ng
IMAP- Internet Message Access Protocol
fE
IMAP is similar to SMTP in many ways .It is a client/server protocol running over TCP, where the
client (running on the user's desktop machine) issues commands in the form of <CRLF> terminated ASCII text
lines and the mail server(running on the machine that maintains the user's mailbox) responds in-kind.
O
The exchange begins with the client authenticating herself, and identifying the mailbox she wants to
access. This can be represented by the simple state transaction diagram shown in the figure. In this diagram,
e
LOGIN, AUTHENTICATE, SELECT, EXAMINE, CLOSE and LOGOUT are example commands that the
g
client can issue, while OK is one possible server response. Other common commands include FETCH, STORE,
le
DELETE, and EXPUNGE, with the obvious meanings. Additional server responds include NO (client does not
ol
decodes it. In addition to the message itself, IMAP also defines a set of message
u
attributes that are exchanged as part of other commands, independent of transferring the message itself.
ad
iln
m
Ta
<br>
25
Connection established
Server greeting
Not authenticated
(7) (4)
Authenticated
g
(7) (5) (6)
in
Selected
e er
Logout
in
ng
Both sides close the connection
(1)
(2)
(3)
fE
Connection without preauthentication (OK greeting)
Preauthenticated connection (PREAUTH greeting)
Rejected connection (BYE greeting)
(4) Successful LOGIN or AUTHENTICATE Command
O
(5) Successful SELECT or EXAMINE Command
(6) CLOSE command, or failed SELECT or EXAMINE command
LOGOUT command, server shutdown, or connection closed
e
(7)
IMAP State Transition Diagram
g
le
Message attributes include information like the size of the message, but more interestingly, various
ol
flags associated with a message, such as Seen, Answered, Deleted and Recent. These flags are used to keep the
client and server synchronized, that is, when the user deletes a message in the mail reader:, the client needs to
C
report this fact to the mail server. Later, should the user decide to expunge all deleted messages, the client issues
an EXPUNGE command to the server, which knows to actually remove all earlier deleted messages from the
u
mail box.
ad
Finally, note that when the user replies to a message, or sends a new message, the mail reader does not
forward the message from the client to the mail server using IMAP, but it instead uses SMTP .This means that
iln
the user's mail server is effectively the first mail gateway traversed along the path from the desktop to the
recipient's mail box.
m
SMTP Commands: SMTP operations are executed using a series of commands and responses exchanged
Ta
between SMTP server and receiver. Each command consists of a single line text – beginning with 4 letter
command code followed by argument
Command Description
26
g
Receiver sends “220 service ready"
in
Sender sends HELO to identity itself
er
Receiver accepts with "250 okay"
e
2. Mail Transfer: After establishing the connection, SMTP sender sends messages as
in
MAIL command identifying originator of message
ng
RCPT commands identifying recipients of message
DATA command transfers message
S
R:
MAIL FROM abc yahoo.com
250 ok
@
fE
RCPT TO xyz @annauniv.edu
O
S:
R: 250 ok
e
DATA
354 start
g
R:
S:
le
3. Connection closing:
ol
SMTP
SMTP cannot transmit text data including national language characters. MIME translates all these
m
MIME is needed to transfer audio and video through SMTP (i.e.) non text data
<br>
27
Audio application
Domino
Mail
message text types
Image non-ASCI,
rich text
g
in
Complex MIME message content types
e er
in
ng
POP- Post Office Protocol
fE
Post Office Protocol, version3 (POP3) and Internet Mail Access Protocol version4
O
(IMAP4) are protocol used by a mail server in conjunction with SMTP to receive and hold mail for hosts.
e
Functions of POP3.
g
Sends the LIST command to the server, which responds with a maildrop.
u
ad
Invokes a rollback on the POP3 server. The server then performs an undo on message deletion.
Shuts down the connection to the POP3 server. First commit the changes on the server.
28
Retrieves from the server the first nLines lines of the mail with number nMsg.
Retrieves from the server a unique message ID string for message nMsg.
g
in
SMTP internet msg transfer
er
agent pop3 server user agent
pop3
e
in
ng
dial up connection
Sending
Host
mailbox ISP's
machine
fE user's pc
O
10/08/2010 POP3 & IMAP 7
g e
le
ol
POP3 protocol
S: +0K POP3 server ready
C
C: user alice
aut horization phase S: +0K
C: pass hungry
O cient commands:
S: +0K user successtully logged on
u
S: 1 498
O server responses S: 2 912
S:
O+0K
C: retr 1
9-ERR Cmessage 1 contents>
iln
transaction phase,client: S:
C: dele 1
O
list: list message numbers C: retr 2
retr: retrieve message by
m
D Kmessage 1 contents>
number
C: dele 2
O dele: delete
Ta
C quit
O quit S +OK POP3 server signing off
The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data on the World Wide
Web. The protocol transfer all data in the form of plain text, hypertext, audio, video, and so on. However it is
<br>
29
called the hypertext transfer protocol because its efficiency allows its use in a hypertext environment where there
are rapid jumps from one document to another.
HTTP functions ike a combination of FTP and SMTP. It is similar to FTP because it transfers files and
uses the services of TCP. However, it is much simpler than FTP because it uses only data are transferred
between the client and the server.
HTTP is like SMTP because the data transferred between the client and server look like SMTP messages.
In addition, the format of the messages is controlled by MIME-like headers.
However, HTTP differs from SMTP in the way the messages are sent from the client to the server and
from the server to the client. Unlike SMTP, the HTTP messages are not destined to be read by humans; they are
read and interpreted by the HTTP server and HTTP client (browser). SMTP messages are stored and forwarded,
g
but HTTP messages are delivered immediately.
in
The idea of HTTP is very simple. A client sends a request, which looks like mail, to the server. The
er
server sends the response, which looks like a mail reply, to the client. The request and response messages carry
data in the form of a letter with MIME-like format.
e
The commands from the client to the server are embedded in a letter like request message. The contents
in
of the requested file or other information are embedded in a letter like response message.
ng
The core idea of hypertext is that one document can link to another document, and the protocol
(HTTP) and document language (HTML)were designed to meet that goal.
One helpful way to think of the Web is as a set of cooperating clients and servers, all of whom
fE
speak the same language: HTTP.
Most people are exposed to the Web through a graphical client program, or Web browser, like
O
Safari, Chrome, Firefox or Internet Explorer.
Clearly, if you want to organize information into a system of linked documents or objects, you
e
Hence, any Web browser has a function that allows the user to obtain an object by "opening a
le
URL."
URLs (Uniform Resource Locators) are so familiar to most of us by now that it's easy to forget
ol
They provide information that allows objects on the Web to be located, and they look like the
following:
u
http://www.cs.princeton.edu/index.html
ad
If you opened that particular URL, your Web browser would open a TCP connection to the Web
server at a machine called www.cs.princeton.edu and immediately retrieve and display the file
iln
called index.html.
Most files on the Web contain images and text and many have other objects such as audio and
m
30
MESSAGE_BODY <CRLF>
where as before,<CRLF>stands for carriage-return-line-feed.The first line (START LINE)
indicates whether this is a request message or a response message.
Messages
There are two general types of HTTP messages, shown in figure request and response. Both message
types follow almost the same format.
Request Messages
A request message consists of a request line, headers, and sometimes a body.
g
The first line of an HTTP request message specifies three things:
in
i. operation to be performed,
er
ii. Web page the operation should be performed on, and
iii. version of HTTP being used.
e
Although HTTP defines a wide assortment of possible request operations- including
in
"write" operations that allow a Web page to be posted on a server the two most common
operations are GET (fetch the specified Web page) and HEAD (fetch status information
ng
about the specified Web page).
HTTP request operations
fE
Operation Description
OPTIONS Request information about available options
O
GET Retrieve document identified in URL
HEAD Retrieve metainformation about document identified in URL
e
TRACE Loopback
Response Message
u
indicating whether or not the request was successful, and a text string giving the
reason for the response.
m
31
The World Wide Web has been so successful and has made the Internet accessible to so many
people that sometimes it seems to be synonymous with the Internet.
In fact, the design of the system that became the Web started around 1989, long after the Internet
had become a widely deployed system.
The original goal of the Web was to find a way to organize and retrieve information, drawing on
ideas about hypertextinterlinked documentsthat had been around since at least the 1960s.
g
Hypertext and Hypermedia
in
The WWW uses the concept of hypertext and hypermedia. In a hypertext environment, information is stored in a
er
set of documents that are linked together using the concept of pointers. An item can be associated with another
document using a pointer.
The reader who is browsing through the document move to other documents by choosing (clicking) the items that
e
are linked to other documents. Figure shows the concept of hypertext.
in
Whereas hypertext documents contain only text, hypermedia documents can contain pictures, graphics, and sound.
A unit of hypertext or hypermedia available on the Web is called a page. The main page for an organization or an
ng
individual is known as a homepage.
I The first part of a URI is a scheme that names a particular way of identifying a certain
g
kind of resource, such as mailto for email addresses or file for file names.
le
The second part ofa URI, separated from the first part by a colon, is the scheme-specific part.
ol
A client that wants to access a document needs an address. To facilitate the access of documents
distributed throughout the world, HTTP uses the concept of locators. The uniform resource locator (URL) is a
u
Host computer
m
Port
Path
Ta
The method is the protocol used to retrieve the document, for example HTTP. The host is the computer
where the information is located, although the name can be an alias. Web pages are usually stored in computers,
and computers are given alias names that usually begin with the characters www". This is not mandatory,
however, as the host can be any name given to the computer that hosts the web page.
The URL optionally can contain the port number of the server. If the port is included, it should be
inserted between the host and the path, and it should be separated from the host by a colon.
Path is the pathname of the file where the information is located. Note that the path can itself contain
slashes that, in the UNIX operating system, separate the directories from subdirectories and files.
<br>
32
TCP Connections
The original version of HTTP (1.0) established a separate TCP connection for each data item retrieved
from the server.
It's not too hard to see how this was a very inefficient mechanism: connection setup and teardown
messages had to be exchanged between the client and server even if all the client wanted to do was verify
that it had the most recent copy of a page.
Thus, retrieving a page that included some text and a dozen icons or other small graphics would result in
13 separate TCP connections being established and closed.
g
in
HTTP 10 behavior
er
Client Server
e
SYN
in
SYN +ACK
ng
HTTP Get
Server processes
fE
HTTP Response request
SYN+ACK
g
le
HTTP Get
Server processes
ol
FIN
u
To overcome this situation, HTTP version 1.1 introduced persistent connections- the client and
ad
server can exchange multiple request/response messages over the same TCP connection.
Persistent connections have many advantages.
iln
First, they obviously eliminate the connection setup overhead, thereby reducing the
load on the server, the load on the network caused by the additional TCP packets,
m
33
Client Server
HTTP Get
Server processes
HTTP Response request
Client parses
response
HTTP Get
Server processes
g
HTTP Response request
in
er
HTTP 1.l behavior with persistent connections
e
Caching
in
One of the most active areas of research (and entrepreneurship) in the Internet today is how to effectively
cache Web pages.
ng
Caching has many benefits. From theclient's perspective, a page that can be retrieved from a ncarby
cache can be displayed much more quickly than if it has to be fetched from across the world.
fE
From the server's perspective, having a cache intercept and satisfy a request reduces the load on the
server.
O
Caching can be implemented in many different places. For example, a user's browser can cache recently
accessed pages, and simply display the cached copy if the user visits the same page again.
e
This allows users to take advantage of pages previously downloaded by other users.
le
behalf of the site, and they configure their browsers to connect directly to the caching host. This node is
C
WEB SERVICES
ad
Much of the motivation for enabling direct application-to-application communication comes from the
business world. Historically, interactions between enterprises--businesses or other organizations have
iln
involved some manual steps such as filling out an order form or making a phone call to determine whether some
product is in stock. Even within a single enterprise it is common to have manual steps between software systems
m
An ordering application at enterprise A would send a message to an order fulfillment application at enterprise B,
which would respond immediately indicating whether the order can be filled. Perhaps, if the order cannot be
filled by B, the application at A would immediately order from another supplier, or solicit bids from a collection
of suppliers.
Amazon and FedEx had to have a protocol for exchanging the information needed to track packagescall it
the Package Tracking Protocol.
34
Both architectures are called Web Services, taking their name from the term for the individual
applications that ofer a remotely-accessible service to client applications to form network applications.
The terms used as informal shorthand to distinguish the two Web Services architectures are SOAP(Simple Object
Access Protocol) and REST(Representational State Transfer ) (as in, "the SOAP vs. REST debate").
The SOAP architecture's approach to the problem is to make it feasible, at least in theory, to generate
protocols that are customized to each network application.
The key elements of the approach are a framework for protocol specification, software toolkits for
automatically generating protocol implementations from the specifications, and modular partial
specifications that can be reused across protocols.
The REST architecture's approach to the problem is to regard individual Web Services as World Wide
g
Web resources-identified by URIs and accessed via HTTP.
in
Essentially, the REST architecture is just the Web architecture.
The Web architecture's strengths include stability and a demonstrated scalability (in the network-size sense).
er
1.Custom Application Protocols (WSDL, SOAP)
e
The architecture informally referred to as SOAP is based on Web Services Description Language
in
(WSDL) and SOAP.4
Both of these standards are issued by the World Wide Web Consortium (W3C).
ng
This is the architecture that people usually mean when they use the term Web Services without any
preceding qualifier.
fE
WSDL and SOAP are frameworks for specifying and implementing application protocols and transport protocols,
respectively. They are generally used together, although that is not strictly required. WSDL is used to specify
application-specific details such as what operations are supported, the formats of the application data to invoke or
O
respond to those
operations, and whether an operation involves a response. SOAP's role is to make it easy to define a transport
e
protocol with exactly the desired semantics regarding protocol features such as reliability and security.
g
WSDL has chosen a procedural operation model of application protocols. An example from W3C's WSDL
ol
Primer is a hotel reservation Web Service with two operations, CheckAvailability andMakeReservation. Each
C
that in practice only two MEPs are being used: In-Only (a single
ad
message from client to service) and In-Out (a request from client and a corresponding reply fromservice). These
patterns should be very familiar,and suggest that the costs of supporting MEP flexibility perhaps outweigh the
iln
benefits wSDL nicely separates the parts of a protocol that can be specified abstractly-operations, MEPs,
abstract message formats-from the parts that must be concrete. WSDL's concrete part specifies an underlying
m
protocol, how MEPs are mapped onto it, and what bit-level representation is used for messages on the wire. This
part of a specification is known as a binding, although it is better described as an implementation, WSDL
Ta
modularity should be familiar to anyone who has developed moderately large pieces of software. A WSDL
document need not be a complete specification; it could, for example, define a single message format.
The partial specifications are uniquely identified using XML Namespaces each WSDL document specifies the
URI of a target namespace, and any new definitions in the document are named in the context of that
namespace. One WSDL document can incorporate components
of another by including the second document if both share the same target namespace or importing it if the target
namespaces differ.
Defining Transport Protocols
<br>
35
SOAP provides a simple messaging framework whose core functionality is concerned with providing
extensibility." SOAP uses many of the same strategies as WSDL, including message formats defined using XML
Schema, bindings to underlying protocols, Message Exchange Patterns, and reusable specification elements
identified using XML namespaces.
SOAP 1.2 introduced a feature abstraction, which the specification describes thus: A SOAP feature is an
extension of the SOAP messaging framework. Although SOAP poses no constraints on the potential scope of
such features, example features may include "reliability," "security,"
"correlation, " "routing, " and message exchange patterns (MEPs) such as request/response, one-way, and peer
to-peer coversations. A SOAP feature specification must include:
g
# A URI that identifies the feature
in
#The state information and processing, abstractly described, that is required at each SOAP node to implement
the feature
er
# The information to be relayed to the next node
# If the
feature is a MEP, the life cycle and temporal/causal relationships of the messages exchangedfor
e
example, responses follow requests and are sent to the originator of the request The second and more flexible
in
way to implement features involves header blocks. A SOAP message consists of an Envelope, which contains a
Header that contains header blocks, and a Body, which contains the payload destined for the ultimate receiver.
ng
This message structure is
illustrated in Figure
fE
Envelope
O
Header
Header biock
e
Header biock
g
le
Body
ol
C
wSDL and SOAP aren't protocols; they are standards for specifying protocols. For different enterprises
ad
to implementWeb Services that interoperate with each other., it is not enough to agree to use WSDL and SOAP
to define their protocols; they must agree on standardize specific protocols. This tension between
iln
standardization and customization is tackled by establishing partial standards called profiles. A profile is a set of
guidelines that narrow or constrain choices available in WSDL, SOAP, and other standards that may be
m
referenced in defining a protocol. They may at the same time resolve ambiguities or gaps in those standards. In
practice, a profile often formalizes an emerging de facto standard. The broadest and most widely adopted profile
Ta
is known as the WS-I Basic Profile. It was proposed by the Web Services Interoperability Organization (WS-I),
an industry consortium, while WSDL and SOAP are specified by the World Wide Web Consortium (W3C). The
WS-I Basic Security Profile adds security constraints to the Basic Profile by specifying how the SSL/TLS layer is
to be used and requiring conformance to WS-Security
2.A Generic Application Protocol (REST)
The WSDL/SOAP Web Services architecture is based on the assumption that the best way to integrate
applications across networks is via protocols that are customized to each application. That architecture is
designed to make it practical to specify and implement all those protocols. In contrast,the REST Web Services
architecture is based on the assumption that the best way to integrate applications across networks is by re
<br>
36
applying the model underlying the World Wide Web architecture. This model, articulated byWeb architect Roy
Fielding, is known as Representational State Transfer (REST). There is no need for a new REST architecture for
Web Services-the existing Web architecture is sufficient, although a few extensions are probably necessary.
The representation of a resource state is abstract; it need not resemble how the resource is actually implemnented
by a particularWeb Service instance. It is not necessary to transmit a complete resource state in each message.
The size of messages can be reduced by transmitting just the parts of a state that are of interest (e.g., just the
parts that are being modified). And, because Web Services share a single protocol and address space with other
web resources, parts of states can be passed by reference-by URIeven when they are otherWeb Services.
This approach is best summarized as a data-oriented or documentpassing style, as opposed to a procedural style.
Defining an application protocol in this architecture consists of defining the document structure (i.e., the state
representation). XML and the lighter-weight JavaScript Object Notation (JSON) are the most frequently used
g
.
presentation languages In contrast with wSDL'SOAP, the Web has had time for standards to stabilize and to
in
demonstrate that it scales very well. It also comes with some security in the form of Secure Socket Layer
(SSL)/Transport Layer Security (TLS). The Web and REST may also have an advantage in
er
evolvability.Although the WSDL and SOAP frameworks are highly flexible with regard to what new features
and bindings can go into the definition of a protocol, that flexibility is irrelevant once the protocol is defined.
e
in
DNS(Domain name System) -Name Service
ng
It is not an application that users invoke explicitly, but an application that all other network applications depend
on. It is used to translate host names into host addresses. We have been using address to identify hosts. While
fE
perfectly suited for processing by routers, addresses are not exactly user friendly. It is for this reason that a
unique name is also typically assigned to each host in a network.
O
Host names differ from host addresses in two important ways.
First, they are usually of variable length and mnemonic, thereby making them easier for
e
humans to remember.
g
Second, names typically contain no information that helps the network locate (route
le
A name space can be either flat (names are not divisble into components), or it
can be hierarchical (Unix file names are an obvious exanple).
u
Second, the naming system maintains a collection of bndings of names to values. The
ad
value can be anything we want the naming system to return when presented with a name;
in many cases it is an address.
iln
Finally, a resolution mechanismn is a procedure that, when invoked with a name, returns the corresponding value.
A name server is a specific implementation of a resolution mechanism that is available on a network and that can
m
37
User 1
2
cs.princeton.edu [email protected]
Name Mail
server program
192.12.69.5 192.12.69.5 4
3
TCP
g
in
192.12.69.5 5
e er
IP
in
ng
Names translated into addresses, where the numbers 1 to 5 show the sequence of steps in the process.
fE
A naming service can be developed to map user-friendly names into router-friendly addresses. Name
services are sometimes called middleware because they fill a gap between applications and the underlying
O
network.
Host names differ from host addresses in two important ways. First, they are usually of variable length
and mnemonic, thereby making them easier for humans to remember. (In contrast, fixed-length numeric
e
addresses are easier for routers to process).Second, names typically contain no information that helps the
g
network locate (route packets toward) the host. Addresses, in contrast, sometimes have routing information
le
embedded in them; flat addresses (those not divisible into component parts) are the exception.
ol
A namespace defines the set of possible names. A namespace can be either flat (names are not divisible
into components), or it can be hierarchical.
C
The naming system maintains a collection of bindings of names to values. The value can be anything we
want the naming system to return when presented with a name; in many cases it is an address.
u
A resolution mechanism is a procedure that, when invoked with a name, returns the corresponding
ad
value. A name server is a specific implementation of a resolution mechanism that is available on a network and
that can be queried by sending it a message.
iln
What happens in the Internet is that a user presents a host name to an application program, and this
program encages the naming system to translate this name into a host address. The application then opens a
m
connection to this host by presenting some transport protocol with the host's IP address.
Ta
DOMAIN HIERARCHY:
DNS implements a hierarchical name space for Internet objects. Unlike Unix file names, which
are processed from left to right with the naming components separated with slashes, DNS names are processed
from right to left and use periods as the separator.
Like the Unix file hierarchy, the DNS hierarchy can be visualized as a tree, where each node in
the tree corresponds to a domain, and the leaves in the tree correspond to the hosts being named.
DNS names are processed from right to left and use periods as the separator. An example domain name
a
for host is cicada.cs.princeton.edu.
<br>
38
DNS employs a hierarchical namespace rather than a flat namespace, and the "table" of bindings that
implements this namespace is partitioned into disjoint pieces and distributed throughout the Internet. These sub
tables are made available in name servers that can be queried over the network.
There are domains for each country, plus the "big six" domains: .edu, .com, -gov, .mil, .org, and
.net.
princeton
... mit cisco
.. yahoo nasa .. nsf arpa navy acm ... ieee
g
in
CS ee physics
er
ux01 ux04
e
in
Example of a domain hierarchy.
ng
NAME SERVERS:
The first step is to partition the hierarchy into sub trees called zones. Each zone can be thought of as
fE
coresponding to some administrative authority that is responsible for that portion of the hierarchy.
Within this zone, some department is a zone want the responsibility of managing the hierarchy (and so
O
they remain in the university-level zone), while others, like the Department of Computer science, manage their
own department-level zone.
e
The relevance of a zone is that it corresponds to the fundamental unit of implementation in DNS -the
g
name server. Specifically, the information contained in each zone is implemented in two or more name servers.
le
Each name server, in turn, is a program that can be accessed over the Internet. Clients send queries to
name servers, and name servers respond with the requested information. Sometimes the response contains the
ol
final answer that the client wants, and sometimes the response contains a pointer to another that the client should
C
query next.
u
Each name server implements the zone information as a collection of resource records. In essence, a
ad
resource record is a name-to-value binding, or more specifically, a 5-tuple that contains the following fields:
< Name, Value, Type, Class, TTL >
iln
The Name and Value fields are exactly what you would expect, while the Type field specifies
how the Value should be interpreted. For example, Type=A indicates that the Value is in IP address. Thus, A
m
39
ml ora net uk
e AAAAAAAAA
physics
X01UD4
g
NS: The Value field gives the domain name for a host is running a name server that knows
in
how to resolve names within the specified domain.
er
CNAME: the Value field gives the canonical name for a particular host; it is used to
define aliases.
e
MX: The Value field gives the domain name for a host that is running a mail server that
in
accepts the messages for the specified domain.
ng
The Class field was included to allow entities other than the NIC to define useful record types. To date,
the only widely used Class is the one used by the Internet; it is denoted IN. Finally, the TTL field shows how
fE
long this resource record is valid. It is used by servers that cache resource records from other servers; when the
TTL expires, the server must evict the record from its cache.
O
Root
name server
g e
le
ol
CS EE
ad
NAME RESOLUTION
It is a procedure to invoke by giving name as input and returns address as output.
Ta
This local name server, in turn, has resource records for one or more of the root servers, for example:
< 'root', a.root-servers.net,NS,IN>
<
a.root-servers.net, 198.41.0.4,A,IN>
Thus, resolving a name actually involves a client querying the local server, which in turn acts as a client that
queries the remote servers on the original client's behalf. This results in the client/server interactions illustrated
in Figure
<br>
40
ROOT
jerald.cs.princeton.edu NAME
SERVER
128,196.12835
4+jerald.cs.princetonedu
princeton,edu, EDU
1: NAME
SERVER
,192.12.69.5
1: jerald.es.princetonedu
LOCAL
CLIENT NAME
6:jerald.cs.princetonedu
SERVER
g
66 8:jerald.
128.112.155.1
in
PRINCETON
cs.princetonedu NAME
9:128.112.
er
-60
158.166
e
in
CS
ng
NAME
SERVER
Name resolution in practice, where the numbers 1 to 10 show the sequence of steps in the process.
fE
SIMPLE NETWORK MANAGEMENT PROTOCOL (SNMP)
O
A network is a complex system, both in terms of the number of nodes that are involved and in terms of the
suite of protocols that can be running on any one node.
e
Even if you restrict yourself to worrying about the nodes within a single administrative domain, such as a
g
campus, there might be dozens of routers and hundredsor even thousands-of hosts to keep track of. If you
le
think about all the state that is maintained and manipulated on any one of those nodesfor example, address
translation tables, routing tables, TCP connection state, and so on then it is easy to become depressed about the
ol
printers, modem racks, and more. It is used mostly in network management systems to monitor network-attached
ad
GET and SET. The former is used to retrieve a piece of state from some node, and the latter is used to store a
new piece of state in some node.
m
This client program usually has a graphical interface. Whenever the administrator selects a certain
piece of information that he or she wants to see, the client program uses SNMP to request that
information from the node in question. (SNMP runs on top of UDP.)
An SNMP server running on that node receives the request, locates the appropriate piece of
information, and returns it to the client program, which then displays it to the user.
Request syntax is ASN.I BER
<br>
41
EX: The string 1.3.6.1.2.4.3 points to the real-time value IPinReceives, The string 1.3.6.1.2 refers to the specific
hardware being monitored and is provided by the vendor. The 4 refers to the IP group and the 3 refers to the
third value in the group.
GET-NEXT
Functions as a GET but returns the string pointing to the next possible MIB value in addition to the value of the
string in the GET-NEXT.
An SNMP-managed network consists of three key components:
Managed device
Agent- software which runs on managed devices
Network management system (NMS) software which runs on the manager
g
A
managed device is a network node that implements an SNMP interface that allows unidirectional (read-only)
in
or bidirectional access to node-specific information. Managed devices exchange node -specific information with
er
the NMSs.
An agent is a network-management software module that resides on a managed device. An agent has local
e
knowledge of management information and translates that information to or from an SNMP specific form.
in
A network management system (NMS) executes applications that monitor and control managed devices. NMSs
provide the bulk of the processing and memory resources required for network management. One or more NMSs
ng
may exist on any managed network.
Management information base (MIB) fE
SNMP itself does not define which information (which variables) a managed system should offer. Rather,
SNMP uses an extensible design, where the available information is defined by management information bases
O
(MIBs). MIBs describe the structure of the management data of a device subsystem; they use a hierarchical
namespace containing object identifiers (OID). Each OID identifies a variable that can be read or set via SNMP.
e
1.
System parameters,
le
Interface parameters,
iii. Address Translation,
ol
iv. IP
C
V TCP statistics,
vi. UDP statistics,
u
vi. ICMP,
ad
viii. EGP,
ix. SNMP
X. media
iln
m
Ta
<br>
42
Management Management
Information Base SNMP Community Information Base
(MIB) (MIB)
SNMP SET
g
SNMP TRAP (ALERT)
in
e er
in
SNMP Agents
ng
Router
SNMP
Manager SNMP
fE
Server
O
9t Multilayer
e
Switch
g
le
ol
C
You can think of this interface as playing the same role as a Web browser.
ad
Whenever the administrator selects a certain piece of information that he or she wants to see, the client program
uses SNMP to request that information from the node in question.
An SNMP server running on that node receives the request, locates the appropriate piece of information, and
iln
How does the server know which variable in memory to read to satisfy the request?
o
The answer is that SNMP depends on a companion specification called the management information base
Ta
(MIB).
The MIB defines the specific pieces of informationthe MIB variables that you can retrieve from a
network node.
The current version of MIB, called MIB-II, organizes variables into 10 different groups.
Some examples of the groups are:
1. System: general parameters of the system (node) as a whole, including where the node is located, how
long it has been up, and the system's name.
2. Interfaces: information about all the network interfaces (adaptors) attached to this node, such as the
physical address of each interface, how many packets have been sent and received on each interface.
3. Address translation: information about the Address Resolution Protocol (ARP), and in particular, the
contents of its address translation table.
<br>
43
4. IP: variables related to IP, including its routing table, how many datagrams it has successfully
forwarded, and statistics about datagram reassembly. Includes counts of how many times IP drops a
datagram.
5. TCP: information about TCP connections, such as the number of passive and active opens, the number
of resets, the number of timeouts, default timeout settings, and so on.
6. UDP: information about UDP traffic, including the total number of UDP datagrams that have been
sent and received.
There are also groups for ICMP, EGP, and SNMP itself. The 10th group is used by different media.
g
in
e er
in
ng
fE
O
g e
le
ol
C
u
ad
iln
m
Ta