UnixDroid

Lesson 2 of 6 · 7 min

Step 2: IP addresses and subnets

If you don't know what /24 means, you don't know what you're scanning. Learn CIDR in five minutes.

Nmap needs a target: one IP, a list, or a whole range. Ranges are written in CIDR notation, like 192.168.1.0/24.

What /24 means

An IPv4 address has 32 bits. The number after the slash says how many bits are fixed (the network part). The rest can change (the hosts).

CIDRAddressesExample range
/321just 192.168.1.10
/304192.168.1.8 – .11
/24256192.168.1.0 – .255
/1665,536192.168.0.0 – 192.168.255.255

So /24 = 256 addresses. Type /16 by mistake and you scan 256 times more machines than you meant to.

Find your own lab subnet

ip a

Look for something like inet 10.0.2.15/24. In your lab, that's the range you scan:

nmap -sn 10.0.2.0/24

-sn only checks which hosts are up, without scanning ports.

Want more detail? IP addresses and subnets in the Networking path.

Try it yourself
  1. Run ip a and write down your IP and prefix.
  2. Work out how many addresses your subnet has.
  3. Run a host-discovery scan (-sn) on your lab subnet only.
No Linux machine? Practise in the free online terminal

Quick check

How many addresses does a /24 cover? (number)

Need a hint?

2 to the power of (32 − 24).

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 →