IP Addressing and Subnetting Study Notes
Prerequisites and Fundamental Concepts
Binary-to-Decimal Conversion Principles:
Computer network addressing relies heavily on converting between binary (base-2) and decimal (base-10) representations.
In an 8-bit binary octet, the positional bit values corresponding to powers of from right to left are:
Bit 0 ():
Bit 1 ():
Bit 2 ():
Bit 3 ():
Bit 4 ():
Bit 5 ():
Bit 6 ():
Bit 7 ():
Conversion Example:
Binary representation:
Calculation:
Decimal output:

Internet Protocol (IP) Fundamentals
Definition:
The Internet Protocol (IP) is the primary network-layer method or protocol by which data is routed and sent from one computer host to another across the Internet.
Host Identification:
Every computer connected to the Internet is designated as a host.
Each host possesses at least one unique IP address that globally distinguishes it from all other interconnected machines.
Packetization:
Data transmitted across the network (such as web pages or e-mail messages) is partitioned into discrete segments called packets or datagrams.
Every packet carries header information containing both the source host IP address and the destination host IP address.
Layered Communication and Protocol Data Units (PDUs):
Network communications operate via a layered architecture.
As data moves down the protocol stack on the sending host, each layer encapsulates upper-layer payloads by prepending specific header control information.
As data moves up the protocol stack on the receiving host, each layer strips off its corresponding header and processes the payload according to header instructions.
Encapsulation Stack Order (Top to Bottom):
Upper Layer Message: Contains Upper Layer Headers and Application Data.
Transport Layer Message: Encapsulates application data with a TCP or UDP Header.
IP Datagram (Network Layer): Encapsulates TCP/UDP messages with an IP Header.
Layer 2 Frame (Data Link Layer): Encapsulates the IP datagram with a Layer 2 Header and a Layer 2 Frame Footer.
Layer 1 (Physical Layer): Transmits the frame as a continuous physical bitstream (s and s).

IPv4 Datagram Structure and Header Fields
Structure Overview:
The IPv4 datagram consists of a structured control header followed by the variable-length payload/data section.
Header fields are aligned across 32-bit () words.

Detailed Field Specifications:
Version (): Indicates the IP protocol version being utilized (e.g., IPv4 vs. IPv6).
Internet Header Length / IHL (): Specifies the total length of the IP header expressed as a multiple of 32-bit () words. The minimum length for a standard header without options is words ().
Type of Service / ToS (): Defines service quality specifications to facilitate packet prioritization and traffic management.
Total Length (): Specifies the complete size of the datagram, including both header and payload, measured in bytes.
Identification (): A unique identifier assigned to a datagram to enable the target host to reassemble fragmented pieces into the original structure.
Flags (): Control bits used to manage datagram fragmentation:
Reserved Bit: Must remain set to
Don't Fragment (DF): If set to , prohibits routers from fragmenting the datagram.
More Fragments (MF): If set to , indicates that additional fragments follow; if set to , marks the final fragment.
Fragment Offset (): Indicates the relative position of the fragment's payload data relative to the beginning of the unfragmented datagram payload, measured in 8-byte () blocks. All fragments except the final one must contain payload sizes that are exact multiples of .
Time to Live / TTL (): A counter decremented by each router hop along the transmission path. Prevents persistent looping by discarding the datagram when the value reaches
Protocol (): Identifies the transport-layer protocol recipient of the payload data (e.g., TCP protocol code , UDP protocol code
Header Checksum (): Provides error detection for header integrity during transit. Recomputed and verified at every intermediate hop.
Source Address (): Contains the globally unique IPv4 address of the originating sender host.
Destination Address (): Contains the globally unique IPv4 address of the intended receiver host.
Options (Variable length): Optional operational settings including explicit routing constraints, timing markers, or security controls.
Padding (Variable length): Zero-fill bits appended to guarantee that the IP header length terminates precisely on a 32-bit boundary.
Payload / Data: The actual user information originating from upper-layer transport protocols.
IPv4 Fragmentation and Reassembly
Path Maximum Transmission Unit (MTU):
Different physical underlying link-layer technologies enforce varying limits on the maximum size of a frame payload, known as the Maximum Transmission Unit (MTU).
Token Ring LAN MTU:
Ethernet LAN MTU:
Fragmentation Mechanics:
When a datagram encounters a network link with an MTU smaller than the datagram's total size, intermediate access gateways or routers split the datagram into smaller, manageable fragments.
Reassembly Execution: Fragment reassembly is performed exclusively at the final destination host, never at intermediate access gateways.
Comprehensive Path Walkthrough:
A Source Host application generates of payload user data.
Transmission across Token Ring LAN ():
Datagram Fragment 1 User Payload:
Datagram Fragment 2 User Payload:
Combined initial transmission:
Transit through global internetwork access gateways to Ethernet LAN ():
Standard IP Header Size =
Maximum allowable user payload per Ethernet frame:
The payload segment is split into:
Ethernet Fragment 1: payload
Ethernet Fragment 2: payload
Ethernet Fragment 3: payload ( remaining plus header adjustment, totaling payload block)
The payload segment is split into:
Ethernet Fragment 4: payload
Ethernet Fragment 5: payload
Ethernet Fragment 6: payload ( block split down to final remainder )
Reassembly at Destination Host:
The receiving host aggregates all arriving payloads:
The complete message is passed up to the destination application layer.

Class-Based IP Addressing Architecture
Address Formatting:
IPv4 addresses consist of a 32-bit sequence divided into four distinct 8-bit groupings known as octets.
Expressed in dotted-decimal notation:
An address is divided logically into two components:
NetID: Identifies the specific network to which the host belongs.
HostID: Identifies the individual endpoint device on that network.
Address Classification System:

Class A Addresses:
Leading Bits: Fixed binary
0().NetID Allocation: .
HostID Allocation: .
Type: Unicast addressing.
First Octet Decimal Range: to
Total Theoretical Networks:
Special Reserved NetIDs: NetID
0(represents current local network) and NetID127(reserved for loopback testing).Usable Unique Networks:
Unique Hosts per Network:
Class B Addresses:
Leading Bits: Fixed binary
10().NetID Allocation: .
HostID Allocation: .
Type: Unicast addressing.
First Octet Decimal Range: to
Total Unique Networks:
Unique Hosts per Network:
Class C Addresses:
Leading Bits: Fixed binary
110().NetID Allocation: .
HostID Allocation: .
Type: Unicast addressing.
First Octet Decimal Range: to
Total Unique Networks:
Unique Hosts per Network:
Class D Addresses:
Leading Bits: Fixed binary
1110().Address Allocation: dedicated to multicast group identification.
Type: Multicast addressing (transmits packets to a defined subscriber group).
First Octet Decimal Range: to
Class E Addresses:
Leading Bits: Fixed binary
1111().Type: Reserved for future experimental, testing, and research usage.
First Octet Decimal Range: to
Special-Purpose IP Addresses and Routing Rules:
Network Address (HostID = All s):
Identifies the entire network segment itself rather than an individual endpoint device.
Local Network Reference (NetID = All s):
Refers to "this current local network" where the sending machine is located.
Limited Broadcast Address (Every Bit = , i.e., ):
Delivers a broadcast message to every machine residing on the immediate local physical network segment. Routers block these packets from traversing boundaries.
Direct Broadcast Address (HostID = All s):
Delivers a message to all host endpoints located on a specified target network (e.g., for a Class B NetID , the direct broadcast address is ).
Loopback Address (Class A NetID = All s,
127.x.x.x):Reserved for internal diagnostics and local stack testing. Messages routed to
127.0.0.1are returned internally without hitting a physical network interface.
Local Area Network Assignment Rule:
Every individual LAN or subnet within an organization shares a common primary NetID but maintains distinct subnet identifiers.
Subnetting and Subnet Masking
Subnet Architecture:
Standard Classful IP allocation can result in inefficient address space utilization.
Subnetting allows a single primary site NetID to be subdivided into multiple logical internal sub-networks (subnets).
Structural Division:
HostID bits are borrowed from the traditional host portion to construct the internal SubnetID space.
Subnet Masking Principles:
A subnet mask is a 32-bit delimiter that explicitly indicates which bit positions correspond to the network/subnet portion and which correspond to host endpoints.
Binary Encoding:
Bit
= 1: Identifies Network and Subnet portions ().Bit
= 0: Identifies Local Host portion ().
Worked Example of Subnet Mask Interpretation:
Base Network ID:
128.10.12.0Subnet Mask:
255.255.255.0Binary Subnet Mask:
11111111.11111111.11111111.00000000Analysis:
Because
128falls in the range , the primary network is Class B (default NetID size = ).First 2 octets (
128.10): Represent the Internet-wide primary Class B NetID.3rd octet (
12): Represents the borrowed 8-bit SubnetID.4th octet (
0): Represents the remaining local host address space.External Internet gateways routing traffic to this site process only the primary Class B NetID (
128.10); internal subnets remain transparent to outside routers.
Campus Subnetting Calculation Task:
Problem Parameters:
Assigned Site Base IP:
150.10.0.0Required Internal LANs (Subnets):
Required Host Capacity: Up to host devices per LAN.
Step 1: Determine Address Class:
The initial octet is , which falls between and . The address belongs to Class B.
Base allocations: NetID = , HostID = .
Step 2: Calculate Required Subnet Bits ():
Formula requirement:
For subnets: (insufficient); (sufficient, borrowed).
Step 3: Calculate Required Host Bits ():
For usable hosts: (insufficient); (sufficient, required).
Step 4: Verify Bit Allocation Balance:
Total Bits: .
Step 5: Derive Custom Subnet Mask:
Combined Network + Subnet length = .
Binary Mask:
11111111.11111111.11111100.00000000Dotted Decimal Subnet Mask:
255.255.252.0
Classless Inter-Domain Routing (CIDR)
Concept and Advantages:
Classless addressing replaces rigid Class A, B, and C boundaries, allowing the network prefix length to be defined at any arbitrary bit boundary ().
Represented using CIDR notation:
w.x.y.z / n, wherenspecifies the exact number of contiguous leading bits assigned to the network prefix.Eliminates address allocation waste by matching assigned blocks precisely to organizational requirements.
Allocation Example:
Scenario: An organization requires IP addresses for host machines.
Traditional Classful Method: Class C provides only usable addresses (insufficient). The organization must be given a Class B block ( addresses), wasting over addresses.
Classless Method: The organization is allocated a block of () addresses.
Prefix Calculation: .
Notation:
w.x.y.z / 22Bit Split: Leading represent the NetID prefix; remaining are assigned for internal host addresses.
CIDR Range Analysis Task:
Parameter Input Range:
200.30.0.0through200.30.3.255Binary Conversion:
Start Address (
200.30.0.0):11001000.00011110.00000000.00000000End Address (
200.30.3.255):11001000.00011110.00000011.11111111Prefix Derivation:
1st Octet (
200):11001000()2nd Octet (
30):00011110()3rd Octet Range (
0to3): Binary00000000to00000011. The first (000000) remain static across the range, while the last vary.Total Common Network Bits (): .
Final Derived Parameters:
Network ID (CIDR):
200.30.0.0 / 22Binary Address Mask:
11111111.11111111.11111100.00000000Dotted Decimal Address Mask:
255.255.252.0
Network Address Translation (NAT)
Operational Function:
Network Address Translation (NAT) maps an entire internal private IP address space to a single public IP address for outgoing and incoming Internet communications.
Conserves public IPv4 space and provides an implicit boundary layer for internal network security.
Standard Reserved Private IP Ranges (RFC 1918):
10-bit Block (
10.0.0.0 / 8):Range:
10.0.0.0to10.255.255.255Capacity: host addresses.
12-bit Block (
172.16.0.0 / 12):Range:
172.16.0.0to172.31.255.255Capacity: host addresses.
16-bit Block (
192.168.0.0 / 16):Range:
192.168.0.0to192.168.255.255Capacity: host addresses.
NAT Translation Table Mechanics:
The NAT router dynamically tracks connection states by altering address and port values in passing IP and TCP/UDP packet headers.
Local IP/Port bindings are converted to corresponding Global IP/Port bindings.

Step-by-Step Translation Sequence:
System Topology Configuration:
Local Host Endpoint: Private IP
10.0.0.3NAT Router Interface (Internal): Private IP
10.0.0.4NAT Gateway External Interface (ADSL Line): Public IP
168.24.16.7Remote Web Server: Public IP
128.40.19.12, HTTP Port80Step 1 (Outbound Local Packet - Internal Segment):
Local Host
10.0.0.3originates a request on source port2750addressed to Web Server128.40.19.12:80.Source IP:
10.0.0.3| Source Port:2750Destination IP:
128.40.19.12| Destination Port:80Step 2 (Outbound Global Packet - NAT Gateway Processing):
NAT router intercepts the packet, assigns an unused public source port (
4001), and overwrites the header fields.NAT Table Entry Generated:
10.0.0.3 : 2750168.24.16.7 : 4001Source IP:
168.24.16.7| Source Port:4001Destination IP:
128.40.19.12| Destination Port:80Step 3 (Inbound Response Packet - Global Internet Return):
Web Server
128.40.19.12generates a response targeted to the router's public address and port combination.Source IP:
128.40.19.12| Source Port:80Destination IP:
168.24.16.7| Destination Port:4001Step 4 (Inbound Local Packet - NAT Table Lookup and Delivery):
NAT router inspects port
4001in its translation table, identifies matching local host binding10.0.0.3:2750, rewrites destination address fields, and forwards the packet to the local machine.Source IP:
128.40.19.12| Source Port:80Destination IP:
10.0.0.3| Destination Port:2750