What is an IP address, and how is it structured?


Let's delve into more technical details about IP addresses:

IPv4 Address Structure:

  1. Binary Representation:
    • An IPv4 address is a 32-bit binary number.
    • Example: 11000000101010000000000100000001
  2. Dotted-Decimal Notation:
    • To make it more human-readable, IPv4 addresses are expressed in dotted-decimal format.
    • Example: 192.168.0.1
    • Each octet (8 bits) is represented by a decimal number.
  3. Classes (Historical):
    • IPv4 originally had classes (A, B, C, D, E) with predefined network and host portions.
    • Class A: 0.0.0.0 to 127.255.255.255
    • Class B: 128.0.0.0 to 191.255.255.255
    • Class C: 192.0.0.0 to 223.255.255.255
    • Class D: 224.0.0.0 to 239.255.255.255 (Multicast)
    • Class E: 240.0.0.0 to 255.255.255.255 (Reserved)
  4. Subnetting and CIDR:
    • Classful addressing is largely replaced by CIDR.
    • CIDR allows more flexible allocation of IP addresses.
    • Example CIDR notation: 192.168.0.0/24
  5. Reserved Addresses:
    • Some IP addresses are reserved for special purposes:
      • 127.0.0.1: Loopback (localhost)
      • 0.0.0.0: Unspecified address
      • 255.255.255.255: Broadcast (limited broadcast)

IPv6 Address Structure:

  1. Binary Representation:
    • IPv6 addresses are 128-bit binary numbers.
    • Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334
  2. Hexadecimal Notation:
    • IPv6 addresses are expressed in hexadecimal with colons separating each 16-bit group.
    • Shortening consecutive groups of zeros is allowed (e.g., ::1 for 0000:0000:0000:0000:0000:0000:0000:0001).
  3. Address Types:
    • Global Unicast: Routable on the Internet.
    • Link-Local: Used for communication on a single network segment.
    • Site-Local (deprecated): Restricted to a specific site.
  4. IPv4-Mapped Addresses:
    • IPv6 can represent IPv4 addresses for compatibility.
    • Example: ::ffff:192.168.0.1
  5. Reserved Addresses:
    • Similar to IPv4, IPv6 has reserved addresses, including the loopback (::1) and unspecified (::).
  6. IPv6 Prefixes:
    • IPv6 addresses include a prefix to denote the network and subnet.
    • Example Prefix: 2001:0db8:85a3::/48