ITNuvoAkademiya
Academy homePackagesPlaylistsToolsSubnet calculatorSearchGlossary
CiscoCCNA · CCNA: networking fundamentals1. Introduction2. Network Fundamentals3. Network Access4. IP Connectivity5. IP Services6. IPv67. Security Fundamentals8. AutomationCCNP: Enterprise networks · coming soon
LinuxLinux: system administrator üçün · Linux for system administrators1. Getting to know Linux2. Working with text3. Users and permissions4. Processes and packages5. Inside the system6. Monitoring and logs7. NetworkingRed Hat Enterprise Linux · Red Hat Enterprise Linux: from beginner to advanced1. Getting started2. Packages3. Users and permissions4. SELinux5. Services6. Storage7. Networking8. Building services9. Boot and recovery10. DevOps11. Security and monitoring
FortinetFortiGate Administrator · FortiGate Administrator: from first login to ZTNA1. Getting to know FortiGate2. Routing, policy and NAT3. Security profiles4. Users and logs5. Resilience, SD-WAN and automation6. VDOM7. VPN and ZTNA8. Proxy9. DMZ
MonitoringZabbix · Zabbix: from installation to alerts1. Introduction2. Installation and the database3. Basics: groups, templates, users4. Connecting devices5. Alerts, Grafana and the API
VirtualizationProxmox VE · coming soonVMware ESXi · coming soon
My account / Sign in
AZENRU
← itnuvo.com

IP addresses and subnetting: calculating on Linux

Lesson 7.28 minIntermediateDecember 1, 2026
Open

This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.

Key points

  • 10.20.0.15/24: /24 — the first 24 bits of the address are the network, mask 255.255.255.0.
  • Number of hosts = 2^(32 − prefix) − 2: /24 → 254, /26 → 62, /30 → 2.
  • The network address (first) and broadcast (last) are not given to hosts.
  • Private ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 — not routed on the internet.
  • ipcalc 10.20.0.15/26 shows the network, mask, first/last host and broadcast; ipcalc 10.20.0.0/24 -s 50 50 suggests a split.

CIDR notation

An IPv4 address is 32 bits and has two parts: the network and the host. The mask says where they split. In CIDR notation the mask is written after a slash as a number of bits:

CIDRMaskAddressesHostsWhere
/8255.0.0.016 777 21616 777 214A large private network (10.0.0.0/8)
/16255.255.0.065 53665 534Campus
/24255.255.255.0256254A typical office/server VLAN
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614A small DMZ
/30255.255.255.25242A link between two routers
/32255.255.255.25511A single host (loopback, route)

Rule: hosts = 2^(32 − prefix) − 2. Two addresses are subtracted: the network address (all host bits 0) and the broadcast (all host bits 1).

Calculating by hand: 10.20.0.15/26

  1. /26 — in the last octet 2 bits belong to the network and 6 to the host. Block size 2^6 = 64.
  2. Blocks in the last octet: 0, 64, 128, 192.
  3. 15 is in the first block (0–63).
  4. Network: 10.20.0.0, broadcast: 10.20.0.63, hosts: 10.20.0.1–10.20.0.62.

Quick method: block size = 256 − the mask's last octet. /26 → 256 − 192 = 64.

Checking with ipcalc

srv-web01
ali@srv-web01:~$ sudo apt install -y ipcalc
ali@srv-web01:~$ ipcalc -b 10.20.0.15/26
Address:   10.20.0.15
Netmask:   255.255.255.192 = 26
Wildcard:  0.0.0.63
=>
Network:   10.20.0.0/26
HostMin:   10.20.0.1
HostMax:   10.20.0.62
Broadcast: 10.20.0.63
Hosts/Net: 62                    Class A, Private Internet

Wildcard is the inverse mask used in Cisco ACLs — a familiar number for network admins.

Splitting a network

The 10.20.0.0/24 network must be split into three parts: servers (50 hosts), staff (100 hosts), management (10 hosts). We allocate from largest to smallest:

srv-web01
ali@srv-web01:~$ ipcalc -b 10.20.0.0/24 -s 100 50 10 | grep -E "^(Network|HostMin|HostMax)"
Network:   10.20.0.0/25
HostMin:   10.20.0.1
HostMax:   10.20.0.126
Network:   10.20.0.128/26
HostMin:   10.20.0.129
HostMax:   10.20.0.190
Network:   10.20.0.192/28
HostMin:   10.20.0.193
HostMax:   10.20.0.206
SegmentNeededSubnetHosts
Staff10010.20.0.0/25.1 – .126
Servers5010.20.0.128/26.129 – .190
Management1010.20.0.192/28.193 – .206

This method is called VLSM: each segment gets a size that fits its needs, and no addresses are wasted.

Special ranges

RangeWhat it is
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private (RFC 1918) — reach the internet through NAT
127.0.0.0/8Loopback — the server itself
169.254.0.0/16Link-local — an automatic address when DHCP does not answer
100.64.0.0/10Provider NAT (CGNAT)
0.0.0.0/0"All addresses" — the default route

If you see a 169.254.x.x address on a server, it means the DHCP server did not answer.

Small checks on Linux

srv-web01
ali@srv-web01:~$ ip -4 -br a show ens18
ens18            UP             10.20.0.15/24
ali@srv-web01:~$ ip route get 10.20.0.20
10.20.0.20 dev ens18 src 10.20.0.15 uid 1000
    cache
ali@srv-web01:~$ ip route get 8.8.8.8
8.8.8.8 via 10.20.0.1 dev ens18 src 10.20.0.15 uid 1000
    cache

ip route get says: 10.20.0.20 is on the same network — it goes directly; 8.8.8.8 is on another network — it goes via the gateway 10.20.0.1. If the mask is wrong (for example /32), even neighbouring servers are treated as "another network" — a typical configuration mistake.

In the Linux simulator, check which network addresses fall into with ip -br a and ip route get.

Check yourself

5 questions · answers are shown instantly · 3 correct answers complete the lesson

1How many host addresses does a /26 network have?

2^6 = 64, minus the network and broadcast addresses.

2Which network does 10.20.0.100/26 belong to?

The blocks are 64: 0, 64, 128, 192; 100 is in the second block.

3What is the /28 mask?

256 − 16 = 240.

4You see the address 169.254.12.7 on a server. What does it mean?

169.254.0.0/16 is the link-local range.

5What does ip route get 10.20.0.20 show?

It shows the kernel's routing decision.
Was this lesson useful?

Comments

Sign in to comment.