Essentials of IP Addressing, Subnetting, and DNS Resolution
IP Address Allocation and Ranges
To manage network resources efficiently, IPv4 addresses are categorized into classes. Specific ranges are reserved for private internal networks to conserve global public addresses.
Private Adress Spaces (RFC 1918)
Class A: 10.0.0.0 -> 10.255.255.255 (Mask: /8)
Class B: 172.16.0.0 -> 172.31.255.255 (Mask: /16)
Class C: 192.168.0.0 -> 192.168.255.255 (No Mask specified, typically /24)
Strategies for IP Scarcity
When available IPv4 pool is exhausted, two primary methods address connectivity:
-
Network Address Translation (NAT) This technique maps multiple private internal IPs to a single or fewer public IP addresses. It allows thousands of devices to share internet access through one gateway IP. Benefits include conservation of public address space and inherent network obfuscation against direct external attacks.
-
IPv6 Adoption The successor protocol utilizes 128-bit addressing represented in hexadecimal groups. Format:
Group 1 : Group 2 ...where each group contains up to 4 hex digits.
Subnet Masks and CIDR
The subnet mask defines which portion of an IP address identifies the network versus the specific host device. If two devices reside in the same logical segment (subnet), they communicate directly via Layer 2 switches. Cross-subnet communication requires a router.
Calculating Network Segments
To determine if hosts belong to the same subnet:
- Convert the IP address and Subnet Mask into binary format.
- Perform a bitwise AND operation between the IP and the Mask.
- Compare the resulting network IDs.
- Identical results indicate the devices are on the same local segment.
Calculation Example
Given Host A (172.16.10.1) and Host B (172.16.10.2) with Mask 255.255.255.0:
| Component | Binary Representation |
|---|---|
| Host A IP | 10101100.00010000.00001010.00000001 |
| Mask | 11111111.11111111.11111111.00000000 |
| AND Result | 10101100.00010000.00001010.00000000 (172.16.10.0) |
Both yield the same network ID (172.16.10.0). Thus, they are neighbors on the same LAN.
CIDR Notation
Using slash notation simplifies mask definition (e.g., /24). The number represents the count of leading 1s in the binary mask.
/24implies 24 bits to the network and 8 bits for hosts ($2^8 = 256$ total).- Reserved Addresses: The first address (
network ID) and last address (broadcast) are not assignable to hosts. - Usable Hosts: Total - 2.
Default Gateway
The gateway acts as the bridge to external networks. In home/office environments, this is the internal interface IP of the local router. It is distinct from the public WAN IP assigned by the ISP.
Domain Name System (DNS)
Because numeric IP addresses are difficult for humans to memorize, the DNS maps human-readable domain names to corresponding IPs.
Locators and Cache Hierarchy
Before querying remote servers, the system checks several local stores:
- Local Hosts File: Static mapping stored at
%SystemRoot%\System32\drivers\etc\hosts. Has highest priority. - Browser Cache: Recent queries are stored locally by the browser engine.
- OS Resolver Cache: The operating system maintains its own lookup cache.
Command:
ipconfig /displaydns(View),ipconfig /flushdns(Clear). - Router DNS Cache: Local network hardware may cache results.
- ISP/Recursive DNS Server: If missed locally, the query goes to the configured upstream resolver (e.g., Cloudflare, Google, Alibaba DNS).
Public DNS Resolvers
Common recursive resolvers include:
- Google:
8.8.8.8,8.8.4.4 - Cloudflare:
1.1.1.1 - Aliyun:
223.5.5.5 - Public:
114.114.114.114
Resolution Process Flow
- Check Local Hosts file.
- Check Browser/OS Cache.
- Query Recursive DNS Server.
- If unknown, Resolver queries Root Servers (13 logical sets).
- Root directs to TLD Server (Top-Level Domain, e.g.,
.com). - TLD directs to Authoritative Server (specific domain holder).
- Authoritative server returns the final IP address to the client.
Domain Architecture
A Fully Qualified Domain Name (FQDN) consists of segments separated by dots, read right-to-left in terms of hierarchy.
- Root Level: Implicitly the trailing dot
.representing the root zone. - TLD (Top-Level Domain): e.g.,
.cn(Country),.com(Commercial),.org(Organization). - SLD (Second-Level Domain): The registered name, e.g.,
exampleinexample.com. - Subdomains: Defined by the SLD owner, e.g.,
mail.example.com.
Example Structure:
http://www.sfn.cn
^^^ ^^^
Subdomain TLD
\\
\-- SLD
Concept Review
Insure mastery of the following topics:
- Function of subnet masks in determining network boundaries.
- Methodology for verifying if two IPs share a subnet via Boolean logic.
- Interpretation of CIDR notation (e.g.,
/16vs/24). - Relationship between Gateways and Routing tables.
- Step-by-step mechanics of DNS resolution and caching commands.
- Distinction between different domain types and ownership levels.