Appearance
IPv4 and IPv6
IPv4
- 32-bit address → 2³² = ~4.3 billion addresses.
- Written in dotted decimal:
192.168.1.1 - 4 octets, each 0–255.
- Header size: 20–60 bytes.
IPv4 Header Key Fields
- Version (4 bits) — value = 4
- TTL — prevents infinite loops, decremented at each hop
- Protocol — TCP=6, UDP=17, ICMP=1
- Source/Destination IP
- Checksum — error checking
Address Classes (Classful — mostly obsolete)
| Class | Range | Use |
|---|---|---|
| A | 1.0.0.0 – 126.x.x.x | Large networks |
| B | 128.0.0.0 – 191.255.x.x | Medium networks |
| C | 192.0.0.0 – 223.255.255.x | Small networks |
| D | 224.0.0.0 – 239.x.x.x | Multicast |
| E | 240.0.0.0 – 255.x.x.x | Reserved |
Private IP Ranges (RFC 1918)
| Range | CIDR |
|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 |
Special Addresses
127.0.0.1→ Loopback0.0.0.0→ Default route / unspecified255.255.255.255→ Limited broadcast
IPv4 Notation Explained
192 . 168 . 1 . 1
11000000 10101000 00000001 00000001Each octet = 8 bits (decimal 0–255). Total = 32 bits.
IPv6
- 128-bit address → 2¹²⁸ = ~340 undecillion addresses.
- Written in colon-hex:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
IPv6 Compression Rules
- Leading zeros dropped:
0db8→db8 - Consecutive all-zero groups →
::(only once) - Example:
2001:db8::8a2e:370:7334
IPv6 Header (Fixed 40 bytes — simpler than IPv4)
- Version (4 bits) — value = 6
- Traffic Class — like DSCP/ToS in IPv4
- Flow Label — identifies packet flows for QoS
- Hop Limit — like TTL
- No checksum — offloaded to transport layer
IPv6 Address Types
| Type | Description | Example |
|---|---|---|
| Unicast | One-to-one | 2001:db8::1 |
| Multicast | One-to-many | FF02::1 |
| Anycast | One-to-nearest | Same as unicast format |
| No Broadcast | Replaced by multicast | — |
Special IPv6 Addresses
::1→ Loopback (equivalent to 127.0.0.1)FE80::/10→ Link-local (auto-configured, not routable)::→ Unspecified
Key Improvements of IPv6 over IPv4
- No NAT needed — every device gets a global address
- No ARP — replaced by NDP (Neighbor Discovery Protocol)
- Auto-configuration — SLAAC (Stateless Address Autoconfiguration)
- Built-in IPSec support
- Simpler header — faster routing
- No broadcast — reduces unnecessary traffic
IPv6 Notation Explained
2001 : 0db8 : 85a3 : 0000 : 0000 : 8a2e : 0370 : 7334
16b 16b 16b 16b 16b 16b 16b 16b = 128 bits totalIPv4 vs IPv6 — Side by Side
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address size | 32-bit | 128-bit |
| Address count | ~4.3 billion | ~340 undecillion |
| Header size | 20–60 bytes (variable) | 40 bytes (fixed) |
| Checksum | Yes | No |
| Broadcast | Yes | No (multicast instead) |
| ARP | Yes | No (NDP instead) |
| NAT required | Yes (usually) | No |
| Configuration | Manual / DHCP | SLAAC / DHCPv6 |
| Security | Optional IPSec | Built-in IPSec |
| Notation | Dotted decimal | Colon hexadecimal |
| Groups | 4 octets (8 bits) | 8 groups (16 bits) |
| Display format | Decimal | Hexadecimal |