KEMBAR78
Computer Networking Questions and Answers Lecture 3 | PDF | Internet Protocols | I Pv6
0% found this document useful (0 votes)
45 views59 pages

Computer Networking Questions and Answers Lecture 3

Questions and answer on computer networking

Uploaded by

Sanneh Seedy
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)
45 views59 pages

Computer Networking Questions and Answers Lecture 3

Questions and answer on computer networking

Uploaded by

Sanneh Seedy
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
You are on page 1/ 59

LECTURE 3

Network layer

 Sending side encapsulates segments into datagrams

 Receiving side, delivers segments to transport layer

 Network layer protocols in every host, router

 Routers examine header fields in all IP datagrams passing through them

[Diagram: Layers stacked - application, transport, network, data link, physical]

Datagram networks

 No call setup at network layer

 Routers: no state about end-to-end connections

 No network-level concept of "connection"

 Packets forwarded using destination host address

Two key network-layer functions

 Forwarding: move packets from router's input to appropriate router output

 Routing: determine route taken by packets from source to destination. Routing


algorithms

Analogy:

 Routing: process of planning trip from source to destination

 Forwarding: process of getting through single interchange

Interplay between routing and forwarding


 Routing algorithm determines end-to-end path through network

 Forwarding table determines local forwarding at this router

Network layer: Data plane, control plane

 Data plane: local, per-router function, forwarding datagram arriving on input


port to output port, implemented in hardware at nanosecond timescales

 Control plane: network-wide logic, determines routing path, implemented in


software at second timescales

Traditional routing algorithms: Per-router control plane

 Routers exchange routing messages

 Routing algorithms compute forwarding table entries (FIB)

 Router performs forwarding based on forwarding table entries

Remote controller determines and distributes values in forwarding tables (SDN -


Software-Defined Networking)

 Data plane components are identical in traditional and SDN

 Controller computes and distributes forwarding tables

Outline

 Overview of network layer

 What's inside a router

 IP: Internet Protocol

What does a Router Look like?

 Examples of core routers: Ericsson SSR 8020, Cisco CRS-1, Juniper T4000
 Home routers: D-Link DIR-615 Wireless, Belkin N600 Dual-Band

Who Makes Core Routers?

 Cisco: CRS (Carrier Router Series)

 Juniper: T-series

 Alcatel-Lucent (now Nokia): XRS

 Huawei: Netengine

 Others focus on aggregation/access network gear for edge deployments

Router Architecture Overview

 Two key router functions: run routing algorithms/protocols (RIP, OSPF, BGP),
forward datagrams from incoming to outgoing link

 Forwarding Information Base (FIB) computed and pushed to line cards

 Routing Information Base (RIB) consolidates routing info from multiple


protocols

 High-speed switching fabric connects input and output line cards

Routing Information Base (RIB)

 Contains entries per routing protocol, consolidated into global RIB or FIB

 Minimum contents: destination subnet, cost/metric, next-hop gateway

 Also contains quality of service info, access control lists

Forwarding Information Base (FIB)

 Contains optimized next hop forwarding info in hardware-friendly format

 Installed on line cards by control processor


 Fast path lookup for forwarding, slow path on FIB miss

Input Port Functions

 Physical layer: bit-level reception

 Data link layer: Ethernet etc.

 Lookup forwarding table in input port memory, "match plus action"

 Queuing if datagrams arrive faster than forwarding rate

Datagram forwarding table

 Uses range of destination addresses (aggregate entries), not individual


addresses

 Matches destination IP to output link interface

Longest prefix matching

 Forwarding uses longest matching prefix for destination address

Exercise

 Given forwarding table with address prefixes and link interfaces, find interface
for a given IP destination

Switching Fabrics

 Transfers packets from input buffer to output buffer

 Switching rate measured as multiple of line rate

 Types: memory, bus, dedicated fabric

Output Ports

 Contains buffer for packets awaiting transmission


 Scheduling discipline for queued packets

Output Port Queuing

 Buffering when arrival rate exceeds output line speed

 Can cause delay and packet loss due to buffer overflow

Input Port Queuing

 Queueing occurs if fabric slower than combined input ports

 Head-of-Line (HOL) blocking: front packet blocks others behind it

Outline

 Overview of network layer

 What's inside a router

 IP: Internet Protocol

Internet network layer functions:

 Path selection with routing protocols (RIP, OSPF, BGP)

 Forwarding table

 IP protocol: addressing conventions, datagram format, packet handling

 ICMP protocol: error reporting, router signaling

IP datagram format

 IP version, header length, type of service, total length, identification, flags,


fragment offset, TTL, protocol, header checksum, source and destination IP
addresses, options, data
 Overhead: typically 40 bytes (20 bytes TCP + 20 bytes IP) plus application
layer

IP fragmentation, reassembly

 Different links have different MTU

 Large datagram divided into fragments within the network

 Reassembled only at final destination

 Header fields identify, order fragments

Example fragmentation

 4000 byte datagram, MTU = 1500 bytes

 Result: 3 smaller datagrams with proper fragment flags and offsets

IP addressing: introduction

 32-bit identifier for host/router interface

 Hosts usually have 1 or 2 interfaces

 IP addresses associated with each interface

Subnets

 IP address: hierarchical (network + host interface)

 Subnet part: high order bits

 Host part: low order bits

 Devices in same subnet can reach each other without router

Subnets examples given with 223.1.1.0/24 etc.

Subnet masks (/n) define address space allocation


Number of subnets and hosts summarized

IP address names topological location and serves as host identifier

 One address per interface

 Hierarchical: network = location, host = identity

IP addressing and how ISPs get blocks

 ICANN allocates IP addresses, manages DNS, assigns domain names

How host gets IP address

 Manually or automatically (DHCP)

 DHCP protocol steps: discover, offer, request, ack

 Example DHCP messages with transaction IDs and addresses

Private addresses extend lifetime of address space

 Private address ranges: 10.0.0.0/8 etc.

 Private addresses not globally unique

 Need public address to communicate globally

NAT: Network Address Translation

 Local network uses single public IP for outside world

 NAT maps internal local addresses to public IP + port numbers

 Motivation: saves address space, allows address changes without affecting


outside, provides some security

NAT operation described stepwise for outgoing and incoming datagrams

NAT implementation
 Router replaces source IP and port on outgoing datagrams

 Maintains translation table for incoming datagrams to restore local addresses

NAT is controversial

 Violates end-to-end principle

 Port numbers meant for addressing processes, not hosts

 Routing supposed to be layer 3 only

 IPv6 is long-term solution for address shortage

ICMP: Internet Control Message Protocol

 Used by hosts and routers for network-level info

 Error reporting and echo request/reply (ping)

 Message types and codes explained

IPv6: motivation

 Need larger address space (128 bits)

 Header format facilitates faster forwarding and QoS

IPv6 datagram format

 Fixed-length 40-byte header

 No fragmentation in IPv6 header

 Fields: version, traffic class, flow label, payload length, next header, hop limit,
source and destination addresses

IPv6 addressing rules

 128 bits, expressed in colon-hex notation


 Rules to compress zeros for readability

IPv6 address categories

 Unicast: identifies single interface

 Multicast: identifies group of interfaces

 Anycast: assigned to multiple interfaces, delivered to nearest only

Other IPv6 changes

 Removed checksum for efficiency

 Options outside header indicated by next header

 ICMPv6: enhanced messages including Packet Too Big

No built-in communication or backward compatibility between IPv4 and IPv6

 Coexistence strategies: Dual stack, translation, tunneling

Tunneling

 IPv6 packets encapsulated inside IPv4 packets for transit over IPv4 routers

 Details of header encapsulation given

Example of tunneling and flows between routers illustrated

Example subnetting

 Using 200.35.1.0/24 network block

 Define prefix allowing 20 hosts per subnet → /27

 Max hosts per subnet: 30 (2^5 -2)

 Max number of subnets: 8 (2^3)


 List of /27 subnets: 200.35.1.0/27, 200.35.1.32/27, 200.35.1.64/27, ...,
200.35.1.224/27

QUESTIONS

1.What are the two key functions of the network layer?

o Forwarding: moving packets from router's input to appropriate router


output.

o Routing: determining the route taken by packets from source to destination.

2. Explain the difference between forwarding and routing in the network


layer.

o Forwarding is the per-router process of moving packets from input to


output ports based on a forwarding table.

o Routing is the process of computing the path packets take through the
network, done by routing algorithms.

3. What is the role of the data plane and control plane in a router?

o Data plane: local, per-router function implementing packet forwarding at


hardware speeds (nanoseconds).
o Control plane: network-wide logic managing routing decisions and
forwarding table computations, implemented in software at slower speeds
(seconds).

4. How do traditional routing algorithms compute forwarding tables?

o Routers exchange routing messages per routing protocols (e.g., RIP, OSPF,
BGP), compute Routing Information Base (RIB), consolidate it, and
compile it into an optimized Forwarding Information Base (FIB).

5. What is Software Defined Networking (SDN), and how does it change


routing?

o SDN centralizes control plane logic in a remote controller, which


computes forwarding tables and pushes them to routers, while data plane
forwarding remains similar.

Router Architecture and Operation

6. Describe the main components inside a core router.

o Routing processor (runs routing algorithms and management control


plane), line cards (input and output ports), high-speed switching fabric
connecting inputs and outputs, and forwarding information base (FIB).

7. What is the difference between the Routing Information Base (RIB) and
the Forwarding Information Base (FIB)?

o RIB: contains routing info learned from different routing protocols,


consolidated routing table.

o FIB: hardware-optimized version of RIB used for fast forwarding lookups


on line cards.
8. How does a router perform packet forwarding using the forwarding table?

o It matches the packet destination IP address using longest prefix matching


against FIB entries to select an output interface and forwards the packet
there.

9. What is longest prefix matching in IP forwarding? Give an example.

o Choosing the forwarding table entry with the longest matching prefix to
the destination IP address.

o Example: If prefixes are 11001000 00010111 00010* (interface 0) and


11001000 00010111 00011000* (interface 1), and the IP is 11001000
00010111 00011000 10101010, forwarding uses interface 1.

10.Explain the function of input ports in a router.

 Handle physical and data link layer tasks, perform forwarding table lookup,
encapsulate or decapsulate frames, and buffer packets if necessary.

Switching Fabric and Queuing

11.What are the different types of switching fabrics used in routers?

 Memory, bus, and dedicated switching fabric.

12.What causes Head-of-the-Line (HOL) blocking in router queues?

 When the packet at the front of an input queue blocks others behind it because
it cannot proceed, delaying packet forwarding.

13.Why is output port queuing necessary in routers, and what are its
consequences?

 Queuing occurs when packet arrival rate exceeds link transmission rate; it
introduces delay and can cause packet loss if buffers overflow.
Internet Protocol (IP)

14.What are the main fields in the IPv4 datagram header?

 Version, header length, type of service, total length, identification, flags,


fragment offset, TTL, protocol, header checksum, source IP, destination IP,
options, and data.

15.How does IP fragmentation and reassembly work? Why is it necessary?

 Large datagrams are broken into smaller fragments to fit the MTU of the
transmission link; fragments are reassembled only at the final destination using
identification, offset, and flags in header.

16.Explain the hierarchical structure of an IPv4 address.

 Consists of network part (high order bits) identifying subnet and host part (low
order bits) identifying specific interface.

17.What is a subnet, and how does subnetting work?

 A subnet is an isolated network segment with common subnet prefix;


subnetting involves dividing an IP address space into smaller logical networks
by borrowing bits from the host portion.

18.How does a router use subnet masks to forward packets?

 By applying subnet mask to destination address to identify the subnet and using
the forwarding table entries matching the subnet prefix.

IP Address Allocation and DHCP

19.How do hosts obtain their IP addresses in networks? Describe the DHCP


process.
 Manually or automatically via DHCP. DHCP process steps: Discover
(broadcast from client), Offer (server response), Request (client asks for offered
IP), Acknowledge (server assigns IP).

20.What is the function of ICANN regarding IP addressing?

 Allocates IP address blocks to ISPs and organizations, manages DNS, assigns


domain names, and resolves naming disputes.

21.Why are private IP addresses used, and what are their address ranges?

 To extend IPv4 address space longevity by allowing reuse in local networks;


private ranges are 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16.

NAT (Network Address Translation)

22.Explain how NAT works and its main purposes.

 NAT maps private local IP addresses to a single public IP address with port
numbers for communication to the internet, conserving global IP addresses and
providing some security.

23.What are some controversies or drawbacks associated with NAT?

 Violates end-to-end principle, repurposes port numbers meant for processes,


complicates protocols relying on IP addresses, and routing is supposed to be
layer 3 only.

ICMP (Internet Control Message Protocol)

24.What is the purpose of ICMP in IP networks?

 Used for error reporting and network diagnostics between hosts and routers.

25.Describe some common types of ICMP messages and their use.


 Echo request/reply (ping), destination unreachable (network/host/port
unreachable), TTL expired, source quench (congestion control), router
advertisement/discovery.

IPv6

26.What are the main motivations for the introduction of IPv6?

 Exhaustion of 32-bit IPv4 address space, improved header processing,


enhanced support for QoS, and simplified extension headers.

27.List and describe the key differences between IPv4 and IPv6 headers.

 IPv6 has fixed 40-byte header length, no fragmentation fields (handled by


extension headers), uses 128-bit addresses, no header checksum, flow labeling,
hop limit instead of TTL, next header field replaces protocol field.

28.Explain the three categories of IPv6 addresses.

 Unicast: identifies a single interface, packets sent to it are delivered there.

 Multicast: identifies multiple interfaces, packets sent to group.

 Anycast: assigned to multiple interfaces, delivered to nearest one.

29.How does IPv6 address compression work?

 Uses colon-hex notation with suppression of leading zeros in groups and one
double colon (::) to replace longest run of consecutive zero 16-bit blocks.

30.What are the main strategies to enable coexistence and transition between
IPv4 and IPv6?

 Dual stack (both IPv4 and IPv6 run simultaneously), translation (header and
address mapping), and tunneling (encapsulate IPv6 in IPv4 packets).

Subnetting Example
31.Given network block 200.35.1.0/24, how would you subnet it to support at
least 20 hosts per subnet?

 Use 5 bits for hosts (since 2^5=32 > 20), so subnet prefix is /27 (32-5=27).

32.How many subnets and hosts per subnet can be created with a /27 subnet
mask?

 8 subnets (2^(27-24) = 2^3 = 8), each with up to 30 hosts (2^5 - 2).

Additional Subnetting Theory Questions


61. Define the term "subnet mask" and explain its role in IP addressing.
A subnet mask is a 32-bit number that masks an IP address and divides the IP
address into network and host parts. The bits set to 1 identify the network/subnet
portion, and the bits set to 0 identify the host portion. It is used by routers and hosts
to determine which subnet an IP address belongs to and to route packets correctly.

62. How do you determine the number of usable hosts per subnet given a
subnet mask?
Count the number of bits set to 0 in the subnet mask (host bits). The number of
usable hosts is $ 2^{number of host bits} - 2 $ because the all-zeros host bits
represent the network address and the all-ones represent the broadcast address.

63. What is the difference between classful and classless addressing?


Classful addressing divides IP addresses into fixed classes (A, B, C, etc.) with
predefined subnet masks; subnet masks are determined by class. Classless
addressing (CIDR) allows arbitrary subnet masks, enabling more flexible and
efficient allocation by varying the prefix length.
64. Explain how borrowing bits from the host portion of an IP address affects
the number of subnets and hosts.
Borrowing bits from the host portion increases the number of subnets (by
$ 2^{number of bits borrowed} $) but reduces the number of hosts per subnet
(because fewer bits remain for host addressing).

65. Given an IP address and subnet mask, how do you calculate the network
address?
Perform a bitwise AND operation between the IP address and the subnet mask. The
result is the network address.

66. How do you calculate the broadcast address of a subnet?


Set all the host bits (bits not masked by the subnet mask) to 1 in the IP address. The
resulting address is the broadcast address for that subnet.

67. Why are the all-zeros and all-ones host bit patterns reserved in IPv4
subnets?

 All-zeros host bits designate the network (subnet) address.

 All-ones host bits designate the broadcast address for that subnet.
Neither can be assigned to a host.

68. How does Variable Length Subnet Masking (VLSM) improve address
allocation efficiency?
VLSM allows subnets to have different prefix lengths (mask lengths), enabling more
precise allocation of IP addresses based on subnet size requirements, which reduces
waste and improves utilization.

69. Explain the significance of CIDR notation (e.g., /24) in IP subnetting.


CIDR notation compactly represents the subnet mask by denoting the number of bits
set to 1 starting from the most significant bit. For example, /24 means the first 24
bits are the network prefix and remaining bits are for hosts.

70. How does the subnetting of a /16 address differ from subnetting a /24
address block?
A /16 has more host bits (16 bits) and thus can support more hosts per subnet than
/24, but subnetting a /16 allows creating many more subnets by borrowing bits,
whereas subnetting a /24 can only create fewer subnets with fewer hosts.

Additional Calculation-Based Questions

71. Given the IP address 192.168.10.130 with subnet mask 255.255.255.192,


determine:

 a) Network address
Subnet mask 255.255.255.192 is /26 (11111111.11111111.11111111.11000000)
IP in binary last octet: 130 → 10000010
Mask last octet: 192 → 11000000
Bitwise AND: 10000010 & 11000000 = 10000000 (128 decimal)
Thus, network address = 192.168.10.128

 b) Broadcast address
Host bits are last 6 bits (as mask is /26), so broadcast address ends with all host
bits 1:
Network base: 192.168.10.128
Host bits set to 1: 0b00111111 = 63
Broadcast = 192.168.10.128 + 63 = 192.168.10.191

 c) Number of valid hosts in the subnet


Hosts = 26 −2=62 (subtracting network and broadcast)
72. You have a network block 172.16.0.0/16. How many /20 subnets can be
created from this block? How many hosts per subnet?

 Number of bits borrowed = $ 20 - 16 = 4 $

 Number of subnets = $ 2^4 = 16 $

 Host bits = $ 32 - 20 = 12 $

 Hosts per subnet = $ 2^{12} - 2 = 4094 $

73. Calculate the subnet mask needed to support at least 1000 hosts per subnet.
What is the prefix length?

 Minimum host bits: $ 2^h - 2 \geq 1000 $

 $ 2^{10} = 1024 $, so $ h = 10 $ bits carry hosts

 Network prefix = 32 - 10 = 22

 Subnet mask: /22 → 255.255.252.0

74. Given the network 10.0.0.0/8, divide it into subnets that support 500 hosts
each. How many subnets can you create, and what is the subnet mask?

 Hosts needed bits $ h $: $ 2^h - 2 \geq 500 $ → $ h=9 $ bits (512 hosts)

 Network bits = 32 - 9 = 23

 Subnet mask: /23 → 255.255.254.0

 Number of subnets = $ 2^{23-8} = 2^{15} = 32768 $

75. What is the valid host range for the subnet 192.168.5.64/26?

 Network address: 192.168.5.64

 Broadcast address: 192.168.5.64 + 63 = 192.168.5.127

 Usable hosts: 192.168.5.65 to 192.168.5.126


76. For the subnet 200.100.50.0/27, list all the possible subnet ranges that can be
carved from it by further subnetting.

 /27 has 32 addresses/subnet (30 usable)

 Borrow 1 bit to get /28 subnets (16 addresses each, 14 usable)

 Possible subnets:

o 200.100.50.0/28 (0-15)

o 200.100.50.16/28 (16-31)

o 200.100.50.32/28 (32-47)

o 200.100.50.48/28 (48-63)

77. You need to create 10 subnets from the network 192.168.1.0/24. What
subnet mask will you use? How many hosts will each subnet support?

 Need at least 10 subnets → borrow bits $ b $ for subnets such that $ 2^b \geq
10 $

 $ 2^4 = 16 \geq 10 $, so borrow 4 bits

 Subnet mask: 24 + 4 = /28 → 255.255.255.240

 Host bits: 32 - 28 = 4 bits = 14 usable hosts per subnet

78. Given the IP address 192.168.100.14/28, find the:

 a) Network address
/28 → subnet mask 255.255.255.240
(11111111.11111111.11111111.11110000)
Last octet IP: 14 → 00001110
AND with mask last octet 240 → 00001110 & 11110000 = 00000000 (0
decimal)
Network: 192.168.100.0

 b) Broadcast address
Network base + 15 = 192.168.100.15

 c) Number of usable hosts


$ 2^4 - 2 = 14 $

79. An organization is assigned the block 150.100.0.0/16. They want to create


subnets that allow 500 hosts. What subnet mask should they use? How many
such subnets are possible?

 Hosts bits: 9 (since $ 2^9 - 2 = 510 \geq 500 $)

 Subnet mask: 32 - 9 = /23 → 255.255.254.0

 Subnets: $ 2^{23-16} = 2^7 = 128 $

80. Given a subnet mask 255.255.255.224, calculate the number of subnets and
valid hosts per subnet for a Class C network.

 Class C default mask: /24

 New mask: 255.255.255.224 → /27

 Bits borrowed: 27 - 24 = 3 bits for subnets

 Number of subnets: $ 2^3 = 8 $

 Host bits: 5 (32-27)

 Usable hosts: $ 2^5 - 2 = 30 $


New Calculation and Analytical Questions with Answers

81. Given the network 192.168.50.0/24, you want to divide it into subnets to
support different department sizes: 50 hosts, 30 hosts, and 10 hosts. Design an
addressing scheme with appropriate subnet masks for each subnet and show
the ranges.

Answer:

 Hosts needed & subnet mask:

o 50 hosts → Need 6 bits (2^6 = 64 > 50), subnet mask /26


(255.255.255.192)

o 30 hosts → Need 5 bits (2^5 = 32 > 30), subnet mask /27


(255.255.255.224)

o 10 hosts → Need 4 bits (2^4 = 16 > 10), subnet mask /28


(255.255.255.240)

Assign subnets starting from 192.168.50.0:

 Subnet #1 (50 hosts): 192.168.50.0/26, range 192.168.50.1 – 192.168.50.62,


broadcast 192.168.50.63

 Subnet #2 (30 hosts): 192.168.50.64/27, range 192.168.50.65 – 192.168.50.94,


broadcast 192.168.50.95

 Subnet #3 (10 hosts): 192.168.50.96/28, range 192.168.50.97 – 192.168.50.110,


broadcast 192.168.50.111

Remaining address space can be used for smaller subnets or future use.
82. Calculate the time-to-live (TTL) field decrement impact on packet delivery
in case a packet traverses 10 routers, if the initial TTL is 32. What happens if
the TTL reaches zero before reaching destination?

Answer:

 TTL is decremented by 1 at every router hop. For 10 routers, TTL after


traversal = 32 - 10 = 22.

 If TTL reaches zero before packet reaches destination, the packet is discarded
by the router and an ICMP "Time Exceeded" message is sent back to the sender
to indicate packet expiration.

83. You have a routing table that uses longest prefix matching:

Prefix Output Interface

192.168.0.0/16 1

192.168.0.0/18 2

192.168.64.0/18 3

0.0.0.0/0 0
(default)

Determine the output interface for a packet destined for IP 192.168.65.5.

Answer:

 Convert to subnet match:

o 192.168.65.5 falls under 192.168.64.0/18 (192.168.64.0 to


192.168.127.255) → interface 3
o It also matches 192.168.0.0/16 but /18 is longer prefix → prefer interface 3
Output Interface: 3

84. Explain the process a NAT router uses to modify packets for an outgoing
connection from a local host with private IP 10.0.1.15, communicating to a
public IP address.

Answer:

 NAT replaces the source private IP address with the router’s public IP address
and assigns a unique port number, recording this mapping in its translation
table.

 Outgoing packet has source IP = router public IP, source port = assigned port.

 Return packets arriving at the router’s public IP and port are translated back to
the local host’s private IP and port using the translation table.

85. A packet of 4500 bytes needs to be sent over a link with MTU of 1500 bytes.
Describe how fragmentation is performed and how many fragments are
created.

Answer:

 MTU = 1500 bytes includes IP header (usually 20 bytes), so payload per


fragment = 1500 - 20 = 1480 bytes.

 Number of fragments = ceiling(4500 / 1480) = 4 fragments.

 Fragment 1, 2, and 3 carry 1480 bytes of data each with offset values 0, 185
(1480/8), and 370 (2952/8).

 Fragment 4 carries remaining 60 bytes (4500 - 1480*3). Flag MF (More


Fragments) set for fragments 1-3, cleared for last.
86. A Class B network address is 172.16.0.0. You want to subnet it into 500
subnets. What subnet mask do you use?

Answer:

 Default Class B mask is /16.

 Need to borrow enough bits for 500 subnets:

o 2^b ≥ 500 → b ≥ 9 (since 2^8=256 < 500, 2^9=512≥500)

 New subnet mask = 16 + 9 = /25 (255.255.255.128)

 This mask supports 512 subnets with 2^(32-25)-2 = 126 hosts each.

87. How does the three categories of IPv6 addresses (Unicast, Multicast,
Anycast) impact routing and packet delivery?

Answer:

 Unicast: Packet delivered to exactly one interface. Standard one-to-one


communication.

 Multicast: Packet delivered to all interfaces in a group. One-to-many


communication optimized for group data exchange.

 Anycast: Packet delivered to the nearest one among multiple interfaces sharing
the address. Used for load balancing and redundancy.

88. Given an IPv4 address 10.10.10.72/29, calculate the network address,


broadcast address, and valid host range.

Answer:

 /29 mask = 255.255.255.248, 8 IPs per subnet.

 Network address: 10.10.10.(72 & 248) = 10.10.10.72


 Broadcast address: 10.10.10.72 + 7 = 10.10.10.79

 Valid hosts: 10.10.10.73 to 10.10.10.78 (6 usable IPs)

89. A router has a forwarding table with the following prefixes:

Prefix Interface

11000000 10101000 00000000 0


00000000/24

11000000 10101000 00000000 1


00001000/29

11000000 10101000 00000000 2


00001000/30

Default 3

For destination IP 192.168.0.11, which interface will the router forward the
packet to?

Answer:

 IP 192.168.0.11 in binary: 11000000 10101000 00000000 00001011

 Matches /29 prefix (192.168.0.8 - 192.168.0.15), Interface 1, prefix length 29 is


more specific than /24.

 But also matches /30 prefix (192.168.0.8 - 192.168.0.11 for /30) Interface 2
which is even longer prefix (30) and includes 192.168.0.11.

 Longest prefix match → Interface 2


90. You receive an ICMP type 3 code 1 message. What has happened in the
network, and what does it mean?

Answer:

 ICMP Type 3 = Destination Unreachable

 Code 1 = Host unreachable

 This means an intermediate router or host could not deliver the packet to the
destination host, likely because the host is down or unreachable on that network.

Analytical & Calculation Questions with Answers

91. A router receives an IP datagram with the "Don't Fragment" (DF) bit set, and the
datagram size exceeds the MTU of the next link. What will the router do, and what
ICMP message will be generated?

Answer:
The router will drop the datagram because fragmentation is forbidden by the DF bit.
It will send back an ICMP Type 3, Code 4 ("Fragmentation needed but DF set")
message to the sender, indicating the MTU of the next link.

92. Given the IPv6 address: 2001:0db8:0000:0000:0000:0000:1428:57ab, write it in


compressed IPv6 notation.

Answer:
The compressed form uses zero compression and removing leading zeros:
2001:db8::1428:57ab

93. Suppose a company is assigned a block of 192.168.0.0/22. How many subnets


with a /26 mask can be created within this block? How many hosts per subnet?
Answer:

 Block size: /22 means 32 - 22 = 10 host bits total.

 New subnet: /26 means 32 - 26 = 6 host bits per subnet.

 Number of subnets created:


$ 2^{26 - 22} = 2^4 = 16 $

 Hosts per subnet:


$ 2^6 - 2 = 62 $

94. Explain the concept of "Longest Prefix Match" and why it is important in a
router’s forwarding process.

Answer:
Longest Prefix Match is the rule by which routers select the forwarding entry with
the longest matching subnet prefix for a given destination IP. It's important because
it allows routers to choose the most specific route to a destination, optimizing
routing precision and efficiency.

95. A router’s input port has a forwarding table that includes the prefixes:

 10.0.0.0/8 → Interface 0

 10.1.0.0/16 → Interface 1

 10.1.2.0/24 → Interface 2
For a packet destined to 10.1.2.15, which interface will the router forward the
packet to and why?

Answer:
The router will forward the packet to Interface 2 because the prefix /24 is the longest
match (most specific) for the IP 10.1.2.15.
96. Calculate the number of hosts and subnets available when subnetting a Class C
address with a mask of 255.255.255.192.

Answer:

 Mask 255.255.255.192 is /26.

 Number of bits borrowed for subnetting: 2 bits (26 - 24)

 Number of subnets: $ 2^2 = 4 $

 Host bits: 6 bits (32 - 26)

 Hosts per subnet: $ 2^6 - 2 = 62 $

97. For the subnet mask 255.255.255.240, how many subnets and hosts per subnet
does it support over a Class C network?

Answer:

 Mask /28 (255.255.255.240)

 Borrowed bits: 4 (28 - 24)

 Subnets: $ 2^4 = 16 $

 Hosts bits: 4

 Hosts per subnet: $ 2^4 - 2 = 14 $

98. You are given the network 172.16.0.0/16. You need at least 1000 hosts per
subnet. What is the smallest subnet mask you can use and how many such subnets
can you create?

Answer:

 Hosts per subnet required: ≥1000


 Find host bits ℎ: 2ℎ −2≥1000

 210 =1024, so ℎ=10 bits for hosts

 Subnet prefix length: 32−10=22 → subnet mask 255.255.252.0 (/22)

 Number of subnets: 222−16 =26 =64

99. Describe what happens during a DHCP process between a client and server
when a device joins a network.

Answer:

1. Client broadcasts a DHCP Discover message to locate servers.

2. Server replies with DHCP Offer containing IP and lease info.

3. Client sends DHCP Request to accept offer.

4. Server sends DHCP Acknowledgment, finalizing the assignment.

100. You have a forwarding table that contains the following entries:

 0.0.0.0/0 → Interface 0 (Default route)

 192.168.0.0/16 → Interface 1

 192.168.1.0/24 → Interface 2
What interface will a router use for the destination IP 192.168.1.100?

Answer:
Router selects the route with the longest prefix match → 192.168.1.0/24 (Interface 2)

101. A datagram of size 2000 bytes (including 20-byte IP header) must be sent
across a link with MTU 576 bytes. Calculate the number of fragments and the
payload size of each fragment.

Answer:
 Payload size per fragment = MTU – header = 576 - 20 = 556 bytes

 Total payload = 2000 - 20 = 1980 bytes

 Number of fragments = ceil(1980 / 556) = 4

 Fragment payload sizes:

o Fragments 1–3: 556 bytes each

o Fragment 4: 1980 – (556*3) = 312 bytes

102. Explain how the ICMP protocol assists in network error handling and
diagnostics.

Answer:
ICMP sends error messages (e.g., destination unreachable, TTL expired) and
requests/replies (e.g., ping echo) to inform hosts and routers about network issues,
enabling diagnostics and troubleshooting.

103. Given the IPv4 address 10.128.0.0/9, how many hosts and subnets can you
create if you require subnets with 500 hosts each?

Answer:

 Hosts needed: 500

 2ℎ −2≥500 → ℎ=9 (512 hosts)

 Subnet mask: 32 - 9 = 23 → /23 (255.255.254.0)

 Number of subnets: 223−9 =214 =16384

104. A packet with a TTL of 1 reaches a router. What happens to the packet and
why?
Answer:
The router decrements TTL to zero, drops the packet, and sends an ICMP Time
Exceeded (Type 11) message back to the sender. This prevents packets looping
forever in the network.

105. Design an IPv4 subnetting scheme for hosting 6 subnets within 192.168.4.0/24
and calculate the subnet mask and hosts per subnet.

Answer:

 Needs ≥6 subnets → borrow bits b so 2b ≥6 → b=3 (8 subnets)

 New prefix = 24 + 3 = 27 → subnet mask = 255.255.255.224

 Hosts per subnet = 2(32−27) −2=30 hosts

106. Given the IP block 192.168.20.0/24, subnet it to create at least 12 subnets.


What subnet mask should you use? How many hosts per subnet will be
available?

 To create at least 12 subnets, find bits to borrow:


$ 2^b \geq 12 \Rightarrow b = 4 (since 2^3=8<12, 2^4=16\geq12) $

 Original mask /24, borrow 4 bits from host → new mask = /28
(255.255.255.240)

 Hosts bits remaining: $ 32 - 28 = 4 $

 Hosts per subnet:


$ 2^4 - 2 = 14 $
 Answer: Subnet mask is /28. This provides 16 subnets with 14 hosts in each
subnet.

107. You have the IP address 10.10.8.130 with subnet mask 255.255.252.0.
Calculate:

 a) Network address

 b) Broadcast address

 c) Number of valid hosts in the subnet

 Mask 255.255.252.0 = /22 (11111111.11111111.11111100.00000000)

 IP in binary last two bytes: 8 = 00001000, 130 = 10000010

 Network address for third octet:


$ 8 & 252 = 8 $

 Network address: 10.10.8.0

 Broadcast address:
Last 10 bits host bits → all bits 1 → third octet: 8 + 3 = 11 (since mask covers
252 = 11111100, so host bits 000011)
Fourth octet: 255
So broadcast address = 10.10.11.255

 Valid hosts:
$ 2^{10} - 2 = 1022 $

 Answer:
a) 10.10.8.0
b) 10.10.11.255
c) 1022 hosts per subnet

108. For an organization needing subnets with up to 200 hosts, what is the
smallest subnet mask you can assign? How many hosts are actually available
with this mask?

 Minimum host bits ℎ must satisfy 2ℎ −2≥200

 28 =256 so ℎ=8 bits

 Prefix length: 32−8=24 → /24 → 255.255.255.0

 Usable hosts: 28 −2=254

 Answer:
Subnet mask = /24 (255.255.255.0), with 254 usable hosts per subnet.

109. If an IP datagram is 3000 bytes and is sent over a link with MTU 1400
bytes, how many fragments are produced? Specify the size of each fragment’s
data payload.

 MTU = 1400 bytes

 IP header = 20 bytes

 Maximum payload per fragment = 1400 - 20 = 1380 bytes

 Total payload to send = 3000 - 20 = 2980 bytes

 Number of fragments $ = \lceil \frac{2980}{1380} \rceil = 3 $

 Payload sizes:
Fragment 1: 1380 bytes
Fragment 2: 1380 bytes
Fragment 3: 2980 - 1380*2 = 220 bytes
 Answer: 3 fragments with payloads 1380, 1380, 220 bytes respectively.

110. How many subnets and hosts per subnet can be created if you subnet a
Class B network 172.16.0.0/16 with a /21 subnet mask?

 Class B default mask is /16

 New mask /21 → borrowed bits = 21 - 16 = 5 bits

 Number of subnets = 25 =32

 Host bits = 32 - 21 = 11 bits

 Hosts per subnet = 211 −2=2046

 Answer: 32 subnets with 2046 hosts per subnet.

111. A router has a forwarding table with these entries:

 172.16.0.0/16 → Interface 0

 172.16.32.0/19 → Interface 1

 172.16.64.0/18 → Interface 2
What interface will a packet with destination IP 172.16.50.25 be forwarded to?

 Check which subnet 172.16.50.25 belongs to:

o /16 covers 172.16.0.0 to 172.16.255.255 (Interface 0)

o /18 subnet 172.16.64.0 to 172.16.127.255 (Interface 2) does not include


172.16.50.x

o /19 subnet 172.16.32.0 to 172.16.63.255 (Interface 1) does include


172.16.50.25

 Longest prefix match selects Interface 1.


 Answer: Interface 1.

112. Convert the subnet mask 255.255.254.0 to CIDR notation and calculate the
number of usable hosts in that subnet.

 255.255.254.0 in binary:
255 (8 bits), 255 (8 bits), 254 (7 bits ones), 0 (0 bits) →
Total bits set = 8 + 8 + 7 + 0 = 23

 CIDR notation: /23

 Hosts bits = 32 - 23 = 9 bits

 Usable hosts: 29 −2=510

 Answer: /23 mask with 510 valid hosts per subnet.

113. An IPv6 address is given as 2001:0db8:0000:0000:0000:ff00:0042:8329.


Write the compressed form of this IPv6 address.

 Remove leading zeros in each block:


2001:db8:0:0:0:ff00:42:8329

 Replace longest run of consecutive zeros with "::" once:


2001:db8::ff00:42:8329

 Answer: 2001:db8::ff00:42:8329

114. If a router receives an IPv4 packet destined for 192.168.1.45, and has the
following forwarding table entries:

 192.168.1.0/25 → Interface 0

 192.168.1.32/27 → Interface 1
 192.168.1.0/26 → Interface 2
Which interface will the router forward the packet to?

 Evaluate prefix lengths and match:

o 192.168.1.0/25 covers 0–127 (Interface 0)

o 192.168.1.0/26 covers 0–63 (Interface 2)

o 192.168.1.32/27 covers 32–63 (Interface 1)

 Destination 45 lies between 32–63, matched by /27 and /26.

 Longest prefix match is /27 → Interface 1

 Answer: Interface 1.

115. Calculate how many IP addresses exist in the network 10.0.0.0/12 and how
many can be assigned to hosts.

 Total bits = 32

 Network bits = 12

 Host bits = 20

 Total IPs = 220 =1,048,576

 Usable hosts = 220 −2=1,048,574 (network and broadcast reserved)

 Answer: 1,048,576 addresses total; 1,048,574 usable hosts.

116. For the subnet 192.168.100.64/27, define the network address, broadcast
address, and valid host IP range.

 /27 → block size = 32 IP addresses (64 to 95)

 Network address: 192.168.100.64


 Broadcast address: 192.168.100.95

 Valid hosts: 192.168.100.65 to 192.168.100.94

 Answer: Network: 192.168.100.64, Broadcast: 192.168.100.95, Hosts: 65–94.

117. A datagram requires fragmentation for a link with MTU 1000 bytes. The
IP header length is 20 bytes. If the original datagram length is 2200 bytes, how
many fragments will be created and what are their data payload sizes?

 MTU = 1000 bytes

 Payload per fragment = 1000 - 20 = 980 bytes

 Total payload = 2200 - 20 = 2180 bytes

 Number of fragments: ⌈2180/980⌉=3

 Payload sizes:

o Fragment 1: 980 bytes

o Fragment 2: 980 bytes

o Fragment 3: 2180 - 980*2 = 220 bytes

 Answer: 3 fragments with payloads 980, 980, and 220 bytes.

118. Given a LAN with the IP 192.168.30.0/24, how many usable host IPs are
available if the network is subnetted into /28 subnets? How many subnets are
created?

 /28 subnet mask → 4 bits borrowed (from 24 to 28)

 Number of subnets = 24 =16

 Hosts bits = 4 → usable hosts per subnet:


24 −2=14
 Answer: 16 subnets each with 14 usable hosts.

119. An organization has IP block 172.20.0.0/16 and wants to allocate subnets


for locations requiring at least 600 hosts each. What subnet mask do they use,
and how many such subnets can they create?

 Hosts needed: ≥600

 Host bits ℎ: 2ℎ −2≥600 → ℎ=10 (1024 usable)

 Subnet mask: 32 - 10 = 22 → 255.255.252.0 (/22)

 Number of subnets =222−16 =26 =64

 Answer: /22 mask, 64 subnets with ≥600 hosts each.

120. Explain the difference in usable host count between a /30 and /31 subnet
mask.

 /30: 32 - 30 = 2 host bits → usable hosts = 2^2 - 2 = 2 hosts.

 /31: 1 host bit only → usable hosts = 2^1 - 2 = 0 hosts under traditional rules,
but /31 is special.

 /31 is used for point-to-point links with only two devices, RFC 3021 allows
both IPs to be assigned (no broadcast needed).

 Answer:

o /30 supports 2 usable hosts with broadcast and network addresses reserved.

o /31 supports 2 hosts as well but without traditional broadcast; used only
for point-to-point links.


Additional Calculation Theory Questions with Answers

121. Given the network 10.0.0.0/8, you want to create subnets to support 4000 hosts
each. What subnet mask should you use? How many such subnets can be created?

Answer:

 Hosts needed: ≥4000

 Host bits ℎ satisfy 2ℎ −2≥4000

 212 =4096, so ℎ=12 bits

 Subnet mask: 32−12=20 → /20 (255.255.240.0)

 Number of subnets created:


220−8 =212 =4096

 Result: Subnet mask /20, 4096 subnets with 4094 hosts each.

122. You have the IP address 172.16.45.130 with a subnet mask 255.255.255.192.
Find:

 a) Network address

 b) Broadcast address

 c) Valid host range

Answer:

 Mask /26 = 255.255.255.192 (11111111.11111111.11111111.11000000)

 Third octet: 45

 Fourth octet: 130

 Calculate network address:


Last octet: 130 & 192 = 128 → Network address: 172.16.45.128
 Broadcast address: Network base + 63 → 172.16.45.191

 Valid hosts: 172.16.45.129 to 172.16.45.190

 Summary:
a) 172.16.45.128
b) 172.16.45.191
c) 172.16.45.129 - 172.16.45.190

123. An IP datagram has length 2500 bytes and needs to cross a network with MTU
576 bytes. How many fragments will it be divided into, and what is the payload size
of each fragment?

Answer:

 MTU = 576 bytes

 IP header = 20 bytes

 Max payload per fragment = 576 - 20 = 556 bytes

 Total data = 2500 - 20 = 2480 bytes

 Number of fragments: ⌈2480/556⌉=5 fragments

 Payload sizes:
Four fragments with 556 bytes, last one with 2480 - 556*4 = 256 bytes

 Answer: 5 fragments; first 4 carry 556 bytes each, last has 256 bytes payload.

124. You have subnetted 192.168.0.0/24 into 8 subnets. What subnet mask are you
using, and how many valid hosts are in each subnet?

Answer:

 To create 8 subnets: 2b =8 → borrow 3 bits from host


 New prefix length: 24 + 3 = 27

 Mask: 255.255.255.224

 Hosts per subnet: 25 −2=30

 Answer: Mask 255.255.255.224 (/27), 30 valid hosts per subnet.

125. Calculate the total number of IP addresses and usable hosts in a /19 subnet.

Answer:

 Host bits: 32−19=13

 Total IP addresses: 213 =8192

 Usable hosts: 8192−2=8190

 Result: 8192 addresses total, 8190 usable hosts.

126. A packet destined to 192.168.10.75 is received. Which interface will the router
forward the packet to given the following forwarding table?

Prefix Interface

192.168.10.0/25 0

192.168.10.64/2 1
7

192.168.10.64/2 2
6

Answer:

 192.168.10.75 lies in:

o /25 (covers 0-127) Interface 0


o /26 (covers 64-127) Interface 2

o /27 (covers 64-95) Interface 1

 Longest prefix match: /27 (Interface 1)

 Result: Forward to Interface 1.

127. Given a Class C network 192.168.1.0/24, subnet it to at least 20 subnets. What


subnet mask will you use, and how many hosts will each subnet support?

Answer:

 For 20 subnets, bits borrowed b such that 2b ≥20 → b=5 (32 subnets)

 New prefix = 24 + 5 = 29

 Hosts bits = 32 - 29 = 3 bits

 Hosts per subnet = 23 −2=6 usable hosts

 Answer: Mask /29 (255.255.255.248), 6 usable hosts per subnet.

128. What is the maximum number of subnets and hosts you can get if you subnet a
Class A address 10.0.0.0/8 with a /16 subnet mask?

Answer:

 Borrowed bits = 16 - 8 = 8 bits

 Number of subnets = 28 =256

 Host bits = 32-16 = 16 bits

 Hosts per subnet = 216 −2=65534

 Answer: 256 subnets, each with 65,534 usable hosts.

129. Given an original packet size of 4500 bytes and a link MTU of 1500 bytes,
detail the fragmentation process and number of fragments.
Answer:

 Payload size: 1500 - 20 = 1480 bytes

 Total payload: 4500 - 20 = 4480 bytes

 Number of fragments: ⌈4480/1480⌉=4

 Fragments 1-3: 1480 bytes

 Fragment 4: 4480 - 1480*3 = 40 bytes

 Answer: 4 fragments - first 3 with 1480 bytes, last with 40 bytes.

130. For the network 200.100.50.0/24, if you split it into subnets of size /30, how
many subnets and hosts per subnet will result?

Answer:

 /30 means 30 mask bits, subtract from 24: borrowed bits = 6

 Number of subnets: 26 =64

 Hosts per subnet: 22 −2=2 usable hosts (as /30 has 2 host bits)

 Answer: 64 subnets, each with 2 usable hosts.

Why Fragmentation is Needed

 Different physical networks have different Maximum Transmission Units


(MTUs) — the largest packet (frame) size that can be transmitted.

 If an IP datagram is larger than the MTU of the link it must traverse, it needs to
be fragmented into smaller pieces that fit within the MTU.
 Fragmentation allows a large IP packet to be broken into smaller fragments,
transmitted separately, and reassembled at the destination.

Process of Fragmentation

1. When Fragmentation Occurs:

o A router or sending host examines the IP datagram size.

o If datagram size > MTU of outgoing link, fragmentation occurs.

o If the Don't Fragment (DF) bit is set in the IP header, fragmentation is


disallowed, and the router drops the packet and sends back an ICMP error.

2. Fragmentation Details:

o The original datagram is divided into smaller pieces called fragments.

o Each fragment is itself an IP datagram with its own IP header.

3. Important Fields in Fragmentation (in IPv4 Header):

o Identification: Identifies all fragments belonging to the same original


datagram.

o Flags:

 MF (More Fragments) bit: Set to 1 for all fragments except


the last, which is set to 0.

o Fragment Offset: Specifies where this fragment belongs in the original


datagram, measured in units of 8 bytes.

4. Fragment Sizes:
o Each fragment (except possibly the last) must contain a data payload size
that is a multiple of 8 bytes (64 bits) because the offset is given in 8-byte
units.

o Maximum fragment data size = MTU - IP header size (usually 20 bytes).

Reassembly

 All fragments with the same Identification number are reassembled at the final
destination only.

 The receiving host uses the Fragment Offset to place the data in the correct
order.

 Fragments are held until all fragments arrive or a timeout occurs.

 If a fragment is missing, the entire datagram cannot be reassembled.

Example of Fragmentation

Suppose you have:

 Original IP datagram size: 4000 bytes (including 20 bytes IP header)

 MTU of outgoing link: 1500 bytes

Then:

 Maximum payload per fragment: 1500 - 20 = 1480 bytes.

 Number of fragments: ceiling((4000 - 20) / 1480) = ceiling(3980/1480) = 3


fragments.

 Fragment 1: offset 0, length 1500 bytes (20 bytes header + 1480 bytes data),
MF = 1.

 Fragment 2: offset 1480/8 = 185, length 1500 bytes, MF = 1.


 Fragment 3: offset 14802/8 = 370, length (4000 - 14802) + 20 header = 1040
bytes, MF = 0 (last fragment).

Important Notes on Fragmentation

 Fragmentation is costly: it causes overhead due to packet header duplication


and reassembly complexity.

 Modern best practice and IPv6 avoid in-network fragmentation. Instead, Path
MTU Discovery is used to find the smallest MTU along the path to prevent
fragmentation.

 IPv6 does not allow routers to fragment packets; only the source host fragments
packets if needed.

Common Calculation Steps for Fragmentation

Given:

 MTU size

 Datagram size

 IP header size (usually 20 bytes)

Steps:

1. Calculate maximum payload per fragment = MTU - IP header size.

2. Calculate number of fragments = ceiling (datagram payload size / max payload


per fragment).

3. For each fragment except last:

o Payload size is max payload per fragment.

o MF bit = 1.
o Fragment offset multiples of 8 bytes.

4. Last fragment:

o Payload size = remaining data.

o MF bit = 0.

IP Fragmentation Calculation Questions with Answers

1. An IP datagram is 4000 bytes long (including a 20-byte IP header). It needs to


travel over a link with an MTU of 1500 bytes. How many fragments will be created?
What will be the size and offset of each fragment?

Answer:

 MTU = 1500 bytes, IP header = 20 bytes

 Max payload per fragment = 1500 - 20 = 1480 bytes

 Total payload = 4000 - 20 = 3980 bytes

 Number of fragments = ceiling(3980 / 1480) = 3

Fragment details:

 Fragment 1:

o Offset = 0 (start)

o Data size = 1480 bytes

o Total length = 1480 + 20 = 1500 bytes

o MF (More Fragments) bit = 1


 Fragment 2:

o Offset = 1480 / 8 = 185

o Data size = 1480 bytes

o Total length = 1500 bytes

o MF = 1

 Fragment 3:

o Offset = (1480 * 2) / 8 = 370

o Data size = 3980 - (1480 * 2) = 1020 bytes

o Total length = 1020 + 20 = 1040 bytes

o MF = 0 (last fragment)

2. A 2500-byte IP datagram encounters a link with an MTU of 576 bytes. Fragment


the datagram showing the number of fragments, their sizes, and offsets.

Answer:

 MTU = 576 bytes, header = 20 bytes

 Max payload per fragment = 576 - 20 = 556 bytes

 Total payload = 2500 - 20 = 2480 bytes

 Number of fragments = ceiling(2480 / 556) = 5 fragments

Fragments:

 Fragments 1 to 4: 556 bytes data each (length 576 bytes)

 Fragment 5: 2480 - (556 * 4) = 2480 - 2224 = 256 bytes data

Offsets (in units of 8 bytes):


 Fragment 1: offset 0

 Fragment 2: offset 556/8 = 69

 Fragment 3: offset 112

 Fragment 4: offset 167

 Fragment 5: offset 222

MF flag: set (1) for fragments 1-4, cleared (0) for last fragment.

3. A 2200-byte IP datagram traverses a link with an MTU of 1000 bytes. How many
fragments are needed, and what is the size of each fragment's payload? Include
fragment offsets.

Answer:

 MTU = 1000 bytes, header = 20 bytes

 Max payload per fragment: 980 bytes

 Total payload = 2200 - 20 = 2180 bytes

 Number of fragments = ceiling(2180 / 980) = 3 fragments

Fragments:

 Fragment 1: payload = 980, offset = 0

 Fragment 2: payload = 980, offset = 980/8 = 122

 Fragment 3: payload = 2180 - 9802 = 220, offset = 196 (1228 + 74) or


calculated as 980
2/8 = 245 (corrected offset)
Note: Offset units are multiples of 8 bytes, so:Fragment 1 offset: 0Fragment 2
offset: 980 / 8 = 122.5 → offset must be integer → use 122Fragment 3 offset:
9802 / 8 = 245

MF flag is set for fragments 1 & 2, cleared for fragment 3.

4. An IP datagram payload is 6000 bytes with an IP header of 20 bytes. It passes


over a link with MTU 2000 bytes. Calculate the number of fragments, payload size
of each fragment, and their offsets.

Answer:

 MTU = 2000 bytes, header = 20 bytes

 Max payload per fragment = 2000 - 20 = 1980 bytes

 Total payload = 6000 bytes

 Number of fragments = ceiling(6000 / 1980) = 4

Fragments:

 Fragments 1-3: 1980 bytes data each

 Fragment 4: 6000 - (1980*3) = 6000 - 5940 = 60 bytes data

Offsets (in units of 8 bytes):

 Fragment 1: 0

 Fragment 2: 1980 / 8 = 247.5 → use 247

 Fragment 3: 1980*2 / 8 = 495

 Fragment 4: 1980*3 / 8 = 742.5 → use 742

MF flags 1 for first three, last fragment MF=0.


5. A 1500-byte IP datagram encounters a link with MTU 576 bytes. Calculate the
number of fragments, payload per fragment, fragment offsets, and total length of
each fragment.

Answer:

 MTU = 576 bytes, header = 20 bytes

 Max payload per fragment = 576 - 20 = 556 bytes

 Payload length = 1500 - 20 = 1480 bytes

 Number of fragments = ceiling(1480 / 556) = 3 fragments

Fragments:

 Fragment 1: payload 556 bytes, offset 0, total length 576 bytes, MF=1

 Fragment 2: payload 556 bytes, offset 556 / 8 = 69, total length 576 bytes,
MF=1

 Fragment 3: payload 1480 - 2556 = 368 bytes, offset 5562 /8 = 138, total length
368+20=388 bytes, MF=0

Would you like me to generate more IP fragmentation problems or step-by-step


explanations?

NAT Calculation and Analysis Questions with Answers

1. A home network uses the private IP address block 192.168.1.0/24 behind a NAT
router. The ISP assigns the public IP 203.0.113.5 to the router. If there are 50
devices in the local network communicating to the internet simultaneously, explain
how NAT maps the local addresses to the public IP and how many simultaneous
connections it can support.

Answer:

 The NAT router replaces the source IP address of each outgoing packet from
192.168.1.x to 203.0.113.5.

 Since all devices share the single public IP, NAT uses source port numbers to
distinguish connections.

 NAT maintains a translation table mapping (private IP + private port) to


(public IP + public port).

 Because ports are 16-bit numbers, there are up to approximately 65,535 ports
per public IP, so one public IP can support tens of thousands of simultaneous
connections (more than enough for 50 devices).

 Each device’s connection uses unique port mappings to allow the router to
correctly forward return traffic.

2. Suppose a NAT router has a single public IP address and supports up to 2000
simultaneous TCP connections. If each internal host can open up to 100 TCP
connections, how many hosts can be supported simultaneously?

Answer:

 Maximum TCP connections supported = 2000

 Connections per host = 100

 Number of hosts supported = 2000 / 100 = 20 hosts at the same time

 Because NAT maps connections based on IP+port, the max simultaneous


connections are limited by port availability and current mappings.
3. An internal host with IP 10.0.0.5 and source port 3456 sends a packet to an
external web server (80) via a NAT router with public IP 198.51.100.2. The router
assigns public source port 50000 for this packet. Describe how the destination
server’s reply packet is handled by the NAT router.

Answer:

 The outgoing packet source: 10.0.0.5:3456 becomes 198.51.100.2:50000

 The NAT router stores this translation: (10.0.0.5:3456) ↔ (198.51.100.2:50000)

 When the reply arrives with destination 198.51.100.2:50000, the NAT looks up
the translation table, finds the corresponding private address and port, and
modifies dest IP+port to 10.0.0.5:3456 before forwarding internally.

4. A company uses the private IP block 192.168.0.0/16 internally with a NAT router
assigned one public IP address. During peak hours, the translation table contains
5000 entries. If each connection requires a unique (IP, port) mapping, estimate the
minimum number of available ports per public IP that the company’s NAT router
should support.

Answer:

 Each translation entry corresponds to one (IP, port) mapping.

 For 5000 simultaneous entries, the router must support at least 5000 unique port
mappings (assuming all use one public IP).

 Since TCP/UDP ports per IP = 65,535, 5000 is well within limits.

 However, the router must allocate port numbers carefully to avoid collisions.

 Answer: Minimum at least 5000 port mappings must be supported, but


practically a router supports full 65,535 ports per public IP.
5. Calculate how many private hosts can theoretically share a single public IP
address through NAT if each host uses 10 unique ports for connections
simultaneously.

Answer:

 Total available ports per public IP = 65,535 (TCP or UDP)

 Ports per host = 10

 Number of hosts = 65,535 / 10 = 6553 hosts (approximately)

 Answer: Approximately 6,553 hosts if each uses 10 ports concurrently.

6. A NAT device replaces the source IP address and source port of outgoing packets.
Explain why the port number is crucial for NAT operation and what problems occur
if port numbers run out.

Answer:

 Port numbers distinguish concurrent connections from multiple hosts sharing


the same public IP.

 Without unique port mappings, NAT can’t differentiate incoming packets'


intended destination host.

 If ports run out (port exhaustion), NAT cannot create new mappings, leading to
connection failures.

 This limitation constrains the number of simultaneous connections a NAT


device can handle.

7. Suppose a NAT device translates private IP addresses from the 10.0.0.0/24 range
to a single public IP. How many concurrent TCP connections can this NAT device
theoretically support, considering port number limitations?
Answer:

 Total ports per IP ≈ 65,535

 Private hosts: 256 addresses (10.0.0.0-10.0.0.255)

 So, max connections per host = 65,535 / 256 ≈ 256 concurrent connections per
host (assuming even distribution)

 Answer: Approximately 65,535 total connections across all hosts, about 256
per host.

Summary:
NAT conserves public IP addresses by multiplexing many private hosts onto a
single public IP using port numbers. Port number limits constrain the number of
simultaneous connections. The translation table tracks mappings between private
IP/port and public IP/port for correct packet routing.

NAT Calculation and Analysis Questions with Answers

1. A home network uses the private IP address block 192.168.1.0/24 behind a NAT
router. The ISP assigns the public IP 203.0.113.5 to the router. If there are 50
devices in the local network communicating to the internet simultaneously, explain
how NAT maps the local addresses to the public IP and how many simultaneous
connections it can support.

Answer:

 The NAT router replaces the source IP address of each outgoing packet from
192.168.1.x to 203.0.113.5 (the public IP).
 NAT differentiates connections by assigning unique source port numbers for
each outgoing connection, mapping (private IP, private port) to (public IP,
public port).

 Since port numbers are 16-bit, approximately 65,535 ports are available for
multiplexing per IP address.

 Hence, one public IP can support tens of thousands of simultaneous


connections, so 50 devices working concurrently is easily supported.

2. Suppose a NAT router has a single public IP address and supports up to 2000
simultaneous TCP connections. If each internal host opens up to 100 TCP
connections, how many hosts can be supported simultaneously?

Answer:

 Total connections = 2000

 Connections per host = 100

 Number of hosts supported = 2000 / 100 = 20 hosts

 The maximum number of hosts simultaneously supported is limited by the total


available port mappings.

3. An internal host with IP 10.0.0.5 and source port 3456 sends a packet to an
external web server (port 80) via a NAT router with public IP 198.51.100.2. The
router assigns public source port 50000 for this packet. Describe how the destination
server’s reply packet is handled by the NAT router.

Answer:

 Outgoing packet: source (10.0.0.5:3456) replaced by (198.51.100.2:50000); this


mapping is recorded in the NAT table.
 When reply arrives at (198.51.100.2:50000), NAT router looks up the table and
translates destination to original (10.0.0.5:3456) before forwarding it internally.

4. A company uses the private IP block 192.168.0.0/16 internally with a NAT router
assigned one public IP address. During peak hours, the translation table contains
5000 entries. If each connection requires a unique (IP, port) mapping, estimate the
minimum number of available ports per public IP the NAT router must support.

Answer:

 Each entry represents a unique (public IP, port) mapping.

 The NAT router must support at least 5000 ports in use simultaneously.

 Since there are 65,535 TCP/UDP ports available per IP, 5000 is well within
limits.

 Minimum ports required: 5000, practically the device supports all 65,535
ports.

5. Calculate how many private hosts can theoretically share a single public IP
address through NAT if each host uses 10 unique ports for simultaneous connections.

Answer:

 Total ports: approx. 65,535

 Ports per host: 10

 Hosts supported = 65,535 / 10 ≈ 6,553 hosts

 Thus, one public IP can theoretically serve about 6,553 hosts simultaneously,
assuming each uses 10 ports.

6. Explain why port numbers are crucial for NAT operation and the consequence if
the NAT runs out of available ports.
Answer:

 Port numbers distinguish connections from multiple private hosts sharing one
public IP.

 Without unique port assignments, NAT can’t differentiate packets in the return
path, leading to routing errors.

 If NAT port numbers are exhausted (port exhaustion), no new connections can
be established, resulting in connection failures until existing mappings time out
and free ports.

7. A NAT device translates private IP addresses from the 10.0.0.0/24 range into a
single public IP address. How many concurrent TCP connections can this NAT
device theoretically support if ports are evenly distributed?

Answer:

 Available ports per IP ≈ 65,535

 Private hosts in /24 subnet = 256

 Connections per host = 65,535 / 256 ≈ 256 connections per host

 Total connections = 65,535 across all hosts.

You might also like