Typorithm · medium

IP Addressing & Subnets

ip-subnetsnetworksipv4cidrsubnet
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn IP Addressing & Subnets

0%

L3 — Network Layer

An IPv4 address is 32 bits split into a network part and a host part. CIDR notation like /24 says how many leading bits are the network; the subnet mask draws that line. 192.168.x, 10.x, and 172.16-31.x are private ranges. L3 is logical addressing — it routes between separate networks.

An IPv4 address is 32 bits, written as four dotted octets. CIDR notation appends a prefix length: /24 means the first 24 bits identify the network and the remaining 8 bits identify the host, giving 256 addresses in 192.168.1.0/24.

The subnet mask (255.255.255.0 for /24) is the boundary between the network and host parts. Two hosts share a subnet when their addresses match across all the network bits, so they can talk directly without a router.

Some ranges are reserved as private: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. Layer 3 is logical, not physical — IP addresses let routers forward packets between subnets and networks worldwide.

01

IPv4 is 32 bits: network part + host part.

02

CIDR /24 = 24 network bits, 256 addresses.

03

192.168.x, 10.x, 172.16-31.x are private.

ip addr show
ip -4 addr
# 192.168.1.10/24 -> network 192.168.1.0
ipcalc 192.168.1.10/24
ip route get 8.8.8.8

Read the implementation

Connect each part of the code to the concept before you type.

1. Show addresses

ip addr show lists every interface and the IPv4/IPv6 addresses assigned to each.

ip addr show

2. IPv4 only

The -4 flag filters the output to IPv4 addresses only.

ip -4 addr

3. CIDR notation

A /24 prefix uses the top 24 bits for the network, so 192.168.1.10 sits in network 192.168.1.0.

# 192.168.1.10/24 -> network 192.168.1.0

4. Subnet math

ipcalc expands a CIDR address into its network, broadcast, mask, and host range.

ipcalc 192.168.1.10/24

5. Resolve a route

ip route get shows which source address and route the kernel would use to reach a destination.

ip route get 8.8.8.8

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

IP Addressing & Subnets: Lesson & Practice · Typorithm | ApplyDjinn