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.

CIDRSubnet maskUsable hostsCommon use
/8255.0.0.016,777,214Large enterprise, ISP
/16255.255.0.065,534Large corporate LAN
/24255.255.255.0254Office LAN, most common
/25255.255.255.128126Splitting a /24
/26255.255.255.19262Small segment
/29255.255.255.2486Point-to-point with a few hosts
/30255.255.255.2522Router links (exactly 2 hosts)
/32255.255.255.2551Single 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.

RangeCIDRCommon use
10.0.0.0 – 10.255.255.25510.0.0.0/8Enterprise, cloud VPCs (AWS, Azure)
172.16.0.0 – 172.31.255.255172.16.0.0/12Enterprise, Docker default bridge
192.168.0.0 – 192.168.255.255192.168.0.0/16Home 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/RangePurpose
127.0.0.1 / 127.0.0.0/8Loopback — packets never leave the host
0.0.0.0/0Default route — matches any destination
255.255.255.255Limited broadcast (does not cross routers)
Network.255 (e.g., 192.168.1.255)Directed broadcast for that subnet
169.254.0.0/16Link-local / APIPA — DHCP failure indicator
224.0.0.0/4Multicast (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