UnixDroid

Lesson 1 of 5 · 7 min

IP addresses and subnets

What an IP address really is, which ranges are private, and what /24 means, explained without heavy maths.

Every device on a network needs an address so data knows where to go. That's the IP address. The common version, IPv4, is four numbers from 0 to 255 separated by dots, like 192.168.1.20.

Private IP ranges, loopback, link-local and what a /24 subnet means
Private IP ranges, loopback, link-local and what a /24 subnet means

Find your own IP

ip a          # Linux
ipconfig      # Windows

On Linux, look for a line starting with inet under your network card, such as inet 192.168.1.20/24.

Private vs public

Some ranges are reserved for private networks, like your home Wi-Fi or an office LAN. They're never routed on the public internet, so millions of homes can all use 192.168.1.x at the same time:

RangeTypical use
10.0.0.0/8Large companies
172.16.0.0/12Companies, cloud networks, Docker
192.168.0.0/16Homes, small offices, labs

Your router has one public IP from your ISP and shares it with every device at home. Check yours with curl ifconfig.me.

Two special ones are worth remembering: 127.0.0.1 always means "this machine", and an address starting with 169.254 usually means your device asked for an address and nobody answered.

What /24 means

The number after the slash says how many of the 32 bits are the network part. The rest are for devices.

CIDRAddressesFeels like
/321One single machine
/24256A typical home or lab network
/1665,536A big office
/816.7 millionA huge organisation

In a /24 like 192.168.1.0/24, the first address (.0) names the network and the last (.255) is the broadcast address. That leaves 254 addresses for devices. The router is usually .1.

Why hackers care

When you scan a network, the first thing you need is its range. nmap -sn 192.168.56.0/24 only works because you understand what that /24 covers. Get the range wrong and you either miss machines or scan things you have no permission to touch.

IPv6 addresses look different (fe80::1c2b:...) and are much longer, but the same idea applies: a network part and a device part.

Try it yourself
  1. Run ip a (or ipconfig) and write down your IP address and its /number.
  2. Work out your network range. For example, 192.168.1.20/24 means 192.168.1.0 to 192.168.1.255.
  3. Run curl ifconfig.me and compare your public IP with your private one.
No Linux machine? Practise in the free online terminal

Quick check

How many usable device addresses are in a /24 network?

Need a hint?

256 minus two.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →