Computer Networks Exam Notes: Units I–III with Solved Numericals

Computer Networks — Exam Preparation Notes

B.Tech CSE | Minor-I | Units I, II & III

These notes are organized according to your syllabus, the two uploaded question papers, and your teacher’s exam guidelines: approximately 60% numerical/problem-solving and 40% theory.

Your preparation priority

60%

Numericals and problem-solving

Unit III routing, shortest paths and IP addressing; Unit II CRC, Hamming code, flow control and ARQ; Unit I delay calculations.

40%

Theory and diagrams

Unit I devices, transmission media and OSI/TCP-IP; Unit II topologies, switching, multiplexing and MAC; Unit III congestion control and network services.

Unit I — Introduction to Computer Networks

1. Computer Network

A computer network is a collection of interconnected computers and devices that communicate and share data, resources and services.

Advantages: Resource sharing, communication, data sharing, centralized management and cost savings.

2. Types of Networks

Advanced Network Switches for High-Speed Performance | High Speed Network Switch

Add to Favorites

LAN — Local Area Network

Covers a small area such as a room, office, building or campus. Usually high-speed and privately managed.

Example: College computer lab.

Types of computer network | PPTX

Add to Favorites

MAN — Metropolitan Area Network

Covers a city or metropolitan area and connects multiple LANs.

Example: A city-wide institutional network.

Cisco CCNA Wide Area Networks (WANs) Part I

Add to Favorites

WAN — Wide Area Network

Covers large geographical areas, such as countries or continents.

Example: The Internet.

FeatureLANMANWAN
CoverageSmallCityCountry/world
OwnershipUsually privateMultiple/private/publicMultiple organizations
Typical exampleOffice networkCity networkInternet

3. Data Transmission Modes

A. Serial and Parallel Transmission

  • Serial: Bits are sent one after another over a communication channel. Used in USB and many network links.

  • Parallel: Multiple bits are transmitted simultaneously over multiple lines. Used in some internal computer buses and older printer interfaces.

SerialParallel
Fewer wiresMultiple wires
Suitable for longer linksTiming and skew can limit distance
Bits sent sequentiallyMultiple bits sent together

B. Simplex, Half Duplex and Full Duplex

Simplex — One-way only

Sender

Receiver

Example: Traditional broadcast TV.

Half duplex — Both directions, one at a time

Device A

Device B

Example: Walkie-talkie.

Full duplex — Both directions simultaneously

Device A

Device B

Example: Telephone conversation.

C. Synchronous and Asynchronous Transmission

  • Synchronous: Sender and receiver use synchronized timing; data is transmitted in a continuous stream or organized blocks. Usually less per-character overhead.

  • Asynchronous: Data is often sent one character or small unit at a time, with start and stop bits. Timing is resynchronized for each unit.

Exam difference: Synchronous transmission relies on coordinated timing; asynchronous transmission uses start/stop framing for individual units.

4. Transmission Media

Transmission media are channels through which data travels.

Guided Media — Physical Cables

Indoor Cat5e Cable UTP Shielded Twisted Pair Ethernet LAN Network SFTP FTP UTP Shielded Cable with Copper Wire Conductor - Network Cable and LAN Cable

Add to Favorites

Twisted Pair Cable

Two insulated copper wires twisted together.

  • Cheap and easy to install.

  • Used in Ethernet LANs and telephone lines.

  • UTP is less shielded; STP includes additional shielding.

Coaxial Cable Guide | Amphenol RF

Add to Favorites

Coaxial Cable

Central conductor, insulating layer and metallic shielding.

  • Better shielding than ordinary twisted pair.

  • Used in cable TV and broadband systems.

Thorlabs

Add to Favorites

Optical Fiber

Transmits information using light.

  • Very high bandwidth and low attenuation.

  • Immune to electromagnetic interference.

  • Used in backbone and long-distance networks.

Unguided Media — Wireless

  • Radio waves: Used in broadcasting, Wi-Fi and mobile communications; may travel in different directions and can penetrate some obstacles.

  • Microwaves: Often directional and require line of sight for terrestrial links; used in satellite and point-to-point communication.

  • Infrared: Used for short-range communication and some remote controls.

Electromagnetic spectrum: Radio waves, microwaves, infrared, visible light, ultraviolet, X-rays and gamma rays. Optical fiber commonly uses infrared wavelengths.

5. Networking Devices

DeviceMain functionOSI layer (typical)
RepeaterRegenerates or retimes signalsPhysical (L1)
HubRepeats incoming bits to all other portsPhysical (L1)
BridgeConnects LAN segments using MAC addressesData Link (L2)
SwitchForwards frames using MAC addressesData Link (L2), typically
RouterForwards IP packets between networksNetwork (L3)
GatewayConnects different systems; may translate protocolsDepends on function
ModemModulates/demodulates signals for a communication linkDepends on implementation
Proxy serverActs as an intermediary for client requestsApplication (L7), commonly
Wireless routerRoutes traffic and often provides Wi-Fi and NATMultiple functions/layers
Wireless Access Point (WAP)Connects wireless clients to a LANUsually L2 bridging

Remember: A hub broadcasts bits to all ports, a switch forwards frames based on MAC addresses, and a router forwards packets based on IP addresses.

6. Network Performance Criteria

  • Bandwidth: Capacity of a communication link, usually measured in bits per second (bps) in networking.

  • Throughput: Actual successful data transfer rate.

  • Latency: Total time taken for data to travel between endpoints.

  • Propagation time: Time for a signal to travel across the medium.

  • Transmission time: Time required to put all packet bits onto the link.

  • Queuing time: Time spent waiting in a buffer before transmission.

Important formulas:

$$T_p=rac{ ext{Distance}}{ ext{Propagation speed}}$$

$$T_t=rac{ ext{Packet size in bits}}{ ext{Data rate}}$$

$$D=T_{ ext{proc}}+T_{ ext{queue}}+T_t+T_p$$

where $D$ is total nodal delay.

Solved Numerical — Unit I

Question: Two systems are 8,000 km apart. Data rate is 500 Mbps, propagation speed is $4 imes10^6$ m/s and message size is 5 MB. Find total delay, ignoring queuing and processing.

Step 1: Propagation delay

$$T_p=rac{8000 imes1000}{4 imes10^6}=2 ext{ s}$$

Step 2: Convert message size to bits

$$5 ext{ MB}=5 imes10^6 imes8=40 imes10^6 ext{ bits}$$

Step 3: Transmission delay

$$T_t=rac{40 imes10^6}{500 imes10^6}=0.08 ext{ s}$$

Step 4: Total delay

$$D=2+0.08=oxed{2.08 ext{ seconds}}$$

7. OSI Reference Model

7

Application

Network services for applications

6

Presentation

Data format, encryption and compression

5

Session

Session establishment and management

4

Transport

End-to-end delivery, ports and reliability

3

Network

IP addressing and routing

2

Data Link

Frames, MAC addressing and link errors

1

Physical

Bits, signals, cables and connectors

Mnemonic (Layer 7 to 1): All People Seem To Need Data Processing.

8. TCP/IP Reference Model

The commonly taught TCP/IP model has four layers:

  1. Application: HTTP, DNS, SMTP and application services.

  2. Transport: TCP and UDP; communication between processes.

  3. Internet: IP addressing and packet routing.

  4. Network Access/Link: Data-link and physical transmission.

OSITCP/IP
Application + Presentation + SessionApplication
TransportTransport
NetworkInternet
Data Link + PhysicalNetwork Access/Link

Frequently asked: Explain the OSI model, compare OSI and TCP/IP, and identify the functions of each layer.

Unit II — Physical Layer and Data Link Layer

1. Network Topologies

A topology describes how devices are arranged and connected in a network.

Network Topologies - Computer Network

Add to Favorites

Bus Topology

All devices share one backbone cable.

  • Advantages: Low cost, less cable.

  • Disadvantages: Backbone failure can stop communication; fault finding can be difficult.

The Networking Journey — Ring Topology | by Shlomi Boutnaru, Ph.D. | Medium

Add to Favorites

Ring Topology

Each device connects to two neighbors, forming a ring.

  • Advantages: Orderly access in token-based systems.

  • Disadvantages: A link failure can disrupt the ring unless protection exists.

What Is a VLAN and How Does It Work? (Simple Explanation)

Add to Favorites

Star Topology

All devices connect to a central hub or switch.

  • Advantages: Easy installation and troubleshooting.

  • Disadvantages: Central-device failure affects the network.

Mesh topology advantages, disadvantages, and features - Know Computing

Add to Favorites

Mesh Topology

Devices have multiple direct connections.

  • Advantages: Reliable, multiple paths.

  • Disadvantages: Expensive and complex.

Topology formulas

For $n$ devices:

Star:

$$L=n-1$$

Full Mesh:

$$L=rac{n(n-1)}{2}$$

Solved question: Find the number of links for 6 devices.

Star: $L=6-1=5$

Mesh: $L=rac{6(6-1)}{2} =rac{30}{2}=15$

Remember: The mesh formula applies to a fully connected mesh.

2. Switching Techniques

Switching transfers data from source to destination through a network.

A. Circuit Switching

A dedicated path is established before data transfer.

Phases:

  1. Connection establishment.

  2. Data transfer.

  3. Connection release.

Advantages: Predictable resources after setup and suitable for continuous communication.

Disadvantages: Setup delay and possible resource wastage.

Example: Traditional telephone networks.

B. Message Switching

The complete message is stored at each intermediate node and then forwarded.

Advantages:

  • No dedicated path is required.

  • Network links can be shared.

Disadvantages:

  • High storage requirements.

  • Potentially large delays.

C. Packet Switching

The message is divided into smaller units called packets.

Advantages:

  • Efficient link sharing.

  • Suitable for computer networks and the Internet.

Disadvantages:

  • Variable delay.

  • Packets may be lost or arrive out of order.

FeatureCircuitMessagePacket
Dedicated pathYesNoNo dedicated end-to-end circuit
Unit transferredContinuous streamWhole messagePacket
Storage neededUsually low in switchesHighPacket buffers
Typical useTraditional telephoneStore-and-forward systemsInternet

Circuit-switching numerical

Question: Setup time is $s$, propagation delay per hop is $d$, message length is $x$ bits, data rate is $b$ bits/s, and path length is $k$ hops.

Assuming negligible processing delay and setup propagation included in $s$:

$T_{ ext{setup}}=s$

$T_{ ext{prop}}=kd$

$T_{ ext{trans}}=rac{x}{b}$

Therefore:

$$T_{ ext{total}}=s+kd+rac{x}{b}$$

3. Multiplexing

Multiplexing combines multiple data streams onto a shared communication medium. A multiplexer (MUX) combines signals; a demultiplexer (DEMUX) separates them.

PPT - Efficient Multiplexing Systems: FDM & TDM Overview PowerPoint Presentation - ID:9194691

Add to Favorites

FDM — Frequency Division Multiplexing

The channel is divided into different frequency bands.

Example: Radio broadcasting and cable TV.

Remember: Different frequencies.

Multiplexing Techniques: The Invisible Highway System of Your Data

Add to Favorites

WDM — Wavelength Division Multiplexing

Multiple light wavelengths travel through one optical fiber.

Example: High-capacity optical communication.

Remember: Different light wavelengths.

PPT - Multiplexing and Spreading (Bandwidth Utilization) PowerPoint Presentation - ID:2072964

Add to Favorites

TDM — Time Division Multiplexing

Each signal gets a different time slot.

Example: Digital telecommunication.

Remember: Different time slots.

FDMWDMTDM
Frequency bandsLight wavelengthsTime slots
Radio/TVOptical fiberDigital links
Simultaneous transmission on separate bandsSimultaneous optical channelsTurns assigned by time

4. Data Link Layer: Introduction and Functions

The Data Link Layer is Layer 2 of the OSI model. It provides communication between directly connected nodes over a link.

Main functions:

  1. Framing: Divides a bit stream into frames.

  2. Physical addressing: Uses MAC addresses.

  3. Error control: Detects errors and may retransmit damaged frames.

  4. Flow control: Regulates transmission speed.

  5. Access control: Controls use of a shared channel.

Design issues

  • Defining services to the Network Layer.

  • Identifying frame boundaries.

  • Detecting and handling errors.

  • Managing the sender’s transmission rate.

  • Sharing the channel fairly.

Services offered to the Network Layer

  1. Unacknowledged connectionless service: Frames are sent without ACKs.

  2. Acknowledged connectionless service: Frames are individually acknowledged.

  3. Acknowledged connection-oriented service: A logical connection is established, and reliable ordered delivery is provided.

These are general textbook service types; actual protocols may implement only some of them.

5. Framing

Framing divides a continuous stream of bits into separate data units called frames.

Bit stream → [Frame 1] [Frame 2] [Frame 3]

Framing methods

  • Byte count: A field specifies frame length.

  • Byte stuffing: Special bytes mark frame boundaries; escape bytes distinguish data from control bytes.

  • Bit stuffing: A zero is inserted after a specified run of consecutive ones so data does not imitate a delimiter.

  • Coding violations: Reserved signal patterns identify frame boundaries where the physical encoding allows them.

Exam question: Explain framing and its different methods with examples.

6. Error Control and Flow Control

Error Control

Error control detects and handles corrupted, lost or duplicated frames.

Techniques include:

  • Parity bits.

  • CRC.

  • Hamming codes.

  • Acknowledgements, timers and retransmissions.

Flow Control

Flow control prevents a fast sender from overwhelming a slower receiver.

Two important methods are:

  • Stop-and-Wait.

  • Sliding Window.

Example: If a sender can transmit 100 frames per second but a receiver can process only 50, flow control helps regulate the sender.

7. ARQ Strategies

ARQ means Automatic Repeat reQuest. It uses error detection and retransmission to improve reliable delivery.

A. Stop-and-Wait ARQ

The sender sends one frame and waits for an acknowledgement before sending the next.

Sender                   Receiver   | ---- Frame 0 --------> |   | <------ ACK 0 -------- |   | ---- Frame 1 --------> |   | <------ ACK 1 -------- |

Advantages: Simple.

Disadvantages: Low utilization on long-delay links.

B. Go-Back-N ARQ

The sender can send multiple frames before receiving acknowledgements. If a frame is lost or damaged, the sender retransmits that frame and the subsequent outstanding frames within the affected sequence.

Advantages: Better utilization than Stop-and-Wait.

Disadvantages: Some correctly received frames may need retransmission.

C. Selective Repeat ARQ

Only lost or damaged frames are retransmitted. Correct frames may be buffered while the missing frames are awaited.

Advantages: More efficient retransmissions.

Disadvantages: More complex and requires extra buffering.

Stop-and-WaitGo-Back-NSelective Repeat
One outstanding frameMultipleMultiple
SimpleModerate complexityHigher complexity
Lower utilizationMay repeat correct framesRepeats only affected frames

Stop-and-Wait throughput numerical

Let:

  • $L$ = packet length in bits

  • $R$ = link data rate in bits/s

  • $T_t=L/R$ = packet transmission time

  • $RTT$ = round-trip propagation time

  • ACK transmission time is negligible

Then:

$$U=rac{T_t}{T_t+RTT}$$

Throughput:

$$S=R imes U=rac{L}{T_t+RTT}$$

Example: Packet size = 1000 bytes, data rate = 1 Mbps and $RTT=20$ ms.

Convert packet size: $L=1000 imes8=8000$ bits

Transmission time: $T_t=rac{8000}{10^6}=0.008$ s

Utilization: $U=rac{0.008}{0.008+0.020}$

$U=rac{0.008}{0.028}=0.2857$

$$U”, approximately 28.57\%$$

Throughput: $S=10^6 imes0.2857$

$$S”, approximately 285.7\text{ kbps}$$

8. Error Detection and Correction

Parity Bit

An extra bit is added to make the total number of 1s either even or odd.

Even parity example:

Data: 1011

There are three 1s, so add parity bit 1.

Codeword: 10111

Total number of 1s = 4, which is even.

Odd parity example:

Data: 1011

Add parity bit 0.

Codeword: 10110

Total number of 1s = 3, which is odd.

Limitation: A single parity bit detects any odd number of bit flips but may miss an even number of bit flips.

CRC — Cyclic Redundancy Check

CRC uses modulo-2 binary division to detect errors.

Steps:

  1. Write the data.

  2. Write the generator polynomial in binary.

  3. Append zeros equal to the degree of the generator.

  4. Divide using XOR.

  5. Append the remainder to the original data.

  6. At the receiver, divide the received codeword by the same generator.

For example:

$G(x)=x^3+x+1$

Binary generator: 1011

Since its degree is 3, append three zeros before division.

XOR rules:

OperationResult
$0\oplus0$0
$0\oplus1$1
$1\oplus0$1
$1\oplus1$0

There is no carry or borrow.

A zero remainder means no error was detected; a nonzero remainder indicates a detectable error.

Hamming Code

Hamming code uses parity bits to identify and correct bit errors.

Parity positions are powers of two: $1,\ 2,\ 4,\ 8,\ 16,\ldots$

Formula:

$$2^r\geq m+r+1$$

where:

  • $r$ = parity bits.

  • $m$ = data bits.

Solved example: Find the parity bits needed for 4 data bits.

Try $r=2$: $2^2=4<4+2+1=7$

Not sufficient.

Try $r=3$: $2^3=8\geq4+3+1=8$

Therefore: $r=3$

Total bits: $m+r=4+3=7$

Standard Hamming (7,4) corrects a single-bit error.

9. MAC Sublayer and Channel Allocation

The MAC (Media Access Control) sublayer controls how devices share a common communication channel.

The channel allocation problem asks:

Which device is allowed to transmit, and when?

Approaches include:

  • Static allocation, such as fixed frequency bands or time slots.

  • Dynamic allocation, where stations compete for or request access.

Pure ALOHA

A station transmits whenever it has data. If frames collide, it waits a random period and retransmits.

Maximum theoretical efficiency:

$$S_{\max}=\frac{1}{2e}”, approximately 18.4\%$$

Slotted ALOHA

Time is divided into slots. Transmission can begin only at slot boundaries.

Maximum theoretical efficiency:

$$S_{\max}=\frac{1}{e}”, approximately 36.8\%$$

Pure ALOHASlotted ALOHA
Transmit at any timeTransmit at slot boundaries
No slot synchronizationRequires synchronization
Vulnerable period $2T$Vulnerable period $T$
Efficiency 18.4%Efficiency 36.8%

Here $T$ is the time required to transmit one frame.

CSMA

Carrier Sense Multiple Access means a station listens before transmitting.

  • If the channel is free, it transmits according to the protocol.

  • If busy, it waits.

CSMA/CD

Carrier Sense Multiple Access with Collision Detection:

  1. Listen to the channel.

  2. Transmit if free.

  3. Detect a collision.

  4. Stop transmission.

  5. Wait for a random backoff period.

  6. Retransmit.

Used in traditional shared half-duplex Ethernet.

CSMA/CA

Carrier Sense Multiple Access with Collision Avoidance:

  1. Listen to the channel.

  2. Wait if it is busy.

  3. Use waiting intervals and random backoff where applicable.

  4. Transmit when permitted.

  5. Use acknowledgements to confirm successful reception.

Commonly used in Wi-Fi.

CSMA/CDCSMA/CA
Collision detectionCollision avoidance
Traditional shared EthernetWireless LANs
Stops after detecting collisionAttempts to reduce collision probability

10. IEEE 802.3 Ethernet Frame Format

Preamble

7 bytes

SFD

1 byte

Destination

6 bytes

Source

6 bytes

Length

2 bytes

Data + Padding

46–1500 bytes

FCS

4 bytes

Traditional Ethernet format. Preamble and SFD are transmitted before the MAC frame.

  • Preamble: Synchronization.

  • SFD: Marks the start of the frame.

  • Destination address: Destination MAC address.

  • Source address: Sender’s MAC address.

  • Length: Payload length in IEEE 802.3 format.

  • Data and padding: Payload; padding may be needed to meet minimum size.

  • FCS: CRC-based error detection.

Traditional Ethernet MAC frames range from 64 to 1518 bytes, excluding preamble and SFD, without VLAN tagging.

Unit III — Network Layer and Transport Layer

Highest priority for numericals: Your exam guidelines specifically mention IP addressing, Distance Vector Routing, Link State Routing and Dijkstra’s shortest-path algorithm. Learn these first.

1. Network Layer: Introduction and Functions

The Network Layer is Layer 3 of the OSI model. It transfers packets from the source network to the destination network.

Main functions:

  1. Logical addressing: Uses IP addresses.

  2. Routing: Determines a suitable path to the destination.

  3. Forwarding: Sends a packet to the appropriate next hop.

  4. Internetworking: Connects different networks.

  5. Congestion handling: Helps manage excessive traffic.

  6. Fragmentation: IPv4 may fragment packets when necessary, depending on network conditions and settings.

Network Layer design issues

  • Logical addressing.

  • Route selection.

  • Packet forwarding.

  • Handling congestion.

  • Connecting heterogeneous networks.

2. IP Addressing — Important Numerical Topic

An IPv4 address contains 32 bits, divided into four octets.

Example: 192.168.1.10

Each octet has 8 bits and ranges from 0 to 255.

A. Classful IPv4 addressing

ClassFirst octet rangeDefault maskTraditional use
A1–126255.0.0.0 (/8)Large networks
B128–191255.255.0.0 (/16)Medium networks
C192–223255.255.255.0 (/24)Smaller networks
D224–239—Multicast
E240–255—Reserved/experimental

The ranges above omit special-use addresses such as 0 and 127.

Modern networks generally use CIDR (Classless Inter-Domain Routing) instead of relying on classful allocation.

B. Subnet Mask and CIDR

A subnet mask separates network bits from host bits.

Example: 192.168.1.10/24

Here, /24 means 24 network bits and 8 host bits.

Number of addresses:

$$2^{32-24}=2^8=256$$

For a typical IPv4 subnet, two addresses are reserved for network identification and broadcast.

Usable host addresses: $2^8-2=oxed{254}$

C. Solved IP Addressing Questions

Question 1: How many usable host addresses are available in a /26 subnet?

Step 1: Find host bits. $32-26=6$

Step 2: Calculate total addresses. $2^6=64$

Step 3: Subtract network and broadcast addresses. $64-2=oxed{62 ext{ usable hosts}}$

Question 2: Find the network address of 192.168.1.70/26.

Step 1: A /26 subnet has a block size of: $256-192=64$

The last octet subnet ranges are:

  • 0–63

  • 64–127

  • 128–191

  • 192–255

Step 2: The last octet, 70, falls in the range 64–127.

Therefore:

  • Network address: 192.168.1.64

  • Broadcast address: 192.168.1.127

  • First usable address: 192.168.1.65

  • Last usable address: 192.168.1.126

Usable hosts = $oxed{62}$

3. Distance Vector Routing

Distance Vector Routing is a routing method in which each router maintains a table containing the best-known distance and next hop to each destination.

Routers exchange their distance vectors with neighboring routers.

Working

  1. Each router initially knows its directly connected neighbors.

  2. Routers exchange routing tables with neighbors.

  3. Each router calculates possible routes through its neighbors.

  4. It selects the lowest-cost route.

  5. Updates continue until the network converges.

Formula

$$D_x(y)=\min_v\{c(x,v)+D_v(y)\}$$

Where:

  • $D_x(y)$: Minimum distance from router $x$ to destination $y$.

  • $c(x,v)$: Link cost from $x$ to neighbor $v$.

  • $D_v(y)$: Neighbor $v$’s advertised distance to $y$.

Solved Numerical

Consider the network:

Link costs:

  • A–B = 1

  • A–C = 4

  • B–D = 2

  • C–D = 1

Find the shortest distance from A to D.

Step 1: Directly connected routes

From A:

  • To B = 1

  • To C = 4

  • To A = 0

Step 2: Calculate route through B: $A\rightarrow B\rightarrow D$ gives $1+2=3$

Step 3: Calculate route through C: $A\rightarrow C\rightarrow D$ gives $4+1=5$

Step 4: Choose the smaller cost: $\min(3,5)=\boxed{3}$

The shortest path is: $\boxed{A\rightarrow B\rightarrow D}$

Next hop from A to D = B.

Count-to-Infinity Problem

When a link fails, routers may incorrectly believe that a destination is reachable through each other. Their advertised distances increase repeatedly.

Solutions: Split horizon, route poisoning, poison reverse and triggered updates.

4. Link State Routing

Link State Routing allows routers to build a map of the network topology and calculate shortest paths.

Working

  1. Discover neighboring routers.

  2. Measure the cost of links.

  3. Create link-state packets.

  4. Flood these packets throughout the network.

  5. Build a topology database.

  6. Run Dijkstra’s algorithm to determine shortest paths.

Advantages: Fast convergence with accurate topology information and efficient shortest-path calculations.

Disadvantages: More memory and processing requirements than basic Distance Vector Routing.

5. Dijkstra’s Shortest Path Algorithm

Dijkstra’s algorithm finds the shortest paths from one source node to all other nodes in a graph with non-negative edge costs.

Steps

  1. Set source distance to 0 and other distances to infinity.

  2. Select the unvisited node with the smallest tentative distance.

  3. Relax its outgoing edges.

  4. Mark the selected node visited.

  5. Repeat until all reachable nodes are finalized.

Solved Numerical

Consider the network:

Find the shortest paths from A.

Step 1: Initialize distances

NodeDistance from A
A0
B4
C2
D$\infty$
E$\infty$
F$\infty$

Select C because its distance 2 is the smallest unvisited distance.

Step 2: Visit C

C connects to E with cost 1.

$A\rightarrow C\rightarrow E=2+1=3$

Update E to 3.

Step 3: Visit E

E connects to F with cost 4.

$A\rightarrow C\rightarrow E\rightarrow F =2+1+4=7$

Update F to 7.

Step 4: Visit B

B connects to D with cost 5.

$A\rightarrow B\rightarrow D=4+5=9$

Update D to 9.

Step 5: Visit F

F connects to D with cost 3.

$A\rightarrow C\rightarrow E\rightarrow F\rightarrow D =2+1+4+3=10$

The existing distance to D is 9, so keep 9.

Final shortest-path table

DestinationShortest distancePath
A0A
B4A–B
C2A–C
D9A–B–D
E3A–C–E
F7A–C–E–F

Exam tip: Always write the distance table at each stage and clearly mark the selected node. This helps earn stepwise marks.

6. Floyd–Warshall Algorithm

Floyd–Warshall finds the shortest paths between every pair of vertices.

It repeatedly considers whether going through an intermediate vertex $k$ improves the distance from $i$ to $j$.

Formula

$$D_{ij}=\min(D_{ij},\ D_{ik}+D_{kj})$$

Simple example

Suppose:

  • A–B = 3

  • B–C = 2

  • A–C = 10

Initially, the direct distance from A to C is 10.

Check the path through B: $A\rightarrow B\rightarrow C=3+2=5$

Compare: $\min(10,5)=\boxed{5}$

The improved shortest distance from A to C is 5.

Difference from Dijkstra: Dijkstra calculates shortest paths from one source; Floyd–Warshall calculates shortest paths between all pairs.

7. Hierarchical Routing

Hierarchical Routing divides a large network into regions, areas or groups.

Routers maintain detailed routes within their own region and summarized routes for other regions.

Advantages:

  • Smaller routing tables.

  • Reduced routing update overhead.

  • Better scalability.

Disadvantages:

  • Routes may not always be globally optimal.

  • Network design becomes more complex.

Example: Dividing a large organization’s network into regional areas.

8. Flooding

Flooding is a routing technique in which a router forwards an incoming packet on all outgoing links except the link on which it arrived.

Advantages

  • Simple.

  • Can deliver packets even when the best route is unknown.

  • Useful for broadcasting and distributing link-state information.

Disadvantages

  • Produces duplicate packets.

  • Wastes bandwidth.

  • Can cause congestion.

Duplicate traffic can be controlled using sequence numbers, hop limits or controlled flooding.

9. Congestion Control

Congestion occurs when too many packets compete for limited network resources, causing queue growth, delay and packet loss.

A. Open-Loop Congestion Control

Attempts to prevent congestion before it happens.

Methods include:

  • Retransmission policies.

  • Window policies.

  • Acknowledgement policies.

  • Admission policies.

  • Traffic shaping.

B. Closed-Loop Congestion Control

Detects congestion and reacts to it using feedback.

Methods include:

  • Feedback signals.

  • Explicit congestion notification.

  • Reducing sending rates.

  • Routing changes when appropriate.

Open LoopClosed Loop
PreventionDetection and reaction
Does not rely on congestion feedback to correct trafficUses feedback to respond to congestion
Example: Traffic shaping policyExample: Sender reduces rate after congestion feedback

10. Leaky Bucket Algorithm

The Leaky Bucket algorithm smooths outgoing traffic by transmitting data at a controlled rate.

Imagine a bucket with a small hole:

  • Packets enter the bucket.

  • Packets leave at a fixed rate.

  • If the bucket fills, extra packets may be discarded.

Example

Bucket capacity = 10 packets.

Incoming burst = 15 packets.

If the bucket is initially empty and all 15 packets arrive at once, only 10 can be held.

$15-10=\boxed{5\text{ packets dropped}}$

This example assumes no packets leave during the burst.

Advantages: Smooth traffic and limit burst output.

Disadvantage: Bursts above capacity may be discarded.

11. Token Bucket Algorithm

The Token Bucket algorithm allows controlled bursts.

  • Tokens are generated at a fixed rate.

  • Tokens accumulate up to a maximum capacity.

  • A packet must obtain sufficient tokens to be transmitted.

  • Saved tokens permit bursts when the network is idle.

Example

Token capacity = 10 tokens, with one token required per packet.

If 10 tokens have accumulated, up to 10 packets can be transmitted immediately, subject to other network limits.

Leaky Bucket vs Token Bucket

Leaky BucketToken Bucket
Smooths output at a controlled rateAllows bursts when tokens are available
Excess packets may be dropped if fullTokens accumulate up to capacity
Limits burst outputControls average rate while permitting bursts

12. Connection-Oriented and Connectionless Services

Connection-Oriented Service

A logical connection is established before data transfer.

Features:

  • Connection setup.

  • Ordered delivery may be provided.

  • Reliability may be provided.

  • Connection termination.

Example: TCP.

Connectionless Service

Data is sent without first establishing an end-to-end connection.

Features:

  • No connection setup.

  • Each packet is handled independently.

  • Packets may take different routes.

  • Delivery and ordering are not guaranteed by the service itself.

Example: IP; UDP is a connectionless transport protocol.

Connection-OrientedConnectionless
Setup before communicationNo setup required
May provide reliability and orderingNo inherent delivery or ordering guarantee
Example: TCPExample: UDP/IP

13. Port Addressing Basics

An IP address identifies a host or network interface. A port number identifies a communication endpoint or service on a host.

TCP and UDP port numbers are 16 bits long: $\boxed{0\text{ to }65535}$

Common port numbers

ServicePortProtocol
HTTP80TCP
HTTPS443TCP
DNS53UDP and TCP
FTP control21TCP
SSH22TCP
SMTP25TCP
DHCP server67UDP
DHCP client68UDP

A communication endpoint is commonly identified by protocol, IP address and port number. A TCP connection is identified by a combination of source/destination IP addresses and source/destination ports.

Most Important Exam Questions

These are priority questions based on your syllabus, teacher’s preparation guidelines and the uploaded papers.

Revision checklist

0/21 complete

Unit I

Explain the OSI model with a diagram.

Compare OSI and TCP/IP models.

Differentiate LAN, MAN and WAN.

Explain guided and unguided transmission media.

Differentiate hub, switch, bridge, router and gateway.

Solve propagation-time and transmission-time numericals.

Unit II

Explain Bus, Ring, Star and Mesh topologies with diagrams.

Compare circuit, message and packet switching.

Explain FDM, WDM and TDM.

Solve CRC and Hamming-code numericals.

Explain Stop-and-Wait, Go-Back-N and Selective Repeat ARQ.

Compare Pure ALOHA and Slotted ALOHA.

Explain CSMA/CD, CSMA/CA and Ethernet frame format.

Unit III

Solve IPv4 subnetting and network-address problems.

Solve Distance Vector Routing tables.

Solve Link State Routing using Dijkstra’s algorithm.

Solve all-pairs shortest paths using Floyd–Warshall.

Explain count-to-infinity and hierarchical routing.

Compare open-loop and closed-loop congestion control.

Explain Leaky Bucket and Token Bucket.

Differentiate connection-oriented and connectionless services.

Reset checklist

Final study plan

If your exam is close, prepare in this order:

  1. Unit III: IP addressing, Distance Vector, Link State and Dijkstra numericals.

  2. Unit II: CRC, Hamming code, Stop-and-Wait throughput, ARQ and topology formulas.

  3. Unit I: Delay numericals, OSI/TCP-IP models, devices and transmission media.

  4. Theory revision: Congestion control, switching, multiplexing, ALOHA and Ethernet frame format.

For numerical answers, always write Given → Formula → Substitution → Calculation → Final answer with units. This makes your solution easy to follow and helps you earn method marks even if a final calculation goes wrong.