0% found this document useful (0 votes)
22 views77 pages

Computer Networks Question Bank Solutions

The document is a question bank solution for the Computer Networks course at SJB Institute of Technology, detailing the OSI reference model, local area networks (LANs), design issues of network layers, service primitives, and various protocols in the TCP/IP model. It covers essential concepts such as the functionalities of different layers in the OSI model, the characteristics of LANs, and the differences between OSI and TCP/IP models. The document serves as a comprehensive guide for students in the Information Science & Engineering department during their 4th semester.

Uploaded by

ishowpuneet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views77 pages

Computer Networks Question Bank Solutions

The document is a question bank solution for the Computer Networks course at SJB Institute of Technology, detailing the OSI reference model, local area networks (LANs), design issues of network layers, service primitives, and various protocols in the TCP/IP model. It covers essential concepts such as the functionalities of different layers in the OSI model, the characteristics of LANs, and the differences between OSI and TCP/IP models. The document serves as a comprehensive guide for students in the Information Science & Engineering department during their 4th semester.

Uploaded by

ishowpuneet
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

|| Jai Sri Gurudev||

Sri Adichunchanagiri Shikshana Trust(R)


SJB INSTITUTE OF TECHNOLOGY
BGS Health & Education City, Dr. Vishnuvardhan Road, Kengeri, Bengaluru–560060
An Autonomous Institute under Visvesvaraya Technological University, Belagavi
Affiliated to Visvesvaraya Technological University, Belagavi & Approved by AICTE,
New Delhi, Certified by ISO 9001-2015
Accredited by NBA & NAAC, New Delhi with ‘A+’ Grade, Recognized by UGC,
New Delhi with 2(f) and 12(B)

Question Bank Solution

Course Name: Computer Networks

Course Code: 23ISI403

By

Faculty Name: Mrs. Poornima M, Dr. Abhilash C.N & Mr. Abhinand B.V

Semester: 4th A, B & C

Department of Information Science & Engineering

Academic Year: EVEN SEM /2024-25


MODULE 1
1. Explain the functionalities of OSI reference model with neat diagram

Solution:-The OSI Reference Model

• This model is based on a proposal developed by the International Standards Organization (ISO). It just
tells what each layer should do.
• The model is called the ISO OSI (Open Systems Interconnection) Reference Model because it deals
with connecting open systems—that is, systems that are open for communication with other systems.
The Physical Layer
• The physical layer focuses on transmitting raw bits through a communication channel.
• Key design issues include ensuring accurate bit representation (1 as 1 and 0 as 0).
• Considerations involve the choice of electrical signals, bit duration, and simultaneous bidirectional
transmission.
• The layer addresses connection establishment and teardown processes.
• It also deals with mechanical, electrical, and timing interfaces, as well as the physical transmission
medium.
The Data Link Layer

• The data link layer's primary function is to eliminate undetected transmission errors from a raw
transmission facility.
• The sender segments input data into data frames, usually ranging from a few hundred to a few
thousand bytes.
• Frames are transmitted sequentially from the sender to the receiver.
• In reliable services, the receiver sends back an acknowledgment frame to confirm the correct receipt
of each data frame.
• The medium access control (MAC) sub layer is responsible for managing access to the shared
communication channel.
• The data link layer plays a crucial role in ensuring efficient and error-free communication between
devices in a network.
The Network Layer
• The network layer manages subnet operations, focusing on packet routing from source to destination.
• Routing methods include static tables, automatic updates for failed components, initial session-based
routing, and dynamic routing based on current network conditions.
• Network congestion occurs when too many packets are present simultaneously, leading to
bottlenecks.
The Transport Layer
• The basic function of the transport layer is to accept data from above it, split it up into smaller units,
if need be, pass these to the network layer, and ensure that the pieces all arrive correctly at the other
end.
• The most popular type of transport connection is an error-free point-to- point channel that delivers
messages or bytes in the order in which they were sent.
• The type of service is determined when the connection is established.
• The transport layer is a true end-to-end layer; it carries data all the way from the source to the
destination.
The Session Layer
• The session layer allows users on different machines to establish sessions between them.
• Sessions offer various services, including dialog control (keeping track of whose turn it is to transmit),
token management (preventing two parties from attempting the same critical operation simultaneously),
and synchronization (checkpointing long transmissions to allow them to pick up from where they left
off in the event of a crash and subsequent recovery).
The Presentation Layer

• The presentation layer is concerned with the syntax and semantics of the information transmitted. In
order to make it possible for computers with different internal data representations to communicate, the
data structures to be exchanged can be defined in an abstract way, along with a standard encoding to be
used ‘‘on the wire.
The Application Layer
• The application layer contains a variety of protocols that are commonly needed by users.
• One widely used application protocol is HTTP (Hyper Text Transfer Protocol), which is the
basis for the World Wide Web.
• When a browser wants a Web page, it sends the name of the page it wants to the server hosting the page
using HTTP.
• The server then sends the page back. Other application protocols are used for file transfer, electronic
mail, and network news.
2. Define Computer Network. Explain local area network in detail with a neat diagram

Solution:-

• Broadcast networks share a communication channel among all machines on the network.
Packets sent by any machine are received by all other machines on the network.

Local Area Networks

• A Local Area Network (LAN) is a privately owned network operating within a single building or nearby
areas.
• LANs are commonly used to connect personal computers and consumer electronics for resource
sharing and information exchange.
• In corporate settings, LANs are referred to as enterprise networks.
• Wireless LANs are increasingly popular in various environments, including homes and offices.
• Wireless LANs eliminate the need for cabling, making installation easier in places like cafeterias and
older buildings.
• Each computer in a wireless LAN is equipped with a radio modem and antenna for
communication.
• Computers typically connect to an Access Point (AP), wireless router, or base station.
• The AP relays data packets between wireless computers and the Internet.
• Direct peer-to-peer communication (Instead of relying on a central server to connect users, devices talk
directly to each other) is possible among nearby computers in a wireless LAN.
• A switch relays packets among connected computers by using packet addresses to determine the
destination.
• Larger LANs can be constructed by connecting multiple switches through their ports.
• Network protocols are designed to handle packet routing, ensuring safe delivery even in the case
of looped connections between switches.
• Large physical LAN can be divided into smaller logical LANs for better management.
• This division is useful when the network layout does not align with organizational structure.
• Example: Engineering and Finance departments may benefit from separate Virtual LANs (VLANs).
• Each port in a VLAN is tagged with a specific “color” to distinguish between different
departments.
• Packets sent to one VLAN (e.g., red for finance) do not reach another VLAN (e.g., green for
engineering).
• Switched Ethernet is a modern variant of classic Ethernet, which originally used a single linear cable.
• Classic Ethernet allowed only one machine to transmit at a time and used a collision resolution
algorithm.
• In classic Ethernet, machines would wait a random time after a collision before trying to transmit
again.
• Both wired and wireless networks can be categorized into static and dynamic channel allocation designs.
• Many devices are already network-capable, including computers, entertainment systems,
and smart appliances.

• Home networks should be user-friendly, as many consumers struggle with complicated wireless
router setups.
3. List out various the design issues of the layers

Solution:- DESIGN ISSUES FOR LAYERS


• Reliability in networking involves designing systems that function correctly despite individual
component unreliability.
• Data packets can experience damage during transmission due to various factors such as
electrical noise and hardware/software issues.
• Error detection codes are used to identify errors in received data, allowing for retransmission until
the information is correct.
• More advanced error correction codes enable the recovery of the correct message from
potentially corrupted bits.
• These mechanisms add redundant information and are utilized at both low and high network
layers to ensure data integrity during transmission.
• Reliability issues in networking include finding functional paths between source and destination
despite potential link or router failures.
• Automatic routing decisions are crucial, allowing packets to reroute through alternative paths when
certain network segments are down.
• Network evolution requires integration of new designs with existing networks, often
facilitated by protocol layering to manage complexity.
• Addressing or naming mechanisms are essential for identifying senders and receivers in message
transmission across different network layers.
• Different network technologies have varying limitations, such as message order preservation and
maximum message size, necessitating disassembly and reassembly solutions.
• The concept of internetworking addresses the challenges of connecting diverse networks with
different operational characteristics.
• Scalability is important in network design, ensuring systems function effectively as they
grow larger and face issues like traffic congestion.
• Resource allocation is a critical design issue in network systems, affecting service delivery to
hosts.
• Effective resource allocation includes mechanisms to prevent interference among hosts.
• Flow control is essential for preventing fast senders from overwhelming slow receivers with
data.

• Congestion occurs when network demand exceeds its capacity, requiring computers to reduce
their traffic.
• Networks offer more than just bandwidth; they also need to ensure timely delivery for
applications like live video.
• Quality of service mechanisms help balance the competing demands of real-time delivery and
high throughput.
• Network security is a major design issue, addressing threats such as eavesdropping on
communications.
• Confidentiality mechanisms are implemented across multiple layers to protect against
unauthorized access.
• Authentication and integrity mechanisms are crucial for verifying identities and
ensuring messages remain unchanged.
4. Differentiate between LAN, WAN and MAN

Solution:-
5. Differentiate between connection oriented and connection less service

Solution:-
6. What are service primitives with a help of a diagram and service primitives explain client server
communication

Solution:-
SERVICE PRIMITIVES
• A service is defined by a set of primitives (operations) that user processes can use to access it.
• When the protocol stack is in the operating system, these primitives are typically implemented
as system calls.
• System calls trigger a trap to kernel mode, transferring control to the operating system to
manage packet transmission.
• The specific set of available primitives varies based on the type of service being offered.
• Connection-oriented services have a distinct set of primitives compared to connectionless services.
• Understanding the nature of the service is crucial for determining the appropriate primitives
to use.

• In a client-server environment, the server uses the LISTEN primitive to accept incoming
connections, generally implemented as a blocking system call.
• The server process remains blocked until a connection request is received.
• The client process initiates a connection using the CONNECT call, specifying the server's
address.
• The operating system sends a connection request packet to the server, causing the client
process to suspend until a response is received.
• Upon receiving the connection request, the server's operating system checks for a listener and
unblocks it if present.
• The server establishes the connection with the ACCEPT call, sending a response back to the
client to confirm the connection.
• The server then executes the RECEIVE call to prepare for the first request, which blocks the server
again.
• The client sends its request using the SEND call and waits for a reply by executing RECEIVE.
• After processing the request, the server sends the response back to the client, unblocking it to inspect
the answer.
• The client terminates the connection with DISCONNECT, followed by the server acknowledging and
also disconnecting, which ultimately releases both processes.
7. Explain various protocols in TCP/IP Model

Solution:-
• The first one, TCP (Transmission Control Protocol), is a reliable connection-oriented protocol
that allows a byte stream originating on one machine to be delivered without error on any other
machine in the internet.
• It segments the incoming byte stream into discrete messages and passes each one on to the internet
layer.

• At the destination, the receiving TCP process reassembles the received messages into the
output stream.
• TCP also handles flow control to make sure a fast sender cannot swamp a slow receiver with
more messages than it can handle.
• The second protocol in this layer, UDP (User Datagram Protocol), is an unreliable,
connectionless protocol for applications that do not want TCP’s sequencing or flow control and
wish to provide their own.
• It is also widely used for one-shot, client-server-type request-reply queries and applications in
which prompt delivery is more important than accurate delivery, such as transmitting speech or
video.
• On top of the transport layer is the application layer. It contains all the higher-level protocols. The
early ones included virtual terminal (TELNET), file transfer (FTP), and electronic mail (SMTP),
the Domain Name System (DNS), for mapping host names onto their network addresses, HTTP, the
protocol for fetching pages on the World Wide Web, and RTP, the protocol for delivering real-time
media such as voice or movies.
8. List the difference between OSI and TCP/IP reference Model

Solution:-
A Comparison of the OSI and TCP/IP Reference Models
• The OSI and TCP/IP reference models share similarities, particularly in their structure as stacks of
independent protocols and the functionality of their layers.
• Both models aim to provide end-to-end, network-independent transport services to
communicating processes through their transport layers.
• Key concepts in the OSI model are services, interfaces, and protocols, with a clear distinction made
between them.
• The OSI model emphasizes the semantic definition of services, how layers interface with one
another, and the internal workings of protocols being hidden from higher layers.
• The OSI model was created prior to the invention of its corresponding protocols, resulting in
a more general framework but also leading to challenges in defining layer functionalities.
• In contrast, the TCP/IP model was developed around existing protocols, ensuring a good fit.
• The OSI model consists of seven layers, while the TCP/IP model has only four layers, with
differences in their respective functions.

• The OSI model supports both connectionless and connection-oriented communication in the
network layer but only connection-oriented in the transport layer.
• The TCP/IP model supports connectionless communication in the network layer and both modes in
the transport layer, offering users greater flexibility, particularly for simple request-response
protocols
9. With a neat diagram explain guided transmission media

Solution:-
• The purpose of the physical layer is to transport bits from one machine to another. Various
physical media can be used for the actual transmission.
• Each one has its own niche in terms of bandwidth, delay, cost, and ease of installation and
maintenance.
• Media are roughly grouped into guided media, such as copper wire and fiber optics, and unguided
media, such as terrestrial wireless, satellite, and lasers through the air.
Magnetic Media
 Data transportation can be achieved by writing it onto magnetic tape or removable media
and physically delivering it to another computer, often proving more cost-effective than
using advanced technologies like satellites.
 An Ultrium tape can store 800 gigabytes, and a box containing 1000 tapes can hold a total
of 800 terabytes, allowing for efficient large- scale data transport.
 Delivery of data tapes can be accomplished within 24 hours across the U.S., achieving an
effective bandwidth of over 70 Gbps, and exceeding 1700 Gbps for local deliveries.
 The cost of an Ultrium tape is approximately $40, and considering reusability and
shipping, the total expense for transporting 800 TB amounts to around $5000, or just
over half a cent per gigabyte.
 Current computer networks cannot match the effective bandwidth and cost efficiency of
physical tape transport for large data transfers.
Twisted Pairs

 A twisted pair consists of two insulated copper wires, typically around 1 mm thick, twisted together in
a helical form.
 By twisting wires that carry current through them, the interference/noise produced by one wire
is effectively canceled by the interference/noise produced by the other.
 Signals are transmitted as the difference in voltage between the two wires, enhancing noise
immunity.
 External noise tends to affect both wires equally, which keeps the differential signal
intact.
 The most prevalent use of twisted pairs is in telephone systems.
 Twisted pairs can run several kilometers without amplification, but for longer distances the signal
becomes too attenuated and repeaters are needed.
 Twisted pairs can be used for transmitting either analog or digital information.
 The bandwidth depends on the thickness of the wire and the distance traveled, but several
megabits/sec can be achieved for a few kilometers in many cases.
 Due to their adequate performance and low cost, twisted pairs are widely used and are likely to
remain so for years to come.
 Twisted-pair cabling has several varieties, with Category 5 (Cat 5) being common in offices.
 A category 5 twisted pair consists of two insulated wires gently twisted together. Four such pairs
are typically grouped in a plastic sheath to protect the wires and keep them together.
Coaxial Cable
• It has better shielding and greater bandwidth than unshielded twisted pairs, so it can span longer
distances at higher speeds.
• Two kinds of coaxial cable are widely used. One kind, 50-ohm cable, is commonly used when it is
intended for digital transmission from the start. The other kind, 75-ohm cable, is commonly used for
analog transmission and cable television.
• A coaxial cable consists of a stiff copper wire as the core, surrounded by an insulating material. The
insulator is encased by a cylindrical conductor, often as a closely woven braided mesh. The outer
conductor is covered in a protective plastic sheath.

Power Lines
• The use of power lines for data communication is an old idea. Power lines have been used by
electricity companies for low-rate communication.

• The difficulty with using household electrical wiring for a network is that it was designed to distribute
power signals.
Fiber Optics
• A fiber-optic cable is made of glass or plastic and transmits signals in the form of light.
• Light travels in a straight line as long as it is moving through a single uniform substance.
• If a ray of light traveling through one substance suddenly enters another substance (of a different
density), the ray changes direction.
10. Explain MAN with a neat labeled diagram

Solution:-
Metropolitan Area Networks
• A Metropolitan Area Network (MAN) typically covers a city, with cable television networks
being prominent examples.
• These cable systems evolved from community antenna systems meant to improve poor over-
the-air television reception.
• Early systems involved large antennas placed on hills, transmitting signals to subscribers' homes.
• Initially, these were locally designed systems until companies started securing contracts to
wire entire cities.
• The expansion included specialized television programming and channels catering to specific
interests, like news and sports.
• Until the late 1990s, cable networks were primarily for television reception only.
• The rise of the Internet led cable operators to realize they could offer two- way Internet service
using unused spectrum.
• This transition marked the evolution of cable systems from television distribution to
Metropolitan Area Networks (MANs).
• The centralized cable head end now distributes both television signals and Internet services to
homes.
• In addition to cable networks, high-speed wireless Internet access developments have led to another
MAN standard known as WiMAX (IEEE 802.16).
11. What is Path Loss? Explain different types of Frequency bands in radio transmission with
necessary diagram

Solution:-
At low frequencies, radio waves pass through obstacles well, but the power falls off sharply with
distance from the source. This attenuation is called path loss.
Radio Transmission
Radio frequency (RF) waves are easy to generate, can travel long distances, and can penetrate buildings
easily, so they are widely used for communication, both indoors and outdoors.
Radio waves also are omnidirectional, meaning that they travel in all directions from the source, so the
transmitter and receiver do not have to be carefully aligned physically.
The properties of radio waves are frequency dependent.
At low frequencies, radio waves pass through obstacles well, but the power falls off sharply with distance
from the source. This attenuation is called path loss.
At high frequencies, radio waves tend to travel in straight lines and bounce off obstacles.
12. What are guided transmission media? Explain twisted pair cable in detail

Solution:-

 A twisted pair consists of two insulated copper wires, typically around 1 mm thick, twisted
together in a helical form.
 By twisting wires that carry current through them, the interference/noise produced by
one wire is effectively canceled by the interference/noise produced by the other.
 Signals are transmitted as the difference in voltage between the two wires, enhancing noise
immunity.
 External noise tends to affect both wires equally, which keeps the differential
signal intact.
 The most prevalent use of twisted pairs is in telephone systems.
 Twisted pairs can run several kilometers without amplification, but for longer distances the
signal becomes too attenuated and repeaters are needed.
 Twisted pairs can be used for transmitting either analog or digital information.
 The bandwidth depends on the thickness of the wire and the distance traveled, but several
megabits/sec can be achieved for a few kilometers in many cases.
 Due to their adequate performance and low cost, twisted pairs are widely used and are
likely to remain so for years to come.
 Twisted-pair cabling has several varieties, with Category 5 (Cat 5) being common in
offices.
 A category 5 twisted pair consists of two insulated wires gently twisted together. Four such
pairs are typically grouped in a plastic sheath to protect the wires and keep them together.
13. Explain different Wireless communication Technique.

Solution:-
WIRELESS TRANSMISSION
• The modern era has created "information junkies" who require constant online connectivity
through various portable devices.
• Traditional wired communication methods like twisted pair, coax, and fiber optics are insufficient
for these mobile users, who prefer wireless solutions.
• Wireless communication offers significant advantages beyond just mobile internet access,
benefiting even fixed devices in certain situations.
• In challenging terrains such as mountains, jungles, or swamps, wireless technology can be a
more effective solution than laying fiber cables.
• The origins of modern wireless digital communication trace back to the Hawaiian Islands,
where geographical barriers and inadequate telephone infrastructure prompted the need for
wireless solutions.

The Electromagnetic Spectrum


When electrons move, they create electromagnetic waves that can propagate through space (even in a
vacuum).
The number of oscillations (movement back and forth in a regular rhythm) per second of a wave is called
its frequency, f, and is measured in Hz
The distance between two consecutive maxima (or minima) is called the wavelength.
When an antenna of the appropriate size is attached to an electrical circuit, the electromagnetic waves
can be broadcast efficiently and received by a receiver some distance away. All wireless
communication is based on this principle.
In a vacuum, all electromagnetic waves travel at the same speed, no matter what their frequency. This
speed, usually called the speed of light, c, is approximately 3
× 108 m/sec, or about 1 foot (30 cm) per nanosecond.
The speed of light is the ultimate speed limit. No object or signal can ever move faster than it.

Radio Transmission
Radio frequency (RF) waves are easy to generate, can travel long distances, and can penetrate buildings
easily, so they are widely used for communication, both indoors and outdoors.
Radio waves also are omnidirectional, meaning that they travel in all directions from the source, so the
transmitter and receiver do not have to be carefully aligned physically.
The properties of radio waves are frequency dependent.
At low frequencies, radio waves pass through obstacles well, but the power falls off sharply with distance
from the source. This attenuation is called path loss.
At high frequencies, radio waves tend to travel in straight lines and bounce off obstacles.
Amateur radio operators (hams) use these bands to talk long distance. The military also communicate in the
HF and VHF bands.
Microwave Transmission
Above 100 MHz, the waves travel in nearly straight lines and can therefore be narrowly focused.
Concentrating all the energy into a small beam by means of a parabolic antenna (like the familiar satellite TV
dish) gives a much higher signal to-noise ratio, but the transmitting and receiving antennas must be accurately
aligned with each other. In addition, this directionality allows multiple transmitters lined up in a row to
communicate with multiple receivers in a row without interference, provided some minimum spacing rules are
observed.
For decades these microwaves formed the heart of the long-distance tele phone transmission system
Microwaves travel in a straight line, so if the towers are too far apart, Thus, repeaters are needed periodically.
The higher the towers are, the farther apart they can be. The distance between repeaters goes up very roughly
with the square root of the tower height.

Infrared Transmission
Infrared waves are widely used for short-range communication.
The remote controls used for televisions, VCRs, and stereos all use infrared communication.
They are relatively directional, cheap, and easy to build but have a major drawback: they do not pass through
solid objects.
On the other hand, the fact that infrared waves do not pass through solid walls well is also a plus.
It means that an infrared system in one room of a building will not interfere with a similar system in adjacent
rooms or buildings: you cannot control your neighbor’s television with your remote control.
no government license is needed to operate an infrared system, in contrast to radio systems, which must be
licensed outside the ISM bands.
As per IrDA (Infrared Data Association) standard.

Light Transmission
Unguided optical signaling or free-space optics has been in use for centuries. A more modern application
is to connect the LANs in two buildings via lasers mounted on their rooftops.
Optical signaling using lasers is inherently unidirectional, so each end needs its own laser and its own photo
detector.
It is also relatively easy to install.
MODULE 2

1. What is framing? Explain various framing methods with example

• To provide service to the network layer, the data link layer must use the service provided to it by the
physical layer.
• What the physical layer does is accept a raw bit stream and attempt to deliver it to the destination.
• It is up to the data link layer to detect and, if necessary, correct errors.
• The usual approach is for the data link layer to break up the bit stream into discrete frames,
compute a short token called a checksum for each frame, and include the checksum in the frame
when it is transmitted.
• The first framing method uses a field in the header to specify the number of bytes in the frame.
• When the data link layer at the destination sees the byte count, it knows how many bytes
follow and hence where the end of the frame is.
• The trouble with this algorithm is that the count can be garbled by a transmission error.

• For example, if the byte count of 5 in the second frame becomes a 7 due to a single bit flip, the
destination will get out of synchronization. It will then be unable to locate the correct start of the
next frame. The byte count method is rarely used by itself.
• The second framing method gets around the problem of resynchronization after an error by having
each frame start and end with special bytes. Often the same byte, called a flag byte, is used as both
the starting and ending delimiter.

• Two consecutive flag bytes indicate the end of one frame and the start of the next. Thus, if the
receiver ever loses synchronization, it can just search for two flag bytes to find the end of the current
frame and the start of the next frame.
• It may happen that the flag byte occurs in the data being transmitted
• The third method - Each frame begins and ends with a special bit pattern. This pattern is a flag byte.
Whenever the sender’s data link layer encounters five consecutive 1s in the data, it automatically
stuffs a 0 bit into the outgoing bit stream.
• When the receiver sees five consecutive incoming 1 bits, followed by a 0 bit, it
automatically destuffs (i.e., deletes) the 0 bit.
• If the user data contain the flag pattern, 01111110, this flag is transmitted as 011111010 but stored in
the receiver’s memory as 01111110.
• With both bit and byte stuffing, a side effect is that the length of a frame now depends on the contents
of the data it carries.

The last method of framing - We can use some reserved signals to indicate the start and end of
frames. We are using ‘‘coding violations’’ to delimit frames.
2. Write the algorithm for computing the checksum (CRC). Calculate CRC for a frame.

The algorithm for computing the CRC is as follows:


 1. Let r be the degree of G(x). Append r zero bits to the low-order end of the frame so it now
contains m + r bits and corresponds to the polynomial x r M(x)
 2. Divide the bit string corresponding to G(x) into the bit string corresponding to x r M(x),
using modulo 2 division.
 3. Subtract the remainder (which is always r or fewer bits) from the bit string
corresponding to x r M(x) using modulo 2 subtraction.
The result is the checksummed frame to be transmitted. Call its polynomial T(x). Figure 3-9 illustrates
the calculation for a frame 1101011111 using the generator G(x) = x 4 + x+ 1.
3. Explain the working of a simplex stop and wait protocol with code snippet for sender and receiver

Consider the following scenario:

 The network layer on A gives packet 1 to its data link layer. The packet is correctly received at
B and passed to the network layer on B. B sends an acknowledgement frame back to A.
 2. The acknowledgement frame gets lost completely. It just never arrives at all. Life would be a
great deal simpler if the channel mangled and lost only data frames and not control frames, but
sad to say, the channel is not very discriminating. Dept. of ISE, SJBIT Page 17 COMPUTER
NETWORKS 23ISI403
 3. The data link layer on A eventually times out. Not having received an acknowledgement, it
(incorrectly) assumes that its data frame was lost or damaged and sends the frame containing
packet 1 again
 4. The duplicate frame also arrives intact at the data link layer on B and is unwittingly passed
to the network layer there. If A is sending a file to B, part of the file will be duplicated (i.e.,
the copy of the file made by B will be incorrect and the error will not have been detected). In
other words, the protocol will fail.
Protocols in which the sender waits for a positive acknowledgement before advancing to the
next data item are often called ARQ (Automatic Repeat reQuest) or PAR (Positive
Acknowledgement with Retransmission). Like protocol 2, this one also transmits data only in
one direction. Protocol 3 differs from its predecessors in that both sender and receiver have a
variable whose value is remembered while the data link layer is in the wait state. The sender
remembers the sequence number of the next frame to send in next frame to send; the receiver
remembers the sequence number of the next frame expected in frame expected.
4. Find the CRC for the data blocks 100100 with divisor 1101 and compute the code word.

.
5. Explain with code an unrestricted simplex protocol for sender and receiver.

.
6. Explain the working of ARQ with code.

 Protocols in which the sender waits for a positive acknowledgement before advancing to the next
data item are often called ARQ (Automatic Repeat reQuest) or PAR (Positive Acknowledgement
with Retransmission).
 Like protocol 2, this one also transmits data only in one direction. Protocol 3 differs from its
predecessors in that both sender and receiver have a variable whose value is remembered while
the data link layer is in the wait state.
 The sender remembers the sequence number of the next frame to send in next frame to send;
the receiver remembers the sequence number of the next frame expected in frame expected.
 Each protocol has a short initialization phase before entering the infinite loop .After
transmitting a frame and starting the timer, the sender waits for something exciting to happen .

.
7. Explain with neat diagram selective repeat protocol

 The other general strategy for handling errors when frames are pipelined is called
selective repeat.
 When it is used, a bad frame that is received is discarded, but any good frames received after it
are accepted and buffered. When the sender times out, only the oldest unacknowledged frame is
retransmitted.
 If that frame arrives correctly, the receiver can deliver to the network layer, in sequence, all the
frames it has buffered. Selective repeat corresponds to a receiver window larger than 1.
 This approach can require large amounts of data link layer memory if the window is large.
Selective repeat is often combined with having the receiver send a negative
acknowledgement (NAK) when it detects an error, for example, when it receives a checksum
error or a frame out of sequence.
 NAKs stimulate retransmission before the corresponding timer expires and thus improve
performance

 In Fig. 3-18(b), frames 0 and 1 are again correctly received and acknowledged and frame 2 is
lost. When frame 3 arrives at the receiver, the data link layer there notices that it has missed a
frame, so it sends back a NAK for 2 but buffers 3.
 When frames 4 and 5 arrive, they, too, are buffered by the data link layer instead of being
passed to the network layer. Eventually, the NAK 2 gets back to the sender, which immediately
resends frame 2. When that arrives, the data link layer now has 2, 3, 4, and 5 and can pass all of
them to the network layer in the correct order.

.
8. Explain with neat diagram Go Back N protocol

 One option, called go-back-n, is for the receiver simply to discard all subsequent frames,
sending no acknowledgements for the discarded frames. This strategy corresponds to a
receive window of size 1.
 In other words, the data link layer refuses to accept any frame except the next one it must
give to the network layer.
 If the sender’s window fills up before the timer runs out, the pipeline will begin to empty.
 Eventually, the sender will time out and retransmit all unacknowledged frames in order,
starting with the damaged or lost one. This approach can waste a lot of bandwidth if the
error rate is high.

 In Fig. 3-18(b) we see go-back-n for the case in which the receiver’s window is large. Frames
0 and 1 are correctly received and acknowledged.
 Frame 2, however, is damaged or lost. The sender, unaware of this problem,
continues to send frames until the timer for frame 2 expires.
 Then it backs up to frame 2 and starts over with it, sending 2, 3, 4, etc. all over again

.
9. Explain with code the working of 1-bit sliding window protocol

 A sliding window protocol with a window size of 1. Such a protocol uses stop-and-wait since the
sender transmits a frame and waits for its acknowledgement before sending the next one.
 Figure 3-16 depicts such a protocol. Like the others, it starts out by defining some variables.
Next frame to send tells which frame the sender is trying to send. Similarly, frame expected tells
which frame the receiver is expecting. In both cases, 0 and 1 are the only possibilities
.
10. Differentiate between pure ALOHA and slotted ALOHA
11. Differentiate between Persistent and Non-persistent CSMA
12. Explain any code Collision free protocol with neat diagram

 A Bit-Map Protocol In our first collision-free protocol, the basic bit-map method, each
contention period consists of exactly N slots.
 If station 0 has a frame to send, it transmits a 1 bit during the slot 0. No other station is allowed
to transmit during this slot.
 Regardless of what station 0 does, station 1 gets the opportunity to transmit a 1 bit during slot 1,
but only if it has a frame queued.
 Protocols like this in which the desire to transmit is broadcast before the actual transmission are
called reservation protocols because they reserve channel ownership in advance and prevent
collisions.
 Let us briefly analyze the performance of this protocol. For convenience, we will measure
time in units of the contention bit slot, with data frames consisting of d time units.
 The channel efficiency at low load is easy to compute. The overhead per frame is N bits and the
amount of data is d bits, for an efficiency of d / (d+N ).
13. Write a note on Adaptive Tree walk protocol

 This mixed sample was then tested for antibodies. If none were found, all the soldiers in the
group were declared healthy. If antibodies were present, two new mixed samples were
prepared, one from soldiers 1 through N / 2 and one from the rest. The proc-ess was repeated
recursively until the infected soldiers were determined
 If, on the other hand, two or more stations under node 2 want to transmit, there will be a
collision during slot 1, in which case it is node 4‘s turn during slot 2.

 In essence, if a collision occurs during slot 0, the entire tree is searched, depth first, to locate
all ready stations.
 Each bit slot is associated with some particular node in the tree. occurs, the search continues
recursively with the node‘s left and right children. If a bit slot is idle or if only one station
transmits in it, the searching of its node can stop because all ready stations have been located.
 When the load on the system is heavy, it is hardly worth the effort to dedicate slot 0 to node 1
because that makes sense only in the unlikely event that precisely one station has a frame to
send.
14. Explain with neat diagram MACA protocol and identify how the hidden nodes problems are
solved

 An early and influential protocol that tackles these problems for wireless LANs is MACA
(Multiple Access with Collision Avoidance) (Karn, 1990).
 The basic idea behind it is for the sender to stimulate the receiver into outputting a short frame,
so stations nearby can detect this transmission and avoid transmitting for the duration of the
upcoming (large) data frame.
 This technique is used instead of carrier sense.
 MACA is illustrated in Fig. 4-12. Let us see how A sends a frame to B. A starts by sending
an RTS (Request To Send) frame to B, as shown in Fig. 4-12(a).
 This short frame (30 bytes) contains the length of the data frame that will eventually follow.
Then B replies with a CTS (Clear To Send) frame, as shown in Fig. 4-12(b).
 The CTS frame contains the data length (copied from the RTS frame). Upon receipt of the
CTS frame, A begins transmission
MODULE 3

1. Write Dijksthras algorithm to compute shortest path through graph Explain with an example

 Dijkstra’s algorithm finds the shortest path from a source node to all other nodes in a weighted graph by
iteratively selecting the node with the smallest tentative distance and updating the distances to its
neighbours.
 It ensures the shortest path is progressively discovered and is based on the principle of greedy
optimization.
Algorithm:
 Create a Set sptSet (shortest path tree set) that keeps track of vertices included in the shortest path tree,
i.e., whose minimum distance from the source is calculated and finalized. Initially, this set is empty.
 Assign a distance value to all vertices in the input graph. Initialize all distance values as INFINITE.
Assign the distance value as 0 for the source vertex so that it is picked first.
 While Set doesn’t include all vertices
 Pick a vertex ‘u‘ that is not there in Set and has a minimum distance value.
 Include ‘u‘ to sptSet.
 Then update the distance value of all adjacent vertices of u.
 To update the distance values, iterate through all adjacent vertices.
 For every adjacent vertex v, if the sum of the distance value of u (from source) and weight of edge u-v, is
less than the distance value of v, then update the distance value of v.
2. Illustrate the working of OSPF and BGP

OSPF (Open Shortest Path First)


1. Router Initialization:
o When a router starts, it identifies OSPF-enabled interfaces and assigns them to appropriate areas.
2. Hello Protocol:
o Routers send Hello packets to discover and maintain neighbor relationships.
o Routers become neighbors if their parameters match (like area ID, Hello/dead intervals, etc.).
3. Database Exchange:
o Once neighbors are established, routers exchange LSAs (Link-State Advertisements).
o Each LSA contains information about directly connected links, costs, and neighboring routers.
4. Link-State Database (LSDB):
o Each router maintains a copy of the LSDB, which contains the full network topology.
5. Shortest Path Calculation:
o Using Dijkstra's algorithm, each router calculates the shortest path to every destination.
o The result is stored in the routing table.
6. Area Design:
o OSPF uses hierarchical routing with Areas (e.g., Area 0 is the backbone).
o This reduces routing overhead and improves scalability.
BGP Works:
1. BGP Peering:
o Routers (BGP speakers) establish TCP connections on port 179 with other routers (peers).
o Peers can be internal (iBGP) or external (eBGP).
2. Exchange of Routing Information:
o BGP routers exchange UPDATE messages containing full path information to reach networks
(prefixes).
o The path includes AS numbers the route has passed through.
3. Routing Table Formation:
o BGP selects the best path based on several attributes (like AS_PATH, LOCAL_PREF,
MED).
o Chosen routes are placed into the routing table and advertised to other peers.
4. Policy-Based Routing:
o BGP allows custom routing policies (e.g., avoid certain ASes, prefer cheaper providers).
5. Loop Prevention:
o Loops are prevented using the AS_PATH attribute; if a router sees its own AS in the path, it
discards the route.
3. What is congestion control? List and explain various approaches to congestion control

Approaches to Congestion Control

• The presence of congestion means that the load is (temporarily) greater than the resources (in a part
of the network) can handle.
• Two solutions come to mind: increase the resources or decrease the load. Leaky Bucket
Algorithm
 It mainly controls the total amount and the rate of the traffic sent to the network.

• Step 1 − Let us imagine a bucket with a small hole at the bottom where the rate at which water is
poured into the bucket is not constant and can vary but it leaks from the bucket at a constant rate.
• Step 2 − So (up to water is present in the bucket), the rate at which the water leaks does not depend on
the rate at which the water is input to the bucket.
• Step 3 − If the bucket is full, additional water that enters into the bucket that spills over the sides and is
lost.
• Step 4 − Thus the same concept applied to packets in the network. Consider that data is coming from the
source at variable speeds.
Token bucket algorithm
• Main problem is that it cannot control burst data, as it only allows average rate i.e. constant rate of data
flow and also it does not consider idle time of host.
• Step 1 − For example, if the host was idle for 12 seconds and now it is willing to send data at a very high
speed for another 12 seconds, the total data transmission will be divided into 24 seconds and average data
rate will be maintained.
• Step 2 − The host has no advantage of sitting idle for 12 seconds. Thus, we adopted a token bucket
algorithm.
• Step 3 − Hence, the token bucket algorithm is modification of leaky bucket in which leaky bucket
contains tokens.
• Step 4 − in this a token(s) are generated at every clock tick. For every packet to be transmitted, the system
must remove token(s) from the bucket. Thus, the token bucket algorithm allows idle hosts to accumulate
credit for the future in the form of tokens.
4. What is packet scheduling algorithm? Explain FIFO algorithm

• Algorithms that allocate router resources among the packets of a flow and between competing flows are
called packet scheduling algorithms.
• Three different kinds of resources can potentially be reserved for different flows:
1. Bandwidth.
2. Buffer space.
3. CPU cycles.
• The first one, bandwidth, is the most obvious. If a flow requires 1 Mbps and the outgoing line has a
capacity of 2 Mbps, trying to direct three flows through that line is not going to work. Thus, reserving
bandwidth means not oversubscribing any output line
• Packet scheduling algorithms allocate bandwidth and other router resources by determining which
of the buffered packets to send on the output line next.
• We already described the most straightforward scheduler when explaining how routers work. Each router
buffers packets in a queue for each output line until they be sent, and they are sent in the same order that
they arrived.
• This algorithm is known as FIFO (First-In First-Out), or equivalently FCFS (First- Come First-Serve).
FIFO -The other scheduling algorithms that we will describe also create other opportunities for deciding
which packet to drop when the buffers are full.
• FIFO scheduling is simple to implement, but it is not suited to providing good quality of service
because when there are multiple flows, one flow can easily affect the performance of the other
flows.
• If the first flow is aggressive and sends large bursts of packets, they will lodge in the queue.
Processing packets in the order of their arrival means that the aggressive sender can hog most of the
capacity of the routers its packets traverse, starving the other flows and reducing their quality of
service.
• To add insult to injury, the packets of the other flows that do get through are likely to be delayed
because they had to sit in the queue behind many packets from the aggressive sender.
5. Explain store and forward switching with neat diagram

Store and Forward packet switching:

• The host sends the packet to the nearest router.

• This packet is stored there until it has fully arrived once the link is fully processed by verifying the
checksum then it is forwarded to the next router till it reaches the destination. This mechanism is called
“Store and Forward packet switching.”
6. Explain the implementation of connection oriented and connectionless service with neat
diagrams

Implementation of Connectionless Service


• If connectionless service is offered, packets are injected into the network individually and routed
independently of each other.
• No advance setup is needed.
• In this context, the packets are frequently called datagrams (in analogy with telegrams) and the
network is called a datagram network.

How a Datagram Network Works


• Message from Process P1 to P2
– Process P1 on host H1 wants to send a long message to P2 on host H2.
– The transport layer on H1 adds a transport header and passes the message to the network
layer.
– Since the message is too large, the network layer splits it into four smaller packets (1, 2, 3,
and 4).
• Sending Packets Through the Network
– H1 sends all four packets to router A using a point-to-point protocol like PPP.
– Router A receives the packets, verifies their checksums, and forwards them
based on its routing table.
• Routing Process
– Packets 1, 2, and 3 follow the path: A → C → E → F → H2.
– Packet 4 takes a different route: A → B → F → H2.
– This happens because router A dynamically updates its routing table (e.g., due to congestion
on the ACE path).
• Routing Algorithm
– The process of updating routing tables and deciding packet paths is handled by a routing
algorithm.
– Different routing algorithms exist, and they determine the best path for each packet.
• IP as a Connectionless Network Service
– Each packet carries its own destination IP address (IPv4: 32-bit, IPv6: 128- bit).
– Routers forward packets independently, meaning packets may take different routes.
– This is an example of a datagram network, where packets travel independently
without a fixed connection.
Implementation of Connection-Oriented Service

How a Virtual-Circuit Network Works


1. Connection Setup
• Before sending data, a connection (virtual circuit) is established between the source and
destination.
• A specific route is chosen and stored in routers' tables (unlike a datagram network where each
packet takes its own route).
2. Packet Forwarding Using Connection Identifiers
• Each packet carries a connection identifier (instead of a full destination address).
• Routers forward packets based on the connection identifier, ensuring they follow the pre-
established route.
• This is similar to how telephone calls work, where a connection remains active for the entire
session.
3. Example Scenario
– Host H1 establishes a connection (Connection 1) with H2.
– Routers A → C → E store an entry in their tables, routing Connection 1 packets along this
path.
• Handling Multiple Connections
– Now, host H3 also wants to connect to H2 and chooses Connection 1 (since it’s the first
connection for H3).
– Router A can distinguish packets from H1 and H3, but router C cannot, as both connections
have the same identifier.
– To solve this, routers modify connection identifiers to avoid conflicts (this process is called
label switching).
• MPLS (MultiProtocol Label Switching)
– MPLS is an example of a connection-oriented technology used in modern networks.
– It assigns a 20-bit label to packets, allowing ISPs to manage traffic efficiently.
– MPLS is widely used for traffic engineering and Quality of Service (QoS)
to ensure stable performance.
7. Compare and discuss Virtual-Circuit and Datagram Networks

How a Datagram Network Works

Message from Process P1 to P2


– Process P1 on host H1 wants to send a long message to P2 on host H2.
– The transport layer on H1 adds a transport header and passes the message to the network
layer.
– Since the message is too large, the network layer splits it into four smaller packets (1, 2, 3,
and 4).
• Sending Packets Through the Network
– H1 sends all four packets to router A using a point-to-point protocol like PPP.
– Router A receives the packets, verifies their checksums, and forwards them
based on its routing table.
• Routing Process
– Packets 1, 2, and 3 follow the path: A → C → E → F → H2.
– Packet 4 takes a different route: A → B → F → H2.
– This happens because router A dynamically updates its routing table (e.g., due to congestion
on the ACE path).
• Routing Algorithm
– The process of updating routing tables and deciding packet paths is handled by a routing
algorithm.
– Different routing algorithms exist, and they determine the best path for each packet.
• IP as a Connectionless Network Service
– Each packet carries its own destination IP address (IPv4: 32-bit, IPv6: 128- bit).
– Routers forward packets independently, meaning packets may take different routes.
– This is an example of a datagram network, where packets travel independently
without a fixed connection.

How a Datagram Network Works
• Message from Process P1 to P2
– Process P1 on host H1 wants to send a long message to P2 on host H2.
– The transport layer on H1 adds a transport header and passes the message to the network
layer.
– Since the message is too large, the network layer splits it into four smaller packets (1, 2, 3,
and 4).
• Sending Packets Through the Network
– H1 sends all four packets to router A using a point-to-point protocol like PPP.
– Router A receives the packets, verifies their checksums, and forwards them
based on its routing table.
• Routing Process
– Packets 1, 2, and 3 follow the path: A → C → E → F → H2.
– Packet 4 takes a different route: A → B → F → H2.
– This happens because router A dynamically updates its routing table (e.g., due to congestion
on the ACE path).
• Routing Algorithm
– The process of updating routing tables and deciding packet paths is handled by a routing
algorithm.
– Different routing algorithms exist, and they determine the best path for each packet.
• IP as a Connectionless Network Service
– Each packet carries its own destination IP address (IPv4: 32-bit, IPv6: 128- bit).
– Routers forward packets independently, meaning packets may take different routes.
– This is an example of a datagram network, where packets travel independently
without a fixed connection.

Implementation of Connection-Oriented Service

How a Virtual-Circuit Network Works


1. Connection Setup
• Before sending data, a connection (virtual circuit) is established between the source and
destination.
• A specific route is chosen and stored in routers' tables (unlike a datagram network where each
packet takes its own route).
2. Packet Forwarding Using Connection Identifiers
• Each packet carries a connection identifier (instead of a full destination address).
• Routers forward packets based on the connection identifier, ensuring they follow the pre-
established route.
• This is similar to how telephone calls work, where a connection remains active for the entire
session.
3. Example Scenario
– Host H1 establishes a connection (Connection 1) with H2.
– Routers A → C → E store an entry in their tables, routing Connection 1 packets along this
path.
• Handling Multiple Connections
– Now, host H3 also wants to connect to H2 and chooses Connection 1 (since it’s the first
connection for H3).
– Router A can distinguish packets from H1 and H3, but router C cannot, as both connections
have the same identifier.
– To solve this, routers modify connection identifiers to avoid conflicts (this process is called
label switching).
• MPLS (MultiProtocol Label Switching)
– MPLS is an example of a connection-oriented technology used in modern networks.
– It assigns a 20-bit label to packets, allowing ISPs to manage traffic efficiently.
– MPLS is widely used for traffic engineering and Quality of Service (QoS)
to ensure stable performance.
8. Write a short note on flooding

Flooding
• Flooding is a method where every router forwards a received packet to all its outgoing
connections, except the one from which it came. This ensures that the packet reaches every possible
destination.
• Problems with Flooding:
1. Too Many Duplicates – Every router keeps forwarding packets, creating an overwhelming
number of duplicates.
2. Infinite Loops – If unchecked, packets can keep circulating forever.
• How to Control the Flood:
1. Hop Counter (TTL - Time to Live)
– Each packet has a counter that decreases at every hop.
– When the counter reaches zero, the packet is discarded.
– The counter should ideally match the expected path length.
2. Tracking Sent Packets (Sequence Number Method)
– Each packet has a unique sequence number assigned by the source.
– Routers remember previously seen sequence numbers and discard duplicates.
– When is Flooding Useful?
1. Broadcasting Messages – If information must reach every node in the network.
2. Highly Reliable Communication – If routers fail (like in war zones), flooding
ensures delivery as long as a path exists.
3. Building Other Routing Protocols – Since it requires no setup, flooding can help
discover paths before using more efficient routing methods.
4. Benchmarking – Since it explores all paths, it helps compare other routing algorithms.
9. Explain Distance vector routing with Example: Distance Vector Routing a short note on flooding

• Computer networks generally use dynamic routing algorithms that are more complex than flooding, but
more efficient because they find shortest paths for the current topology.
• Two dynamic algorithms in particular, distance vector routing and link state routing, are the
most popular.
• A distance vector routing algorithm operates by having each router maintain a table (i.e., a vector)
giving the best-known distance to each destination and which link to use to get there.
• These tables are updated by exchanging information with the neighbors. Eventually, every router knows
the best link to reach each destination.
EXAMPLE
The Count-to-Infinity Problem
• Good news spreads fast: If a better route is found, routers update immediately.
• Bad news spreads slowly: If a link fails, routers take multiple steps to realize it.
• A —— B —— C —— D
• Each router knows the shortest distance to A:
• B → A (1 hop)
• C → A (2 hops)
• D → A (3 hops)
• A ✖B —— C —— D
• B loses its direct path to A.
• B asks C for a route.
• C still thinks A is 2 hops away, so it tells B:
• "I can reach A in 2 hops"
• B updates its route to A as 3 hops (even though A is actually gone).
• A ✖B(3) —— C(4) —— D(5)
• C updates its distance to A as 4 (B’s 3 + 1)
• D updates its distance to A as 5 (C’s 4 + 1)
• The wrong information keeps spreading!
• The count keeps increasing until it reaches a set maximum.
• Split Horizon: Prevents routers from advertising routes back to the source.
Poison Reverse: Marks failed routes as infinite immediately.
Hold-Down Timer: Prevents immediate updates from incorrect sources.
10. Discuss count to infinity problem with example
What is the Count to Infinity Problem?
The Count to Infinity Problem occurs in distance vector routing protocols when routers
continuously increase the metric (hop count) to a destination that has become unreachable, due to a
slow propagation of failure information.
 Distance vector protocols rely on neighboring routers' information to update their routing tables.
 If a route goes down, it takes time for all routers to realize the destination is unreachable.
 Meanwhile, they may believe a neighbor still has a valid path, causing the hop count to increase
gradually—this is called counting to infinity.
Example:
Let’s take a simple network of 3 routers: A, B, and C. A --- B --- C
 Each link has a hop count of 1.
 So the initial routing tables look like this:

Now suppose router C fails (goes down):


1. B detects C is unreachable and removes the route.
2. A doesn’t know this yet. It still has an entry saying it can reach C via B.
3. A tells B: "Hey, I can reach C in 2 hops!"
4. B believes A and updates its table: "I can reach C in 3 hops via A."
5. Now A hears B say it can reach C in 3 hops and thinks: "Oh, I can get to C in 4 hops."
6. This process continues: hop count keeps increasing…
This goes on until the hop count reaches a maximum (in RIP, infinity is 16 hops), and only then the route is
marked unreachable
11. Discuss Hierarchal routing with example

Hierarchical Routing
• As networks grow, routers need to store more entries in their routing tables.
• More memory, CPU power, and bandwidth are required to handle these growing tables.
• At a certain point, it becomes impractical for every router to know about every other router.
• Divide the network into regions so that each router only tracks details of its own region and
summary information for other regions.
• Routers inside a region know the full details of local routing.
• For outside traffic, routers forward packets to a designated router that handles connections to other
regions.
• The process can be extended into multiple levels (regions → clusters → zones → groups, etc.).
EXAMPLE
• Suppose a packet travels from Berkeley, California to Malindi, Kenya:
– Berkeley router handles California traffic but sends out-of-state traffic to Los Angeles.
– Los Angeles router knows U.S. routes but forwards international traffic to
New York.
– New York router directs all Kenyan traffic to Nairobi.
– Nairobi router forwards the packet to Malindi.
• Saves memory: The routing table size is greatly reduced.
• Scalability: Works better for very large networks.
• If there are N routers, the best number of hierarchy levels is ln(N) (natural logarithm of N).
• A logarithm is just the opposite of an exponent. It tells you what power you need to raise a number to
get another number.
• ln720≈6.58 → This means e raised to 6.58 is about 720.
12. Write a short note on broadcast routing and Multicast routing

Broadcast Routing
1. Basic Broadcasting (Inefficient)
The simplest way is for the source to send a separate packet to each destination.
• Problems: Wastes bandwidth, slow, and requires knowing all destinations.
2. Multidestination Routing (Better, but Still Not Ideal)
Instead of separate packets, the source sends one packet with multiple destinations listed.
• Uses bandwidth better but still requires knowing all destinations.
3. Flooding (Efficient but Redundant)
A packet is sent to all neighboring routers, which forward it again, spreading the message.
• To prevent infinite loops, routers check sequence numbers and discard duplicates.
• Good for emergencies, but inefficient for regular broadcasting.
4. Reverse Path Forwarding (More Efficient)
• Routers only forward a broadcast packet if it arrives on the shortest path from the source.
• When a router receives a broadcast packet, it checks the link it came from.
• If the packet arrived on the best path from the source, the router forwards it to all other links.
• If the packet came from a different (non-optimal) path, the router discards it (since it’s likely a
duplicate).
5. Spanning Tree Broadcasting (Most Efficient)
Uses a spanning tree, a special structure that connects all routers without loops.
• Each router forwards the packet only along tree paths.
• Advantage: Minimizes the number of packets needed.
• Disadvantage: Routers must know the spanning tree, which is not always available.
• Basic broadcasting wastes bandwidth.
Multicast Routing
• Multicast routing efficiently delivers messages only to group members using special routing
techniques.
1. Pruning a Spanning Tree (For Dense Groups)
• Dense Groups (Many members, spread across the network)
• Most routers in the network have group members nearby.
• First, use a broadcast tree to reach all routers.
• Then, remove unnecessary links (pruning) so the message only goes where needed.
• Example protocols: MOSPF (Multicast OSPF), DVMRP.
• Problem: Large networks need to store too many trees, making it inefficient.
13. Explain packet routing for mobile host with a neat diagram

Routing for Mobile Hosts


• Mobile routing is a method that allows a moving device (laptop, phone, etc.) to receive data even
when it changes locations. The goal is to route packets efficiently to the mobile device using its
permanent home address, even if it moves far away.
• How It Works
1. Mobile Host Registers Location
• The mobile device gets a temporary address (care-of address) in the new location.
• It sends this address to its home agent (a trusted device in its home network).
2. Packet Routing
• A sender sends data to the mobile device’s permanent home address (because the sender does
not know the new location).
• The home agent intercepts the packet and forwards it to the mobile device’s new address.
3. Tunneling
• The home agent encapsulates the packet (wraps it in another packet) and sends it to the new
location.
• The mobile device unwraps the packet and reads the message.
4. Replying and Direct Routing
• The mobile device replies directly to the sender.
• The sender may learn the new address and start sending packets directly, skipping the home
agent.
• Key Concepts
• Home Agent – A trusted device that helps forward packets when the mobile device is
away.
• Care-of Address – The temporary address assigned when a mobile device moves.
• Tunneling – A method of forwarding packets by encapsulating them.
• Triangle Routing – Packets first go to the home agent, then to the mobile device,
forming a triangular path.
14. Briefly discuss routing in Adhoc network

Routing in Ad Hoc Networks


• An ad hoc network is a type of wireless network where routers are also mobile. Unlike traditional
networks, where routers are fixed, ad hoc networks can change constantly.
• "Ad hoc" is Latin for "for this" or "for this purpose," meaning something is created or used specifically for
a particular situation, without prior planning or infrastructure.
• Examples:
• Emergency rescue teams in disaster areas
• Military vehicles on battlefields
• Ships communicating at sea
• Groups of laptops in areas without Wi-Fi
• These networks are also called MANETs (Mobile Ad hoc NETworks). Since they do not have fixed
infrastructure, routing is much harder.
• As an example, we will look at one of the most popular routing algorithms, AODV (Ad hoc On-
demand Distance Vector).
• How AODV Routing Works
1. Route Discovery (Finding a Path)
• If A wants to send a packet to I, it checks its routing table.
• If no path is found, A sends a ROUTE REQUEST message (broadcast).
• This request spreads like a wave, reaching nearby nodes.
• When it reaches I, I sends a ROUTE REPLY back to A.
• The reply follows the reverse path and tells each node how to reach I.
• Now, A has a route to I
2. Route Maintenance (Keeping Paths Valid)
• Nodes send "Hello" messages to check if neighbors are still active.
• If a node stops responding, its route is deleted from the table.
• If a node moves away, all affected routes are updated.
3. Efficient Routing with Sequence Numbers
• Each route has a sequence number to prevent outdated paths.
• Nodes only store active routes to save battery and bandwidth.
15. Discuss the Approaches to congestion control

Approaches to Congestion Control

• The presence of congestion means that the load is (temporarily) greater than the resources (in a part
of the network) can handle.
• Two solutions come to mind: increase the resources or decrease the load.

1. Build a network that can handle the expected traffic.


• If there’s a slow link (low-bandwidth) where a lot of traffic goes, it becomes a
bottleneck — like a one-lane road during rush hour.
What Can Be Done?
Short-Term Fixes (Dynamic Solutions)
When congestion hits hard:
• Turn on spare routers
• Use backup lines (normally kept for emergencies)
• Buy more bandwidth (temporarily)
Long-Term Fixes (Provisioning)
• Regularly busy links/routers are upgraded.
• This is called provisioning.
• It’s based on traffic trends over months.

2. Making the Most of Existing Network Capacity


• Instead of adding more hardware, we can use smarter routing to reduce congestion.
Why Routing Needs to Adjust:
• Internet traffic changes throughout the day (due to time zones).
– Example: When people in Asia sleep, users in Europe or the U.S. become active.
• What Can Be Done:
1. Traffic-Aware Routing
– Routes are adjusted based on current traffic.
– The network can change shortest path weights to steer traffic away from
busy paths.
2. Splitting Traffic Across Multiple Paths
– Instead of sending all data down one path, it can be split across several less- busy routes
to balance the load.

3. When You Can’t Add More Capacity


• Sometimes it’s not possible to upgrade routers, links, or buy more bandwidth — due to cost, limits, or
timing.
Solution: Decrease the Load
In that case, the only option is to control how much traffic enters the network.
Admission Control
• Used in virtual-circuit networks (where connections are set up before sending data).
• If a new connection would overload the network, it’s rejected (not allowed in).
• This keeps the network from becoming congested.
4. What Happens When Congestion Is About to Happen?
• The network can take fine-grained actions to deal with it:
Feedback to Traffic Sources
The network tells the sources (senders) to:
– Slow down (throttle traffic)
– Or the network itself slows them down
16. Discuss any two packet scheduling algorithms

Packet Scheduling
• Algorithms that allocate router resources among the packets of a flow and between competing flows are
called packet scheduling algorithms. Three different kinds of resources can potentially be reserved for
different flows:
1. Bandwidth. 2. Buffer space. 3. CPU cycles.
• It takes router CPU time to process a packet, so a router can process only a certain number of packets
per second.
1. FIFO (First In, First Out) — Simple but unfair
• All packets go into one queue.
• Whoever arrives first, leaves first.
• Problem: One greedy flow can hog the queue and ruin QoS for others.
2. Fair Queueing (FQ) — Everyone gets a fair share
• Each flow gets its own queue.
• Router picks from queues round-robin: 1 packet per queue per round.
• Problem: Flows with large packets get more bandwidth.
3. Byte-based Fair Queueing
• Fixes the above issue by simulating byte-by-byte fairness.
• Computes finish time for each packet based on size:
s Finish time = Arrival time or previous finish time + Length of packet
• Packets are sent in order of finish time.
4. Weighted Fair Queueing (WFQ) — Fair, but with priority
• Gives some flows more bandwidth (via weights).
• Example: Video stream gets 3x the share of a file download. Finish time Fi =
max(Ai, Fi−1) + Li / Wi
• Popular and used in real-world routers.
5. Deficit Round Robin (DRR) — WFQ but fast
• WFQ can be slow to implement because of sorting packets.
• DRR is an approximation of WFQ that’s much faster (constant time per packet).
6. Priority Scheduling
• Packets are marked as high or low priority.
• Always send high-priority packets first.
• Problem: Low-priority traffic can starve (never get sent).
7. Timestamp Scheduling
• Each packet has a timestamp.
• Send packets in timestamp order.
• Helps even out delay by speeding up slow packets and slowing down fast ones — results in more
consistent delivery.
MODULE 4
1. Explain the Transport service primitives

THE TRANSPOR SERVICE


Services Provided to the Upper Layers
• The transport layer makes use of the services provided by the network layer.
• The software and/or hardware within the transport layer that does the work is called the
transport entity.
• The transport entity can be located in the operating system kernel, in a library package bound into
network applications, in a separate user process, or even on the network interface card.
 The (logical) relationship of the network, transport, and application layers is illustrated

 The connection-oriented transport service is similar to the connection-oriented network service.


Connections have three phases: establishment, data transfer, and release. Addressing and flow control are
also similar in both layers.
• The connectionless transport service is also very similar to the connectionless network service.
• The obvious question is this: if the transport layer service is so similar to the network layer service,
why are there two distinct layers? Why is one layer not adequate?
• The transport code runs entirely on the users’ machines, but the network layer mostly runs on the
routers, which are operated by the carrier.
• What happens if the network layer offers inadequate service? What if it frequently loses packets? What
happens if routers crash from time to time?
• The only possibility is to put on top of the network layer another layer that improves the quality of the
service.
• The existence of the transport layer makes it possible for the transport service to be more reliable than the
underlying network.
• Layers 1–4 (physical to transport) = service providers (they make data delivery happen).
• Layers above 4 (like applications) = service users.
2. List and explain the socket primitives for TCP

• Socket primitives, are a real-world, widely-used implementation of the transport service


interface, especially for TCP/IP programming.
• Sockets are the programming abstraction that allows processes to communicate over a network,
particularly using TCP (connection-oriented) or UDP (connectionless) protocols.
• Originally introduced in Berkeley UNIX 4.2BSD (1983).
• Still in use today on:
• UNIX/Linux systems
• Windows (via Winsock API)
They provide a standard way for applications to:
• Open network connections
• Send/receive data
• Close connections
Compared to theoretical transport primitives (CONNECT, SEND, etc.), sockets offer:
• More flexibility
• Real-world applicability
• Lower-level control (e.g., choosing between TCP and UDP, setting options)
3. Explain the connection Establishment using three way handshake

• Three-Way Handshake Disconnect


• A common method that usually works (though not perfect):
1. Side A sends DISCONNECT REQUEST (DR).
2. Side B replies with DR and starts a timer.
3. Side A replies with ACK.
4. Both sides then safely release the connection.
• What if messages are lost?
1. ACK lost → Timer expires → Side B releases anyway.
2. DR lost → Side A retries after timeout.
4. Write a short note on crash recovery

 Crash Recovery in Networks


1 Router & Network Failures Are Manageable
• Transport protocols like TCP already assume that some packets will get lost or arrive out
of order.
• These are handled by retransmissions, so crashes of routers or short-lived connections
aren't a huge problem.
2. Host Crashes Are Tricky
• If a server crashes mid-transfer, it loses its memory of which data it had already received
or acknowledged.
• Example scenario:
• Client sends a file to a server using stop-and-wait (sends one segment, waits
for ACK).
• Server crashes after sending the ACK but before saving the data.
• When it reboots, it doesn’t know what it has or hasn’t received.
Why Recovery Logic Can Fail
There are two conflicting goals:
• Avoid duplicates: Don’t send the same data twice if it was already saved.
• Avoid data loss: Don’t skip sending if the server actually didn’t get the data.
• If the client doesn’t retransmit (thinking the ACK means the data is saved), the data
might be [Link] the client does retransmit (just to be safe), the data might be
duplicated
Conclusion: Fundamental Limitation
“Recovery from layer N crashes must be handled by layer N+1.”
• In simple terms:
• Transport layer can recover from network failures.

• But application layer must recover from transport-level failures (like incomplete
transactions after a server crash).
5. Discuss max-min fairness

Max-Min Fairness
• Definition: A bandwidth allocation is max-min fair if no flow can be given more
bandwidth without decreasing
the allocation of another flow that has less or equal bandwidth.
Example:
If three flows share a link:
• They each get 1/3.
• Even if another link has spare capacity, redistributing bandwidth would hurt less
privileged flows — violating fairness.
Convergence: Adjusting to Changing Conditions
• Network traffic is dynamic.
• New flows arrive, others leave, usage fluctuates. A good
congestion control algorithm must:
• Converge quickly to the best state.
• Track changes in traffic efficiently.
• Avoid oscillation or delay in adjustments.
Example:
• Flow 1 starts → gets all bandwidth.
• Flow 2 joins → they split bandwidth.
• Flow 3 joins, but only uses 20% → other two adjust to 40% each.
• Flow 2 leaves → Flow 1 takes up remaining bandwidth.
• At every step, total usage = 100%, and no one gets more than they need.
• What Makes a Congestion Control Algorithm "Good"?
6. Briefly discuss the steps of Remote Procedure call

Remote Procedure Call


• RPC lets a program on one machine call a procedure on another machine just like calling a local
function
• It hides the network communication behind the scenes, making it feel like the procedure is nearby.
• In the simplest form, to call a remote procedure, the client program must be bound with a small library
procedure,
called the client stub, that represents the server procedure in the client’s address space.

• Similarly, the server is bound with a procedure called the server stub.
1. Client calls a local "stub" function (the client stub).
2. The client stub:
• Packs (marshals) the parameters. [Packing the parameters is called marshaling. ]
• Sends a network message (usually via UDP) to the server.
3. The server's OS gets the message and passes it to the server stub.
4. The server stub unpacks the parameters and calls the real procedure.
5. The reply goes back the same way in reverse.
This way, the programmer sees a normal function call, not a network operation
7. Explain R T P —The Real-time Transport Protocol header with a diagram

Real-Time Transport Protocols


• RTP (Real-time Transport Protocol) is a protocol used to send audio and video over the Internet in real
time
• It’s designed for applications like:
• Video conferencing
• Internet radio
• Voice calls (VoIP)
• Live streaming
• RTP was created to provide a standard, reusable way to handle real-time communication.
How RTP Works
• RTP is usually used on top of UDP (not TCP).
• It runs in user space (alongside the app), not in the OS kernel.
• The application feeds audio/video/text streams to RTP.
• RTP library takes those streams, adds timestamps and sequence numbers, and puts them into
RTP packets.
• These RTP packets are then wrapped inside UDP packets and sent over the network.
At the receiver:
• UDP delivers the RTP packets.
• RTP reorders them (if needed) and handles timing.
• The application plays the media at the correct time.
8. Explain the TCP segment header with a diagram

The TCP Segment Header

• IP header: 20 bytes
• TCP header: 20 bytes (minimum)
• Max data size: 65,535 - 20 - 20 = 65,495 bytes
• Optional: Up to 40 bytes of options
• Main TCP Header Fields (Fixed 20 Bytes)

• Options Field (Variable Length, up to 40 bytes)


• Options are used to extend TCP functionality. Key options include:

• 1. MSS (Maximum Segment Size)


• Each host says how much data it can handle in a segment. If not set,
defaults to 536 bytes of payload
• 2. Window Scale
• Extends the window size by up to 2³⁰ bytes.
• Useful on high-speed, high-delay networks.
• 3. Timestamp Option
• Adds sender's timestamp to each packet.
• Helps:
• Measure round-trip time
• Avoid sequence number wraparound (via PAWS)
• 4. SACK (Selective ACK)
• Tells sender exactly which pieces of data were received.
• Improves efficiency during packet loss.
• Helps avoid unnecessary retransmissions.
• How Some Key Fields Work Together
• Sequence & Acknowledgement Numbers
• Track what has been sent and received.
• Each byte gets a unique sequence number.
• ACK number = the next expected byte, not the last received one.
• Window Size & Flow Control
• Controls how much data the sender can send without waiting for ACKs.
• Receiver tells the sender: “I can accept X more bytes starting at byte Y.”
• Can temporarily be set to 0 (e.g., when the receiver is busy).
• TCP Connection = 5-Tuple
• A TCP connection is identified by:
• Source IP
• Source port
• Destination IP
• Destination port
• Protocol (TCP)
• This 5-tuple uniquely identifies a single connection on the internet.
9. Explain TCP connection Establishment

TCP Connection Establishment

• TCP Three-Way Handshake: Step-by-Step Goal:


• Establish a reliable, full-duplex TCP connection between a client and server before actual data is
exchanged.
Steps in the Normal Case:
1. Client → Server: SYN
• Client sends a SYN segment (SYN=1, ACK=0)
• Includes:
• Initial Sequence Number (ISN) for the client
• Optional fields (like MSS)
• 2. Server → Client: SYN + ACK
• If server is listening on the port:
• Responds with SYN=1, ACK=1
• Acknowledges client’s SYN
• 3. Client → Server: ACK
• Acknowledges server’s SYN
• Now both sides agree on sequence numbers and are ready to exchange data
Result:
• Connection is established. Data transfer can now begin.
• Each side chooses its own Initial Sequence Number (ISN).
• If two hosts try to connect to each other at the same time, both send SYNs.
• TCP allows this: both SYNs are acknowledged and merged into a single connection.
• No connection needed: Just send and receive, like mailing a letter.
• Minimal overhead: Lightweight and fast.
• UDP transmits segments consisting of an 8-byte header followed by the pay load.
• The two ports serve to identify the end points within the source and destination machines.
Header contains:
1. Source Port (used for replies)
2. Destination Port (used to route to the correct app)
3. Length (header + data)
4. Checksum (optional, for error checking)
• It checksums the header, the data, and a conceptual IP pseudoheader.
• When performing this computation, the Checksum field is set to zero and the data field is padded out with
an additional zero byte if its length is an odd number.
• The checksum algorithm is simply to add up all the 16-bit words in one’s complement and to take the
one’s complement of the sum.
• When the receiver performs the calculation on the entire segment, including the Checksum field,
the result should be 0.
The checksum checks for errors in:
• UDP header
• UDP data
• A special "pseudoheader" (contains source/destination IPs, protocol, and length)
• It contains the 32-bit IPv4 addresses of the source and destination machines, the protocol
number for UDP (17), and the byte
count for the UDP segment (including the header).
• No flow control
• No congestion control
• No retransmission of lost packets
• These responsibilities are left to the application.
10. With general format explain the various fields of UDP and explain how checksum is generated

• UDP (User Datagram Protocol) is a connectionless transport layer protocol.


• UDP provides a way for applications to send encapsulated IP datagrams without having to establish a
connection.
• Ports: Like mailboxes; used to deliver data to the correct application.
• De-multiplexing: UDP uses port numbers to deliver incoming packets to the right process.
• TCP allows this: both SYNs are acknowledged and merged into a single connection.
• No connection needed: Just send and receive, like mailing a letter.
• Minimal overhead: Lightweight and fast

• UDP transmits segments consisting of an 8-byte header followed by the pay load.
• The two ports serve to identify the end points within the source and destination machines.
Header contains:
5. Source Port (used for replies)
6. Destination Port (used to route to the correct app)
7. Length (header + data)
8. Checksum (optional, for error checking)
• It checksums the header, the data, and a conceptual IP pseudoheader.
• When performing this computation, the Checksum field is set to zero and the data field is padded out with
an additional zero byte if its length is an odd number.
• The checksum algorithm is simply to add up all the 16-bit words in one’s complement and to take the
one’s complement of the sum.
• When the receiver performs the calculation on the entire segment, including the Checksum field,
the result should be 0.
• The checksum checks for errors in:
• UDP header
• UDP data
• A special "pseudoheader" (contains source/destination IPs, protocol, and length)

• It contains the 32-bit IPv4 addresses of the source and destination machines, the protocol number for
UDP (17), and the byte count for the UDP segment (including the header).
• No flow control
• No congestion control
• No retransmission of lost packets These
responsibilities are left to the application
MODULE 5

1. Explain client/server and peer to peer architecture with neat diagrams

Solution:

Client-Server Architecture

• In this architecture, there is a server and many clients distributed over the network (Figure 1.1a).

• The server is always-on while a client can be randomly run.

• The server is listening on the network and a client initializes the communication.

• Upon the requests from a client, the server provides certain services to the client.

• Usually, there is no communication between two clients.

• The server has a fixed IP address.

• A client contacts the server by sending a packet to the server's IP address.

• A server is able to communicate with many clients.

• The applications such as FTP, telnet, Web, e-mail etc use the client-server architecture.

P2P Architecture

• There is no dedicated server (Figure 1.1b).

• Pairs of hosts are called peers.


• The peers communicate directly with each other.
• The peers are not owned by the service-provider. Rather, the peers are laptops controlled by users.
• Many of today's most popular and traffic-intensive applications are based on P2P architecture.
• Examples include file sharing (BitTorrent), Internet telephone (Skype) etc.
• Main feature of P2P architectures: self-scalability.
• Three challenges of the P2P applications:
1) ISP Friendly
2) Security
3) Incentive
2. Explain HTTP request message format in detail

HTTP Message Format

• Two types of HTTP messages: 1) Request-message and 2) Response-message.

HTTP Request Message

1. Request-line
2. 2. Header-line and
3. 3. Carriage return.

• The first line of message is called the request-line. The subsequent lines are called the header lines.
• The request-line contains 3 fields. The meaning of the fields is as follows:

1) Method ➢“GET”: This method is used when the browser requests an object from the server.

2) URL ➢“/somedir/[Link]”: This is the object requested by the browser.

3) Version ➢“HTTP/1.1”: This is version used by the browser.

• The request-message contains 4 header-lines.

The meaning of the header-lines is as follows:

1) “Host: [Link]” specifies the host on which the object resides.

2) “Connection: close” means requesting a non-persistent connection.

3) “User-agent:Mozilla/5.0” means the browser used is the Firefox.

4) “Accept-language:eng” means English is the preferred language.

• The method field can take following values: GET, POST, HEAD, PUT and DELETE.
1. Status line

2. Header-lines

3. Data (Entity body).

• The status line contains 3 fields:

1) Protocol version 2) Status-code and 3) Status message.

• Some common status-codes and associated messages include:

1) 200 OK: Standard response for successful HTTP requests.

2) 400 Bad Request: The server cannot process the request due to a client error.

3) 404 Not Found: The requested resource cannot be found.

• The meaning of the Status line is as follows: “HTTP/1.1 200 OK”: This line indicates the server is using
HTTP/1.1 & that everything is OK.

• The response-message contains 6 header-lines.

The meaning of the header-lines is as follows:

1. Connection: This line indicates browser requesting a non-persistent connection.


2. Date: This line indicates the time & date when the response was sent by the server.

3. Server: This line indicates that the message was generated by an Apache Web-server.

4. Last-Modified: This line indicates the time & date when the object was last modified.

5. Content-Length: This line indicates the number of bytes in the sent-object.

6. Content-Type: This line indicates that the object in the entity body is HTML text.
3. Explain the use of cookie in web application
4. With a neat diagram explain how SMTP can be used for transmitting mails from sender to

Receiver
5. Explain persistent and non-persistent http in detail
6. Explain web caching with a diagram
7. List and Explain the transport services available to Applications
8. Write a short note on FTP protocol
9. Discuss FTP commands and Replies
10. Write a note on Mail Access protocols

You might also like