AWS Solutions Architect · Module 2 · Day 6

IPv4 Addressing

⏱ 14 min read🎯 Beginner friendly🖼 1 diagram🧪 3 live demos

An IPv4 address like 192.168.1.10 looks like four random numbers. It isn’t. In this lesson you learn to read it in binary, understand which part names the network and which names the device, and use a live subnet calculator. These skills are exactly what you need to design AWS VPCs.

In this session

  • IPv4 = 32 bits in four octets (0–255)
  • Binary ⇄ decimal with a live converter
  • Special addresses: 0.0.0.0, 255.255.255.255, 127.0.0.1
  • Which pairs of PCs can talk, and why
  • Subnet masks, CIDR and a live subnet calculator
  • AWS reserves 5 addresses per subnet

01What an IPv4 address looks like

IPv4 = 32 bits, written as four numbers (octets) separated by dots. Each octet is 8 bits, so it can be 0 to 255.
octetbinary (8 bits)1921st110000001682nd1010100013rd00000001104th00001010
192.168.1.10 = 11000000.10101000.00000001.00001010 (4 × 8 = 32 bits).

02Binary ⇄ decimal: the easy trick

Each of the 8 positions has a value. Start at 1 and keep doubling: 128, 64, 32, 16, 8, 4, 2, 1. Add the values wherever the bit is 1. All eight 1s = 255.

Demo · Binary converter
BinaryWorkingDecimal
10110001128 + 32 + 16 + 1177
11000000128 + 64192
10101000128 + 32 + 8168
000010108 + 210
11111111all of them255
Decimal → binary: go through 128, 64, 32… If the value fits in what is left, write 1 and subtract; otherwise write 0. Example 192: 128 fits (64 left), 64 fits (0 left), rest 0 → 11000000.

03Special addresses

AddressNameMeaning
0.0.0.0“any” address“this device” or “all addresses”; never given to a PC. In AWS, 0.0.0.0/0 = anywhere on the internet
255.255.255.255limited broadcasta message to every device on the local network
127.0.0.1loopback (localhost)the computer talking to itself
224–239.x.x.xmulticastone-to-many groups
240–255.x.x.xreservedresearch only

So normal devices use first octets 1–223, except 127.

04Can these two PCs talk?

Two PCs on one cable can talk only if they are in the same network and have different, usable addresses. Here the network is 1.0.0.0 with mask 255.0.0.0:

Demo · Valid or invalid?
Fine print: the rule is about the whole host part, not just the last number. In network 1 with mask 255.0.0.0, 1.0.5.0 is a valid device address; only 1.0.0.0 (all host bits 0) is the network ID.

05Subnet mask and CIDR

An IP address has a fixed part (the network) and a changing part (the devices). The subnet mask marks them: 255 = network, 0 = device. CIDR is the short form: count the 1-bits in the mask.

Subnet maskCIDRNetwork partAddresses
255.0.0.0/8first octet16,777,216
255.255.0.0/16first two octets65,536
255.255.255.0/24first three octets256
255.255.255.240/2828 bits16
255.255.255.255/32all 32 bits1 (a single IP)
Formula: addresses = 2(32 − prefix). Usable for devices = addresses − 2 (network ID and broadcast). In AWS, subtract 5.
Demo · Subnet calculator
AWS reserves in every subnetExample in 10.0.1.0/24
Network address10.0.1.0
VPC router10.0.1.1
DNS server10.0.1.2
Future use10.0.1.3
Broadcast (not supported, still reserved)10.0.1.255
🎯 Exam corner
  • A /24 subnet in AWS gives 251 usable IPs (256 − 5).
  • VPC and subnet sizes in AWS: from /16 (65,536) to /28 (16).
  • /32 = exactly one IP (e.g. “My IP” in a security group). 0.0.0.0/0 = everyone.

06Why IP addresses were divided up

If whole first-octet networks like 1.x.x.x (16.7 million addresses) were given to single companies, there would be room for only about 255 companies, and most addresses would be wasted. So IANA (which allocates addresses) and the IETF (which writes internet standards) divided addresses into classes of different sizes. That is Day 7.

What came after: in 1993 the internet moved to CIDR (any prefix length, not only /8, /16, /24). AWS uses CIDR everywhere. IPv4 running out is also why IPv6 (128-bit) exists, and since February 2024 AWS charges for every public IPv4 address.

07Summary

08Quick quiz

1. Convert 11000000 to decimal.

2. How many bits in an IPv4 address?

3. Can PC1 = 1.0.0.1 and PC2 = 1.0.0.0 communicate?

4. How many addresses in a /24?

5. Usable IPs in a /24 subnet in AWS?

09References

Created by Ajeetkumar