Module 3 CN MQP Soln
Module 3 CN MQP Soln
MODULE 3:
MODEL QUESTION PAPER & SOLNS.
Syllabus:
Network Layer: Network layer Services, Packet Switching, IPv4 Address, IPv4
Datagram, IPv6
Datagram, Introduction to Routing Algorithms, Unicast Routing Protocols:
DVR, LSR, PVR,
Unicast Routing protocols: RIP, OSPF, BGP, Multicasting Routing-MOSPF
5a. Explain classful addressing system with a neat diagram.
Classful Addressing
➔ When the Internet started, an IPv4 address was designed with a fixed-length
prefix, but to accommodate both small and large networks, three fixed-
length prefixes were designed instead of one (n = 8, n = 16, and n = 24). The
whole address space was divided into five classes (class A, B, C, D, and E).
This scheme is referred to as classful addressing.
➔ In class A, the network length is 8 bits, but since the first bit, which is 0,
defines the class, we can have only seven bits as the network identifier. This
means there are only 27 = 128 networks in the world that can have a class A
address.
➔ In class B, the network length is 16 bits, but since the first two bits, which
are (10)2, define the class, we can have only 14 bits as the network identifier.
This means there are only 214 = 16,384 networks in the world that can have
a class B address.
➔ All addresses that start with (110)2 belong to class C. In class C, the network
length is 24 bits, but since three bits define the class, we can have only 21
bits as the network identifier. This means there are 221 = 2,097,152 networks
in the world that can have a class C address.
Class D is not divided into prefix and suffix. It is used for multicast addresses. All
addresses that start with 1111 in binary belong to class E. As in Class D, Class E is
not divided into prefix and suffix and is used as reserve.
Dijkstra’s Algorithm
The Dijkstra’s Algorithm is a greedy algorithm that is used to find the minimum
distance between a node and all other nodes in a given graph. Here we can
consider node as a router and graph as a network. It uses weight of edge .ie,
distance between the nodes to find a minimum distance route.
Algorithm:
1: Mark the source node current distance as 0 and all others as infinity.
2: Set the node with the smallest current distance among the non-visited nodes
as the current node.
3: For each neighbor, N, of the current node:
• Calculate the potential new distance by adding the current distance of the
current node with the weight of the edge connecting the current node to
N.
• If the potential new distance is smaller than the current distance of node
N, update N's current distance with the new distance.
4: Make the current node as visited node.
5: If we find any unvisited node, go to step 2 to find the next node which has the
smallest current distance and continue this process.
Example:
Consider the graph G:
Graph G
Now, we will start normalising graph one by one starting from node 0.
step 1
Nearest neighbour of 0 are 2 and 1 so we will normalize them first .
step 3
Similarly we will normalize other node considering it should not form a cycle
and will keep track in visited nodes.
step 5
o Isolates sensitive parts of a network, ensuring that access between subnets can
be controlled using routers or firewalls.
4. Simplifies Management:
o Makes it easier to manage smaller subnets than one large network.
o Helps in logically grouping devices, improving organization and
troubleshooting.
5. Facilitates Hierarchical Routing:
o Subnetting reduces the size of routing tables, as routers only need to know
how to route traffic to a subnet rather than every individual IP address.
Importance of Subnetting
1. Scalability:
o Allows a network to grow efficiently while maintaining its structure and
performance.
2. Broadcast Control:
o Broadcast traffic (e.g., ARP requests) is contained within subnets, improving
overall network efficiency.
3. Security Isolation:
o Devices in one subnet can be restricted from accessing another subnet unless
explicitly allowed.
4. Cost Savings:
o Makes better use of available IP address space, reducing waste and the need to
acquire additional IP blocks.
5. Support for Different Network Sizes:
o Allows networks of different sizes to coexist, tailored to specific needs (e.g.,
smaller subnets for isolated servers, larger subnets for general user devices).
Key Points:
• Goal: To identify the optimal path between nodes based on specific criteria like
shortest distance, least cost, or minimum delay.
• Dynamic or Static:
o Dynamic Routing: Uses algorithms to update routing tables automatically
based on network conditions (e.g., OSPF, RIP, BGP).
o Static Routing: Manually configured routes that do not change unless
explicitly updated.
• Algorithms: Implements routing algorithms to compute routes, such as:
o Distance Vector Routing: Shares the cost to reach destinations with neighbors
(e.g., RIP).
o Link State Routing: Builds a complete map of the network (e.g., OSPF).
• Routing Table: A data structure maintained by routers containing information about
routes to various network destinations.
Example:
A router using OSPF (Open Shortest Path First) calculates the shortest path to a destination
based on the link-state information it gathers from other routers.
2. Forwarding
Definition:
Forwarding is the process of transferring a data packet from an input interface of a router to
the appropriate output interface based on the routing table. It is a local, per-packet operation
performed at each hop in the network.
Key Points:
• Goal: To move packets toward their destination efficiently, using information in the
routing table.
• Decentralized: Forwarding decisions are made at each router based on the packet's
destination address and the router's forwarding table.
• Forwarding Table:
o Derived from the routing table.
o Contains mappings of destination addresses or subnets to the next hop or
output interface.
• Fast Process: Optimized for speed, often implemented in hardware (e.g., using
Ternary Content Addressable Memory (TCAM)).
Example:
NAMMA VTU_JUNCTION(1 & 2) EMAIL:[email protected]
COMPUTER NETWORK(BCS502)
When a router receives a packet destined for 192.168.1.0/24, it checks its forwarding table to
determine the next hop or interface and sends the packet accordingly.
Determines the best path for data Moves packets along the determined
Purpose
packets. path.
Data
Routing Table. Forwarding Table.
Structure
Metric:
OSPF calculates the cost of reaching a destination from a source by considering
link weights, which can vary based on the type of service. This is shown in Figure
below, where the total cost to the destination is calculated by summing the costs of
individual links.
Forwarding Tables:
OSPF routers use Dijkstra’s algorithm to create forwarding tables by building the
shortest-path tree to destinations. The difference between OSPF and RIP forwarding
tables is mainly in the cost values. If OSPF uses hop count as its metric, its
forwarding tables would be identical to those of RIP. Both protocols determine the
best route using shortest-path trees.
Areas:
OSPF is designed for both small and large autonomous systems (AS). In large ASs,
flooding link-state packets (LSPs) across the entire network can cause congestion,
so OSPF introduces areas to localize LSP flooding. The AS is divided into smaller
sections called areas, with one backbone area (Area 0) responsible for inter-area
communication.
Link-State Advertisement (LSA):
OSPF routers advertise their link states to neighbors for forming a global link-state
database (LSDB). Unlike the simple graph model, OSPF distinguishes between
different types of nodes and links, requiring various types of advertisements:
Router Link: Announces router existence and its connection to other entities.
Network Link: Advertises the existence of a network, but with no associated cost.
Summary Link to Network: Advertised by area border routers to summarize
links between areas.
Summary Link to AS: Announced by AS boundary routers to inform other areas of
external AS links.
External Link: Advertises external network routes to the AS.
OSPF Implementation:
OSPF operates at the network layer and uses IP for message propagation. OSPF
messages are encapsulated in IP datagrams with a protocol field value of 89. OSPF
has two versions, with version 2 being the most widely implemented.
OSPF Algorithm:
OSPF uses a modified link-state routing algorithm. After routers form their shortest-
path trees, they create corresponding routing tables. The algorithm also handles
OSPF message exchange.
Performance:
Update Messages: OSPF’s LSPs are complex and can create heavy traffic in large areas,
using considerable bandwidth.
Convergence of Forwarding Tables: OSPF converges relatively quickly once
flooding is complete, although Dijkstra's algorithm can take time to run.
Robustness: OSPF is more robust than RIP since routers operate independently
after constructing their LSDBs. A failure in one router has less impact on the overall
network.
The 64-byte option field in DHCP serves two purposes: carrying additional or
vendor-specific information. A special value, called a "magic cookie"
(99.130.83.99), helps the client recognize options in the message. The next 60 bytes
contain options, structured in three fields: a 1-byte tag, 1-byte length, and variable-
length value. The tag field (e.g., 53) can indicate one of the 8 DHCP message types
used by the protocol.
DHCP Operation
1. The host creates a DHCPDISCOVER message with only a random
transaction-ID, as it doesn’t know its own IP address or the server’s. The
message is sent using UDP (source port 68, destination port 67) and
broadcasted (source IP: 0.0.0.0, destination IP: 255.255.255.255).
2. The DHCP server responds with a DHCPOFFER message, containing the
offered IP address, server address, and lease time. This message is sent with
the same port numbers but reversed, using a broadcast address so other
servers can also offer better options.
3. The host selects the best offer and sends a DHCPREQUEST to the
server. The message includes the chosen IP address and is sent as a
broadcast (source: new client IP, destination: 255.255.255.255) to notify
other servers that their offers were declined.
4. The selected server responds with a DHCPACK if the IP address is valid,
completing the process. If the IP address is unavailable, a DHCPNACK is
sent, and the host must restart the process.
Two Well-Known Ports
DHCP uses well-known ports (68 for the client, 67 for the server) to avoid
conflicts with other services using ephemeral ports. Since DHCP responses are
broadcast, using a well-
known port (68) ensures the DHCP response is only delivered to the correct
client, preventing confusion with other clients (e.g., DAYTIME) that might be
using the same temporary port. If two DHCP clients are running simultaneously
(e.g., after a power failure), they are distinguished by their unique transaction
IDs.
Using FTP
The DHCPACK message includes a pathname to a file with additional
information (e.g., DNS server address). The client uses FTP to retrieve this
information.
Error Control
Since DHCP relies on unreliable UDP, it ensures error control by requiring UDP
checksums and using timers with a retransmission policy. To avoid traffic
congestion (e.g., after a power failure), clients use random timers for
retransmission.
NAMMA VTU_JUNCTION(1 & 2) EMAIL:[email protected]
COMPUTER NETWORK(BCS502)
Transition States
The operation of the DHCP were very simple. To provide dynamic address
allocation, the DHCP client acts as a state machine that performs transitions
from one state to another depending on the messages it receives or sends.
1. INIT state: The client starts here and sends a Discover message to find a DHCP
server.
2. SELECTING state: After receiving one or more Offer messages, the
client selects one offer.
3. REQUESTING state: The client sends a Request message to the
selected server and waits.
4. BOUND state: If the server responds with an ACK message, the client uses
the assigned IP address.
5. RENEWING state: When 50% of the lease time is expired, the client tries
to renew the lease by contacting the server. If successful, it stays in the
BOUND state.
6. REBINDING state: If the lease is 75% expired and no response is received,
the client tries to contact any DHCP server. If the server responds, it stays
BOUND; otherwise, it goes back to INIT to request a new IP.