Understanding IP Addressing
IP addressing is the foundation of all network configuration. Every server needs an IP address, subnet mask, and default gateway to communicate. Understanding how these work — not just copying examples — lets you configure interfaces correctly, troubleshoot connectivity issues, and understand why certain addresses are reserved or unreachable.
IPv4 address structure
IP address: 192.168.1.10 with subnet mask 255.255.255.0
In binary:
192.168.1.10 = 11000000.10101000.00000001.00001010
255.255.255.0 = 11111111.11111111.11111111.00000000
↑
Network part (1s) Host part (0s)
Network address: 192.168.1.0 (all host bits = 0)
Broadcast: 192.168.1.255 (all host bits = 1)
Usable hosts: 192.168.1.1 — 192.168.1.254 (254 hosts)CIDR notation
CIDR (Classless Inter-Domain Routing) notation replaces the verbose subnet mask with a prefix length: the number of network bits.
| CIDR | Subnet mask | Usable hosts | Common use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Large enterprise, ISP |
| /16 | 255.255.0.0 | 65,534 | Large corporate LAN |
| /24 | 255.255.255.0 | 254 | Office LAN, most common |
| /25 | 255.255.255.128 | 126 | Splitting a /24 |
| /26 | 255.255.255.192 | 62 | Small segment |
| /29 | 255.255.255.248 | 6 | Point-to-point with a few hosts |
| /30 | 255.255.255.252 | 2 | Router links (exactly 2 hosts) |
| /32 | 255.255.255.255 | 1 | Single host route, loopback |
Private address ranges
RFC 1918 defines three blocks of IP addresses reserved for private use. These addresses are not routed on the public internet — routers at the internet edge will drop packets with these as destination addresses.
| Range | CIDR | Common use |
|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | Enterprise, cloud VPCs (AWS, Azure) |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | Enterprise, Docker default bridge |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | Home networks, small offices |
# Check if an IP is publicly routable or private (conceptually)
# Private:
# 10.x.x.x, 172.16-31.x.x, 192.168.x.x, 127.x.x.x, 169.254.x.x
# 169.254.x.x is APIPA (Automatic Private IP Addressing)
# Assigned when DHCP fails — if you see this, DHCP is not working
Special IP addresses
| Address/Range | Purpose |
|---|---|
| 127.0.0.1 / 127.0.0.0/8 | Loopback — packets never leave the host |
| 0.0.0.0/0 | Default route — matches any destination |
| 255.255.255.255 | Limited broadcast (does not cross routers) |
| Network.255 (e.g., 192.168.1.255) | Directed broadcast for that subnet |
| 169.254.0.0/16 | Link-local / APIPA — DHCP failure indicator |
| 224.0.0.0/4 | Multicast (used by routing protocols, mDNS) |
Viewing addresses on Ubuntu
# Show all IP addresses
ip addr show
# Show only IPv4 addresses
ip -4 addr show
# Show only IPv6 addresses
ip -6 addr show
# Show addresses in a specific interface
ip addr show ens3
# Find your public IP address
curl -s https://checkip.amazonaws.com
# Check if an address is reachable (basic connectivity)
ping -c 3 192.168.1.1 # Gateway
ping -c 3 8.8.8.8 # External IP
ping -c 3 google.com # DNS + routing
Conclusion
An IP address combined with a subnet prefix length tells you the network boundary: addresses within the same /24 can communicate directly; addresses in different subnets need a router (gateway). The most common server network is a /24 giving 254 usable hosts. Use ip addr show to see addresses, and if you see a 169.254.x.x address on a server, that is an APIPA address indicating DHCP failed — investigate the DHCP server or switch connectivity before anything else.
Need help with Ubuntu administration?
Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.
Work with Muhammad Irfan Aslam