Computer Networks PDF
Computer Networks PDF
Tiruvannamalai – 606611
A Course Material
on
Computer Networks
By
A.Owaise Ahmed
Assistant Professor
Computer Science and Engineering Department
S.K.P. Engineering College, Tiruvannamalai VI SEM
Quality Certificate
This is to certify that the course material being prepared by Mr. A.Owaise Ahmed is
of the adequate quality. He has referred more than five books and one among them
is from abroad author.
Seal: Seal:
OUTCOMES: At the end of the course, the student should be able to:
Identify the components required to build different types of networks
Choose the required functionality at each layer for given application
Identify solution for each functionality at each layer
Trace the flow of information from one node to another node in the network
TEXT BOOK:
1. Larry L. Peterson, Bruce S. Davie, ―Computer Networks: A systems approach‖, Fifth
Edition, Morgan Kaufmann Publishers, 2011.
REFERENCES:
1. James F. Kurose, Keith W. Ross, ―Computer Networking - A Top-Down Approach
Featuring the Internet‖, Fifth Edition, Pearson Education, 2009.
2. Nader. F. Mir, ―Computer and Communication Networks‖, Pearson Prentice
Hall
Publishers, 2010.
3. Ying-Dar Lin, Ren-Hung Hwang, Fred Baker, ―Computer Networks: An Open Source
Approach‖, Mc Graw Hill Publisher, 2011.
4. Behrouz A. Forouzan, ―Data communication and Networking‖, Fourth Edition,
Tata
McGraw – Hill, 2011.
CONTENTS
S. No Particulars Page
1 Unit – I 6
2 Unit- II 57
3 Unit – III 86
4 Unit – IV 101
5 Unit – V 119
Prerequisite
Internetwork programming
Network development
VPN troubleshooting
Firewall technology
Multilayer switching
UNIT I
FUNDAMENTALS & LINK LAYER
PART-A
1. Define Computer Network. [CO1 – L1 – MAY/JUNE 2015]
Interconnected collection of autonomous computers is called computer network.
This interconnection among computers facilitates information sharing among
them. Computers may connect to each other by either wired or wireless media.
Geographical span
Inter-connectivity
Administration
Architecture
3. Mention the Network Applications. [CO1 – L1]
Computer systems and peripherals are connected to form a network. They provide
numerous advantages:
In layered communication system, one layer of a host deals with the task done by
or to be done by its peer layer at the same level on the remote host. The task is
either initiated by layer at the lowest level or at the top most level. If the task is
initiated by the-top most layer, it is passed on to the layer below it for further
processing. The lower layer does the same thing, it processes the task and
passes on to lower layer. If the task is initiated by lower most layer, then the
reverse path is taken.
5. What are the three criteria necessary for an effective and efficient network?
[CO1 – L1]
The most important criteria are performance, reliability and security. Performance of
the network depends on number of users, type of transmission medium, and the
capabilities of the connected h/w and the efficiency of the s/w. Reliability is measured
by frequency of failure, the time it takes a link to recover from the failure and the
network‘s robustness in a catastrophe. Security issues include protecting data from
unauthorized access and viruses.
7. What are header and trailers and how do they get added and removed? [CO1 –
L1]
Each layer in the sending machine adds its own information to the message it
receives from the layer just above it and passes the whole package to the layer just
below it. This information is added in the form of headers or trailers. Headers are
added to the message at the layers 6,5,4,3, and 2. A trailer is added at layer2. At the
receiving machine, the headers or trailers attached to the data unit at the
corresponding sending layers are removed, and actions appropriate to that layer are
taken.
10. What are the two interfaces provided by protocols? [CO1 – L1]
Service interface
Peer interface
Service interface- defines the operations that local objects can perform on the
protocol.
Peer interface- defines the form and meaning of messages exchanged between
protocol peers to implement the communication service.
17. What is spread spectrum and explain the two types of spread spectrum? [CO1
– L1]
Spread spectrum is to spread the signal over a wider frequency band than normal in
such a way as to minimize the impact of interference from other devices.
Frequency Hopping
Direct sequence
20. What are the responsibilities of data link layer? [CO1 – L1]
Specific responsibilities of data link layer include the following. a) Framing b) Physical
addressing c) Flow control d) Error control e) Access control.
21. What are the ways to address the framing problem? [CO1 – L1]
Byte-Oriented Protocols(PPP)
Bit-Oriented Protocols(HDLC)
Clock-Based Framing(SONET)
23. Mention the types of errors and define the terms. [CO1 – L1]
Single-bit error.
Burst-bit error.
Single bit error: The term single bit error means that only one bit of a given data unit
(such as byte character/data unit or packet) is changed from 1 to 0 or from 0 to 1.
Burst error: Means that 2 or more bits in the data unit have changed from 1 to 0 from
0 to 1.
24. List out the available detection methods. [CO1 – L1 MAY/JUNE 2016]
There are 4 types of redundancy checks are used in data communication.
Vertical redundancy checks (VRC).
Longitudinal redundancy checks (LRC).
Cyclic redundancy checks (CRC).
Checksum.
30. What are the steps followed in checksum generator? [CO1 – L1]
The sender follows these steps a) the units are divided into k sections each of n bits.
b) All sections are added together using 2‟s complement to get the sum. c) The sum
is complemented and become the checksum. d) The checksum is sent with the data.
PART-B
LANs are composed of inexpensive networking and routing equipment. It may contain
local servers serving file storage and other locally shared applications. It mostly
operates on private IP addresses and does not involve heavy routing. LAN works
under its own local domain and controlled centrally. LAN uses either Ethernet or
Token-ring technology. Ethernet is most widely employed LAN technology and uses
Star topology, while Token-ring is rarely seen.LAN can be wired, wireless, or in both
forms at once.
WAN may use advanced technologies such as Asynchronous Transfer Mode (ATM),
Frame Relay, and Synchronous Optical Network (SONET). WAN may be managed by
multiple administrations.
Bus Topology
In case of Bus topology, all devices share single communication line or cable. Bus
topology may have problem while multiple hosts sending data at the same time.
Therefore, Bus topology either uses CSMA/CD technology or recognizes one host as
Bus Master to solve the issue. It is one of the simple forms of networking where a
failure of a device does not affect the other devices. But failure of the shared
communication line can make all other devices stop functioning.
Both ends of the shared channel have line terminator. The data is sent in only one
direction and as soon as it reaches the extreme end, the terminator removes the data
from the line.
Star Topology
All hosts in Star topology are connected to a central device, known as hub device,
using a point-to-point connection. That is, there exists a point to point connection
between hosts and hub. The hub device can be any of the following:
As in Bus topology, hub acts as single point of failure. If hub fails, connectivity of all
hosts to all other hosts fails. Every communication between hosts, takes place
through only the hub. Star topology is not expensive as to connect one more host,
only one cable is required and configuration is simple.
Ring Topology
In ring topology, each host machine connects to exactly two other machines, creating
a circular network structure. When one host tries to communicate or send message to
a host which is not adjacent to it, the data travels through all intermediate hosts. To
connect one more host in the existing structure, the administrator may need only one
more extra cable.
Failure of any host results in failure of the whole ring. Thus, every connection in the
ring is a point of failure. There are methods which employ one more backup ring.
Mesh Topology
In this type of topology, a host is connected to one or multiple hosts. This topology
has hosts in point-to-point connection with every other host or may also have hosts
which are in point-to-point connection to few hosts only.
Hosts in Mesh topology also work as relay for other hosts which do not have direct
point-to-point links. Mesh technology comes into two types:
Full Mesh: All hosts have a point-to-point connection to every other host in the
network. Thus for every new host n(n-1)/2 connections are required. It provides the
most reliable network structure among all network topologies.
Partially Mesh: Not all hosts have point-to-point connection to every other host.
Hosts connect to each other in some arbitrarily fashion. This topology exists where
we need to provide reliability to some hosts out of all.
Tree Topology
Also known as Hierarchical Topology, this is the most common form of network
topology in use presently. This topology imitates as extended Star topology and
inherits properties of bus topology.
All neighboring hosts have point-to-point connection between them. Similar to the
Bus topology, if the root goes down, then the entire network suffers even though it is
not the single point of failure. Every connection serves as point of failure, failing of
which divides the network into unreachable segment.
Hybrid Topology
A network structure whose design contains more than one topology is said to be
hybrid topology. Hybrid topology inherits merits and demerits of all the incorporating
topologies.
The above picture represents an arbitrarily hybrid topology. The combining topologies
may contain attributes of Star, Ring, Bus, and Daisy-chain topologies. Most WANs
are connected by means of Dual-Ring topology and networks connected to them are
mostly Star topology networks. Internet is the best example of largest Hybrid topology
Guided Media
All communication wires/cables are guided media, such as UTP, coaxial cables, and
fibre Optics. In this media, the sender and receiver are directly connected and the
information is send (guided) through it. Ex. Twisted pair, Coaxial Cable, Fibre Optics
Unguided Media
Wireless or open air space is said to be unguided media, because there is no
connectivity between the sender and receiver. Information is spread over the air, and
anyone including the actual recipient may collect the information. Ex. Satellite
Communication.
Guided Media
Twisted Pair Cable
A twisted pair cable is made of two plastic insulated copper wires twisted together to
form a single media. Out of these two wires, only one carries actual signal and
another is used for ground reference. The twists between wires are helpful in
reducing noise (electro-magnetic interference) and crosstalk.
Coaxial Cable
Coaxial cable has two wires of copper. The core wire lies in the centre and it is made
of solid conductor. The core is enclosed in an insulating sheath. The second wire is
wrapped around over the sheath and that too in turn encased by insulator sheath.
This all is covered by plastic cover.
Because of its structure, the coax cable is capable of carrying high frequency signals
than that of twisted pair cable. The wrapped structure provides it a good shield
against noise and cross talk. Coaxial cables provide high bandwidth rates of up to
450 mbps.
There are three categories of coax cables namely, RG-59 (Cable TV), RG-58 (Thin
Ethernet), and RG-11 (Thick Ethernet). RG stands for Radio Government.
Cables are connected using BNC connector and BNC-T. BNC terminator is used to
terminate the wire at the far ends.
Power Lines
Power Line communication (PLC) is Layer-1 (Physical Layer) technology which uses
power cables to transmit data signals. In PLC, modulated data is sent over the
cables. The receiver on the other end de-modulates and interprets the data.
Because power lines are widely deployed, PLC can make all powered devices
controlled and monitored. PLC works in half-duplex.
Narrow band PLC provides lower data rates up to 100s of kbps, as they work at lower
frequencies (3-5000 kHz).They can be spread over several kilometres.
Broadband PLC provides higher data rates up to 100s of Mbps and works at higher
frequencies (1.8 – 250 MHz).They cannot be as much extended as Narrowband PLC.
Fiber Optics
Fiber Optic works on the properties of light. When light ray hits at critical angle it
tends to refracts at 90 degree. This property has been used in fiber optic. The core of
fiber optic cable is made of high quality glass or plastic. From one end of it light is
emitted, it travels through it and at the other end light detector detects light stream
and converts it to electric data.
Fiber Optic provides the highest mode of speed. It comes in two modes, one is single
mode fiber and second is multimode fiber. Single mode fiber can carry a single ray of
light whereas multimode is capable of carrying multiple beams of light.
Fiber Optic also comes in unidirectional and bidirectional capabilities. To connect and
access fiber optic special type of connectors are used. These can be Subscriber
Channel (SC), Straight Tip (ST), or MT-RJ.
Radio Transmission
Radio frequency is easier to generate and because of its large wavelength it can
penetrate through walls and structures alike. Radio waves can have wavelength from
1mm– 100,000 km and have frequency ranging from 3 Hz (Extremely Low
Frequency) to 300 GHz (Extremely High Frequency). Radio frequencies are sub-
divided into six bands.
Radio waves at lower frequencies can travel through walls whereas higher RF can
travel in straight line and bounce back.
The power of low frequency waves decreases sharply as they cover long distance.
High frequency radio waves have more power.
Lower frequencies such as VLF, LF, MF bands can travel on the ground up to 1000
kilometers, over the earth‘s surface.
Radio waves of high frequencies are prone to be absorbed by rain and other
obstacles. They use Ionosphere of earth atmosphere. High frequency radio waves
such as HF and VHF bands are spread upwards. When they reach Ionosphere,
they are refracted back to the earth.
Microwave Transmission
Electromagnetic waves above 100 MHz tend to travel in a straight line and signals
over them can be sent by beaming those waves towards one particular station.
Because Microwaves travels in straight lines, both sender and receiver must be
aligned to be strictly in line-of-sight.
Microwaves can have wavelength ranging from 1 mm – 1 meter and frequency ranging
from 300 MHz to 300 GHz.
Microwave antennas concentrate the waves making a beam of it. As shown in picture
above, multiple antennas can be aligned to reach farther. Microwaves have higher
frequencies and do not penetrate wall like obstacles.
Microwave transmission depends highly upon the weather conditions and the
frequency it is using.
Infrared Transmission
Infrared wave lies in between visible light spectrum and microwaves. It has
wavelength of 700-nm to 1-mm and frequency ranges from 300-GHz to 430-THz.
Infrared wave is used for very short range communication purposes such as
television and it‘s remote. Infrared travels in a straight line hence it is directional by
nature. Because of high frequency range, Infrared cannot cross wall-like obstacles.
Light Transmission
Highest most electromagnetic spectrum which can be used for data transmission is
light or optical signaling. This is achieved by means of LASER.
Because of frequency light uses, it tends to travel strictly in straight line.Hence the
sender and receiver must be in the line-of-sight. Because laser transmission is
unidirectional, at both ends of communication the laser and the photo-detector needs
to be installed. Laser beam is generally 1mm wide hence it is a work of precision to
align two far receptors each pointing to lasers source.
Lasers cannot penetrate obstacles such as walls, rain, and thick fog. Additionally, laser
beam is distorted by wind, atmosphere temperature, or variation in temperature in the
path.
Laser is safe for data transmission as it is very difficult to tap 1mm wide laser without
interrupting the communication channel.
Multiplexing
Multiplexing is a technique to mix and send multiple data streams over a single
medium. This technique requires system hardware called multiplexer (MUX) for
multiplexing the streams and sending them on a medium, and de-multiplexer (DMUX)
which takes information from the medium and distributes to different destinations.
Line Coding
The process for converting digital data into digital signal is said to be Line Coding.
Digital data is found in binary format. It is represented (stored) internally as series of
1s and 0s.
Digital signal is denoted by discreet signal, which represents digital data. There are
three types of line coding schemes available:
Uni-polar Encoding
Unipolar encoding schemes use single voltage level to represent data. In this case, to
represent binary 1, high voltage is transmitted and to represent 0, no voltage is
transmitted. It is also called Unipolar-Non-return-to-zero, because there is no rest
condition i.e. it either represents 1 or 0.
Polar Encoding
Polar encoding scheme uses multiple voltage levels to represent binary values. Polar
encodings is available in four types:
NRZ-L changes voltage level at when a different bit is encountered whereas NRZ-I
changes voltage when a 1 is encountered.
Manchester
This encoding scheme is a combination of RZ and NRZ-L. Bit time is divided into two
halves. It transits in the middle of the bit and changes phase when a different bit is
encountered.
Differential Manchester
This encoding scheme is a combination of RZ and NRZ-I. It also transit at the middle
of the bit but changes phase only when 1 is encountered.
Bipolar Encoding
Bipolar encoding uses three voltage levels, positive, negative and zero. Zero voltage
represents binary 0 and bit 1 is represented by altering positive and negative
voltages.
Block Coding
To ensure accuracy of the received data frame redundant bits are used. For example,
in even-parity, one parity bit is added to make the count of 1s in the frame even. This
way the original number of bits is increased. It is called Block Coding.
Block coding is represented by slash notation, mB/nB.Means, m-bit block is
substituted with n-bit block where n > m. Block coding involves three steps:
Division,
Substitution
Combination.
After block coding is done, it is line coded for transmission.
Analog-to-Digital Conversion
Microphones create analog voice and camera creates analog videos, which are treated
is analog data. To transmit this analog data over digital signals, we need analog to
digital conversion.
Analog data is a continuous stream of data in the wave form whereas digital data is
discrete. To convert analog wave into digital data, we use Pulse Code Modulation
(PCM).PCM is one of the most commonly used methods to convert analog data into
digital form. It involves three steps:
Sampling
Quantization
Encoding.
Sampling
The analog signal is sampled every T interval. Most important factor in sampling is
the rate at which analog signal is sampled. According to Nyquist Theorem, the
sampling rate must be at least two times of the highest frequency of the signal.
Quantization
Sampling yields discrete form of continuous analog signal. Every discrete pattern
shows the amplitude of the analog signal at that instance. The quantization is done
between the maximum amplitude value and the minimum amplitude value.
Quantization is approximation of the instantaneous analog value.
Encoding
Digital-to-Analog Conversion
When data from one computer is sent to another via some analog carrier, it is first
converted into analog signals. Analog signals are modified to reflect digital data. An
analog signal is characterized by its amplitude, frequency, and phase. There are
three kinds of digital-to-analog conversions:
When binary data represents digit 1, the amplitude is held; otherwise it is set to 0.
Both frequency and phase remain same as in the original carrier signal.
This technique uses two frequencies, f1 and f2. One of them, for example f1, is
chosen to represent binary digit 1 and the other one is used to represent binary digit
0. Both amplitude and phase of the carrier wave are kept intact.
Analog-to-Analog Conversion
Analog signals are modified to represent analog data. This conversion is also known
as Analog Modulation. Analog modulation is required when bandpass is used. Analog
to analog conversion can be done in three ways:
Amplitude Modulation
In this modulation, the amplitude of the carrier signal is modified to reflect the analog
data.
Frequency Modulation
In this modulation technique, the frequency of the carrier signal is modified to reflect
the change in the voltage levels of the modulating signal (analog data).
The amplitude and phase of the carrier signal are not altered.
Phase Modulation
In the modulation technique, the phase of carrier signal is modulated in order to
reflect the change in voltage (amplitude) of analog data signal.
signal is changed (made dense and sparse) to reflect voltage change in the amplitude
of modulating signal.
Communication is possible over the air (radio frequency), using a physical media
(cable), and light (optical fiber). All mediums are capable of multiplexing.
When multiple senders try to send over a single medium, a device called Multiplexer
divides the physical channel and allocates one to each. On the other end of
communication, a De-multiplexer receives data from a single medium, identifies each,
and sends to different receivers.
TDM works in synchronized mode. Both ends, i.e. Multiplexer and De-multiplexer are
timely synchronized and both switch to next channel simultaneously.
When channel A transmits its frame at one end, the De-multiplexer provides media to
channel A on the other end. As soon as the channel A‘s time slot expires, this side
switches to channel B. On the other end, the De-multiplexer works in a synchronized
manner and provides media to channel B. Signals from different channels travel the
path in interleaved manner.
Wavelength Division Multiplexing:
Light has different wavelength (colors). In fiber optic mode, multiple optical carrier
signals are multiplexed into an optical fiber by using different wavelengths. This is an
analog multiplexing technique and is done conceptually in the same manner as FDM
but uses light as signals.
Each station is assigned with a unique code, called chip. Signals travel with these
codes independently, inside the whole bandwidth. The receiver knows in advance the
chip code signal it has to receive.
Circuit Switching
When two nodes communicate with each other over a dedicated communication
path, it is called circuit switching. There 'is a need of pre-specified route from which
data will travel and no other data is permitted. In circuit switching, to transfer the data,
circuit must be established so that the data transfer can take place.
Circuits can be permanent or temporary. Applications which use circuit switching may
have to go through three phases:
Establish a circuit
Transfer the data
Disconnect the circuit
Circuit switching was designed for voice applications. Telephone is the best suitable
example of circuit switching. Before a user can make a call, a virtual path between
caller and called is established over the network.
Packet Switching
Shortcomings of message switching gave birth to an idea of packet switching. The
entire message is broken down into smaller chunks called packets. The switching
information is added in the header of each packet and transmitted independently.
It is easier for intermediate networking devices to store small size packets and they do
not take many resources either on carrier path or in the internal memory of switches.
Packet switching enhances line efficiency as packets from multiple applications can
be multiplexed over the carrier. The internet uses packet switching technique. Packet
switching enables the user to differentiate data streams based on priorities. Packets
are stored and forwarded according to their priority to provide quality of service.
Message Switching
This technique was somewhere in middle of circuit switching and packet switching. In
message switching, the whole message is treated as a data unit and is switching /
transferred in its entirety.
A switch working on message switching, first receives the whole message and
buffers it until there are resources available to transfer it to the next hop. If the next
hop is not having enough resource to accommodate large size message, the
message is stored and switch waits.
Every switch in transit path needs enough storage to accommodate entire message.
Because of store-and-forward technique and waits included until resources are
available, message switching is very slow.
Message switching was not a solution for streaming media and real-time applications.
Application Layer: This layer is responsible for providing interface to the application
user. This layer encompasses protocols which directly interact with the user.
Presentation Layer: This layer defines how data in the native format of remote host
should be presented in the native format of host.
Session Layer: This layer maintains sessions between remote hosts. For example,
once user/password authentication is done, the remote host maintains this session
for a while and does not ask for authentication again in that time span.
Transport Layer: This layer is responsible for end-to-end delivery between hosts.
Network Layer: This layer is responsible for address assignment and uniquely
addressing hosts in a network.
Data Link Layer: This layer is responsible for reading and writing data from and onto
the line. Link errors are detected at this layer.
Physical Layer: This layer defines the hardware, cabling wiring, power output, pulse
rate etc.
Physical Layer
It coordinates the functions required to carry a bit stream over a physical medium.
Encoding—To be transmitted, bits must be encoded into signals, electrical or optical.
Data rate—It defines the transmission rate (number of bits sent per second).
Physical topology—It defines how devices are connected (mesh, star, ring, bus or
hybrid)
Transmission mode defines the direction of transmission between two devices:
Simplex, half-duplex, or full-duplex
The data link layer transforms a raw transmission facility to a reliable link.
Framing—The bit stream is divided into manageable data units called frames.
Physical addressing—Header contains physical address of sender and receiver
Flow control—If receiving rate is less than the transmission rate, flow control
mechanism avoids sender overwhelming the receiver.
Error control—Redundant information is put as trailer to detect and retransmit
damaged/lost frames and to recognize duplicate frames.
Access control—When two or more devices are connected to the same link, link layer
protocols determines which device has control over the link at any given time.
Network Layer
Transport Layer
Transport layer is responsible for process-to-process delivery of the entire message.
Session Layer
Dialog control—It allows two systems to enter into a dialog and communicate
Binding—binds together the different streams that are part of a single application.
For example, audio and video stream are combined in a teleconferencing application.
Presentation Layer
It is concerned with syntax and semantics of the information exchanged between peers.
Application Layer
The application layer enables the user, whether human or software, to access the
network. It provides user interface and support for services such as electronic mail,
remote file access, shared database management and several types of distributed
services. It composes a host of application protocols.
Internet uses TCP/IP protocol suite, also known as Internet suite. This defines Internet
Model
which contains four layered architecture. OSI Model is general communication model
but
Internet Model is what the internet uses for all its communication. The internet is
independent
of its underlying network architecture so is its Model. This model has the following
layers:
Application Layer: This layer defines the protocol which enables user to interact with
the network.For example, FTP, HTTP etc.
Transport Layer: This layer defines how data should flow between hosts. Major
protocol at this layer is Transmission Control Protocol (TCP). This layer ensures data
delivered between hosts is in-order and is responsible for end-to-end delivery.
Internet Layer: Internet Protocol (IP) works on this layer. This layer facilitates host
addressing and recognition. This layer defines routing.
Link Layer: This layer provides mechanism of sending and receiving actual
data.Unlike its OSI Model counterpart, this layer is independent of underlying network
architecture and hardware.
Example Application
The implementation of a simple client/server program that uses the socket interface to
send messages over a TCP connection is discussed. The program also uses other
Unix networking utilities, Our application allows a user on one machine to type in and
send text to a user on another machine. It is a simplified version of the Unix talk
program, which is similar to the program at the core of a web chat room. Client
program :
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define SERVER_PORT 5432
#define MAX_LINE 256
int
main(int argc, char * argv[])
{
FILE *fp;
struct hostent *hp;
struct sockaddr_in sin;
char *host;
char buf[MAX_LINE];
int s;
int len;
if (argc==2) {
host = argv[1];
}
else {
fprintf(stderr, "usage: simplex-talk host\n");
exit(1);
}
/* translate host name into peer‘s IP address */
hp = gethostbyname(host);
if (!hp) {
fprintf(stderr, "simplex-talk: unknown host: %s\n", host);
exit(1);
}
/* build address data structure */
bzero((char *)&sin, sizeof(sin));
sin.sin_family = AF_INET;
bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length);
sin.sin_port = htons(SERVER_PORT);
/* active open */
Server Program :
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#define SERVER_PORT 5432
#define MAX_PENDING 5
#define MAX_LINE 256
int
main()
{
struct sockaddr_in sin;
char buf[MAX_LINE];
int len;
int s, new_s;
/* build address data structure */
bzero((char *)&sin, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(SERVER_PORT);
/* setup passive open */
if ((s = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
perror("simplex-talk: socket"); exit(1);
}
if ((bind(s, (struct sockaddr *)&sin, sizeof(sin))) < 0) {
perror("simplex-talk: bind"); exit(1);
}
listen(s, MAX_PENDING);
/* wait for connection, then receive and print text */
while(1) {
Round Trip Time (RTT) is time taken for the message to travel to the other end and
get back.
For applications that have minimal data transfer, latency dominates performance,
whereas for bulk data transfers, bandwidth dominates performance.
Delay × Bandwidth Product
For example, for a cross-country fiber with 10 Gbps bandwidth, distance of 4000 km,
the RTT is 40 ms and RTT × bandwidth is 400 Mb.
11. DISCUSS ABOUT THE ISSUES IN THE DATA LINK LAYER. [CO1 – H1]
It has several functions like
Data link layer is one of the OSI layers which define the packet format exchanged
between the nodes.
Framing
Link access
Flow control
Reliable delivery
Error detection
Error correction
Half duplex
Full duplex
Data link layer design issues:
The data link layer has a number of specific functions it can carry out. These functions
include
To achieve these goals, the data link layer takes the packets it gets from the network
layer and encapsulates them into frames for transmission.
Each frame contains a frame header, a payload field for holding the packet and a
frame trailer. The relationship between packets and frames is represented below:
The job of data link layer is to transmit the bits to the destination machine. So, they
can be handed over to the network layer.
The data link layer can be designed to offer various services. The actual services
offered can vary from system to system.
The possibilities that are commonly provide are
1. Unacknowledged connectionless service.
2. Acknowledged connectionless service.
3. Acknowledged connection oriented service.
1. Unacknowledged connectionless service:
It consists of having the source machine send independent frames to the destination
machine without having the destination machine acknowledge them.
No logical connection is established beforehand or released afterward.
If a frame is lost due to noise on the line, no attempt is made to detect the loss
recover from it in the data link layer.
Most LANs use unacknowledged connectionless service in the data link layer.
The most sophisticated service the data link layer can provide to the network layer
connection oriented service. With this service, the source and destination machines
establish a connection before any data are transferred. Each frame sent over the
connection is numbered and the data link layer guarantee that each frame sent is
indeed received. Also, it assures that each frame is received exactly once and that all
frames are received in the right order.
(b) Framing:
The incoming data unit from network layer is splitted into more number of small
data units.
(c) Error control:
It is provided as a function in order to find the error and to resend the lost or damaged
data frame. Also error control is used to overcome the duplication problem.
(d) Flow control:
If the rate at which data are taken by the destination entity is less than sender rate then
a flow
control concept is employed to stop the overwhelming or destination entity.
Sentinel Approach
The BISYNC protocol illustrates the sentinel approach to framing; its frame
format is
The data portion of the frame is then contained between special sentinel characters:
STX (start of text) and ETX (end of text).
The SOH (start of header) field serves much the same purpose as the STX field.
The frame format also includes a field labeled CRC (cyclic redundancy check) that is
used to detect transmission errors.
The problem with the sentinel approach is that the ETX character might appear in the
data portion of the frame. BISYNC overcomes this problem by ―escaping‖ the ETX
character by preceding it with a DLE (data-link-escape) character whenever it appears
in the body of a frame; the DLE character is also escaped (by preceding it with an extra
DLE) in the frame body. This approach is called character stuffing.
The more recent Point-to-Point Protocol (PPP). The format of PPP frame
is
Byte-Counting Approach
The number of bytes contained in a frame can he included as a field in the frame
header. DDCMP protocol is used for this approach. The frame format is
In this, frames are viewed as collection of bits. High level data link protocol is used.
The format is
If it sees a 1 (i.e., the last eight bits it has looked at are 01111111), then there must
have been an error and the whole frame is discarded.
It is arranged as nine rows of 90 bytes each, and the first 3 bytes of each row are
overhead, with the rest being available for data.
The first 2 bytes of the frame contain a special bit pattern, and it is these bytes that
enable the receiver to determine where the frame starts.
The receiver looks for the special bit pattern consistently, once in every 810 bytes,
since each frame is 9 x 90 = 810 bytes long.
The STS-N frame can he thought of as consisting of N STS-1 frames, where the
bytes from these frames are interleaved; that is, a byte from the first frame is
transmitted, then a byte from the second frame is transmitted, and so on.
Payload from these STS-1 frames can he linked together to form a larger STS-N
payload, such a link is denoted STS-Nc. One of the bits in overhead is used for this
purpose.
The term Single-bit error means that only one bit of a given data unit (such as byte,
character, data unit or packet) is changed from 1 to 0 or from 0 to 1.
Burst Error
The term Burst Error means that two or more bits in the data unit have changed from
1 to 0 or from 0 to 1.
Redundancy
One method is to send every data twice, so that receiver checks every bit of two
copies and detect error.
Drawbacks
Sends n-redundant bits for n-bit message.
Many errors are undetected if both the copies are corrupted. Instead of adding entire
data, some bits are appended to each unit.
This is called redundant bit because the bits added will not give any new information.
These bits are called error detecting codes.
This adds extra parity byte for entire frame, in addition to a parity bit for each byte.
In this case, 14 bits of redundant information are added with original information.
Steps
Append k-1 zeros with M(x) – P(x)
Divide P(x) by C(x)
Subtract the remainder from T(x)
Subtraction is made by making XOR operation
Error Correction
Error Correction can be handled in two ways
1. When an error is discovered, the receiver can have the sender to retransmit
the entire data unit.
2. A receiver can use an error correcting code, which automatically correct
certain errors.
Error correcting codes are more sophisticated than error-detection codes and require
more redundancy bits.In single bit error detection only two states are sufficient.
1) error
2) no error
Two states are not enough to detect an error but not to correct it.
Redundancy Bits
To calculate the number of redundancy bit(r) required to correct a given number of
data bits (m), we must find a relationship between m and r.
Add m bits of data with r bits. The length of the resulting code is m+r.
Data and Redundancy bits
If the total number of bits are m+r,r then r must be able to indicate at least m+r+1
different states. r bits can indicate 2 different states. Therefore, 2r must be equal to or
greater than m+r+1
2r>=m+r+1
For example if the value of m is 7 the smallest r value that can satisfy this equation is
4.
Number of
Number of Data Bits redundancy Total bits (m+r)
(m) Bits(r)
1 2 3
2 3 5
3 3 6
4 3 7
5 4 9
6 4 10
7 4 11
Hamming Code
R.W. Hamming provides a practical solution for the error correction.
Positioning the Redundancy Bits
For example, a seven-bit ASCII code requires four redundancy bits that can be added
to the end of the data or intersperse with the original data bits. These redundancy bits
are placed in positions 1, 2, 4 and 8. We refer these bits as r1, r2, r3 and r4
Position of redundancy bits in Hamming code
The combination used to calculate each of the four r values for a seven-bit data
sequence are as follows
The r1 bit is calculated using all bits positions whose binary representation include a 1
in the rightmost position
r2 is calculated using all bit position with a 1 in the second position and so on
r1: bits 1,3,5,7,9,11
r2: bits 2, 3, 6, 7, 10, 11
r3: bits 4, 5, 6, 7
Place each bit of the original character in its appropriate position in the 11-bit unit.
Calculate the even parities for the various bit combination.
The parity value for each combination is the value of the corresponding r bit. For
example,
The value of r1 is calculated to provide even parity for a combination of bits 3,5,7,9
and 11.
The value of r2 is calculated to provide even parity with bits 3, 6, 7, 10 and 11.
The value of r3 is calculated to provide even parity with bits 4, 5, 6 and 7.
The value of r4 is calculated to provide even parity with bits 8, 9, 10 and 11.
The receiver takes the transmission and recalculates four new data using the same
set of bits used by the sender plus the relevant parity (r) bit for each set.
Error detection
Then it assembles the new parity values into a binary number in order of r position
(r8, r4, r2, r1).
This step gives us the binary number 0111(7 in decimal) which is the precise location
of the bit in error.
Once the bit is identified, the receiver can reverse its value and correct the error.
Hamming Distance
One of the central concepts in coding for error control is the idea of the Hamming
distance.
The Hamming distance between two words (of the same size) is the number of
differences between the corresponding bits. The Hamming distance between two
words x and y is d(x, y).
The Hamming distance can be found by applying the XOR operation on the two
words and count the number of 1‘s in the result.
In a set of words, the minimum Hamming distance is the smallest Hamming distance
between all possible pairs. We use dmin to define the minimum Hamming distance in
a coding scheme.
Sliding Window
In this flow control mechanism, both sender and receiver agree on the number of
data-frames after which the acknowledgement should be sent. As we learnt, stop and
wait flow control mechanism wastes resources, this protocol tries to make use of
underlying resources as much as possible.
Sliding Window refers to imaginary boxes at both the sender and the receiver.
Window can hold frames at either end and provides the upper limit on the number of
frames that can be transmitted before requiring an acknowledgement.
Frames are numbered modulo-n which means they are numbered from o to n-1
For eg. If n=8 the frames are numbered 0,1,2,3,4,5,6,7. i.e the size of the window is n
-1.
When the receiver sends ACK it includes the number of the next frame it expects to
receive.
When the sender sees an ACK with the number 5, it knows that all frames up through
number 4 have been received.
Receiver Window
The receive window is an abstract concept defining an imaginary box of size 1 with
one single variable Rn.
The window slides when a correct frame has arrived, sliding occurs one slot at a time.
When the timer expires, the sender resends all outstanding frames. For example,
suppose the sender has already sent frame 6, but the timer for frame 3 expires. This
means that frame 3 has not been acknowledged; the sender goes back and sends
frames 3, 4,5, and 6 again. That is why the protocol is called Go-Back-N.
Selective Repeat
Sender Window
Receiver window
The Selective Repeat Protocol allows as many frames as the size of the receive
window to arrive out of order and be kept until there is a set of in-order frames
to be delivered to the network layer.
Because the sizes of the send window and receive window are the same, all the
frames in the send frame can arrive out of order and be stored until they can be
delivered.
If any frame lost, sender has to retransmit only that lost frames.
15. HOW DATA LINK LAYER PERFORMS ERROR CONTROL? [CO1 – L2]
When data-frame is transmitted, there is a probability that data-frame may be lost in
the transit or it is received corrupted. In both cases, the receiver does not receive the
correct data-frame and sender does not know anything about any loss. In such case,
both sender and receiver are equipped with some protocols which helps them to
detect transit errors such as loss of data-frame. Hence, either the sender retransmits
the data-frame or the receiver may request to resend the previous data-frame.
Error detection - The sender and receiver, either both or any, must ascertain that there
is
some error in the transit.
Positive ACK - When the receiver receives a correct frame, it should acknowledge it.
Negative ACK - When the receiver receives a damaged frame or a duplicate frame,
it sends a NACK back to the sender and the sender must retransmit the correct
frame.
There are three types of techniques available which Data-link layer may deploy to
control the errors by Automatic Repeat Requests (ARQ):
Stop-and-wait ARQ
Go-Back-N ARQ
Stop and wait ARQ mechanism does not utilize the resources at their best.
When the acknowledgement is received, the sender sits idle and does nothing.
In Go-Back-N ARQ method, both sender and receiver maintain a window.
The sending-window size enables the sender to send multiple frames without
receiving the acknowledgement of the previous ones. The receiving-window enables
the receiver to receive multiple frames and acknowledge them. The receiver keeps
track of incoming frame‘s sequence number.
When the sender sends all the frames in window, it checks up to what sequence
number it has received positive acknowledgement. If all frames are positively
acknowledged, the sender sends next set of frames. If sender finds that it has
received NACK or has not received any ACK for a particular frame, it retransmits all
the frames after which it does not receive any positive ACK.
In Go-back-N ARQ, it is assumed that the receiver does not have any buffer space
for its window size and has to process each frame as it comes. This enforces the
sender to retransmit all the frames which are not acknowledged.
UNIT II
MEDIA ACCESS & INTERNETWORKING
PART-A
1. What are the functions of MAC? [CO4 – L1]
MAC sub layer resolves the contention for the shared media. It contains
synchronization, flag, flow and error control specifications necessary to move
information from one place to another, as well as the physical address of the next
station to receive and route a packet.
9. What are the four prominent wireless technologies? [CO4 – L1 MAY/JUNE 2016]
Bluetooth
Wi-Fi(formally known as 802.11)
WiMAX(802.16)
Third generation or 3G cellular wireless.
13. What are the four steps involves in scanning? [CO4 – L1]
The node sends a Probe frame.
All APs within reach reply with a Probe Response frame.
The node selects one of the access points, and sends that AP an Association
Request frame.
The AP replies with an Association Response frame.
22. What are the three pieces of information in the configuration messages? [CO4
– L1]
The ID for the bridge that is sending the message.
The ID for what the sending bridge believes to the root bridge.
The distance, measured in hops, from the sending bridge to the root bridge.
25. How does a given bridge learn whether it should forward a multicast
frame over a given port? [CO4 – L2]
It learns exactly the same way that a bridge learns whether it should forward a by
Unicast frame over a particular port observing the source addresses that it receives
over that port.
PART-B
1_Persisitent CSMA
This is the first carrier sense protocol. When a station holds data to transmit, this first
listens to the channel to check if any other is sending at that time.
(a) If the channel is busy, then the station waits until it becomes idle.
(b) When the channel is free, the station sends a frame.
Suppose if a collision happens then the station waits a random amount of time and
starts all over again. This protocol is said to be l persistent, because the station sends
with a probability of l when it detects the channel as free. After a station is sending,
another station will become ready to send and sense the channel.
When the first station‘s signal has not yet reached the second one, the later will sense
the idle channel. Also it sends the frames. This results in collision. If the propagation
delay is zero then there will be collisions. When the 2 stations become ready in the
middle of a third station‘s transmission, both will wait until the transmission is over.
After that both will start to transmit exactly at the same time. This also results collision.
P-persistent CSMA
This applies to slotted channels. If a station wants to send then first it senses the
channel.
(a)When the channel is free, the station sends frames with a probability p. With a
probability q=l-p, it defers until the next slot; when finding that slot is also idle, it may
either sends or defers again with the probabilities of p & q until either the frame has
been transmitted or another station has started the transmission, this process is
repeated.
When the station finds the channel as busy, it waits until the next slot and applies the
same algorithm.
It is the basis of the popular Ethernet LAN. When the 2 stations sense the channel to
be idle and start transmitting at the same time, they will find the collision immediately.
They should stop transmitting as soon as the collision is detected.
If immediately stops the damaged frames then it saves the time and bandwidth. It
refers CSMA with collision Detection. This employs the conceptual model given
below.
CSMA / CD can be in any one of the states like contention, transmission or idle From
the figure, a station ends its transmission at ‗t0‘. Any other station may send now.
Suppose if more than l station wants to send the frames at the same time then there
will be a collision.
After a collision is detected, the station aborts its transmission and waits for a random
amount of time.
Signaling
technique MLT-3 MLT-3 4B5B, NRZI 8B6T, NRZ
Data rate 100 Mbps 100 Mbps 100 Mbps 100 Mbps
Maximum
segment
length 100 m 100 m 100 m 100 m
Network
span 200 m 200 m 400 m 200 m
Fast Ethernet Details
UTP Cable has a 30MHz limit
→ Not feasible to use clock encoding (i.e., NO Manchester encoding)
Instead use bit encoding schemes with sufficient transitions for receiver to
maintain clock synchronization.
100 BASE T4
100 Base TX
Uses two pair of twisted pair, one pair for transmission and one pair
for reception.
Use either STP or Cat 5 UTP.
Uses MTL-3 signaling scheme that involves three voltages.
Uses 4B/5B encoding.
There is a guaranteed signal transition at least every two bits.
100 Base FX
Uses two optical fibers, one for transmission and one for reception.
Uses FDDI technology of converting 4B/5B to NRZI code group streams
into optical signals.
Fast Ethernet Repeaters and Switches
Provides speeds of 1000 Mbps (i.e., one billion bits per second
capacity) for half-duplex and full-duplex operation.
Uses Ethernet frame format and MAC technology.
Uses 802.3x flow control.
All Gigabit Ethernet configurations are poin-to-point!
Gigabit Ethernet
Viewed as LAN solution while ATM is WAN solution.
Gigabit Ethernet can be shared (hub) or switched.
Shared Hub
- Half duplex: CSMA/CD with MAC changes:
Carrier extension
Frame Bursting
Switch
- Full duplex: Buffered repeater called {Buffered Distributor}
Gigabit Ethernet
Physical Properties
WLAN runs over free space based on FHSS (frequency hopping over 79 1-MHz-wide
frequency bandwidth) and DSSS (11-bit chipping sequence) with data rate of 2 Mbps.
Optimal bit rate for transmission is based on signal-to-noise ratio (SNR) in environment.
Distribution System
In wireless network, nodes are mobile and the set of reachable nodes change with
time.
Mobile nodes are connected to a wired network infrastructure called access points
(AP)
Access points are connected to each other by a distribution system (DS) such as
Ethernet.
Nodes communicate directly with each other if they are reachable (eg, A and C)
Communication between two nodes in different APs occurs via two APs (eg, A
and E)
Whenever a mobile node joins a network, it selects an AP. This is called active
scanning.
Node sends a Probe frame.
All APs within reach reply with a Probe Response frame.
Node selects an AP and sends an Association Request frame. o
Corresponding AP replies with an Association Response frame
Access points periodically send a Beacon frame advertising its features such as
transmission rate. This is known as passive scanning.
Hidden Node
Suppose node B is sending data to A. At the same time, node C also wishes to
send to A.
Since node B is not within the range of C, C finds the medium free and transmits
to A.
Frames from nodes B and C sent to A collide with each other.
Exposed Node
Suppose node A is transmitting to node B and node C has some data to be
sent to node D.
Node C finds the medium busy, since it hears the transmission from node A
and refrains from sending to node D, even though its transmission to D would
not interfere.
Thus node C is exposed to transmission from node A to B
Frame Format
Control―indicates frame type (RTS, CTS, ACK or data) and 1-bit To DS / From
DS
Duration―specifies duration of frame transmission.
Addresses―The four address fields depend on value of To DS and From DS
subfield
Sequence Control―defines sequence number of the frame
Payload―contains a maximum of 0–2312 bytes.
CRC―contains CRC-32 error detection sequence.
Bluetooth uses FHSS (79 channels, each 625 µs) for transmission.
Packets can be dropped due to lack of resources.
Each packet is routed independently of previous packets.
A switch or link failure does not have adverse effect.
Routing table
Each switch has a forwarding table that contains destination address and output
port.
When a switch examines a packet, the destination address is looked-up in the
table to determine the corresponding output port, onto which the packet is
forwarded.
Setup Request
Switch 1 receives connection setup request frame from host A.
It knows that frames for host B should be forwarded on port 3. o
Creates an entry in its VC table for the new connection with
incoming port=1 and
outgoing port=3.
Chooses an unused VCI for frames to host B, say 14 as
incoming VCI.
Outgoing VCI is unknown (left blank) and the frame is
forwarded to switch 2.
Similarly entries are made at other switches as frame is forwarded
to destination.
Destination B accepts the setup request frame. Assigns an unused
VCI, say 77, for frames that come from host A.
Acknowledgment
Host B sends an acknowledgment to switch 3.
The ACK frame carries source & destination addresses and chosen VCI
by host B.
Switch 3 uses this VCI, i.e., 77 as outgoing VCI and completes VC table
entry.
Similarly other switches fill up outgoing VCI and forward the ACK.
Finally switch 1 sends an acknowledgment to source host A
containing VCI as 14.
Source host A uses 14 as its outgoing VCI for data frames to be
sent to destination B.
Data transfer starts after connection establishment
Resources are reserved, therefore QoS is guaranteed by the network
In case of switch/link failure, old connection is torn and new one needs to be
established.
All information about network topology required to route a packet to the
destination is provided by the source host.
Header contains ordered list of intermediate hosts, through which
packet must traverse. Hence headers are of variable length.
Headers can be handled either by rotation or stripping or pointer-based
approach.
Source routing is classified as either strict or loose.
Source address and incoming port is appended to the table, if an entry does
not exist.
If two or more bridges are equally close to root, then bridge with smallest id is chosen.
Designated bridge is responsible for forwarding frames to the root bridge.
A bridge stops sending messages over a port, when it‘s not designated bridge for that
port
Example
In VLAN, it is possible to change the logical topology without moving any wires or
changing any address. Changes are made in bridge configuration.
Each VLAN is assigned an identifier and packets can only travel from one segment
to another if both segments have the same identifier.
Example
Hosts W and X are configured as VLAN 100, hosts Y and Z as VLAN 200.
When a packet sent by host X arrives at bridge B2, the bridge inserts a VLAN
header between Ethernet header and its payload with VLAN ID as 100.
Bridge forwards the packet, only on interfaces that is part of VLAN 100.
Packet is forwarded to bridge B1, which forward the packet to host W but not to Y.
Advantages of VLAN.
VLANs reduce the migration cost of stations moving from one group to another.
VLANs can reduce traffic if the multicasting capability of IP was used.
Broadcast messages of one group will not be received by other group members.
9. DISCUSS INTERNETWORKING IN DETAIL: [CO4 – H1]
An internetwork is often referred to as a network of networks because it is made up of
lots of smaller networks. The nodes that interconnect the networks are called routers.
They are also sometimes called gateways, but since this term has several other
connotations, we restrict our usage to router. The internet protocol is the key tool
used today to build scalable, heterogeneous internetwork
Service Model
The main concern in defining a service model for an internetwork is that we can
provide a host-to-host service only if this service can somehow be provided over each
of the underlying physical networks. For Example, it would be no good deciding that
our internetwork service model was going to provide guaranteed delivery of every
packet in 1 ms or less if there were underlying network technologies that could
arbitrarily delay packets.
The IP service model can be thought of as having two parts: an addressing scheme,
which provides a way to identify all hosts in the internetwork, and a datagram
(connectionless) model of data delivery. This service model is sometimes called best
effort because, although IP makes every effort to delivery datagram, it makes no
guarantees.
Datagram Delivery
A datagram is a type of packet that happens to be sent in a connectionless manner
over a network. Every datagram carries enough information to let network forward the
packet to its correct destination; there is no need for any advance setup mechanism
to tell the network what to do when the packet arrives. The network makes its best
effort to get it to the desired destination. The best-effort part means that if something
goes wrong and the packet gets lost, corrupted, misdelivered,or in any way fails to
reach its intended destination, the network does nothing-it made its best effort, and
that is all it had to do. It does not make any attempt to recover from the failure. This is
sometimes called an unreliable service.
PACKET FORMAT
The IP datagram, like most packets, consists of a header followed by a number of
bytes of data.
The Version field specifies the version of IP. The current version of IP is 4, and it is
sometimes called IPv4^2.putting this field right at the start of the datagram makes it
easy for everything else in the packet format to be redefined in subsequent versions;
the header processing software starts off by looking at the version and then branches
off to process the rest of the packet according to the appropriate format.
The next field, HLEN, specifies the length of the header in 32-bit words. When there are
no options, which is most of the time, the header is 5 words (20 bytes) long. The 8_bit
type of service (TOS) field has had a number of different definitions over the years, but
its basic function is to allow packets to be treated differently based on application
needs. For example, the TOS value might determine whether or not a packet should be
placed in a special queue that receives low delay.
The next 16-bit of the header contain the Length of the datagram, including the
header. Unlike the HLEN field, the Length field counts bytes rather than words. Thus,
the maximum size of an IP datagram is 65,535 bytes. The physical network, over
which IP is running, however, may not support such long packets. For this reason, IP
supports a fragmentation and reassembly process, the second word of the header
contains information about fragmentation. The next byte is the time to live (TTL) field.
The intent of the field is to catch packets that have been going around in routing loops
and discard them, rather than let them consume resources indefinitely.
The Protocol field is simply a demultiplexing key that identifies the higher-level
protocol to which this packet should be passed. These are values defined for TCP (6),
UDP (17), and many other protocols that may sit above IP in the protocol graph.
The Checksum is calculated by considering the entire IP header as a sequence of 16-
bit words, adding them up using ones complement arithmetic, and taking the ones
complement of the result.
The last two required fields in the header are the SourceAddr and the DestinationAddr
for the packet. The latter is the key to datagram delivery: every packet contains a full
address for its intended destination so that forwarding decisions can be made at each
router. The source address is required tom allow recipients to decide if they want to
accept the packet and to enable them to reply.
Finally, there may be a number of options at the end of the header. The presence or
absence of options may be determined by examining the header length (HLen) field.
While options are used fairly rarely, a complete IP implementation must handle them
all.
This also means that a host will not send needlessly small packets, which wastes
bandwidth and consumes processing resources by acquiring more headers per byte of
data sent. For example, two hosts connected to FDDI networks that are interconnected
by a point-to-point link would not need to send packets small enough to fit on an
Ethernet.
The central idea here is that every network type has a maximum transmission unit
(MTU), which is the largest IP datagram that it can carry in a frame.
The unfragmented packet has 1,400 bytes of data and a 20-byte IP header. When the
packet arrives at the R2, which has an MTU of 532 bytes, it has to be fragmented. A
532-byte MTU leaves 512 bytes for data after the 20-byte IP header, so the first
fragment contains 512 bytes of data. The router sets the M bit in the Flags field,
meaning that there are more fragments to follow, and it sets the offset to 0,since this
fragmented contains the first part of the original datagram.
The data carried in the second fragment starts with the 513th byte of the original data,
so the Offset field in this header is set to 64, which is 512/8. Why the division by 8?
Because the designers of IP decided that fragmentation should always happen on 8-
byte boundaries, which means that the Offset field counts 8-byte chunks, not bytes.
The third fragment contains the last 376 bytes of data, and the offset is now
2*512/8=128. since this is the last fragment, the M bit is not set.
GLOBAL ADRESSES:
Global uniqueness is the first property that should be provided in an addressing
scheme. Ethernet addresses are globally unique but not sufficient to address entire
network. And also they are flat that is no structure in addressing.
IP addresses are hierarchical. They made up of two parts, they are a network part
and a host part. The network part identifies the network to which the host is
connected. All hosts which are connected to the same network have same network
part in their IP address. The host part then identifies each host on the particular
network.
The routers are host but they are connected with two networks. So they need to have
an address on each network, one for each interface.
IP addresses are divided into three different classes. They are,
1. Class A
2. Class B
3. Class C
The class of an IP address is identified in the most significant few bits. If the first bit is
0, it is a class A address. If the first bit is 1 and the second bit is 0, it is a class B
address. If the first two bits are 1 and the third bit is 0, t is a class C address.
Class A addresses have 7 bits for network part and 24 bits for host part. The 0 and
127 are reserved.
Class B addresses have 14 bits for network part and 16 bits for host part.
Class C addresses have 21 bits for network part and 8 bits for host part. The 0 and
127 are reserved. There are approximately 4 billion possible IP addresses, one half
for class A, one quarter for class B and one-eighth for class C address.
There are also class D and class E are there. But class D for multicast and class E are
currently unused. IP addresses are written as four decimal integers separated via dots.
Each integer represents the decimal value contained in 1 byte of the address, starting at
the most significant.
10. EXPLAIN ADDRESS RESOLUTION PROTOCOL WITH HEADER FORMAT. [CO4
– L2]
While communicating, a host needs Layer-2 (MAC) address of the destination
machine which belongs to the same broadcast domain or network. A MAC address is
physically burnt into the Network Interface Card (NIC) of a machine and it never
changes.
On the other hand, IP address on the public domain is rarely changed. If the NIC is
changed in case of some fault, the MAC address also changes. This way, for Layer-2
communication to take place, a mapping between the two is required.
Once the host gets destination MAC address, it can communicate with remote host
using Layer-2 link protocol. This MAC to IP mapping is saved into ARP cache of both
sending and receiving hosts. Next time, if they require to communicate, they can
directly refer to their respective ARP cache.
Reverse ARP is a mechanism where host knows the MAC address of remote host
but requires to know IP address to communicate.
Query Messages
Echo Request & Reply―The combination of echo-request and echo-reply messages
determines whether two systems can communicate at the IP level.
Timestamp Request & Reply―Two machines can use the timestamp request and
timestamp reply messages to determine the round-trip time (RTT).
Address Mask Request & Reply―A host to obtain its subnet mask, sends an address
mask request message to the router, which responds with an address mask reply
message.
DHCP Server
Advantages:
1. It saves the n/w administrator from having to assign address to individual hosts.
2. Maintains the list of address of individual host & minimizes the manual
configuration.
Operations of DHCP
Another approach is
1. DHCP uses the concept of a relay agent. There is at least one relay agent on
each network, and it is configured with just one piece of information: the IP address
of the DHCP server.
2. When a relay agent receives a DHCPDISCOVER message, it unicasts it to the
DHCP server and awaits the response, which it will then send back to the
requesting client.The process of relaying a message from a host to a remote DHCP
server is shown in Figure( Sir attach the figure from charulatha book).
If Class C addresses were given instead of Class B, then routing tables gets larger.
Classless Interdomain Routing (CIDR) tries to balance between minimize the
number of routing table entries and handling addresses space efficiently.
It is represented as /X, where X is the prefix length in bits. For example, 192.4.16/20
Addresses in a block must be contiguous and number of addresses must be powers
of 2.
Example
UNIT III
ROUTING
PART-A
1. Define packet switching. [CO4 – L1 NOV/DEC 2015, MAY/JUNE 2016]
A packet switch is a device with several inputs and outputs leading to and from the
hosts that the switch interconnects.
13. Write the keys for understanding the distance vector routing. [CO4 – L1]
The three keys for understanding the algorithm are,
Knowledge about the whole networks
Routing only to neighbors
Information sharing at regular intervals
14. Write the keys for understanding the link state routing. [CO4 – L1]
Knowledge about the neighborhood.
Routing to all neighbors.
Information sharing when there is a range.
15. How the packet cost is referred in distance vector and link state routing? [CO4
– L2]
In distance vector routing, cost refer to hop count while in case of link state routing,
cost is a weighted value based on a variety of factors such as security levels, traffic or
the state of the link.
16. Define Reliable flooding. [CO4 – L1]
It is the process of making sure that all the nodes participating in the routing protocol
get a copy of the link state information from all the other nodes.
PART-B
Nodes compute routing table of minimum distance to every other node via
NextHop using information obtained from its neighbors.
Initial State
B 1 B B 1 B B ∞ ―
C 1 C C 0 C C ∞ ―
D ∞ — D 1 D D ∞ ―
E 1 E E ∞ ― E ∞ ―
F 1 F F ∞ ― F 0 F
G ∞ ― G ∞ ― G 1 G
Each node sends its initial table (distance vector) to neighbors and receives their
estimate.
Node A sends its table to nodes B, C, E & F and receives tables from nodes B,
C, E & F.
Each node updates its routing table by comparing with each of its neighbor's
table
For each destination, Total Cost is computed as:
Total Cost = Cost (Node to Neighbor) + Cost (Neighbor to
Destination)
If Total Cost < Cost then Cost = Total Cost and NextHop = Neighbor
Node A learns from C's table to reach node D and from F's table to reach node
G.
Total Cost to reach node D via C = Cost (A to C) + Cost(C to D) = 1 + 1=2
Since 2 < ∞, entry for destination D in A's table is changed to
(D, 2, C)
Total Cost to reach node G via F = Cost(A to F) + Cost(F to G) = 1 + 1=2
Example Network
Routers advertise the cost of reaching networks. Cost of reaching each
link is 1 hop. For example, router C advertises to A that it can reach
network 2, 3 at cost 0 (directly connected), networks 5, 6 at cost 1 and
network 4 at cost 2.
Each router updates cost and next hop for each network number.
Infinity is defined as 16, i.e., any route cannot have more than 15 hops.
Therefore RIP can be implemented on small-sized networks only.
Nodes A and C forward it to B, but does not sends it back to X (fig c).
o Node B receives two copies of LSP with same sequence
number.
o Accepts one LSP and forwards it to D (fig d). Flooding is
complete.
LSP is generated either periodically or when there is a change in the topology.
Route Calculation
Each node knows the entire topology, once it has LSP from every other node.
Forward search algorithm is used to compute routing table from the received
LSPs.
Each node maintains two lists, namely Tentative and Confirmed with entries
of the form (Destination, Cost, NextHop).
Forward Search algorithm (Djkstra‘s Shortest Path)
1. Initialize the Confirmed list with an entry for the Node (Cost = 0).
2. Node just added to Confirmed list is called Next. Its LSP is examined.
3. For each neighbor of Next, calculate cost to reach each neighbor as
Cost (Node to Next) + Cost (Next to Neighbor).
a. If Neighbor is neither in Confirmed nor in Tentative list, then
add (Neighbor, Cost, NextHop) to Tentative list.
b. If Neighbor is in Tentative list, and Cost is less than existing
cost, then replace the entry with (Neighbor, Cost, NextHop).
4. If Tentative list is empty then Stop, otherwise move least cost entry
from Tentative list to
2 (D, 0, –) (B, 11, B) Based on D's LSP, its immediate neighbors B and C are
Load balancing―Multiple routes to the same place are assigned same cost. Thus
traffic is distributed evenly.
Internet has backbone networks and sites. Providers connect at a peering point.
Traffic on the internet is of two types:
o traffic within an autonomous system is called local.
o traffic that passes through an autonomous system is called transit.
Autonomous Systems (AS) are classified as:
o Stub AS is connected to only one another autonomous system and
carries local traffic only (e.g. Small corporation).
o Multihomed AS has connections to multiple autonomous systems but
refuses to carry transit traffic (e.g. Large corporation).
o Transit AS has connections to multiple autonomous systems and is
designed to carry transit traffic (e.g. Backbone service provider).
Border Gateway Protocol (BGP-4)
BGP views internet as a set of autonomous systems interconnected arbitrarily.
Each AS have a border router (gateway), by which packets enter and
leave that AS. In above figure, R3 and R4 are border routers.
One of the router in each autonomous system is designated as BGP speaker.
BGP Speaker exchange reachability information with other BGP speakers.
BGP advertises complete path as enumerated list of AS (path vector) to
reach a particular network. Paths must be without any loop, i.e., AS list is
unique.
For example, backbone network advertises that networks 128.96 and
192.4.153 can be reached along the path <AS1, AS2, AS4>.
If there are multiple routes to a destination, BGP speaker chooses one
based on policy.
Speakers need not advertise any route to a destination, even if one exists.
Advertised paths can be cancelled, if a link/node on the path goes down.
This negative advertisement is known as withdrawn route.
BGP is designed for classless addressing.
Routes are not repeatedly sent. If there is no change, keep alive messages
are sent.
IPv6 enables devices to self-acquire an IPv6 address and communicate within that
subnet. This auto-configuration removes the dependability of Dynamic Host
Configuration Protocol (DHCP) servers. This way, even if the DHCP server on that
subnet is down, the hosts can communicate with each other IPv6 provides new
feature of IPv6 mobility. Mobile IPv6 equipped machines can roam around without the
need of changing their IP addresses.
Address Notation
Standard representation of IPv6 address is x : x : x : x : x : x : x : x where x is a 16-
bit hexadecimal address separated by colon (:). For example,
47CD : 1234 : 4422 : ACO2 : 0022 : 1234 : A456 : 0124
IPv6 address with contiguous 0 bytes can be written compactly. For example,
47CD : 0000 : 0000 : 0000 : 0000 : 0000 : A456 : 0124 47CD : :
A456 : 0124
IPv4 address is mapped to a IPv6 address by prefixing the 32-bit IPv4 address with
2 bytes of 1s and then zero-extending the result to 128 bits. For example,
127.96.33.81 -> : : FFFF : 128.96.33.81
At present, there are few networks which are running on IPv6. There are some
transition mechanisms available for IPv6 enabled networks to speak and roam
around different networks easily on IPv4. These are:
Dual stack implementation
Tunnelling
NAT-PT
Packet Format
IPv6 base header is 40 bytes long.
Extension Headers
Extension header provides greater functionality to IPv6.
Base header may be followed by six extension headers.
Each extension header contains a NextHeader field to identify the header following it.
Hop-by-Hop—source host passes information to all routers visited by the packet
Source Routing—routing information (strict/loose) provided by the source host.
Fragmentation—In IPv6, only the source host can fragment. Source uses a path
MTU discovery technique to find smallest MTU on the path.
Advanced Capabilities
Auto configuration—Auto or stateless configuration of IP address to hosts without the
need for a DHCP server, i.e., plug and play.
Advanced Routing—Enhanced routing support for mobile hosts is provided.
Reverse-Path Broadcasting
Router on receiving a multicast packet from source S to a Destination from
NextHop, forwards the packet on all out-going links, since it comes from
shortest path.
Packet is flooded but not looped back to S. The drawbacks are:
o It floods a network, even if it has no members for that group.
Reverse-Path Multicasting
Multicasting is achieved by pruning networks that do not have members for
a group G.
Step 1: Identify a leaf network which has only one router (parent).
o Leaf network is monitored to determine if it has any members for
group G, by having hosts periodically announce to which group it
belongs to.
o Router thus decides whether or not to forward group G packets over
that LAN.
Step 2: Propagate "no members of G here" up the shortest path tree.
o Routers augments (Destination, Cost) pairs with set of groups for
which the leaf network is interested in receiving multicast packets.
o Information is propagated amongst routers so that a router knows
for what groups it should forward on each of its links.
Including all this information in a routing update is expensive.
Shared Tree
When a router sends Join message for group G to RP, it goes through a set of
routers.
Multicas
Join from R4 Join from R5 t
message to group G
As routers send Join message for a group, branches are added to the tree, i.e.,
shared.
Multicast packets sent from hosts are forwarded to designated router RP.
Suppose router R1, receives a message to group G.
o R1 has no state for group G.
o Encapsulates the multicast packet in a Register
message.
o Multicast packet is tunneled along the way to RP.
RP decapsulates the packet and sends multicast packet onto the shared tree,
towards R2.
R2 forwards the multicast packet to routers R4 and R5 that have members for group G.
Source-specific tree.
RP can force routers to know about group G, by sending Join message to
the sending host, so that tunneling can be avoided.
Intermediary routers create sender-specific entry (S, G) in their tables. Thus
a source- specific route from R1 to RP is formed.
If there is high rate of packets sent from a sender to a group G, then shared-tree is
replaced by source-specific tree with sender as root.
Example
UNIT IV
TRANSPORT LAYER
PART-A
1. What is the main idea of UDP? [CO3 – L1]
The basic idea for a source process is to send a message to a port and for the
destination process is to receive the message from a port.
5. State the two kinds of events trigger a state transition. [CO3 – L3]
A segment arrives from the peer.
The local application process invokes an operation on TCP.
12. What are the two categories of QoS attributes? [CO3 – L1]
The two main categories are,
User Oriented
Network Oriented
13. List out the user related attributes? [CO3 – L1]
SCR – Sustainable Cell Rate
PCR – Peak Cell Rate
MCR- Minimum Cell Rate
CVDT – Cell Variation Delay Tolerance.
16. What are the three events involved in the connection? [CO3 – L1]
For security, the transport layer may create a connection between the two end ports.
A connection is a single logical path between the source and destination that is
associated with all packets in a message. Creating a connection involves three steps:
Connection establishment
Data transfer
Connection release
PART-B
UDP Datagram
UDP packets are known as user datagrams. It has a 8-byte header.
SrcPort and DstPort—Source and destination port number.
Length—total length of the user datagram, i.e., header plus data.
Checksum—computed over UDP header, data and pseudo header.
Pseudo header consists of IP fields (Protocol, SourceAddr,
DestinationAddr) and UDP Length field. UDP delivers message to the
correct recipient process using checksum.
Ports
Processes
(server/client) are identified by an abstract locator known as port.
Server
accepts message at well known port. Some well-known UDP ports are
7–Echo, 53–DNS, 111–RPC, 161–SNMP, etc.
< port, host
> pair is used as key for demultiplexing.
Ports are
implemented as a message queue.
When a
message arrives, UDP appends it to end of the queue.
When queue is full, the message is discarded. When a message is read, it is removed
from the queue.
Applications
Used for management processes such as SNMP.
Used for route updating protocols such as RIP.
It is a suitable transport protocol for multicasting.
UDP is suitable for a process with internal flow and error control
mechanisms such as Trivial File Transfer Protocol (TFTP).
2. List the features of TCP. Draw TCP segment format and explain its fields. [CO3
– L1]
Transmission Control Protocol (TCP) offers connection-oriented, byte-stream service.
Guarantees reliable, in-order delivery of message.
TCP is a full-duplex protocol.
Like UDP, TCP provides process-to-process communication.
Has built-in congestion-control mechanism.
Some well-known TCP ports are 21–FTP, 23– TELNET, 25–SMTP, 80–HTTP, etc.
Sending TCP buffers bytes in send buffer and transmits data unit as segments.
Segments are stored in receive buffer at the other end for application to read.
Segment Format
Data unit exchanged between TCP peers are called segments.
SrcPort and DstPort―port number of source and destination process.
SequenceNum―contains sequence number, i.e. first byte of data segment.
Acknowledgment― byte number of segment, the receiver expects next.
HdrLen― length of TCP header as 4-byte words.
Flags―contains six control bits known as flags.
o URG—segment contains urgent data.
o ACK—value of acknowledgment field is valid. o
PUSH—sender has invoked the push operation. o
RESET—receiver wants to abort the connection.
o SYN—synchronize sequence numbers during connection
establishment. o FIN—terminates the TCP connection.
AdvertisedWindow―defines receiver‘s window size and acts as flow
control.
Checksum―It is computed over TCP header, Data, and pseudo header
containing IP fields (Length, SourceAddr & DestinationAddr).
UrgPtr―specifies first byte of normal data contained in the segment, if
URG bit is set.
Connection Establishment
Connection establishment in TCP is a three-way handshaking.
1. Client sends a SYN segment to the server containing its initial
sequence number (Flags = SYN, SequenceNum = x)
2. Server responds with a segment that acknowledges client‘s segment
and specifies its initial sequence number (Flags = SYN+ ACK, Ack = x
+ 1 SequenceNum = y).
3. Finally, client responds with a segment that acknowledges server‘s
o After sending all data, server sends FIN segment to client, which is
acknowledged by the client.
State Transition Diagram
States involved in opening and closing a connection is shown above and
below
Events that trigger a state transition is:
o Segments that arrive from its peer.
o Application process invokes an operation on TCP
Operation of sliding window is hidden in the ESTABLISHED state
Opening
A byte cannot be read until that byte and all preceding bytes have been
received.
If data is receivedin order, then NextByteExpected = LastByteRcvd + 1
Bytes to theleftof LastByteRead are not buffered, since it is read by
the
application.
Flow Control
Size of send and receive buffer is MaxSendBuffer and MaxRcvBuffer
respectively.
Karn/Partridge Algorithm
Flaw discovered in TCP original algorithm was that an ACK segment,
acknowledges receipt of data, not a transmission.
When an ACK arrives after retransmission, it is impossible to decide, whether
to pair it with original or retransmitted segment for SampleRTT estimation.
o If ACK is associated with original one, then SampleRTT becomes too
large
o If ACK is associated with retransmission, then SampleRTT becomes
too small
Karn and Partridge proposed that
o SampleRTT should be taken for segments that are sent only once,
i.e, for segments that are not retransmitted.
o Each time TCP retransmits, timeout is doubled, since loss of
segments is mostly due to congestion.
When CongestionWindow is plotted as a function of time, a saw-tooth
pattern results.
Slow Start
Slow start is used to increase CongestionWindow exponentially from a cold
start.
Source TCP initializes CongestionWindow to one packet.
TCP doubles the number of packets sent every RTT on successful
transmission.
o When ACK arrives for first packet TCP adds 1 packet to
CongestionWindow
and sends two packets.
o When two ACKs arrive, TCP increments CongestionWindow by 2
packets and sends four packets and so on.
Instead of sending entire permissible packets at once (bursty traffic), packets
are sent in a phased manner, i.e., slow start.
Initially TCP has no idea about congestion, henceforth it increases
CongestionWindow rapidly until there is a timeout.
On timeout: CongestionThreshold = CongestionWindow /
2 CongestionWindow = 1
Slow start is repeated until CongestionWindow reaches
CongestionThreshold and thereafter 1 packet per RTT.
Example
Initial slow start causes increase in CongestionWindow up to 34KB,
Congestion occurs at 0.4 seconds and packets are lost.
ACK does not arrive and therefore trace of CongestionWindow becomes flat.
Timeout occurs at 2sec.
CongestionThreshold=17KB,CongestionWindow=1PK
Slow start is done till 17KB and additive increase thereafter till congestion
occurs.
Slow start provides exponential growth and is designed to avoid bursty
nature of TCP.
TCP loses more packets initially, because it attempts to learn the available
bandwidth quickly through exponential increase.
If connection goes dead while waiting for timer to expire, slow start phase
is used only up to current value of CongestionWindow.
FastRetransmit and Fast Recovery
TCP timeouts led to long periods of time during which the connection
went dead while waiting for a timer to expire.
Fast retransmit is a heuristic approach that triggers retransmission of a
dropped packet sooner than the regular timeout mechanism. It does not
replace regular timeouts.
When a packet arrives out of order, receiving TCP resends the same
acknowledgment (duplicate ACK) it sent last time.
When three duplicate ACK arrives at the sender, it infers that
corresponding packet may be lost due to congestion and retransmits that
packet. This is called fast retransmit before regular timeout.
When packet loss is detected using fast retransmit, the slow start phase is
replaced by additive increase, multiplicative decrease method. This is
known as fast recovery.
Instead of setting CongestionWindow to one packet, this method uses the
ACKs that are still in pipe to clock the sending of packets.
Slow start is only used at the beginning of a connection and after regular
timeout. At other times, it follows a pure AIMD pattern.
Example
In example, packets 1 and 2 are received whereas packet 3 gets lost.
o Receiver sends a duplicate ACK for packet 2 when packet 4
arrives.
o Sender receives 3 duplicate ACKs after sending packet 6 retransmits
packet 3.
o When packet 3 is received, receiver sends cumulative ACK up to
packet 6.
In example trace, slow start is used at beginning and during timeout at 2
secs.
o Fast recovery avoids slow start from 3.8 to 4 sec.
o CongestionWindow is reduced by half from 22 KB to 11 KB.
o Additive increase is resumed thereafter.
interval.
Drop probability
RED thresholds function
Source-Based
Congestion Avoidance
Source looks for signs of congestion in the network. For instance,
increase in RTT indicates queuing at a router.
Some mechanisms
1. TCP checks to see if current RTT is greater than mean RTT. If so,
congestion window is decreased by one-eighth, else normal increase.
2. TCP increases window size by one packet and compares the throughput
achieved when the window was one packet smaller.
TCP Vegas
Throughput increases as congestion window increases. Increase in
window size beyond available bandwidth, results in packets queuing at
the bottleneck router.
TCP Vegas goal is to measure and control the right amount of extra data in
transit.
Extra data refers to amount of data that source would have refrained from
sending so as to not exceed the available bandwidth.
A flow‘s BaseRTT is set to RTT of a packet when the flow is not
congested. BaseRTT = MIN (RTTs)
Expected throughput without overflowing is:
ExpectedRate = CongestionWindow /
BaseRTT
ActualRate, i.e., current sending rate for a packet is calculated by
recording bytes transmitted during a RTT.
ActualRate = ByteTransmitted / SampleRTT
ExpectedRate and ActualRate are compared.
Thresholds α and β are defined and corresponds to less data and too much
extra data in the network, such that α < β.
TCP uses difference in rates and adjusts CongestionWindow accordingly.
o If Diff < α, CongestionWindow is linearly increased during the next
RTT
o If Diff > β, CongestionWindow is linearly decreased during the next
RTT
o If α < Diff < β, CongestionWindow is unchanged
When
actual and expected rates vary significantly, it indicates congestion
in the network. The β threshold triggers decrease in sending rate.
When actual and expected rate is almost the same, there is available
bandwidth that goes wasted. The α threshold triggers increase in sending
rate.
Overall goal of TCP Vegas is to keep between α and β extra bytes in the
network.
8. DEFINE
QOS. MENTION THE APPROACHES TO IMPROVE QOS. [CO3 – L1]
Best-effort service offered by the network is insufficient for applications.
They require assurances from network. For example:
o Multimedia applications require minimum bandwidth.
o Real-time applications require timeliness rather than correctness.
Network that supports different level of service based on application
requirements offer Quality of Service (QoS).
QoS is defined as a set of attributes pertaining to the performance of a
connection. Attributes may be either user or network oriented.
UNIT V
APPLICATION LAYER
PART-A
1. What is the function of SMTP? [CO2 – L1]
The TCP/IP protocol supports electronic mail on the Internet is called Simple Mail
Transfer (SMTP). It is a system for sending messages to other computer users based
on e-mail addresses. SMTP provides mail exchange between users on the same or
different computers.
2. What is the difference between a user agent (UA) and a mail transfer agent
(MTA)? [CO2 – L1]
The UA prepares the message, creates the envelope, and puts the message in the
envelope. The MTA transfers the mail across the Internet.
7. Discuss the three main division of the domain name space. [CO2 – H1]
Domain name space is divided into three different sections: generic domains, country
domains & inverse domain.
Generic domain: Define registered hosts according to their generic behavior, uses
generic suffixes.
Country domain: Uses two characters to identify a country as the last suffix.
Inverse domain: Finds the domain name given the IP address.
10. Name four factors needed for a secure network. [CO2 – L1]
Privacy: The sender and the receiver expect confidentiality.
Authentication: The receiver is sure of the sender‘s identity and that an imposter has not
sent the message.
Integrity: The data must arrive at the receiver exactly as it was sent.
Non-Reputation: The receiver must able to prove that a received message came from a
specific sender.
11. How is a secret key different from public key? [CO2 – L2]
In secret key, the same key is used by both parties. The sender uses this key and an
encryption algorithm to encrypt data; the receiver uses the same key and the
corresponding decryption algorithm to decrypt the data. In public key, there are two
keys: a private key and a public key. The private key is kept by the receiver. The public
key is announced to the public.
13. What are the advantages & disadvantages of public key encryption?
[CO2 – L1]
Advantages:
a) Remove the restriction of a shared secret key between two entities. Here each entity
can create a pair of keys, keep the private one, and publicly distribute the other one.
b) The no. of keys needed is reduced tremendously. For one million users to
communicate, only two million keys are needed.
Disadvantage:
If you use large numbers the method to be effective. Calculating the cipher text using
the long keys takes a lot of time. So it is not recommended for large amounts of text.
14. What are the advantages & disadvantages of secret key encryption? [CO2 –
L1]
Advantage:
Secret Key algorithms are efficient: it takes less time to encrypt a message. The reason
is that the key is usually smaller. So it is used to encrypt or decrypt long messages.
Disadvantages:
15. What are the requests messages support SNMP and explain it? [CO2 – L1]
GET
SET
The former is used to retrieve a piece of state from some node and the latter is used to
store a new piece of state in some node.
The TELNET Protocol is built upon three main ideas: first, the concept of a "Network
Virtual Terminal"; second, the principle of negotiated options; and third, a symmetric
view of terminals and processes.
PART-B
1. EXPLAIN APPLICATION LAYER IN DETAIL. [CO2 – L2 NOV/DEC 2015]
Application layer is the top most layer in OSI and TCP/IP layered model. This layer
exists in both layered Models because of its significance, of interacting with user and
user applications. This layer is for applications which are involved in communication
system.
A user may or may not directly interacts with the applications. Application layer is
where the actual communication is initiated and reflects. Because this layer is on the
top of the layer stack, it does not serve any other layers. Application layer takes the
help of Transport and all layers below it to communicate or transfer its data to the
remote host.
When an application layer protocol wants to communicate with its peer application
layer protocol on remote host, it hands over the data or information to the Transport
layer. The transport layer does the rest with the help of all the layers below it.
There is an ambiguity in understanding Application Layer and its protocol. Not every
user application can be put into Application Layer. except those applications which
interact with the communication system. For example, designing software or text-editor
cannot be considered as application layer programs.
On the other hand, when we use a Web Browser, which is actually using Hyper Text
Transfer Protocol (HTTP) to interact with the network. HTTP is Application Layer
protocol.
Another example is File Transfer Protocol, which helps a user to transfer text based or
binary files across the network. A user can use this protocol in either GUI based
software like FileZilla or CuteFTP and the same user can use FTP in Command Line
mode.
Hence, irrespective of which software you use, it is the protocol which is considered at
Application Layer used by that software. DNS is a protocol which helps user application
protocols such as HTTP to accomplish its work.
2. EXPLAIN SIMPLE MAIL TRANSFER PROTOCOL WITH NECESSARY
DIAGRAMS. [CO2 – L2]
The Simple Mail Transfer Protocol (SMTP) is used to transfer electronic mail from one
user to another. This task is done by means of email client software (User Agents) the
user is using. User Agents help the user to type and format the email and store it until
internet is available. When an email is submitted to send, the sending process is
handled by Message Transfer Agent which is normally comes inbuilt in email client
software.
Message Transfer Agent uses SMTP to forward the email to another Message Transfer
Agent (Server side). While SMTP is used by end user to only send the emails, the
Servers normally use SMTP to send as well as receive emails. SMTP uses TCP port
number 25 and 587.
Client software uses Internet Message Access Protocol (IMAP) or POP protocols to
receive emails.
Commands
Responses
When a client needs to retrieve mails from server, it opens a connection with the server
on TCP port 110. User can then access his mails and download them to the local
computer. POP3 works in two modes.
The most common mode the delete mode, is to delete the emails from remote server
after they are downloaded to local machines. The second mode, the keep mode, does
not delete the email from mail server and gives the user an option to access mails later
on mail server.
This allows the transmission of Non ASCII data through the email, MIME allows
arbitrary data to be encoded in ASCII and sent in a standard email message.
Each MIME message includes information that tells the recipient the type of data and
the type of encoding used and this information along with the MIME version resides in
the MIME header. Typical MIME header looks like,
Content Description: contains the file name of the file that is being sent. Content -
Type: is an important field that specifies the data format ie. tells what kind of data is
being sent. It contains two identifiers a content type and a subtype separated by a
slash. for e.g. image/gif. There are 7 Content Types -
1. text
2. image
3. video
4. audio
5. application
The delivery protocols determine how the mail is transferred by the mail transfer agent
to the user agent which provides an interface for reading mails.
Host names differ from host addresses in two important ways. First, they are usually of
variable length and mnemonic, thereby making them easier for humans to remember.
(In contrast, fixed-length numeric addresses are easier for routers to process).Second,
names typically contain no information that helps the network locate (route packets
toward) the host. Addresses, in contrast, sometimes have routing information
embedded in them; flat addresses (those not divisible into component parts) are the
exception.
A namespace defines the set of possible names. A namespace can be either flat
(names are not divisible into components), or it can be hierarchical. The naming system
maintains a collection of bindings of names to values. The value can be anything we
want the naming system to return when presented with a name; in many cases it is an
address.
A resolution mechanism is a procedure that, when invoked with a name, returns the
corresponding value. A name server is a specific implementation of a resolution
mechanism that is available on a network and that can be queried by sending it a
message.
DNS employs a hierarchical namespace rather than a flat namespace, and the ―table‖ of
bindings that implements this namespace is partitioned into disjoint pieces and
distributed throughout the Internet. These sub tables are made available in name
servers that can be queried over the network.
What happens in the Internet is that a user presents a host name to an application
program, and this program encages the naming system to translate this name into a
host address. The application then opens a connection to this host by presenting some
transport protocol with the host s IP address.
DOMAIN HIERARCHY:
DNS names are processed from right to left and use periods as the separator. An
example domain name for a host is cicada.cs.princeton.edu.There are domains for each
country, plus the ―big six‖ domains: .edu, .com,.gov, .mil, .org, and .net.
NAME SERVERS:
The first step is to partition the hierarchy into sub trees called zones. Each zone can be
thought of as corresponding to some administrative authority that is responsible for that
portion of the hierarchy.
Within this zone, some departments is a zone want the responsibility of managing the
hierarchy (and so they remain in the university-level zone), while others, like the
Department of Computer science, manage their own department-level zone. The
relevance of a zone is that it corresponds to the fundamental unit of implementation in
DNS-the name server. Specifically, the
information contained in each zone is implemented in two or more name servers.
Each name server, in turn, is a program that can be accessed over the Internet. Clients
send queries to name servers, and name servers respond with the requested
information. Sometimes the response contains the final answer that the client wants,
and sometimes the response contains a pointer to another that the client should query
next.
Each name server implements the zone information as a collection of resource records.
In essence, a resource record is a name-to-value binding, or more specifically, a 5-tuple
that contains the following fields:
The Name and Value fields are exactly what you would expect, while the Type field
specifies how the Value should be interpreted. For example, Type=A indicates that the
Value is in IP address. Thus, records implement the name-to-address mapping we have
been assuming. Other record types include
NS: The Value field gives the domain name for a host is running a name server that
knows how to resolve names within the specified domain.
CNAME: the Value field gives the canonical name for a particular host; it is used to
define aliases.
MX: The Value field gives the domain name for a host that is running a mail server that
accepts the messages for the specified domain.
The Class field was included to allow entities other than the NIC to define useful record
types.
Finally, the TTL field shows how long this resource record is valid. It is used by servers
that cache resource records from other servers; when the TTL expires, the server must
evict the record from its cache
Recursive resolution
Iterative resolution
A DNS server is requested with FQDN and it responds back with the IP address
mapped with it. DNS uses UDP port 53.
DNS Messages
FTP uses out-of-band controlling i.e. FTP uses TCP port 20 for exchanging controlling
information and the actual data is sent over TCP port 21.
The client requests the server for a file. When the server receives a request for a file, it
opens a TCP connection for the client and transfers the file. After the transfer is
complete, the server closes the connection. For a second file, client requests again and
the server reopens a new TCP connection.
To access the web pages, a client normally uses web browsers, who are responsible
for initiating, maintaining, and closing TCP connections. HTTP is a stateless protocol,
which means the Server maintains no information about earlier requests by clients.
HTTP functions like a combination of FTP and SMTP. It is similar to FTP because it
transfers files and uses the services of TCP. However, it is much simpler than FTP
because it uses only data are transferred between the client and the server.
HTTP is like SMTP because the data transferred between the client and server look like
SMTP messages. In addition, the format of the messages is controlled by MIME-like
headers.
However, HTTP differs from SMTP in the way the messages are sent from the client to
the server and from the server to the client. Unlike SMTP, the HTTP messages are not
destined to be read by humans; they are read and interpreted by the HTTP server and
HTTP client (browser). SMTP messages are stored and forwarded, but HTTP
messages are delivered immediately.
The idea of HTTP is very simple. A client sends a request, which looks like mail, to the
server. The
server sends the response, which looks like a mail reply, to the client. The request and
response messages carry data in the form of a letter with MIME-like format. The
commands from the client to the server are embedded in a letter like request message.
The contents of the requested file or other information are embedded in a letter like
response message.
HTTP Transaction
Client initializes the transaction by sending a request message. The server replies by
sending a
response.
Messages
There are two general types of HTTP messages, shown in figure request and response.
Both message types follow almost the same format.
A large network can often get into various kinds of trouble due to routers (dropping too
many packets), hosts( going down) etc. One has to keep track of all these occurrence
and adapt to such situations. A protocol has been defined. Under this scheme all
entities in the network belong to 4 classes:
1. Managed Nodes
2. Management Stations
3. Management Information (called Object)
4. A management protocol
The managed nodes can be hosts, routers, bridges, printers or any other device
capable of communicating status information to others. To be managed directly by
SNMP, a node must be capable of running am SNMP management process, called
SNMP agent. Network management is done by management stations by exchanging
information with the nodes. These are basically general purpose computers running
special management software. The management stations polls the stations periodically.
Since SNMP uses unreliable service of UDP the polling is essential to keep in touch
with the nodes. Often the nodes send a trap message indicating that it is going to go
down.
The management stations then periodically checks (with an increased frequency). This
type of polling is called trap directed polling. Often a group of nodes are represented by
a single node which
communicates with the management stations. This type of node is called proxy agent.
The proxy agent can also serve as a security arrangement. All the variables in these
schemes are called Objects. Each variable can be referenced by a specific addressing
scheme adopted by this system. The entire collection of all objects is called
Management Information Base (MIB).
The information are exchanged in a standard and vendor-neutral way. All the data are
represented in Abstract Syntax Notation 1 (ASN.1). It is similar to XDR as in RPC but it
has widely different representation scheme. A part of it actually adopted in SNMP and
modified to form Structure Of Information Base. The Protocol specifies various kinds of
messages that can be exchanged between the managed nodes and the management
station.