IP Addressing

This page covers IPv4 and IPv6 addressing

IPv4 Address Classes

  • Class A: 1.0.0.0 to 127.255.255.255 , Network Prefix: 1-127
  • Class B: 128.0.0.0 to 191.255.255.255 , Network Prefix: 128-191
  • Class C: 192.0.0.0 to 223.255.255.255 , Network Prefix: 192-223
  • Class D: 224.0.0.0 to 239.255.255.255 , Network Prefix: 224-239
  • Class E: 240.0.0.0 to 255.255.255.255 , 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: 10.0.0.1 to 10.255.255.255 , Network Prefix: 10.0.0.0/8
  • Class B: 172.16.0.1 to 172.31.255.255 , Network Prefix: 17.16.0.0/12
  • Class A: 192.68.0.1 to 192.168.255.255 , Network Prefix: 192.168.0.0/16

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.

Subnetting

  • 198.168.0.0/24 – 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 (192.168.0.0)
  • Available addresses: .1 to .254
  • 192.168.11.0/30
  • 32-30=2; 2^2=4; first: 192.168.11.1;last:192.168.11.3;usable: .1 & .2
  • The next network is the current network + the number of devices in the subnet mask
  • 192.168.0.1/24; next network is 192.168.1.0/24
  • 192.168.11.0/30; next network is 192.168.11.4/30
  • /30 can also be represented as a 30-bit subnet mask: 255.255.255.252

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:13.1.68.3 or ::13.1.68.3 (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