Cisco & Networking · Lesson 03

IPv4 Addressing & Subnet Masks

Learn how IPv4 addresses, subnet masks, prefix lengths, network IDs, broadcast addresses, usable host ranges, and default gateways work together to define local and routed communication.

Correct addressing is the foundation for later subnetting, routing, VLAN, ACL, and troubleshooting work. The goal is to calculate and verify instead of guessing from how an address looks.

Lesson Snapshot

IPv4 bits32
Common masks13
Address categories8
Main goalCalculate, then verify

Learning objectives

Read IPv4 addressing as network structure

01

Explain how an IPv4 address is divided into network and host portions by the subnet mask.

02

Recognize private, public, loopback, link-local, multicast, and other common IPv4 address categories.

03

Convert common subnet masks and prefix lengths and explain what they mean.

04

Determine whether two IPv4 hosts are on the same subnet.

05

Identify valid host addresses, network addresses, broadcast addresses, and default gateways in common scenarios.

06

Use addressing evidence to troubleshoot misconfigured hosts and interfaces without changing unrelated settings.

Core idea

The mask gives the address meaning

The same IPv4 address can belong to different-sized networks depending on its subnet mask. Never decide the subnet from the address alone.

Competition trap

Do not assume /24 or gateway .1

Those are common conventions, not universal rules. Use the scenario, device configuration, and actual mask to determine the intended design.

Core concepts

Six pieces of IPv4 subnet reasoning

IPv4 address

A 32-bit logical address usually written as four decimal octets, such as 192.168.10.25.

Subnet mask

A 32-bit value that identifies which bits of the IPv4 address belong to the network portion and which belong to the host portion.

Prefix length

CIDR notation such as /24 that states how many leading bits belong to the network portion.

Network address

The first address in a subnet. It identifies the subnet itself and is not normally assigned to an ordinary host.

Broadcast address

The final IPv4 address in a traditional subnet, used to address all hosts on that local subnet.

Usable host range

The addresses between the network and broadcast addresses that can normally be assigned to devices.

Binary foundation

Every IPv4 octet is eight binary bits

128

Bit 1

Most significant bit in an octet

64

Bit 2

Second binary place value

32

Bit 3

Third binary place value

16

Bit 4

Fourth binary place value

8

Bit 5

Fifth binary place value

4

Bit 6

Sixth binary place value

2

Bit 7

Seventh binary place value

1

Bit 8

Least significant bit in an octet

19211000000

128 + 64

16810101000

128 + 32 + 8

22411100000

128 + 64 + 32

24011110000

128 + 64 + 32 + 16

24811111000

128 + 64 + 32 + 16 + 8

25211111100

128 + 64 + 32 + 16 + 8 + 4

CIDR and masks

Common prefix lengths to recognize quickly

PrefixSubnet maskTotal blockTraditional usable hosts
/8255.0.0.016,777,216 addresses16,777,214 traditional usable hosts
/16255.255.0.065,536 addresses65,534 traditional usable hosts
/20255.255.240.04,096 addresses4,094 traditional usable hosts
/21255.255.248.02,048 addresses2,046 traditional usable hosts
/22255.255.252.01,024 addresses1,022 traditional usable hosts
/23255.255.254.0512 addresses510 traditional usable hosts
/24255.255.255.0256 addresses254 traditional usable hosts
/25255.255.255.128128 addresses126 traditional usable hosts
/26255.255.255.19264 addresses62 traditional usable hosts
/27255.255.255.22432 addresses30 traditional usable hosts
/28255.255.255.24016 addresses14 traditional usable hosts
/29255.255.255.2488 addresses6 traditional usable hosts
/30255.255.255.2524 addresses2 traditional usable hosts

Traditional host formula

usable hosts = 2^(host bits) - 2

This traditional formula reserves the all-zero host value for the network address and the all-one host value for broadcast. Special point-to-point designs can use different standards, but traditional competition subnet questions usually follow this model.

Address categories

Recognize addresses that have special meaning

10.0.0.0/8

Private IPv4

Used inside private networks and not globally routed on the public Internet.

172.16.0.0/12

Private IPv4

Covers 172.16.0.0 through 172.31.255.255.

192.168.0.0/16

Private IPv4

Very common in local networks, labs, and home environments.

127.0.0.0/8

Loopback

Used for local host testing. 127.0.0.1 is the familiar loopback address.

169.254.0.0/16

Link-local

Often appears when a host cannot obtain normal IPv4 configuration and self-assigns a local address.

224.0.0.0/4

Multicast

Used for one-to-many group communication rather than ordinary unicast host addressing.

0.0.0.0

Unspecified / default context

Can mean no specific local address or appear in default-route notation such as 0.0.0.0/0.

255.255.255.255

Limited broadcast

Represents a local limited broadcast and is not an ordinary host address.

Same subnet?

Compare network IDs, not visual similarity

01

Write down both IP addresses

Example: 192.168.10.25 and 192.168.10.200.

02

Confirm the subnet mask

Example: 255.255.255.0, which is /24.

03

Identify the network portion

With /24, the first 24 bits are the network portion, so the first three octets identify the network.

04

Compare the resulting network IDs

Both addresses belong to network 192.168.10.0/24, so they are local peers.

05

If the network IDs differ, use a router

Hosts on different IPv4 subnets need Layer 3 forwarding to communicate.

Worked subnet examples

Find network, broadcast, and usable range

192.168.10.25/24
Network

192.168.10.0

Broadcast

192.168.10.255

Usable

192.168.10.1 - 192.168.10.254

A /24 leaves 8 host bits, so the fourth octet ranges from 0 through 255.

192.168.10.140/25
Network

192.168.10.128

Broadcast

192.168.10.255

Usable

192.168.10.129 - 192.168.10.254

A /25 splits the /24 into blocks of 128 addresses: 0-127 and 128-255.

10.20.30.70/26
Network

10.20.30.64

Broadcast

10.20.30.127

Usable

10.20.30.65 - 10.20.30.126

A /26 creates blocks of 64 addresses in the final octet.

172.16.5.94/27
Network

172.16.5.64

Broadcast

172.16.5.95

Usable

172.16.5.65 - 172.16.5.94

A /27 creates blocks of 32 addresses: 0, 32, 64, 96, and so on.

192.168.50.14/28
Network

192.168.50.0

Broadcast

192.168.50.15

Usable

192.168.50.1 - 192.168.50.14

A /28 creates blocks of 16 addresses.

10.1.1.6/30
Network

10.1.1.4

Broadcast

10.1.1.7

Usable

10.1.1.5 - 10.1.1.6

A traditional /30 gives four addresses: network, two usable hosts, and broadcast.

Block-size shortcut

Find subnet boundaries quickly in the changing octet

/25Mask octet 128
256 - 128 = 128

Starts: 0, 128

/26Mask octet 192
256 - 192 = 64

Starts: 0, 64, 128, 192

/27Mask octet 224
256 - 224 = 32

Starts: 0, 32, 64, 96, 128, 160, 192, 224

/28Mask octet 240
256 - 240 = 16

Starts: 0, 16, 32, 48, 64, ...

/29Mask octet 248
256 - 248 = 8

Starts: 0, 8, 16, 24, 32, ...

/30Mask octet 252
256 - 252 = 4

Starts: 0, 4, 8, 12, 16, ...

Default gateway

The local next hop for remote networks

Default gateway

The Layer 3 next hop a host uses when the destination is outside its local subnet.

Gateway must be reachable locally

The host must be able to reach the gateway on its local Layer 2 segment.

Gateway is not automatically .1

Many networks use the first usable address, but the gateway can be any valid host address chosen by the design.

Wrong gateway affects remote traffic

A host can sometimes communicate locally while failing to reach remote networks if its gateway is wrong.

Gateway mask must match design

The router or Layer 3 interface must use addressing consistent with the intended subnet.

Multiple gateways can exist in advanced designs

Redundancy protocols and complex topologies can present virtual gateways or multiple routed paths.

Cisco inspection

Verify the Layer 3 device state

show ip interface brief

Review Cisco interface IPv4 addresses and operational state.

show running-config | section interface

Review interface configuration in supported IOS environments.

show interfaces

Review detailed interface state and counters.

show ip route connected

Review directly connected IPv4 networks recognized by the router.

show ip route

Review the complete IPv4 routing table.

show arp

Review learned IPv4-to-MAC mappings on supported devices.

ping 192.168.10.1

Test Layer 3 reachability to a specific address.

traceroute 192.168.30.10

Observe the routed path toward a destination when supported.

Endpoint inspection

Verify what the host actually believes

Windows endpoint

ipconfig /all

Review assigned IPv4 address, subnet mask, gateway, DNS, DHCP state, and adapter details.

Linux endpoint

ip addr

Review assigned IPv4 and IPv6 addresses and interface state.

Linux endpoint

ip route

Review local routes and default gateway.

Packet Tracer PC

Desktop > IP Configuration

Review or configure simulated address, mask, gateway, and DNS values.

Packet Tracer PC

Command Prompt > ipconfig

Inspect addressing from the simulated endpoint command line.

Packet Tracer PC

Command Prompt > ping <address>

Test simulated IPv4 reachability.

Addressing symptoms

Use the symptom to narrow the likely cause

Host can reach same-subnet peers but not remote networks

Default gateway, routing beyond the gateway, ACLs, or upstream policy.

Host cannot reach another host that should be local

Wrong subnet mask, wrong VLAN, duplicate IP, interface issue, local firewall, or Layer 2 path.

Host has 169.254.x.x

DHCP failure or missing manual configuration, depending on the scenario.

Two devices use the same IPv4 address

Duplicate address conflict causing intermittent or incorrect delivery.

Router interface and host appear close numerically but cannot communicate

Do not rely on visual similarity. Calculate the actual network ID from the mask.

Host uses the network or broadcast address

Invalid traditional host assignment for that subnet.

Evidence-based reasoning

Calculate before changing

Host 192.168.10.25/24 cannot reach 192.168.11.25/24

Weak response

They both start with 192.168, so they should be local.

Better reasoning

With /24 masks they are on different networks: 192.168.10.0/24 and 192.168.11.0/24. Routing is required.

Host 10.1.1.65/26 cannot reach 10.1.1.126/26

Weak response

They are in different halves because the numbers are far apart.

Better reasoning

A /26 block from 64 through 127 includes both addresses, so they are in the same subnet.

A workstation uses 192.168.50.0/24

Weak response

The address looks normal because it is in the right range.

Better reasoning

192.168.50.0 is the network address for that /24 and should not be assigned to an ordinary host.

A gateway is 192.168.10.254 instead of 192.168.10.1

Weak response

Change it to .1 because gateways always use the first usable address.

Better reasoning

Gateways can use any valid address selected by the design. Verify the router interface and scenario before changing it.

A host has 169.254.20.14

Weak response

The host must be compromised.

Better reasoning

A link-local address often indicates missing DHCP or manual configuration. Investigate addressing and DHCP first.

The router and host have the same subnet mask

Weak response

They must be on the same subnet.

Better reasoning

The mask length alone is not enough. Calculate the network ID for both addresses.

Common mistakes

Addressing shortcuts that create bad fixes

Guessing subnets from decimal appearance

Addresses that look close can be in different subnets, and addresses that look far apart can still share one subnet.

Assuming every network uses /24

Competition networks can use many prefix lengths. A wrong mask changes the host's idea of what is local.

Assuming the gateway must end in .1

Can break working routing by replacing a valid gateway with an invented convention.

Assigning the network or broadcast address to a host

Traditional IPv4 subnetting reserves those addresses for subnet identity and broadcast.

Changing router and host addresses at the same time

Makes it harder to identify the original fault and can create new reachability problems.

Ignoring the return path

Traffic can leave the source correctly but fail because the destination or router does not know how to send the response back.

Practice

Work through common subnet examples

Host: 192.168.10.78/26

Network 192.168.10.64, broadcast 192.168.10.127, usable 192.168.10.65-126.

Host: 192.168.10.130/25

Network 192.168.10.128, broadcast 192.168.10.255, usable 192.168.10.129-254.

Host: 10.0.5.33/27

Network 10.0.5.32, broadcast 10.0.5.63, usable 10.0.5.33-62.

Host: 172.16.4.200/28

Network 172.16.4.192, broadcast 172.16.4.207, usable 172.16.4.193-206.

Hosts: 192.168.50.14/28 and 192.168.50.15/28

The first is a usable host; the second is the broadcast address for 192.168.50.0/28.

Hosts: 10.1.1.6/30 and 10.1.1.5/30

Both are usable hosts in network 10.1.1.4/30.

Verification

Prove the addressing works in the real path

Host address

The endpoint uses the intended IPv4 address and does not duplicate another device.

Subnet mask

The prefix length matches the network design and produces the intended network ID.

Gateway

The configured gateway is a valid reachable address in the host's local subnet.

Router interface

The connected router or Layer 3 interface uses the intended address and mask and is operational.

Connected route

The router recognizes the expected connected subnet.

End-to-end reachability

Local peers, gateway, remote networks, and required services respond as expected.

Defensive lab

Audit a fictional IPv4 addressing plan

01

Use a fictional topology with VLAN 10 Staff, VLAN 20 Students, VLAN 30 Servers, and VLAN 99 Management.

02

Review the addressing plan before changing anything: Staff 192.168.10.0/26, Students 192.168.20.0/25, Servers 192.168.30.0/27, Management 192.168.99.0/28.

03

For each subnet, calculate the network address, broadcast address, usable range, and maximum traditional usable host count.

04

Inspect four fictional endpoints and identify one wrong mask, one invalid host address, one incorrect gateway, and one correct configuration.

05

Use show ip interface brief and show ip route on the router to compare Layer 3 interface addressing with the endpoint plan.

06

Correct only the confirmed fictional addressing errors and document the original values.

07

Verify each endpoint can reach its local gateway and required remote server.

08

Use the final addressing table to explain why each required communication is local or routed.

Lesson checklist

Before moving on

01

I understand that an IPv4 address contains network and host portions.

02

I can explain the relationship between a subnet mask and CIDR prefix length.

03

I recognize common private, loopback, link-local, multicast, and broadcast ranges.

04

I can identify network and broadcast addresses for common prefixes.

05

I can identify the usable host range in a traditional IPv4 subnet.

06

I can use the block-size method for /25 through /30 examples.

07

I can determine whether two hosts are on the same subnet.

08

I understand that the default gateway must be reachable on the local subnet.

09

I do not assume every gateway is .1 or every network is /24.

10

I can inspect addressing on Cisco devices and endpoints before making changes.

11

I can recognize common symptoms of wrong address, mask, gateway, or DHCP configuration.

12

I verify local, gateway, remote, and service reachability after addressing changes.

Reflection

Check your reasoning

Question 1

Why can two addresses that look numerically close still be in different subnets?

Question 2

What does the /27 in 192.168.10.70/27 tell you?

Question 3

Why is the default gateway normally in the same local subnet as the host?

Question 4

What is the difference between a network address and a usable host address?

Question 5

Why can a wrong subnet mask break communication even when the IP address itself looks correct?

Question 6

What should you verify on the router after correcting a host's IPv4 configuration?

Carry this forward

Every IPv4 decision starts with the address and mask together. Calculate the network boundary, confirm the gateway and router state, then verify real connectivity instead of relying on conventions.