NE-03

IP Addressing & Subnetting

Network+ / NE-03
< Network+ Hub

Learning Objectives

IPv4 Address Structure

An IPv4 address is a 32-bit number divided into four 8-bit octets, written in dotted decimal notation. Every IP address has two parts: the network portion (identifies the network) and the host portion (identifies a specific device on that network).

/* IPv4 Address: 192.168.1.100 */ Decimal: 192 . 168 . 1 . 100 Binary: 11000000.10101000.00000001.01100100 /* With /24 subnet mask (255.255.255.0): */ Network: 192.168.1.0 // first 24 bits Host: 0.0.0.100 // last 8 bits

Address Classes (Classful)

The original classful addressing scheme divided the IPv4 space into five classes. While classful routing is obsolete (replaced by CIDR), understanding classes is still required for certification exams.

ClassFirst OctetDefault MaskNetworksHosts/NetPurpose
A1-126/8 (255.0.0.0)12616,777,214Large organizations
B128-191/16 (255.255.0.0)16,38465,534Medium organizations
C192-223/24 (255.255.255.0)2,097,152254Small organizations
D224-239N/AN/AN/AMulticast
E240-255N/AN/AN/AExperimental
Why 127 is Missing:

The 127.0.0.0/8 range is reserved for loopback. 127.0.0.1 is "localhost" -- traffic sent here never leaves the machine. Used for testing the TCP/IP stack locally.

Private Address Ranges (RFC 1918)

These ranges are reserved for internal use and are not routable on the public internet. NAT translates them to public addresses for internet access.

ClassRangeCIDRCommon Use
A10.0.0.0 - 10.255.255.25510.0.0.0/8Enterprise networks
B172.16.0.0 - 172.31.255.255172.16.0.0/12Mid-size networks
C192.168.0.0 - 192.168.255.255192.168.0.0/16Home/small office

CIDR and Subnetting

Classless Inter-Domain Routing (CIDR) replaced classful addressing in 1993. Instead of fixed class boundaries, the subnet mask can be any length. The notation /24 means the first 24 bits are the network portion.

/* Subnet Mask Cheat Sheet */ /24 = 255.255.255.0 256 addresses, 254 usable hosts /25 = 255.255.255.128 128 addresses, 126 usable hosts /26 = 255.255.255.192 64 addresses, 62 usable hosts /27 = 255.255.255.224 32 addresses, 30 usable hosts /28 = 255.255.255.240 16 addresses, 14 usable hosts /29 = 255.255.255.248 8 addresses, 6 usable hosts /30 = 255.255.255.252 4 addresses, 2 usable hosts /31 = 255.255.255.254 2 addresses, point-to-point /32 = 255.255.255.255 1 address, single host /* Formula: Hosts = 2^(32 - prefix) - 2 Subtract 2 for network address and broadcast address */

Subnetting Walkthrough

Given: 192.168.10.0/24 -- create 4 equal subnets.

Step 1: How many subnets? 4. Bits needed: 2^2 = 4. Borrow 2 bits. Step 2: New prefix: /24 + 2 = /26 (255.255.255.192) Step 3: Block size: 256 - 192 = 64 Subnet 1: 192.168.10.0/26 Network: 192.168.10.0 First host: 192.168.10.1 Last host: 192.168.10.62 Broadcast: 192.168.10.63 Subnet 2: 192.168.10.64/26 Network: 192.168.10.64 First host: 192.168.10.65 Last host: 192.168.10.126 Broadcast: 192.168.10.127 Subnet 3: 192.168.10.128/26 Network: 192.168.10.128 First host: 192.168.10.129 Last host: 192.168.10.190 Broadcast: 192.168.10.191 Subnet 4: 192.168.10.192/26 Network: 192.168.10.192 First host: 192.168.10.193 Last host: 192.168.10.254 Broadcast: 192.168.10.255

VLSM -- Variable Length Subnet Masking

VLSM allows different subnets within the same network to have different prefix lengths. This prevents IP address waste by sizing each subnet to the actual number of hosts needed.

/* Scenario: 10.0.0.0/24 -- allocate for these departments: */ Engineering: 60 hosts --> /26 (62 usable) --> 10.0.0.0/26 Marketing: 28 hosts --> /27 (30 usable) --> 10.0.0.64/27 Accounting: 12 hosts --> /28 (14 usable) --> 10.0.0.96/28 Server VLAN: 6 hosts --> /29 ( 6 usable) --> 10.0.0.112/29 WAN link: 2 hosts --> /30 ( 2 usable) --> 10.0.0.120/30 /* Rule: Always allocate the largest subnet first, then work downward. This prevents address overlap. */
Exam Strategy:

On subnetting questions, always write out the binary. AND the IP address with the subnet mask to get the network address. The broadcast is the network address with all host bits set to 1.

Special Addresses

0.0.0.0/0 Default route. Matches all destinations. Used as the "route of last resort."
255.255.255.255 Limited broadcast. Sent to all hosts on the local network segment. Never forwarded by routers.
169.254.0.0/16 APIPA (Automatic Private IP Addressing). Assigned when DHCP fails. Link-local only.
100.64.0.0/10 Carrier-grade NAT (CGN). Used by ISPs for address sharing between customers.

Key Takeaways