Fundamentals of Internet Protocols (IPv4)

Having to plan local area networks from time to time, I find it really handy to keep these IP basics somewhere close.

Public and Private Internet Protocols (IPs)

Public IP addresses are IP addresses that are visible to the world. Private IP addresses, also known as internal IP addresses, are not visible to the world. Quite simple and obvious, isn’t it?

In the TCP/IP protocol suite, IP is the core protocol used for logical addressing. TCP/IP supports about 4 billion (232) addresses for IPv4, and mathematically 3.403×1038 (2128) addresses for IPv6. There are no duplicated IPv4 addresses, each of them is a unique 32-bit number, consisting of four 8-bit octets.

Depending on usage, IPv4 addresses are classified into five different groups: A, B, C, D and E. Three of them, classes A, B and C, have reserved private IP ranges that are used for local area networks (LAN) only.

Class Address Range Reserved Private Addresses
A 1.0.0.0 – 127.255.255.255 10.0.0.0 – 10.255.255.255
B 128.0.0.0 – 191.255.255.255 172.16.0.0 – 172.31.255.255
C 192.0.0.0 – 223.255.255.255 192.168.0.0 – 192.168.255.255
D 224.0.0.0 – 239.255.255.255 none
E 240.0.0.0 – 255.255.255.255 none

Reserved Private IP Ranges

Unlike public IP, private IP addresses are not valid on the Internet. They are reserved for LANs and cannot communicate with the Internet directly unless used with a device performing Network Address Translation (NAT).

Class From IP To IP Default Subnet Mask
Private A 10.0.0.0 10.255.255.255 255.0.0.0
Private B 172.16.0.0 172.31.255.255 255.255.0.0
Private C 192.168.0.0 192.168.255.255 255.255.255.0

Class A

The private class A range provides up to

256 * 256 * 256 – 2 = 16,777,214

hosts (usable addresses) on one network. Although eight bits have 256 possible combinations, only the numbers from 1 to 254 can be used to identify hosts in an IP address.

The number 0 is used as a network ID and represents the entire group of hosts. For example, 10.0.0.0 represents all of the hosts whose first octet is 10.

The number 255 is reserved for broadcast communications. In general, class A is used for large companies having hundreds of thousands of devices, or by extremely busy admins who don’t like to type much.

Class B

The private class B range provides up to

256 * 256 – 2 = 65,534

hosts (usable addresses) per subnet and has up to 16 subnets. The total number of usable IP addresses is

65,534 * 16 = 1,048,544

All devices using class B IP addresses share first two octets. It is usually used for medium-sized networks which require tens of thousands of private addresses.

Class C

The private class C range of IP addresses is designed to support up to 65,534 hosts. In practice, it’s used for home and small-sized network.

Network Masks Reference

CIDR Host Bits Netmask Available Addresses Classful Name
/8 24 255.0.0.0 16777216 Class A
/9 23 255.128.0.0 8388608
/10 22 255.192.0.0 4194304
/11 21 255.224.0.0 2097152
/12 20 255.240.0.0 1048576
/13 19 255.248.0.0 524288
/14 18 255.252.0.0 262144
/15 17 255.254.0.0 131072
/16 16 255.255.0.0 65536 Class B
/17 15 255.255.128.0 32768
/18 14 255.255.192.0 16384
/19 13 255.255.224.0 8192
/20 12 255.255.240.0 4096
/21 11 255.255.248.0 2048
/22 10 255.255.252.0 1024
/23 9 255.255.254.0 512
/24 8 255.255.255.0 256 Class C
/25 7 255.255.255.128 128
/26 6 255.255.255.192 64
/27 5 255.255.255.224 32
/28 4 255.255.255.240 16
/29 3 255.255.255.248 8
/30 2 255.255.255.252 4
/31 1 255.255.255.254 2
/32 0 255.255.255.255 1