A2.3.1 — IP Addressing
The Internet Protocol (IP)
IP facilitates the routing and delivery of packets across networks. Every device connected to a network using IP is assigned an IP address, a unique numerical identifier used for communication.
IPv4 vs IPv6
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address size | 32-bit | 128-bit |
| Format | Dotted decimal — 192.168.1.1Each segment: 0–255 | 8 groups of 4 hex digits — 2001:0db8:85a3::8a2e:0370:7334 |
| Total addresses | ~4.3 billion | ~340 undecillion (3.4 × 10³⁸) |
| Header | Complex — 14 fields | Simplified — 8 fixed fields |
| IPsec support | Optional | Mandatory |
Public vs Private IP Addresses
Public IP Addresses
- Assigned to devices that directly access the internet.
- Globally unique. No two devices can share the same public IP
- Managed and allocated by IANA (Internet Assigned Numbers Authority) via regional registries.
- Used by web servers, email servers, and any internet-accessible device.
Private IP Addresses
- Used within a private network , not exposed to the internet.
- Defined by RFC 1918. Not routed on the internet ,reusable by anyone in private networks.
- Devices need NAT to communicate with the internet.
Special: Loopback Address
- IPv4:
127.0.0.1— directs network traffic back to the device itself. Range127.0.0.0–127.255.255.255reserved for loopback. - IPv6:
::1(shorthand for0000:0000:0000:0000:0000:0000:0000:0001). - Used for testing network software on the local machine without sending data over a real network.
Static vs Dynamic IP Addresses
| Static | Dynamic | |
|---|---|---|
| Assignment | Permanently assigned. Does not change. | Assigned temporarily by a DHCP server. May change on each connection. |
| Configuration | Manually configured by a network administrator. | Automatically configured, no manual input needed. |
| Best for | Web servers, email servers, printers. anything needing a stable, consistent address. | End-user devices — laptops, phones, home PCs. Efficiently manages limited IP pools. |
NAT — Network Address Translation
IPv4 doesn't have enough addresses for every device to have a unique public IP. NAT solves this by allowing many private IP addresses to share a single public IP address.
How NAT works
- A device on the private network sends a packet to the internet.
- The router (NAT device) replaces the device's private IP and source port with the router's public IP and a modified port number.
- The modified packet is sent to the internet.
- When a response arrives, the router consults its internal NAT table to find which private device the response belongs to.
- The router translates the public IP + port back to the correct private IP + port and forwards it to the device.
sUMMARY:
- IPv4 = 32-bit, dotted decimal. IPv6 = 128-bit, hexadecimal with colons.
- Private IPs: 10.x.x.x, 172.16–31.x.x, 192.168.x.x. These are never routed on the internet.
- 127.0.0.1 = loopback = the device talking to itself.
- NAT = many private IPs → one public IP. Solves IPv4 shortage without needing everyone to switch to IPv6.