IP Addressing

This page covers IPv4 and IPv6 addressing

IPv4 Address Classes

  • Class A: to , Network Prefix: 1-127
  • Class B: to , Network Prefix: 128-191
  • Class C: to , Network Prefix: 192-223
  • Class D: to , Network Prefix: 224-239
  • Class E: to , Network Prefix: 240-255

IPv4 Private Addresses

Private addresses are IP addresses that do not reach the Internet. Often used in IP infrastructure and home networks / LANs.

  • Class A: to , Network Prefix:
  • Class B: to , Network Prefix:
  • Class A: to , Network Prefix:

All other addresses are public addresses.

When a private address wants to connect with a public address, it can use network address translation (NAT) to do a conversion. As there may be many private addresses seeking to use a smaller number of public addresses, Port Address Translation (PAT) can be used, whereby private addresses can be assigned a port number on a common public IP address. See IETF RFC 3022 for more information on NAT/PAT/NAPT.


  • – First 24 bits are network, the last 8 bits are host portion
  • First three fields will be the same: 192.168.0
  • Last field will be a host address from 1 to 254
  • Default gateway is usually .1 or .254
  • Broadcast address .255
  • Network address .0 (
  • Available addresses: .1 to .254
  • 32-30=2; 2^2=4; first:;last:;usable: .1 & .2
  • The next network is the current network + the number of devices in the subnet mask
  •; next network is
  •; next network is
  • /30 can also be represented as a 30-bit subnet mask:

Subnet masks

classless inter-domain routing (CIDR) / Variable length subnetting replaced the previous class-based address ranges (A,B,C,D,E). The more flexible approach is adopted to reduce routing table size and mark more addresses available within organizations. The /number at the end of a network address is referred to as the network prefix (length) – number of bits in the network portion of the address. The /number can also be represented as a subnet mask / the number shown in the “Decimal” column below.

Source: IETF RFC 1878

IPv6 Addressing

  • Uses hexadecimal numbers 0-9 & A-F
  • 128 bits written as 8×16 bit chunks, example: ABCD:EF01:2345:6789:ABCD:EF01:2345:6789
  • If two or more consecutive fields containing 0000, then it is written as “:”
  • So, for example, default route is ::/0
  • Not necessary to show leading zeros
  • Examples:
    • ::1 /128 (loopback address)
    • :: /128 (unspecified address)
    • FF00::/8 (multicast address)
    • FE80::/10 (link-local unicast)
    • FF01::101 (example multicast address)
    • Everything else is Global Unicast
    • Anycast addresses are taken from unicast address space
    • No broadcast addresses in IPv6, Multicast used instead
  • Alternative notation
    • 0:0:0:0:0:0: or :: (alternative form when dealing with IPv4 & IPv6 addresses)
  • Unicast types
    • Global
    • Link-local
    • Site-local (deprecated)

General format of global unicast address

Source: IETF RFC 4291

Link-Local Addresses

Source: IETF RFC 4291

Anycast Addresses

Source: IETF RFC 4291

Multicast Addresses

Source: IETF RFC 4291
Source: IETF RFC 4291