• Post author:Bhaskar Soni
  • Post published:
  • Post category:Networking
  • Post comments:0 Comments
  • Reading time:3 mins read

Every device on a network needs an address so that data can reach it. That address is the IP (Internet Protocol) address. Two versions are in use today: IPv4, the original, and IPv6, its much larger successor. This guide explains how IPv4 and IPv6 addresses work, how to read them and how they differ.

IPv4 and IPv6

What an IP address does

An IP address identifies a device’s network interface and tells routers where to send packets. It works at the network layer, together with TCP or UDP at the transport layer, which is why people often speak of TCP/IP. Read more in the TCP/IP model.

IPv4 addresses

An IPv4 address is 32 bits long, written as four decimal numbers (octets) from 0 to 255, separated by dots, for example 192.168.1.10.

IPv4 address structure with network and host portions

Converting to binary

Each octet is 8 bits with place values 128, 64, 32, 16, 8, 4, 2 and 1. To convert 29, add values until you reach it: 16 + 8 + 4 + 1 = 29, so 29 = 00011101.

Network and host portions

A subnet mask or prefix length splits the address into a network part and a host part. With 192.168.1.10/24, the first 24 bits (192.168.1) identify the network and the last 8 bits identify the host.

Classes and CIDR

Originally, IPv4 used fixed classes:

ClassFirst octetDefault maskUse
A1 to 126/8Very large networks
B128 to 191/16Medium networks
C192 to 223/24Small networks
D224 to 239—Multicast
E240 to 255—Reserved

Since 1993, the internet has used CIDR (classless inter-domain routing), so networks can have any prefix length, such as /26 or /20. Classes now matter mostly for exams.

Private and special addresses

RangePurpose
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private networks (RFC 1918)
127.0.0.0/8Loopback (localhost)
169.254.0.0/16Link-local; often means DHCP failed
100.64.0.0/10Carrier-grade NAT

Because IPv4 has only about 4.3 billion addresses, most networks use private addresses with NAT to share public ones.

IPv6 addresses

An IPv6 address is 128 bits long, written as eight groups of four hexadecimal digits separated by colons, for example 2001:0db8:0000:0000:0000:ff00:0042:8329.

IPv6 address format and shortening rules

Shortening rules

  1. Drop leading zeros in each group: 0db8 becomes db8.
  2. Replace one run of consecutive all-zero groups with ::, but only once per address.

So the example becomes 2001:db8::ff00:42:8329.

Common IPv6 address types

  • Global unicast (2000::/3): public addresses.
  • Unique local (fc00::/7): private addresses.
  • Link-local (fe80::/10): used on a single link; every interface has one.
  • Multicast (ff00::/8): one-to-many. IPv6 has no broadcast.
  • Loopback: ::1.

IPv4 vs IPv6

FeatureIPv4IPv6
Length32 bits128 bits
FormatDotted decimalHexadecimal with colons
Address spaceAbout 4.3 billionAbout 3.4 × 10³⁸
ConfigurationManual or DHCPSLAAC, DHCPv6 or manual
BroadcastYesNo (multicast instead)
NATCommonNot needed in normal designs
HeaderVariable length with optionsFixed 40-byte header, extension headers

Should you use IPv6?

Yes. Major mobile networks, cloud providers and content networks support it, and a large share of internet traffic in India already uses IPv6. Most networks run dual stack, using both versions at once. Remember to apply firewall rules to IPv6 too, because an unfiltered IPv6 path is a common security gap.

Related guides

Sources

Need help with network security? We test routers, firewalls, ACLs and segmentation as part of our VAPT services and hardening audits. Contact us for a quote.

Post author avatar

Bhaskar Soni

Bhaskar Soni is a Security Engineer and the founder of Youngster Company, based in Ahmedabad, Gujarat. He works hands-on with Linux server hardening, vulnerability assessment and penetration testing (VAPT), ISO 27001 compliance and OSINT investigations. He writes practical, tested guides for IT professionals and Indian businesses, and every article on this site is written or reviewed by him.

Leave a Reply