Updated CN Course File PDF
Updated CN Course File PDF
Computer Networks
Course File
Index
S.No. Topics
1. Course Syllabus
3. Tutorial Sheets
4. Assignment Sheets
5. Quiz Sheets
6. Term Question Papers with Solutions
8. Notes/Study Materials
Course Syllabus
Prerequisite:FundamentalsofComputer&Programming,
Module Teaching
Content
No. Hours
Introduction Concepts: Goals and Applications of Networks, Network structure and
architecture, The OSI reference model, services, Network Topology Design, connecting
devices, Physical Layer Transmission Media, Line coding scheme, Basic idea of
modulation and multiplexing, Switching methods.
Medium Access sub layer: Medium Access sub layer - Channel Allocations,
LAN protocols - ALOHA protocols, CSMA, CSMA/CD, Overview of IEEE standards 13
I
Data Link Layer – HDLC and point to point protocol, Error detection and correction,
Flow control (sliding window protocol)
Text Book:
Forouzan B. A. (2004), “Data Communication and Networking”, 4th Edition, McGrawHill.
References:
Kurose, J.F. and Ross K.W. (2005), “Computer Networking: A Top-Down Approach Featuring the
Internet”, 3rd Edition, Addison-Wesley.
A.S.Tanenbaum (2006), “Computer Networks”, 2nd Edition, Prentice Hall India.
Outcome
After the completion of the course, the student will be able to:
Understand the terminology and concepts of the OSI reference model and the TCP/IP reference model.
Apply the concepts of protocols, network interfaces, and design/performance issues in local area
networks and wide area networks.
Tutorial Sheet - I
Course:B.Tech (CSE) Year/Semester:IV Session: 2017-2018
Subject Name & Code: Computer Networks (CSE 4003)
Max. Marks: Time allowed:
Note/Instruction (If any)
Q1. Five equal-size datagrams belonging to the same message leave for the destination one after
another. However, they travel through different paths as shown in Table
Q2. The attenuation of a signal is -10 dB. What is the final signal power if it was originally 5
W?
Q3. A signal has a wavelength of 1 micrometer in air. How far can the front of the wave travel
during 1000 periods?
Q5.If the bandwidth of the channel is 5 Kbps, how long does it take to send a frame of
100,000 bits out of this device?
Q6. What is the transmission time of a packet sent by a station if the length of the Packet is 1
million bytes and the bandwidth of the channel is 200 Kbps?
Tutorial Sheet - II
Course: B.Tech (CSE) Year/Semester: IV Session: 2017-2018
Subject Name & Code: Computer Networks (CSE 4003)
Max. Marks: Time allowed:
Note/Instruction (If any)
Q1. Suppose four active nodes—nodes A, B, C and D—are competing for access to a channel
using slotted ALOHA. Assume each node has an infinite number of packets to send. Each
node attempts to transmit in each slot with probability p. The first slot is numbered slot 1, the
second slot is numbered slot 2, and so on.
a. What is the probability that node A succeeds for the first time in slot 5?
b. What is the probability that some node (either A, B, C or D) succeeds in slot 4?
c. What is the probability that the first success occurs in slot 3?
d. What is the efficiency of this four-node system?
Q2. Suppose Host A wants to send a large file to Host B. The path from Host A to Host B has
three links, of rates
R1 = 500 kbps, R2 = 2 Mbps, and R3 = 1 Mbps.
a. Assuming no other traffic in the network, what is the throughput for the file transfer?
b. Suppose the file is 4 million bytes. Dividing the file size by the throughput, roughly how long
will it take to transfer the file to Host B?
c. Repeat (a) and (b), but now with R2 reduced to 100 kbps.
Q3.How long does it take a packet of length 1,000 bytes to propagate over a link of distance
2,500 km, propagation speed 2.5 · 108 m/s, and transmission rate 2 Mbps? More generally, how
long does it take a packet of length L to propagate over a link of distance d, propagation speed
s, and transmission rate R bps? Does this delay depend on packet length? Does this delay depend
on transmission rate?
Q4.In modern packet-switched networks, including the Internet, the source host segments long,
application-layer messages (for example, an image or a music file) into smaller packets and
sends the packets into the network. The receiver then reassembles the packets back into the
original message. We refer to this
process as message segmentation. Figure 1.27 illustrates the end-to-end transport of a message
with and without message segmentation. Consider a message that is 8 · 106 bits long that is to
be sent from source to destination in Figure 1.27. Suppose each link in the figure is 2 Mbps.
Ignore propagation, queuing, and processing delays.
a. Consider sending the message from source to destination without message segmentation. How
long does it take to move the message from the source host to the first packet switch? Keeping
in mind that each switch uses store-and-forward packet switching, what is the total time to move
the message from source host to destination host?
b. Now suppose that the message is segmented into 800 packets, with each packet being 10,000
bits long. How long does it take to move the first packet from source host to the first switch?
When the first packet is being sent from the first switch to the second switch, the second packet
is being sent from the source host to the first switch. At what time will the second packet be
fully received at the first switch?
Q5. If the peak voltage value of a signal is 20 times the peak voltage value of the noise,
what is the SNR? What is the SNR DB?
Q6.We measure the performance of a telephone line (4 KHz of bandwidth). When the signal is
10 V, the noise is 5 mV. What is the maximum data rate supported by thistelephone line?
Q6.Assuming even parity, find the parity bit for each of the following data units.
a. 1001011
b. 0001100
c. 1000000
d. 1110111
Q3.What is the first address of a block of classless addresses if one of the addresses is
12.2.2.127/28?
Q4.An organization is granted a block of classless addresses with the starting address
199.34.32.0/27. How many addresses are granted?
Q5.If 5 is the number of bits for the sequence number, find the efficiency of Go-Back N and
Selective repeat protocol, for transmission time of 1ms and propagation time of 1.5ms.
Q1.An organization is granted the block 21.17.18.10/25. The administrator wants to create 3
subnets each of size 64, 32 and 32.Find the subnet mask. Also find the first address and last
address of each subnet.
Q2.Derive the relationship between transmission time and propagation time in Stop and Wait
ARQ for efficiency greater than 75%.Also find the minimum size of frame.
Q3.Suppose the seven bit dataword 1101011 is to be encoded using an even-parity Hamming
code. What is the binary value after encoding? Now assume that the 9th bit got corrupted during
transmission. Find the error correcting codes.
Q4.Why the sender window size in Go-Back N ARQ is less than 2m .Explain with a suitable
example.
Q6.Suppose the seven bit dataword 1010011 is to be encoded using an even-parity Hamming
code. What is the binary value after encoding? Now assume that the 9th bit got corrupted during
transmission. Find the error correcting codes.
Q1.Consider a network with six routers A,B,C,D,E and F. Distance vector routing is used to
route the packets. Suppose the following routers have sent the distance vectors to router B: from
C(6,1,9,13,6),from D(17,13,6,10,11) and F(4,3,8,9,13).The measured distance to C,D and F are
5,3 and 4.What is B’s new routing table.
Q2.Write the rules for creating a CIDR block. For a destination address 20.27.7.130 and the
subnet mask 255.255.128.0.What is the subnet address and how many host per subnet are
possible.
Q3.Explain the concept of link state routing.ApplyDijkastra’s Algorithm on the given network
having seven routers. Find the routing table for router v1?
Q5. Find CRC if dataword is 110011 and generator polynomial is 11001.What is codeword sent
by sender? Also explain the working at receiver site.
Q6. Calculate the checksum for a text of 8 characters ("Forouzan"). Also explain the working at
receiver site.
Q1. Show the entries for the header of a UDP user datagram that carries a message froma TFTP
client to a TFTP server. Fill the checksum field with Os. Choose an appropriateephemeral port
number and the correct well-known port number. The lengthof data is 40 bytes. Show the UDP
packet, using the format in Figure 23.9.
Q2. An SNMP client residing on a host with IP address 122.45.12.7 sends a message toan SNMP
server residing on a host with IP address 200.112.45.90. What is the pairof sockets used in this
communication?
Q3. A TFTP server residing on a host with IP address 130.45.12.7 sends a message to aTFTP
client residing on a host with IP address 14.90.90.33. What is the pair ofsockets used in this
communication?
Q4. A client has a packet of 68,000 bytes. Show how this packet can be transferred byusing only
one UDP user datagram.
Q5. A client uses UDP to send data to a server. The data are 16 bytes. Calculate the efficiencyof
this transmission at the UDP level (ratio of useful bytes to total bytes).
Q1. What is the difference between local and remote log-in in TELNET?
Q1. What is an advantage of a hierarchical name space over a flat name space for a systemthe
size of the Internet?
Q2. What is the difference between a primary server and a secondary server?
Q3. What are the three domains of the domain name space?
Q1. What is the difference between a port address, a logical address, and a physical
address?
Q2. Name some services provided by the application layer in the Internet model.
Q3. How do the layers of the Internet model correlate to the layers of the OSI model?
Q4. What is the relationship between period and frequency?
Q5. What does the amplitude of a signal measure? What does the frequency of a signal
measure? What does the phase of a signal measure?
Q6. How can a composite signal be decomposed into its individual frequencies?
Q7. What is the position of the transmission media in the OSI or the Internet model?
Q1. Briefly describe the services provided by the data link layer.
Q3. Compare and contrast byte-oriented and bit-oriented protocols. Which category
has been popular in the past (explain the reason)? Which category is popular now
(explain the reason)?
Q4. Compare and contrast byte-stuffing and bit-stuffing. Which technique is used in
byte-oriented protocols? Which technique is used in bit-oriented protocols?
Q5. Explain why most of the addresses in class A are wasted. Explain why a medium-size
or large-size corporation does not want a block of class C addresses.
Q6. What is a mask in IPv4 addressing? What is a default mask in IPv4 addressing?
Q7. What is the network address in a block of addresses? How can we find the network
address if one of the addresses in a block is given?
Q8. Briefly define subnetting and supemetting. How do the subnet mask and supemet
mask differ from a default mask in classful addressing?
Q1. In cases where reliability is not of primary importance, UDP would make a goodtransport
protocol. Give examples of specific cases.
Q2. Are both UDP and IP unreliable to the same degree? Why or why not?
Q3. Do port addresses need to be unique? Why or why not? Why are port addresses shorter than
IP addresses?
Q4. What is the dictionary definition of the word ephemeral? How does it apply to the concept
of the ephemeral port number?
Q7. What is the minimum size of the process data that can be encapsulated in a UDP datagram?
Q8. What is the maximum size of the process data that can be encapsulated in a UDPdatagram?
Q9. Compare the TCP header and the UDP header. List the fields in the TCP headerthat are
missing from UDP header. Give the reason for their absence.
4.Frequency of failure and network recovery time after a failure are measures of the _______ of
a network.
A. Performance B. Reliability C. Security D. Feasibility
ANSWER: B
6. ________ defines how a particular pattern to be interpreted, and what action is to be taken
based on that interpretation
A. Semantics B. Syntax C. Timing D. None of the above
ANSWER: A
7.To deliver a message to the correct application program running on a host, the _______
address must be consulted.
A. port B. physical C. IP D. none
ANSWER: A
8.Which encoding method uses alternating positive and negative values for 1s?
A. NRZ-I B. RZ C. Manchester D. AMI
ANSWER: D
10.The word ______ refers to the portion of a _______ that carries a transmission.
A. channel; link B. link; channel C. line; channel D. line; link
ANSWER: A
Q2.If the IP is 193.1.2.3, Sm= 255.255.255.240. Then number of subnets possible are
A. 32 B. 64 C. 16 D. 256
Q7.An organization has a class-B network and wishes to form subnets for 24 departments. The
subnet mask would be:
A. 255.255.224.0 B 255.255.240.0 C. 255.255.248.0 D. NONE
Q8.In IP4 addressing format, the number of networks allowed under Class-C address is
(a) 2^32 (b) 2^16 (c) 2^14 (d) 2^7
Q9.If ‘K is the maximum number of bits available in sequence number field, then what is the
maximum sender window size in GBN.
(a) 2^K-1 (b) 2^K-1 (c) 2^K (d) 2^K + 1
4. TELNET:
(A) Allows user to connect client machine (B) Transferring files
(C) Sharing files (D) None of these
9. If a server has no clue about where to find the address for a hostname then:
(A) Server asks to the root server (B) Server asks to the adjacent server
(C) Request is not processed (D)Waits for getting address automatically
10. Mail access starts with client when user needs to download e-mail from the:
(A) Mail Box (B) Mail Server (C) IP Server (D) Interne
Note: Attempt all questions from Section-A, any three from Section-B and any three from
Section-C.
Section-A
Note: Attempt all Questions (1X5=5)
Q1.In a digital transmission, the sender clock is 0.3 percent faster than the receiver clock. How
many extra bits does the sender send if the data rate is 2 Mbps?.
Q2.What are the values of SNR and SNR dB for a noiseless channel?
Q4. What do you mean by flow control and Access Control mechanism?
Q5. Assume that a voice channel occupies a bandwidth of 4 kHz. We need to multiplex 10 voice
channels with guard bands of 500 Hz using FDM. Calculate the required bandwidth.
Section-B
Note: Attempt any three questions (2x3=6)
Q1. Calculate the Shannon Capacity for extremely noisy channel. Suppose a signal travels
through a transmission medium from point P1 to point P2 and its voltage is reduced to one half.
Calculate the attenuation in dB.
Q2. Explain the relationship between the bit rate and baud rate in the analog transmission of
digital data. An analog signal has a bit rate of 4000 bps and a baud rate of 500 baud. How many
data elements are carried by each signal element? How may signal elements do we need?
Q3.What are the responsibilities of Data Link layer and Network layer in OSI Model.
Q4.A slotted ALOHA network transmits 400 bit frames using a shared channel with a 400 kbps
bandwidth. The network contains 100 stations. What is the number of frames/sec each station
can send to achieve maximum efficiency? Also explain the vulnerable period in slotted
ALOHA.
Section-C
Note: Attempt any three questions (3x3=9)
Q3. What do we mean when we say that a bridge can filter traffic? Let’s consider the operation
of a learning switch in the context of a network in which 6 nodes labeled A through F are star
connected into an Ethernet switch. Suppose that (i) B sends a frame to E, (ii) E replies with a
frame to B, (iii) A sends a frame to B, (iv) B replies with a frame to A. The switch table is
initially empty. Show the state of the switch table before and after each of these events. For each
of these events, identify the link(s) on which the transmitted frame will be forwarded, and briefly
justify your answers.
Note: Attempt all questions from Section-A, any three from Section-B and any three from
Section-C.
Section-A
Note: Attempt all Questions (1X5=5)
Q1. Find the range of addresses in a block of classless addresses if one of the addresses is
200.17.21.135/27
Q2.If the subnet mask is 255.255.255.128, which address class it corresponds to?
Q3. Out of HDLC and PPP, which one is byte-oriented; which one is bit-oriented?
Q4.A sender sends a series of packets to the same destination using 6-bit sequence numbers. If
the sequence number starts with 0, what is the sequence number after sending 137 packets?
Q5. If we have k bits in sequence number field, then what is the size of sender window and
receiver window in GoBack N protocol?
Section-B
Note: Attempt any three questions (2x3=6)
Q1. Show that the sender window size in GoBack N protocol with m=2 (where m represents the
bits in sequence number field) can be 3 but not equal to 4.
Q2. Given thedataword 1010011110 and the divisor 10111.Show the generation of the
codeword at the sender site (using binary division). Show the checking of the codeword
at the receiver site (assume no error).
Q3. Suppose the seven bit data word 1101110 is to be encoded using an even-parity Hamming
code. What is the binary value after encoding? Now assume that the 6th bit got corrupted
during transmission. Find the error correcting codes.
Section-C
Note: Attempt any three questions (3x3=9)
DEPARTMENT OF COMPUTER ENGINEERING & APPLICATIONS
Course File
COMPUTER NETWORKS
Q1.Consider the network shown below, and assume that each node initially knows the costs to
each of its neighbors. Consider the distance-vector algorithm and show the distance table entries
at node z.
Q2.An organization is granted a class C network 210.1.2.0. The administrator wants to create 4
subnets each of size 64, 32, 16 and 16.Find the first address and last address of each subnet.
Find the subnet mask of each subnet.
Q3.Explain VER, HLEN, Total Length and Protocol fields in IPv4 datagram header. The size
of the option field of an IPv4 datagram is 20 bytes. What is the value of HLEN?
Section-A
Note: Attempt all Questions (1X5=5)
Q1.In a digital transmission, the sender clock is 0.3 percent faster than the receiver clock. How
many extra bits does the sender send if the data rate is 2 Mbps?
Q2.What are the values of SNR and SNR dB for a noiseless channel?
Q4. What do you mean by flow control and Access Control mechanism?
Flow control. If the rate at which the data are absorbed by the receiver is less than the rate at
which data are produced in the sender, the data link layer imposes a flow control mechanism to
avoid overwhelming the receiver.
Access control. When two or more devices are connected to the same link, data link layer
protocols are necessary to determine which device has control over the link at any given time.
Q5. Assume that a voice channel occupies a bandwidth of 4 kHz. We need to multiplex 10 voice
channels with guard bands of 500 Hz using FDM. Calculate the required bandwidth.
Section-B
Note: Attempt any three questions (2x3=6)
Q1. Calculate the Shannon Capacity for extremely noisy channel. Suppose a signal travels
through a transmission medium from point P1 to point P2 and its voltage is reduced to one half.
Calculate the attenuation in dB.
Q2. Explain the relationship between the bit rate and baud rate in the analog transmission of
digital data. An analog signal has a bit rate of 4000 bps and a baud rate of 500 baud. How many
data elements are carried by each signal element? How may signal elements do we need?
Ans.In the analog transmission of digital data, the baud rate is less than
or equal to the bit rate.
Q3.What are the responsibilities of Data Link layer and Network layer in OSI Model.
Q4.A slotted ALOHA network transmits 400 bit frames using a shared channel with a 400 kbps
bandwidth. The network contains 100 stations. What is the number of frames/sec each station
can send to achieve maximum efficiency? Also explain the vulnerable period in slotted
ALOHA.
Section-C
Note: Attempt any three questions (3x3=9)
Q1. Discuss the properties of chip sequences in CDMA. Find the chips for a network with 4
stations and 8 stations.
2.If we multiply a sequence by a number, every element in the sequence is multiplied by that
element. This is called multiplication of a sequence by a scalar. For example
3. If we multiply two equal sequences, element by element, and add the results, we get N, where
N is the number of elements in the each sequence. This is called the inner product of two equal
sequences. For example,
[+1 +1-1 -1]· [+1 +1 -1 -1] = 1 + 1 + 1 + 1 = 4
4. If we multiply two different sequences, element by element, and add the results, we get 0.
This is called inner product of two different sequences. For example,
5. Adding two sequences means adding the corresponding elements. The result is another
sequence. For example,
[+1+1-1-1] + [+1+1+1+1]=[+2 +2 0 0]
For a four-station network we have [+1 +1 +1 +1], [+1 -1 +1 -1], [+1 +1 -1 -1], and [+1-1-1
+1].
For a Eight-station network we
[+1 +1 +1 +1 +1 +1 +1 +1] [+1 -1 +1 -1 +1 -1 +1 -1] [+1 +1 -1 -1 +1 +1 -1 -1] [+1-1-1 +1 +
1 -1 -1 +1]
[+1 +1 +1 +1 -1 -1 -1 -1] [+1 -1 +1 -1 -1 +1 -1 +1] [+1 +1 -1 -1 -1 -1 +1 +1] [+1-1-1 +1 -1
+1 +1 -1]
Two way Set up Phase and One Way Tear Down Phase
Setup and Tear Down Phase = 3 [(4000 km) / (2 ×10 ^ 8 m / s)] + 3 [(2000 bits / 2 Mbps)] =
60 ms + 3 ms = 63 ms
Data Transfer = [(4000 km)/ (2 ×10 ^ 8 m / s)] + [(2000 bits / 2 Mbps)] = 21
Total delay = 63+21= 84 ms
Q3. What do we mean when we say that a bridge can filter traffic? Let’s consider the operation
of a learning switch in the context of a network in which 6 nodes labeled A through F are star
connected into an Ethernet switch. Suppose that (i) B sends a frame to E, (ii) E replies with a
frame to B, (iii) A sends a frame to B, (iv) B replies with a frame to A. The switch table is
initially empty. Show the state of the switch table before and after each of these events. For each
of these events, identify the link(s) on which the transmitted frame will be forwarded, and briefly
justify your answers.
A bridge has filtering capability. It can check the destination address of a frame and decide if
the frame should be forwarded or dropped. If the frame is to be forwarded, the decision must
specify the port. A bridge has a table that maps addresses to ports. Bridges have access to station
physical addresses and can forward a packet to the appropriate segment of the network. In this
way, they filter traffic and help control congestion."
GUIDED MEDIA
Guided media, which are those that provide a conduit from one device to another, include
twisted-pair cable, coaxial cable, and fiber-optic cable. A signal traveling along any of these
media is directed and contained by the physical limits of the medium. Twisted-pair and coaxial
cable use metallic (copper) conductors that accept and transport signals in the form of electric
current. Optical fiber is a cable that accepts and transports signals in the form of light.
Section-A
Note: Attempt all Questions (1X5=5)
Q1. Find the range of addresses in a block of classless addresses if one of the addresses is
200.17.21.135/27
Q2.If the subnet mask is 255.255.255.128, which address class it corresponds to?
Ans.Class C
Q3. Out of HDLC and PPP, which one is byte-oriented; which one is bit-oriented?
Q4.A sender sends a series of packets to the same destination using 6-bit sequence numbers. If
the sequence number starts with 0, what is the sequence number after sending 137 packets?
Q5. If we have k bits in sequence number field, then what is the size of sender window and
receiver window in GoBack N protocol?
Ans.2k-1 , 1
Section-B
Note: Attempt any three questions (2x3=6)
Q1. Show that the sender window size in GoBack N protocol with m=2 (where m represents the
bits in sequence number field) can be 3 but not equal to 4.
Q2. Given thedataword 1010011110 and the divisor 10111.Show the generation of the
codeword at the sender site (using binary division). Show the checking of the codeword
at the receiver site (assume no error).
Q3. Suppose the seven bit data word 1101110 is to be encoded using an even-parity Hamming
code. What is the binary value after encoding? Now assume that the 6th bit got corrupted
during transmission. Find the error correcting codes.
r1=3,5,7,9,11 =0,1,1,0,1=1
r2 = 3,6,7,10,11=0, 1,1,1,1=0
r4=5,6,7=1,1,1=1
r8=9,10,11=0,1,1=0
Receiver got =1 1 0 0 1 0 1 1 0 0 1
C1= 1,3,5,7,9,11=1,0,1,1,0,1=0
C2=2,3,6,7,10,11=0,0,0,1,1,1=1
C4=4,5,6,7=1,1,0,1=1
C8=8,9,10,11=0,0,1,1=0
Ans.Bit stuffing is the process of adding one extra 0 whenever five consecutive 1s follow
a 0 in the data, so that the receiver does not mistakethe pattern 0111110 for a flag.
Example:
Section-C
Note: Attempt any three questions (3x3=9)
Q1.Consider the network shown below, and assume that each node initially knows the costs to
each of its neighbors. Consider the distance-vector algorithm and show the distance table entries
at node z.
1 6
U V
1
Z
2 3
2
Y X
3
Z Tables
U via x 6
V via x 5
X 2
Y via x 5
Z 0
Q2.An organization is granted a class C network 210.1.2.0. The administrator wants to create 4
subnets each of size 64, 32, 16 and 16.Find the first address and last address of each subnet.
Find the subnet mask of each subnet.
Subnet Mask for S1=/26
Subnet Mask for S2=/27
Subnet Mask for S3=/28
Subnet Mask for S4=/28
Q3.Explain VER, HLEN, Total Length and Protocol fields in IPv4 datagram header. The size
of the option field of an IPv4 datagram is 20 bytes. What is the value of HLEN?
Version (VER). This 4-bit field defines the version of the IPv4 protocol. Currently the version
is 4. However, version 6 (or IPng) may totally replace version 4 in the future. This field tells the
IPv4 software running in the processing machine that the datagram has the format of version 4.
Header length (HLEN). This 4-bit field defines the total length of the datagram header in 4-
byte words. This field is needed because the length of the header is variable (between 20 and 60
bytes).
Total length. This is a In-bit field that defines the total length (header plus data) of the IPv4
datagram in bytes. To find the length of the data coming from the upper layer, subtract the
header length from the total length.
Protocol. This 8-bit field defines the higher-level protocol that uses the services of the IPv4
layer. An IPv4 datagram can encapsulate data from several higher-level protocols such as TCP,
Value of HLEN = 10
Section A
I. For six channels, we need at least five guard bands. This means that the required
bandwidth is at least 6 × 200 + 5×20 = 1300 kHz,
II. n(n-1)/2 cable link are required for mesh, n for ring, n-1 cable link for bus, and n
cable link for star topology.
III. Significance of twisting is to reduce the electromagnetic interface(EMI).
IV. If the size of window is 4 and if ACk for packet 2 is lost then we have to retransmit
all packets 2,3,4,5.
V. In NRZ L 0 and in Manchester 20 Transitions
VI. Bandwidth and propagation delay.
VII. Class A.NID =3.0.0.0
VIII. Time to live field.
IX. 2r =m+r+1
X. ARP is used to maintain a correlation between each MAC address and its
corresponding IP address. ARP provides the protocol rules for making this
correlation and providing address conversion in both directions.
XI. 224 addresses as we have 24 bits in HID.
XII. 200.45.0.0
XIII. Confidentiality,authentication,integrity.
XIV. Pseudo header, UDP header and Data
XV. Multipurpose Internet Mail Extension.
XVI. There are two types of DNS messages: queries and responses.
Section B
II. In open-loop congestion control, policies are applied to prevent congestion before
it happens.
Retransmission Policy
Retransmission is sometimes unavoidable. If the sender feels that a sent packet is
lost
or corrupted, the packet needs to be retransmitted. Retransmission in general may
increase congestion in the network.
Window Policy
The type of window at the sender may also affect congestion. The Selective Repeat
window is better than the Go-Back-N window for congestion control. In the Go-
Back-Nwindow, when the timer for a packet times out, several packets may be resent,
although some may have arrived safe and sound at the receiver.
Acknowledgment Policy
The acknowledgment policy imposed by the receiver may also affect congestion. If
the receiver does not acknowledge every packet it receives, it may slow down the
sender and help prevent congestion
The client (resolver) can ask for a recursive answer from a name server. This means that
the resolver expects the server to supply the final answer. If the server is the authority
for the domain name, it checks its database and responds. If the server is not the
authority,it sends the request to another server (the parent usually) and waits for the
response. If the parent is the authority, it responds; otherwise, it sends the query to yet
another server.
Iterative Resolution
If the client does not ask for a recursive answer, the mapping can be done iteratively. If
the server is an authority for the name, it sends the answer. If it is not, it returns (to the
client) the IP address of the server that it thinks can resolve the query. The client is
responsible for repeating the query to this second server. If the newly addressed server
can resolve the problem, it answers the query with the IP address; otherwise, it returns
the IP address of a new server to the client. Now the client must repeat the query to the
third server.
Root Server
A root server is a server whose zone consists of the whole tree. A root server usually
does not store any information about domains but delegates its authority to other
servers,keeping references to those servers.
For many applications, we need a program or a script to be run at the client site. These
are called active documents. For example, suppose we want to run a program that creates
animated graphics on the screen or a program that interacts with the user. The
program definitely needs to be run at the client site where the animation or interaction
takes place. When a browser requests an active document, the server sends a copy of the
document or a script. The document is then run at the client (browser) site.
Dynamic Documents
A dynamic document is created by a Web server whenever a browser requests the
document.When a request arrives, the Web server runs an application program or a
scriptthat creates the dynamic document. The server returns the output of the program
or script as a response to the browser that requested the document. Because a fresh
document is created for each request, the contents of a dynamic document can vary from
one request to another. A very simple example of a dynamic document is the retrieval
of the time and date from a server. Time and date are kinds of information that are
dynamic in that they change from moment to moment. The client can ask the server to
run a program such as the date program in UNIX and send the result of the program to
the client.
Section C
II. POP3 is deficient in several ways. It does not allow the user to organize her mail onthe
server; the user cannot have different folders on the server. (Of course, the user
cancreate folders on her own computer.) In addition, POP3 does not allow the user
topartially check the contents of the mail before downloading.
A user can check the e-mail header prior to downloading. A user can search the contents
of the e-mail for a specific string of characters priorto downloading.A user can partially
download e-mail. This is especially useful if bandwidth is limited and the e-mail
contains multimedia with high bandwidth requirements.A user can create, delete, or
rename mailboxes on the mail server. user can create a hierarchy of mailboxes in a
folder for e-mail storage.
n = pq = 11.3 = 33
phi = (p-1)(q-1) = 10.2 = 20
Choose e=3
Check gcd(e, p-1) = gcd(3, 10) = 1 (i.e. 3 and 10 have no common factors except 1),
and check gcd(e, q-1) = gcd(3, 2) = 1
therefore gcd(e, phi) = gcd(e, (p-1)(q-1)) = gcd(3, 20) = 1
This lecture introduces the ISO-OSI layered architecture of Networks. According to the ISO
standards, networks have been divided into 7 layers depending on the complexity of the
fucntionality each of these layers provide. The detailed description of each of these layers is
given in the notes below. We will first list the layers as defined by the standard in the increasing
order of function complexity:
1. Physical Layer
2. Data Link Layer
3. Network Layer
4. Transport Layer
5. Session Layer
6. Presentation Layer
7. Application Layer
Physical Layer
This layer is the lowest layer in the OSI model. It helps in the transmission of data between two
machines that are communicating through a physical medium, which can be optical
fibres,copper wire or wireless etc. The following are the main functions of the physical layer:
1. Hardware Specification: The details of the physical cables, network interface cards,
wireless radios, etc are a part of this layer.
2. Encoding and Signalling: How are the bits encoded in the medium is also decided by
this layer. For example, on the coppar wire medium, we can use differnet voltage levels
for a certain time interval to represent '0' and '1'. We may use +5mV for 1nsec to
represent '1' and -5mV for 1nsec to represent '0'. All the issues of modulation is dealt
with in this layer. eg, we may use Binary phase shift keying for the representation of '1'
and '0' rather than using different volatage levels if we have to transfer in RF waves.
3. Data Transmission and Reception: The transfer of each bit of data is the responsibility
of this layer. This layer assures the transmissoin of each bit with ahigh probability. The
transmission of the bits is not completely reliable as their is no error correction in this
layer.
4. Topology and Network Design: The network design is the integral part of the physical
layer. Which part of the network is the router going to be placed, where the switches will
be used, where we will put the hubs, how many machines is each switch going to handle,
what server is going to be placed where, and many such concerns are to be taken care of
by the physical layer. The variosu kinds of netopologies that we decide to use may be
ring, bus, star or a hybrid of these topologies depending on our requirements.
1. Framing : Breaking input data into frames (typically a few hundred bytes) and caring
about the frame boundaries and the size of each frame.
2. Acknowledgment : Sent by the receiving end to inform the source that the frame was
received without any error.
Network Layer
Its basic functions are routing and congestion control.
Routing: This deals with determining how packets will be routed (transferred) from source to
destination. It can be of three types :
Static : Routes are based on static tables that are "wired into" the network and are rarely
changed.
Dynamic : All packets of one application can follow different routes depending upon the
topology of the network, the shortest path and the current network load.
Semi-Dynamic : A route is chosen at the start of each conversation and then all the
packets of the application follow the same route.
Transport Layer
Its functions are :
Fragmentation and Re-assembly : The data accepted by the transport layer from the
session layer is split up into smaller units (fragmentation) if needed and then passed to
the network layer. Correspondingly, the data provided by the network layer to the
transport layer on the receiving side is re-assembled.
Types of service : The transport layer also decides the type of service that should be
provided to the session layer. The service may be perfectly reliable, or may be reliable
within certain tolerances or may not be reliable at all. The message may or may not be
received in the order in which it was sent. The decision regarding the type of service to
be provided is taken at the time when the connection is established.
Error Control : If reliable service is provided then error detection and error recovery
operations are also performed. It provides error control mechanism onend to end basis.
Flow Control : A fast host cannot keep pace with a slow one. Hence, this is a mechanism
to regulate the flow of information.
Connection Establishment / Release : The transport layer also establishes and releases
the connection across the network. This requires some sort of naming mechanism so that
a process on one machine can indicate with whom it wants to communicate.
Presentation Layer
This layer is concerned with the syntax and semantics of the information transmitted. In order
to make it possible for computers with different data representations to communicate data
structures to be exchanged can be defined in abstract way alongwith standard encoding. It also
manages these abstract data structres and allows higher level of data structres to be defined an
exchange. It encodes the data in standard agreed way(network format). Suppose there are two
machines A and B one follows 'Big Endian' and other 'Little Endian' for data representation.
This layer ensures that the data transmitted by one gets converted in the form compatibale to
othe machine. This layer is concerned with the syntax and semantics of the information
transmitted.In order to make it possible for computers with different data representations to
communicate data structures to be exchanged canbe defined in abstract way alongwith standard
encoding. It also manages these abstract data structres and allows higher level of data structres
to be defined an exchange. Other functions include compression, encryption etc.
Application Layer
The seventh layer contains the application protocols with which the user gains access to the
network. The choice of which specific protocols and their associated functions are to be used at
the application level is up to the individual user. Thus the boundary between the presentation
layer and the application layer represents a separation of the protocols imposed by the network
designers from those being selected and implemented by the network users.For example
commonly used protocols are HTTP(for web browsing), FTP(for file transfer) etc.
Physical Layer
Physical layer is concerned with transmitting raw bits over a communication channel. The
design issues have to do with making sure that when one side sends a 1 bit, it is recieved by the
DEPARTMENT OF COMPUTER ENGINEERING & APPLICATIONS
Course File
COMPUTER NETWORKS
other side as 1 bit and not as 0 bit. In physical layer we deal with the communication medium
used for transmission.
Types of Medium
Medium can be classified into 2 categories.
1. Guided Media : Guided media means that signals is guided by the prescence of
physical media i.e. signals are under control and remains in the physical wire. For eg.
copper wire.
2. Unguided Media : Unguided Media means that there is no physical path for the signal
to propogate. Unguided media are essentially electro-magnetic waves. There is no
control on flow of signal. For eg. radio waves.
Communication Links
In a nework nodes are connected through links. The communication through links can be
classified as
1. Simplex : Communication can take place only in one direction. eg. T.V broadcasting.
2. Half-duplex : Communication can take place in one direction at a time. Suppose node
A and B are connected then half-duplex communication means that at a time data can
flow from A to B or from B to A but not simultaneously. eg. two persons talking to each
other such that when speaks the other listens and vice versa.
3. Full-duplex : Communication can take place simultaneously in both directions. eg. A
discussion in a group without discipline.
1. Point to Point : In this communication only two nodes are connected to each other.
When a node sends a packet then it can be recieved only by the node on the other side
and none else.
2. Multipoint : It is a kind of sharing communication, in which signal can be recieved by
all nodes. This is also called broadcast.
1. Attenuation : When a signal transmitts in a network then the quality of signal degrades
as the signal travels longer distances in the wire. This is called attenuation. To improve
quality of signal amplifiers are used at regular distances.
2. Noise : In a communication channel many signals transmits simultaneously, certain
random signals are also present in the medium. Due to interference of these signals our
signal gets disrupted a bit.
Bandwidth
Bandwidth simply means how many bits can be transmitted per second in the communication
channel. In technical terms it indicates the width of frequency spectrum.
Transmission Media
GuidedTransmissionMedia
1. Coaxial Cable: Coaxial cable consists of an inner conductor and an outer conductor
which are seperated by an insulator. The inner conductor is usually copper. The outer
conductor is covered by a plastic jacket. It is named coaxial because the two conductors
are coaxial. Typical diameter of coaxial cable lies between 0.4 inch to 1 inch. The most
application of coaxial cable is cable T.V. The coaxial cable has high bandwidth,
attenuation is less.
Twisted Pair: A Twisted pair consists of two insulated copper wires, typically 1mm thick. The
wires are twisted togather in a helical form the purpose of twisting is to reduce cross talk
interference between several pairs. Twisted Pair is much cheaper then coaxial cable but it is
susceptible to noise and electromagnetic interference and attenuation is large.
The most common application of twisted pair is the telephone system. Nearly all
telephones are connected to the telephone company office by a twisted pair. Twisted pair
can run several kilometers without amplification, but for longer distances repeaters are
needed. Twisted pairs can be used for both analog and digital transmission. The
bandwidth depends on the thickness of wire and the distance travelled. Twisted pairs are
generally limited in distance, bandwidth and data rate.
1. Depending on material
Made of glass
Made of plastic.
2. Depending on radius
Thin optical fiber
Thick optical fiber
3. Depending on light source
LED (for low bandwidth)
Injection lased diode (for high bandwidth)
Data Encoding
Digital data to analog signals
A modem (modulator-demodulator) converts digital data to analog signal. There are 3 ways to
modulate a digital signal on an analog carrier signal.
1. Amplitude shift keying (ASK): is a form of modulation which represents digital data
as variations in the amplitude of a carrier wave. Two different amplitudes of carrier
frequency represent '0' , '1'.
2. Frequency shift keying (FSK): In Frequency Shift Keying, the change in frequency
define different digits. Two different frequencies near carrier frequency represent '0'
,''1'.
3. Phase shift keying (PSK): The phase of the carrier is discretely varied in relation either
to a reference phase or to the phase of the immediately preceding signal element, in
accordance with data being transmitted. Phase of carrier signal is shifted to represent '0'
, '1'.
Encoding Techniques
Following are several ways to map data bits to signal elements.
Non return to zero(NRZ) NRZ codes share the property that voltage level is constant
during a bit interval. High level voltage = bit 1 and Low level voltage = bit 0. A problem
arises when there is a long sequence of 0s or 1s and the volatage level is maintained at
the same value for a long time. This creates a problem on the recieving end because now,
the clock synchronization is lost due to lack of any transitions and hence, it is difficult
to determine the exact number of 0s or 1s in this sequence.
1. NRZ-Level: In NRZ-L encoding, the polarity of the signal changes only when
the incoming signal changes from a 1 to a 0 or from a 0 to a 1. NRZ-L method
looks just like the NRZ method, except for the first input one data bit. This is
because NRZ does not consider the first data bit to be a polarity change, where
NRZ-L does.
2. NRZ-Inverted: Transition at the beginning of bit interval = bit 1 and No
Transition at beginning of bit interval = bit 0 or vicecersa. This technique is
known as differential encoding.
NRZ-I has an advantage over NRZ-L. Consider the situation when two data wires are
wrongly connected in each other's place.In NRZ-L all bit sequences will get reversed
(B'coz voltage levels get swapped).Whereas in NAZ-I since bits are recognized by
transition the bits will be correctly interpreted. A disadvantage in NRZ codes is that a
string of 0's or 1's will prevent synchronization of transmitter clock with receiver clock
and a separate clock line need to be provided.
one leading 0
no more than two trailing 0s
Thus it is ensured that we can never have more than three consecutive 0s. Now
these 5-bit codes are transmitted using NRZI coding thus problem of consecutive
1s is solved.
Of the remaining 16 codes, 7 are invalid and others are used to send some control
information like line idle(11111), line dead(00000), Halt(00100) etc.
There are other variants for this scheme viz. 5B/6B, 8B/10B etc. These have self
suggesting names.
o 8B/6T Encoding: In the above schemes, we have used two/three voltage levels
for a signal. But we may altogether use more than three voltage levels so that
more than one-bit could be send over a single signal. Like if we use six voltage
levels and we use 8-bits then the scheme is called 8B/6T. Clearly here we have
729(3^6) combinations for signal and 256(2^8) combinations for bits.
Bipolar AIM: Here we have 3 voltage levels: middle,upper,lower
o Representation 1: Middle level =0 Upper,Lower level =1 such that successive 1's
will be represented alternately on upper and lower levels.
o Representation 2 (pseudoternary): Middle level =1 Upper,Lower level=0
Pulse code modulation(PCM): Here intervals are equally spaced. 8 bit PCB uses 256
different levels of amplitude. In non-linear encoding levels may be unequally spaced.
Delta Modulation(DM): Since successive samples do not differ very much we send the
differences between previous and present sample. It requires fewer bits than in PCM.
no assurance that bit pattern for flag will not appear inside the frame thus destroying
frame level synchronization. So to avoid this we use bit stuffing
Multiplexing
When two communicating nodes are connected through a media, it generally happens that
bandwidth of media is several times greater than that of the communicating nodes. Transfer of
a single signal at a time is both slow and expensive. The whole capacity of the link is not being
utilized in this case. This link can be further exploited by sending several signals combined into
one. This combining of signals into one is called multiplexing.
2. Time Division Multiplexing (TDM): This is possible when data transmission rate of
the media is much higher than that of the data rate of the source. Multiple signals can be
transmitted if each signal is allowed to be transmitted for a definite amount of time.
These time slots are so small that all transmissions appear to be in parallel.
1. Synchronous TDM: Time slots are preassigned and are fixed. Each source is
given it's time slot at every turn due to it. This turn may be once per cycle, or
several turns per cycle ,if it has a high data transfer rate, or may be once in a no.
DEPARTMENT OF COMPUTER ENGINEERING & APPLICATIONS
Course File
COMPUTER NETWORKS
of cycles if it is slow. This slot is given even if the source is not ready with data.
So this slot is transmitted empty.
2. Asynchronous TDM: In this method, slots are not fixed. They are allotted
dynamically depending on speed of sources, and whether they are ready for
transmission.
Network Topologies
A network topology is the basic design of a computer network. It is very much like a map of a
road. It details how key network components such as nodes and links are interconnected. A
network's topology is comparable to the blueprints of a new home in which components such as
the electrical system, heating and air conditioning system, and plumbing are integrated into the
overall design. Taken from the Greek work "Topos" meaning "Place," Topology, in relation to
networking, describes the configuration of the network; including the location of the
workstations and wiring connections. Basically it provides a definition of the components of a
Local Area Network (LAN). A topology, which is a pattern of interconnections among nodes,
influences a network's cost and performance. There are three primary types of network
topologies which refer to the physical and logical layout of the Network cabling. They are:
Advantages
Disadvantages
o Broadcasting and multicasting is not easy because some extra functionality needs
to be provided to the central hub
o If the central node fails, the whole network goes down; thus making the switch
some kind of a bottleneck
o Installation costs are high because each node needs to be connected to the central
switch
2. Bus Topology: The simplest and one of the most common of all topologies, Bus consists
of a single cable, called a Backbone, that connects all workstations on the network using
a single line. All transmissions must pass through each of the connected devices to
complete the desired request. Each workstation has its own individual signal that
identifies it and allows for the requested data to be returned to the correct originator. In
the Bus Network, messages are sent in both directions from a single point and are read
by the node (computer or peripheral on the network) identified by the code with the
message. Most Local Area Networks (LANs) are Bus Networks because the network
will continue to function even if one computer is down. This topology works equally
well for either peer to peer or client server.
The purpose of the terminators at either end of the network is to stop the signal being
reflected back.
Advantages
Disadvantages
o Trouble shooting and error detection becomes a problem because, logically, all
nodes are equal
o Less secure because sniffing is easier
o Limited in size and speed
3. Ring Topology: All the nodes in a Ring Network are connected in a closed circle of
cable. Messages that are transmitted travel around the ring until they reach the computer
that they are addressed to, the signal being refreshed by each node. In a ring topology,
the network signal is passed through each network card of each device and passed on to
the next device. Each device processes and retransmits the signal, so it is capable of
supporting many devices in a somewhat slow but very orderly fashion. There is a very
nice feature that everybody gets a chance to send a packet and it is guaranteed that every
node gets to send a packet in a finite amount of time.
Advantages
o Broadcasting and multicasting is simple since you just need to send out one
message
o Less expensive since less cable footage is required
o It is guaranteed that each host will be able to transmit within a finite time interval
o Very orderly network where every device has access to the token and the
opportunity to transmit
o Performs better than a star network under heavy network load
Disadvantages
Generally, a BUS architecture is preferred over the other topologies - ofcourse, this is a very
subjective opinion and the final design depends on the requirements of the network more than
anything else. Lately, most networks are shifting towards the STAR topology. Ideally we would
like to design networks, which physically resemble the STAR topology, but behave like BUS
or RING topology.
Aloha Protocols
History
The Aloha protocol was designed as part of a project at the University of Hawaii. It provided
data transmission between computers on several of the Hawaiian Islands using radio
transmissions.
Pure Aloha
Pure Aloha is an unslotted, fully-decentralized protocol. It is extremely simple and trivial to
implement. The ground rule is - "when you want to talk, just talk!". So, a node which wants to
transmits, will go ahead and send the packet on its broadcast channel, with no consideration
whatsoever as to anybody else is transmitting or not.
One serious drawback here is that, you dont know whether what you are sending has been
received properly or not (so as to say, "whether you've been heard and understood?"). To resolve
this, in Pure Aloha, when one node finishes speaking, it expects an acknowledgement in a finite
amount of time - otherwise it simply retransmits the data. This scheme works well in small
networks where the load is not high. But in large, load intensive networks where many nodes
may want to transmit at the same time, this scheme fails miserably. This led to the development
of Slotted Aloha.
Slotted Aloha
This is quite similar to Pure Aloha, differing only in the way transmissions take place. Instead
of transmitting right at demand time, the sender waits for some time. This delay is specified as
follows - the timeline is divided into equal slots and then it is required that transmission should
take place only at slot boundaries. To be more precise, the slotted-Aloha makes the following
assumptions:
In this way, the number of collisions that can possibly take place is reduced by a huge margin.
And hence, the performance become much better compared to Pure Aloha. collisions may only
take place with nodes that are ready to speak at the same time. But nevertheless, this is a
substantial reduction.
1. Listen before speaking: If someone else is speaking, wait until they are done. In the
networking world, this is termed carrier sensing - a node listens to the channel before
transmitting. If a frame from another node is currently being transmitted into the channel,
a node then waits ("backs off") a random amount of time and then again senses the
channel. If the channel is sensed to be idle, the node then begins frame transmission.
Otherwise, the node waits another random amount of time and repeats this process.
2. If someone else begins talking at the same time, stop talking. In the networking
world, this is termed collision detection - a transmitting node listens to the channel while
it is transmitting. If it detects that another node is transmitting an interfering frame, it
stops transmitting and uses some protocol to determine when it should next attempt to
transmit.
It is evident that the end-to-end channel propagation delay of a broadcast channel - the time it
takes for a signal to propagate from one of the the channel to another - will play a crucial role
in determining its performance. The longer this propagation delay, the larger the chance that a
carrier-sensing node is not yet able to sense a transmission that has already begun at another
node in the network.
So, we need an improvement over CSMA - this led to the development of CSMA/CD.
We have observed that CSMA/CD would break down in wireless networks because of hidden
node and exposed nodes problems. We will have a quick recap of these two problems through
examples.
One issue that needs to be addressed is how long the rest of the nodes should wait before they
can transmit data over the network. The answer is that the RTS and CTS would carry some
information about the size of the data that B intends to transfer. So, they can calculate time that
would be required for the transmission to be over and assume the network to be free after
that.Another interesting issue is what a node should do if it hears RTS but not a corresponding
CTS. One possibility is that it assumes the recipient node has not responded and hence no
transmission is going on, but there is a catch in this. It is possible that the node hearing RTS is
just on the boundary of the node sending CTS. Hence, it does hear CTS but the signal is so
deteriorated that it fails to recognize it as a CTS. Hence to be on the safer side, a node will not
start transmission if it hears either of an RTS or a CTS.
The assumption made in this whole discussion is that if a node X can send packets to a node Y,
it can also receive a packet from Y, which is a fair enough assumption given the fact that we are
talking of a local network where standard instruments would be used. If that is not the case
additional complexities would get introduced in the system.
The mechanism of collision detection which CSMA/CD follows is through listening while
talking. What this means is so long as a node is transmitting the packet, it is listening on the
cable. If the data it listens to is different from the data it is transmitting it assumes a collision.
Once it has stopped transmitting the packet, and has not detected collision while transmission
was going on, it assumes that the transmission was successful. The problem arises when the
distance between the two nodes is too large. Suppose A wants to transmit some packet to B
Let us try to parametrize the above problem. Suppose "t" is the time taken for the node A to
transmit the packet on the cable and "T" is the time , the packet takes to reach from A to B.
Suppose transmission at A starts at time t0. In the worst case the collision takes place just when
the first packet is to reach B. Say it is at t0+T-e (e being very small). Then the collision
information will take T-e time to propagate back to A. So, at t0+2(T-e) A should still be
transmitting. Hence, for the correct detection of collision (ignoring e) t > 2T
t increases with the number of bits to be transferred and decreases with the rate of transfer (bits
per second). T increases with the distance between the nodes and decreases with the speed of
the signal (usually 2/3c). We need to either keep t large enough or T as small. We do not want
to live with lower rate of bit transfer and hence slow networks. We can not do anything about
the speed of the signal. So what we can rely on is the minimum size of the packet and the
distance between the two nodes. Therefore, we fix some minimum size of the packet and if the
size is smaller than that, we put in some extra bits to make it reach the minimum size.
Accordingly we fix the maximum distance between the nodes. Here too, there is a tradeoff to
be made. We do not want the minimum size of the packets to be too large since that wastes lots
of resources on cable. At the same time we do not want the distance between the nodes to be
too small. Typical minimum packet size is 64 bytes and the corresponding distance is 2-5
kilometers.
The Data Link Layer is the second layer in the OSI model, above the Physical Layer, which
ensures that the error free data is transferred between the adjacent nodes in the network. It breaks
the datagrams passed down by above layers and convert them into frames ready for transfer.
This is called Framing. It provides two main functionalities
What is Framing?
Since the physical layer merely accepts and transmits a stream of bits without any regard to
meaning or structure, it is upto the data link layer to create and recognize frame boundaries.
This can be accomplished by attaching special bit patterns to the beginning and end of the frame.
If these bit patterns can accidentally occur in data, special care must be taken to make sure these
patterns are not incorrectly interpreted as frame delimiters. The four framing methods that are
widely used are
Character count
Starting and ending characters, with character stuffing
Starting and ending flags, with bit stuffing
Physical layer coding violations
Character Count
This method uses a field in the header to specify the number of characters in the frame. When
the data link layer at the destination sees the character count,it knows how many characters
follow, and hence where the end of the frame is. The disadvantage is that if the count is garbled
by a transmission error, the destination will lose synchronization and will be unable to locate
the start of the next frame. So, this method is rarely used.
Character stuffing
In the second method, each frame starts with the ASCII character sequence DLE STX and ends
with the sequence DLE ETX.(where DLE is Data Link Escape, STX is Start of TeXt and ETX
is End of TeXt.) This method overcomes the drawbacks of the character count method. If the
destination ever loses synchronization, it only has to look for DLE STX and DLE ETX
characters. If however, binary data is being transmitted then there exists a possibility of the
characters DLE STX and DLE ETX occurring in the data. Since this can interfere with the
framing, a technique called character stuffing is used. The sender's data link layer inserts an
ASCII DLE character just before the DLE character in the data. The receiver's data link layer
Bit stuffing
The third method allows data frames to contain an arbitrary number of bits and allows character
codes with an arbitrary number of bits per character. At the start and end of each frame is a flag
byte consisting of the special bit pattern 01111110 . Whenever the sender's data link layer
encounters five consecutive 1s in the data, it automatically stuffs a zero bit into the outgoing bit
stream. This technique is called bit stuffing. When the receiver sees five consecutive 1s in the
incoming data stream, followed by a zero bit, it automatically destuffs the 0 bit. The boundary
between two frames can be determined by locating the flag pattern.
Error Control
The bit stream transmitted by the physical layer is not guaranteed to be error free. The data link
layer is responsible for error detection and correction. The most common error control method
is to compute and append some form of a checksum to each outgoing frame at the sender's data
link layer and to recompute the checksum and verify it with the received checksum at the
receiver's side. If both of them match, then the frame is correctly received; else it is erroneous.
The checksums may be of two types: # Error detecting : Receiver can only detect the error in
the frame and inform the sender about it. # Error detecting and correcting : The receiver can not
only detect the error but also correct it. Examples of Error Detecting methods:
Parity bit: Simple example of error detection technique is parity bit. The parity bit is
chosen that the number of 1 bits in the code word is either even( for even parity) or odd
(for odd parity). For example when 10110101 is transmitted then for even parity an 1
will be appended to the data and for odd parity a 0 will be appended. This scheme can
detect only single bits. So if two or more bits are changed then that can not be detected.
Longitudinal Redundancy Checksum: Longitudinal Redundancy Checksum is an
error detecting scheme which overcomes the problem of two erroneous bits. In this
conceptof parity bit is used but with slightly more intelligence. With each byte we send
one parity bit then send one additional byte which have the parity corresponding to the
each bit position of the sent bytes. So the parity bit is set in both horizontal and vertical
direction. If one bit get flipped we can tell which row and column have error then we
find the intersection of the two and determine the erroneous bit. If 2 bits are in error and
they are in the different column and row then they can be detected. If the error are in the
same column then the row will differentiate and vice versa. Parity can detect the only
odd number of errors. If they are even and distributed in a fashion that in all direction
then LRC may not be able to find the error.
We have an n-bit message. The sender adds a k-bit Frame Check Sequence (FCS) to this
message before sending. The resulting (n+k) bit message is divisible by some (k+1) bit
number. The receiver divides the message ((n+k)-bit) by the same (k+1)-bit number and
if there is no remainder, assumes that there was no error. How do we choose this
number?
For example, if k=12 then 1000000000000 (13-bit number) can be chosen, but this is a
pretty crappy choice. Because it will result in a zero remainder for all (n+k) bit messages
with the last 12 bits zero. Thus, any bits flipping beyond the last 12 go undetected. If
k=12, and we take 1110001000110 as the 13-bit number (incidentally, in decimal
representation this turns out to be 7238). This will be unable to detect errors only if the
corrupt message and original message have a difference of a multiple of 7238. The
probablilty of this is low, much lower than the probability that anything beyond the last
12-bits flips. In practice, this number is chosen after analyzing common network
transmission errors and then selecting a number which is likely to detect these common
errors.
Flow Control
Consider a situation in which the sender transmits frames faster than the receiver can accept
them. If the sender keeps pumping out frames at high rate, at some point the receiver will be
completely swamped and will start losing some frames. This problem may be solved by
introducing flow control. Most flow control protocols contain a feedback mechanism to inform
the sender when it should transmit the next frame.
Stop and Wait Protocol: This is the simplest file control protocol in which the sender
transmits a frame and then waits for an acknowledgement, either positive or negative,
from the receiver before proceeding. If a positive acknowledgement is received, the
sender transmits the next packet; else it retransmits the same frame. However, this
protocol has one major flaw in it. If a packet or an acknowledgement is completely
destroyed in transit due to a noise burst, a deadlock will occur because the sender cannot
proceed until it receives an acknowledgement. This problem may be solved using timers
on the sender's side. When the frame is transmitted, the timer is set. If there is no
response from the receiver within a certain time interval, the timer goes off and the frame
may be retransmitted.
Sliding Window Protocols: Inspite of the use of timers, the stop and wait protocol still
suffers from a few drawbacks. Firstly, if the receiver had the capacity to accept more
than one frame, its resources are being underutilized. Secondly, if the receiver was busy
and did not wish to receive any more packets, it may delay the acknowledgement.
However, the timer on the sender's side may go off and cause an unnecessary
retransmission. These drawbacks are overcome by the sliding window protocols.
In sliding window protocols the sender's data link layer maintains a 'sending window'
which consists of a set of sequence numbers corresponding to the frames it is permitted
to send. Similarly, the receiver maintains a 'receiving window' corresponding to the set
of frames it is permitted to accept. The window size is dependent on the retransmission
policy and it may differ in values for the receiver's and the sender's window. The
sequence numbers within the sender's window represent the frames sent but as yet not
acknowledged. Whenever a new packet arrives from the network layer, the upper edge
of the window is advanced by one. When an acknowledgement arrives from the receiver
the lower edge is advanced by one. The receiver's window corresponds to the frames
that the receiver's data link layer may accept. When a frame with sequence number equal
to the lower edge of the window is received, it is passed to the network layer, an
acknowledgement is generated and the window is rotated by one. If however, a frame
falling outside the window is received, the receiver's data link layer has two options. It
may either discard this frame and all subsequent frames until the desired frame is
received or it may accept these frames and buffer them until the appropriate frame is
received and then pass the frames to the network layer in sequence.
In this simple example, there is a 4-byte sliding window. Moving from left to right, the
window "slides" as bytes in the stream are sent and acknowledged.
Most sliding window protocols also employ ARQ ( Automatic Repeat reQuest )
mechanism. In ARQ, the sender waits for a positive acknowledgement before
proceeding to the next frame. If no acknowledgement is received within a certain time
interval it retransmits the frame. ARQ is of two types :
1. Go Back 'n': If a frame is lost or received in error, the receiver may simply
discard all subsequent frames, sending no acknowledgments for the discarded
frames. In this case the receive window is of size 1. Since no acknowledgements
are being received the sender's window will fill up, the sender will eventually
time out and retransmit all the unacknowledged frames in order starting from the
damaged or lost frame. The maximum window size for this protocol can be
obtained as follows. Assume that the window size of the sender is n. So the
window will initially contain the frames with sequence numbers from 0 to (w-1).
Consider that the sender transmits all these frames and the receiver's data link
layer receives all of them correctly. However, the sender's data link layer does
not receive any acknowledgements as all of them are lost. So the sender will
retransmit all the frames after its timer goes off. However the receiver window
has already advanced to w. Hence to avoid overlap , the sum of the two windows
should be less than the sequence number space.
2. Selective Repeat:In this protocol rather than discard all the subsequent frames
following a damaged or lost frame, the receiver's data link layer simply stores
them in buffers. When the sender does not receive an acknowledgement for the
Network Layer
What is Network Layer?
The network layer is concerned with getting packets from the source all the way to the
destination. The packets may require to make many hops at the intermediate routers while
reaching the destination. This is the lowest layer that deals with end to end transmission. In
order to achieve its goals, the network layer must know about the topology of the
communication network. It must also take care to choose routes to avoid overloading of some
of the communication lines while leaving others idle. The network layer-transport layer interface
frequently is the interface between the carrier and the customer, that is the boundary of the
subnet. The functions of this layer include :
1. Routing - The process of transferring packets received from the Data Link Layer of the
source network to the Data Link Layer of the correct destination network is called
routing. Involves decision making at each intermediate node on where to send the packet
next so that it eventually reaches its destination. The node which makes this choice is
called a router. For routing we require some mode of addressing which is recognized by
the Network Layer. This addressing is different from the MAC layer addressing.
2. Inter-networking - The network layer is the same across all physical networks (such as
Token-Ring and Ethernet). Thus, if two physically different networks have to
communicate, the packets that arrive at the Data Link Layer of the node which connects
these two physically different networks, would be stripped of their headers and passed
to the Network Layer. The network layer would then pass this data to the Data Link
Layer of the other physical network..
3. Congestion Control - If the incoming rate of the packets arriving at any router is more
than the outgoing rate, then congestion is said to occur. Congestion may be caused by
many factors. If suddenly, packets begin arriving on many input lines and all need the
same output line, then a queue will build up. If there is insufficient memory to hold all
of them, packets will be lost. But even if routers have an infinite amount of memory,
congestion gets worse, because by the time packets reach to the front of the queue, they
have already timed out (repeatedly), and duplicates have been sent. All these packets are
Addressing Scheme
1. Large Networks : 8-bit network address and 24-bit host address. There are
approximately 16 million hosts per network and a maximum of 126 ( 2^7 - 2 ) Class A
networks can be defined. The calculation requires that 2 be subtracted because 0.0.0.0 is
reserved for use as the default route and 127.0.0.0 be reserved for the loop back function.
Moreover each Class A network can support a maximum of 16,777,214 (2^24 - 2) hosts
per network. The host calculation requires that 2 be subtracted because all 0's are
reserved to identify the network itself and all 1s are reserved for broadcast addresses.
The reserved numbers may not be assigned to individual hosts.
2. Medium Networks : 16-bit network address and 16-bit host address. There are
approximately 65000 hosts per network and a maximum of 16,384 (2^14) Class B
networks can be defined with up to (2^16-2) hosts per network.
3. Small networks : 24-bit network address and 8-bit host address. There are
approximately 250 hosts per network.
You might think that Large and Medium networks are sort of a waste as few
corporations/organizations are large enough to have 65000 different hosts. (By the way, there
are very few corporations in the world with even close to 65000 employees, and even in these
corporations it is highly unlikely that each employee has his/her own computer connected to the
network.) Well, if you think so, you're right. This decision seems to have been a mistak
Address Classes
1 1 1 1 28 bits
Internet Protocol
Special Addresses : There are some special IP addresses :
1. Broadcast Addresses They are of two types :(i) Limited Broadcast : It consists of all 1's,
i.e., the address is 255.255.255.255 . It is used only on the LAN, and not for any external
network.
(ii) Directed Broadcast : It consists of the network number + all other bits as1's. It reaches
the router corresponding to the network number, and from there it broadcasts to all the
nodes in the network. This method is a major security problem, and is not used anymore.
So now if we find that all the bits are 1 in the host no. field, then the packet is simply
dropped. Therefore, now we can only do broadcast in our own network using Limited
Broadcast.
2. Network ID = 0 It means we are referring to this network and for local broadcast we
make the host ID zero.
3. Host ID = 0This is used to refer to the entire network in the routing table.
4. Loop-back Address
Here we have addresses of the type 127.x.y.z It goes down way upto the IP layer and
comes back to the application layer on the same host. This is used to test network
applications before they are used commercially.
Subnetting
Sub netting means organizing hierarchies within the network by dividing the host ID as per our
network. For example consider the network ID : 150.29.x.y We could organize the remaining
16 bits in any way, like : 4 bits - department4 bits - LAN8 bits - host
This gives some structure to the host IDs. This division is not visible to the outside world. They
still see just the network number, and host number (as a whole). The network will have an
internal routing table which stores information about which router to send an address to. Now
consider the case where we have : 8 bits - subnet number, and 8 bits - host number. Each router
on the network must know about all subnet numbers. This is called the subnet mask. We put the
network number and subnet number bits as 1 and the host bits as 0. Therefore, in this example
the subnet mask becomes : 255.255.255.0 . The hosts also need to know the subnet mask when
they send a packet. To find if two addresses are on the same subnet, we can AND source address
Packet Structure
Version Header
Type of Service
Number Length Total Length (16 bits)
(8 bits)
(4 bits) (4 bits)
Flags
ID (16 bits) Flag Offset (13 bits)
(3bits)
Time To Live (8
Protocol (8 bits) Header Checksum (16 bits)
bits)
Source (32 bits)
Destination (32 bits)
Options
Every node keeps information about every other node in the network
In case of adaptive routing, the routing calculations are done and updated for all the
nodes.
The above two are also the disadvantages of non-hierarchical routing, since the table sizes and
the routing calculations become too large as the networks get bigger. So this type of routing is
feasible only for small networks.
Hierarchical Routing
This is essentially a 'Divide and Conquer' strategy. The network is divided into different regions
and a router for a particular region knows only about its own domain and other routers. Thus,
the network is viewed at two levels:
1. The Sub-network level, where each node in a region has information about its peers in
the same region and about the region's interface with other regions. Different regions
may have different 'local' routing algorithms. Each local algorithm handles the traffic
between nodes of the same region and also directs the outgoing packets to the
appropriate interface.
2. The Network Level, where each region is considered as a single node connected to its
interface nodes. The routing algorithms at this level handle the routing of packets
between two interface nodes, and is isolated from intra-regional transfer.
Networks can be organized in hierarchies of many levels; e.g. local networks of a city at one
level, the cities of a country at a level above it, and finally the network of all nations.
All nodes in its region which are at one level below it.
Its peer interfaces.
At least one interface at a level above it, for outgoing packages.
Disadvantage :
Once the hierarchy is imposed on the network, it is followed and possibility of direct
paths is ignored. This may lead to sub optimal routing.
Source Routing
Source routing is similar in concept to virtual circuit routing. It is implemented as under:
Initially, a path between nodes wishing to communicate is found out, either by flooding
or by any other suitable method.
DEPARTMENT OF COMPUTER ENGINEERING & APPLICATIONS
Course File
COMPUTER NETWORKS
This route is then specified in the header of each packet routed between these two nodes.
A route may also be specified partially, or in terms of some intermediate hops.
Advantages:
Bridges do not need to lookup their routing tables since the path is already specified in
the packet itself.
The throughput of the bridges is higher, and this may lead to better utilization of
bandwidth, once a route is established.
Disadvantages:
Establishing the route at first needs an expensive search method like flooding.
To cope up with dynamic relocation of nodes in a network, frequent updates of tables
are required, else all packets would be sent in wrong direction. This too is expensive.
Minimum number of hops: If each link is given a unit cost, the shortest path is the one
with minimum number of hops. Such a route is easily obtained by a breadth first search
method. This is easy to implement but ignores load, link capacity etc.
Transmission and Propagation Delays: If the cost is fixed as a function of
transmission and propagation delays, it will reflect the link capacities and the
geographical distances. However these costs are essentially static and do not consider
the varying load conditions.
Queuing Delays: If the cost of a link is determined through its queuing delays, it takes
care of the varying load conditions, but not of the propagation delays.
Ideally, the cost parameter should consider all the above mentioned factors, and it should be
updated periodically to reflect the changes in the loading conditions. However, if the routes are
changed according to the load, the load changes again. This feedback effect between routing
and load can lead to undesirable oscillations and sudden swings.
Routing Algorithms
As mentioned above, the shortest paths are calculated using suitable algorithms on the graph
representations of the networks. Let the network be represented by graph G ( V, E ) and let the
number of nodes be 'N'. For all the algorithms discussed below, the costs associated with the
links are assumed to be positive. A node has zero cost w.r.t itself. Further, all the links are
assumed to be symmetric, i.e. if di,j = cost of link from node i to node j, then d i,j = d j,i . The
graph is assumed to be complete. If there exists no edge between two nodes, then a link of
DEPARTMENT OF COMPUTER ENGINEERING & APPLICATIONS
Course File
COMPUTER NETWORKS
infinite cost is assumed. The algorithms given below find costs of the paths from all nodes to a
particular node; the problem is equivalent to finding the cost of paths from a source to all
destinations.
Bellman-Ford Algorithm
This algorithm iterates on the number of edges in a path to obtain the shortest path. Since the
number of hops possible is limited (cycles are implicitly not allowed), the algorithm terminates
giving the shortest path.
Algorithm :
Principle:
For zero hops, the minimum length path has length of infinity, for every node. For one hop the
shortest-path length associated with a node is equal to the length of the edge between that node
and node 1. Hereafter, we increment the number of hops allowed, (from h to h+1 ) and find out
whether a shorter path exists through each of the other nodes. If it exists, say through node
'j', then its length must be the sum of the lengths between these two nodes (i.e. di,j ) and the
shortest path between j and 1 obtainable in upto h paths. If such a path doesn't exist, then the
path length remains the same. The algorithm is guaranteed to terminate, since there are utmost
N nodes, and so N-1 paths. It has time complexity of O ( N3 ) .
Dijkstra's Algorithm
Notation:
Di = Length of shortest path from node 'i' to node 1.
Algorithm
Each node j is labeled with Dj, which is an estimate of cost of path from node j to node 1.
Initially, let the estimates be infinity, indicating that nothing is known about the paths. We now
iterate on the length of paths, each time revising our estimate to lower values, as we obtain them.
Actually, we divide the nodes into two groups ; the first one, called set P contains the nodes
whose shortest distances have been found, and the other Q containing all the remaining nodes.
Initially P contains only the node 1. At each step, we select the node that has minimum cost
path to node 1. This node is transferred to set P. At the first step, this corresponds to shifting
the node closest to 1 in P. Its minimum cost to node 1 is now known. At the next step, select the
next closest node from set Q and update the labels corresponding to each node using :
Dj = min [ Dj , Di + dj,i ]
Finally, after N-1 iterations, the shortest paths for all nodes are known, and the algorithm
terminates.
Principle
Suppose the shortest path between i and j using nodes 1,2,...n is known. Now, if node n+1 is
allowed to be an intermediate node, then the shortest path under new conditions either passes
through node n+1 or it doesn't. If it does not pass through the node n+1, then Di,j[n+1] is same
as Di,j[n] . Else, we find the cost of the new route, which is obtained from the sum, Di,n+1[n] +
Dn+1,j[n]. So we take the minimum of these two cases at each step. After adding all the nodes
to the set of intermediate nodes, we obtain the shortest paths between all pairs of nodes
together. The complexity of Floyd-Warshall algorithm is O ( N3 ).
It is observed that all the three algorithms mentioned above give comparable performance,
depending upon the exact topology of the network.
ARP,RARP,ICMP Protocols
Address Resolution Protocol
If a machine talks to another machine in the same network, it requires its physical or MAC
address. But ,since the application has given the destination's IP address it requires some
mechanism to bind the IP address with its MAC address.This is done through Address
Resolution protocol (ARP).IP address of the destination node is broadcast and the destination
node informs the source of its MAC address.
But this means that every time machine A wants to send packets to machine B, A has to send
an ARP packet to resolve the MAC address of B and hence this will increase the traffic load too
much, so to reduce the communication cost computers that use ARP maintains a cache of
recently acquired IP_to_MAC address bindings, i.e. they dont have to use ARP repeatedly. ARP
Refinements Several refinements of ARP are possible: When machine A wants to send packets
to macine B, it is possible that machine B is going to send packets to machine A in the near
future.So to avoid ARP for machine B, A should put its IP_to_MAC address binding in the
special packet while requesting for the MAC address of B. Since A broadcasts its initial request
for the MAC address of B, every machine on the network should extract and store in its cache
the IP_to_MAC address binding of A When a new machine appears on the network (e.g. when
an operating system reboots) it can broadcast its IP_to_MAC address binding so that all other
DEPARTMENT OF COMPUTER ENGINEERING & APPLICATIONS
Course File
COMPUTER NETWORKS
machines can store it in their caches. This will eliminate a lot of ARP packets by all other
machines, when they want to communicate with this new machine.
Consider a scenario where a computer tries to contact some remote machine using ping program,
assuming that there has been no exchange of IP datagrams previously between the two machines
and therefore arp packet must be sent to identify the MAC address of the remote machine.
The arp request message (who is A.A.A.A tell B.B.B.B where the two are IP addresses) is
broadcast on the local area network with an Ethernet protocol type 0x806. The packet is
discarded by all the machines except the target machine which responds with an arp response
message (A.A.A.A is hh:hh:hh:hh:hh:hh where hh:hh:hh:hh:hh:hh is the Ethernet source
address). This packet is unicast to the machine with IP address B.B.B.B. Since the arp request
message included the hardware address (Ethernet source address) of the requesting computer,
target machine doesn't require another arp message to figure it out.
Detailed Mechanism
Both the machine that issues the request and the server that responds use physical network
addresses during their brief communication. Usually, the requester does not know the physical
address. So, the request is broadcasted to all the machines on the network. Now, the requester
must identify istelf uniquely to the server. For this either CPU serial number or the machine's
physical network address can be used. But using the physical address as a unique id has two
advantages.
These addresses are always available and do not have to be bound into bootstrap code.
Because the identifying information depends on the network and not on the CPU vendor,
all machines on a given network will supply unique identifiers.
Request:
Like an ARP message, a RARP message is sent from one machine to the another encapsulated
in the data portion of a network frame. An ethernet frame carrying a RARP request has the usual
preamle, Ethernet source and destination addresses, and packet type fields in front of the frame.
The frame conatins the value 8035 (base 16) to identify the contents of the frame as a RARP
message. The data portion of the frame contains the 28-octet RARP message. The sender
braodcasts a RARP request that specifies itself as both the sender and target machine, and
supplies its physical network address in the target hardware address field. All machines on the
network receive the request, but only those authorised to supply the RARP services process the
Reply:
Servers answers request by filling in the target protocol address field, changing the message
type from request to reply, and sending the reply back directly to the machine making the
request.
Since RARP uses the physical network directly, no other protocol software will time the
response or retransmit the request. RARP software must handle these tasks. Some workstations
that rely on RARP to boot, choose to retry indefinitely until the receive a response. Other
implementations announce failure after only a few tries to avoid flooding the network with
unnecessary broadcast.
Advantage: More reliability. Diadvantage: Overloading may result when all servers respond.
So, to get away with disadvantage we have primary and secondary servers. Each machine that
makes RARP request is assigned a primary server. Normally, the primary server responds but
if it fails, then requester may time out and rebroadcast the request.Whenever a secondary server
receives a second copy of the request within a short time of the first, it responds. But, still there
might be a problem that all secondary servers respond, thus overloading the network. So, the
solution adopted is to avoid having all secondary servers transmit responses simultaneously.
Each secondary server that receives the request computes a random delay and then sends a
response.
Drawbacks of RARP
Since it operates at low level, it requires direct addresss to the network which makes it
difficult for an application programmer to build a server.
It doesn't fully utilizes the capability of a network like ethernet which is enforced to send
a minimum packet size since the reply from the server contains only one small piece of
information, the 32-bit internet address.
ICMP
This protocol discusses a mechanism that gateways and hosts use to communicate control or
error information.The Internet protocol provides unreliable,connectionless datagram
service,and that a datagram travels from gateway to gateway until it reaches one that can deliver
it directly to its final destination. If a gateway cannot route or deliver a datagram,or if the
gateway detects an unusual condition, like network congestion, that affects its ability to forward
the datagram, it needs to instruct the original source to take action to avoid or correct the
problem. The Internet Control Message Protocol allows gateways to send error or control
messages to other gateways or hosts;ICMP provides communication between the Internet
Protocol software on one machine and the Internet Protocol software on another. This is a special
purpose message mechanism added by the designers to the TCP/IP protocols. This is to allow
gateways in an internet to report errors or provide information about unexpecter circumstances.
The IP protocol itself contains nothing to help the sender test connectivity or learn about
DEPARTMENT OF COMPUTER ENGINEERING & APPLICATIONS
Course File
COMPUTER NETWORKS
failures.
ICMP only reports error conditions to the original source; the source must relate errors to
individual application programs and take action to correct problems. It provides a way for
gateway to report the error It does not fully specify the action to be taken for each possible error.
ICMP is restricted to communicate with the original source but not intermediate sources.
What is TCP?
TCP was specifically designed to provide a reliable end to end byte stream over an unreliable
internetwork. Each machine supporting TCP has a TCP transport entity either a user process or
part of the kernel that manages TCP streams and interface to IP layer. A TCP entity accepts user
data streams from local processes, breaks them up into pieces not exceeding 64KB and sends
each piece as a separate IP datagram. Client Server mechanism is not necessary for TCP to
behave properly.
The IP layer gives no guarantee that datagram will be delivered properly, so it is up to TCP to
timeout and retransmit, if needed. Duplicate, lost and out of sequence packets are handled using
the sequence number, acknowledgements, retransmission, timers, etc to provide a reliable
service. Connection is a must for this service.Bit errors are taken care of by the CRC checksum.
TCP connection is a duplex connection. That means there is no difference between two sides
once the connection is established.
The "three-way handshake" is the procedure used to establish a connection. This procedure
normally is initiated by one TCP and responded to by another TCP. The procedure also works
if two TCP simultaneously initiate the procedure. When simultaneous attempt occurs, each TCP
receives a "SYN" segment which carries no acknowledgment after it has sent a "SYN". Of
course, the arrival of an old duplicate "SYN" segment can potentially make it appear, to the
recipient, that a simultaneous connection initiation is in progress. Proper use of "reset" segments
can disambiguate these cases.
The three-way handshake reduces the possibility of false connections. It is the implementation
of a trade-off between memory and messages to provide information for this checking.
The simplest three-way handshake is shown in figure below. The figures should be interpreted
in the following way. Each line is numbered for reference purposes. Right arrows (-->) indicate
departure of a TCP segment from TCP A to TCP B, or arrival of a segment at B from A. Left
arrows (<--), indicate the reverse. Ellipsis (...) indicates a segment which is still in the network
(delayed). TCP states represent the state AFTER the departure or arrival of the segment (whose
contents are shown in the center of each line). Segment contents are shown in abbreviated form,
with sequence number, control flags, and ACK field. Other fields such as window, addresses,
lengths, and text have been left out in the interest of clarity.
Simultaneous initiation is only slightly more complex, as is shown in figure below. Each TCP
cycles from CLOSED to SYN-SENT to SYN-RECEIVED to ESTABLISHED.
The first two figures show how a three way handshake deals with problems of duplicate/delayed
connection requests and duplicate/delayed connection acknowledgements in the network.The
third figure highlights the problem of spoofing associated with a two way handshake.
Connection Establish
Connection Release
The initiator sends a FIN with the current sequence and acknowledgement number.
The responder on receiving this informs the application program that it will receive no
more data and sends an acknowledgement of the packet. The connection is now closed
from one side.
Now the responder will follow similar steps to close the connection from its side. Once
this is done the connection will be fully closed.