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
Learning objectives
Read IPv4 addressing as network structure
Explain how an IPv4 address is divided into network and host portions by the subnet mask.
Recognize private, public, loopback, link-local, multicast, and other common IPv4 address categories.
Convert common subnet masks and prefix lengths and explain what they mean.
Determine whether two IPv4 hosts are on the same subnet.
Identify valid host addresses, network addresses, broadcast addresses, and default gateways in common scenarios.
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
11000000128 + 64
10101000128 + 32 + 8
11100000128 + 64 + 32
11110000128 + 64 + 32 + 16
11111000128 + 64 + 32 + 16 + 8
11111100128 + 64 + 32 + 16 + 8 + 4
CIDR and masks
Common prefix lengths to recognize quickly
| Prefix | Subnet mask | Total block | Traditional usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 addresses | 16,777,214 traditional usable hosts |
| /16 | 255.255.0.0 | 65,536 addresses | 65,534 traditional usable hosts |
| /20 | 255.255.240.0 | 4,096 addresses | 4,094 traditional usable hosts |
| /21 | 255.255.248.0 | 2,048 addresses | 2,046 traditional usable hosts |
| /22 | 255.255.252.0 | 1,024 addresses | 1,022 traditional usable hosts |
| /23 | 255.255.254.0 | 512 addresses | 510 traditional usable hosts |
| /24 | 255.255.255.0 | 256 addresses | 254 traditional usable hosts |
| /25 | 255.255.255.128 | 128 addresses | 126 traditional usable hosts |
| /26 | 255.255.255.192 | 64 addresses | 62 traditional usable hosts |
| /27 | 255.255.255.224 | 32 addresses | 30 traditional usable hosts |
| /28 | 255.255.255.240 | 16 addresses | 14 traditional usable hosts |
| /29 | 255.255.255.248 | 8 addresses | 6 traditional usable hosts |
| /30 | 255.255.255.252 | 4 addresses | 2 traditional usable hosts |
Traditional host formula
usable hosts = 2^(host bits) - 2This 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/8Private IPv4
Used inside private networks and not globally routed on the public Internet.
172.16.0.0/12Private IPv4
Covers 172.16.0.0 through 172.31.255.255.
192.168.0.0/16Private IPv4
Very common in local networks, labs, and home environments.
127.0.0.0/8Loopback
Used for local host testing. 127.0.0.1 is the familiar loopback address.
169.254.0.0/16Link-local
Often appears when a host cannot obtain normal IPv4 configuration and self-assigns a local address.
224.0.0.0/4Multicast
Used for one-to-many group communication rather than ordinary unicast host addressing.
0.0.0.0Unspecified / default context
Can mean no specific local address or appear in default-route notation such as 0.0.0.0/0.
255.255.255.255Limited broadcast
Represents a local limited broadcast and is not an ordinary host address.
Same subnet?
Compare network IDs, not visual similarity
Write down both IP addresses
Example: 192.168.10.25 and 192.168.10.200.
Confirm the subnet mask
Example: 255.255.255.0, which is /24.
Identify the network portion
With /24, the first 24 bits are the network portion, so the first three octets identify the network.
Compare the resulting network IDs
Both addresses belong to network 192.168.10.0/24, so they are local peers.
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/24192.168.10.0
192.168.10.255
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/25192.168.10.128
192.168.10.255
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/2610.20.30.64
10.20.30.127
10.20.30.65 - 10.20.30.126
A /26 creates blocks of 64 addresses in the final octet.
172.16.5.94/27172.16.5.64
172.16.5.95
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/28192.168.50.0
192.168.50.15
192.168.50.1 - 192.168.50.14
A /28 creates blocks of 16 addresses.
10.1.1.6/3010.1.1.4
10.1.1.7
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
256 - 128 = 128Starts: 0, 128
256 - 192 = 64Starts: 0, 64, 128, 192
256 - 224 = 32Starts: 0, 32, 64, 96, 128, 160, 192, 224
256 - 240 = 16Starts: 0, 16, 32, 48, 64, ...
256 - 248 = 8Starts: 0, 8, 16, 24, 32, ...
256 - 252 = 4Starts: 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 briefReview Cisco interface IPv4 addresses and operational state.
show running-config | section interfaceReview interface configuration in supported IOS environments.
show interfacesReview detailed interface state and counters.
show ip route connectedReview directly connected IPv4 networks recognized by the router.
show ip routeReview the complete IPv4 routing table.
show arpReview learned IPv4-to-MAC mappings on supported devices.
ping 192.168.10.1Test Layer 3 reachability to a specific address.
traceroute 192.168.30.10Observe the routed path toward a destination when supported.
Endpoint inspection
Verify what the host actually believes
Windows endpoint
ipconfig /allReview assigned IPv4 address, subnet mask, gateway, DNS, DHCP state, and adapter details.
Linux endpoint
ip addrReview assigned IPv4 and IPv6 addresses and interface state.
Linux endpoint
ip routeReview local routes and default gateway.
Packet Tracer PC
Desktop > IP ConfigurationReview or configure simulated address, mask, gateway, and DNS values.
Packet Tracer PC
Command Prompt > ipconfigInspect 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/26Network 192.168.10.64, broadcast 192.168.10.127, usable 192.168.10.65-126.
Host: 192.168.10.130/25Network 192.168.10.128, broadcast 192.168.10.255, usable 192.168.10.129-254.
Host: 10.0.5.33/27Network 10.0.5.32, broadcast 10.0.5.63, usable 10.0.5.33-62.
Host: 172.16.4.200/28Network 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/28The 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/30Both 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
Use a fictional topology with VLAN 10 Staff, VLAN 20 Students, VLAN 30 Servers, and VLAN 99 Management.
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.
For each subnet, calculate the network address, broadcast address, usable range, and maximum traditional usable host count.
Inspect four fictional endpoints and identify one wrong mask, one invalid host address, one incorrect gateway, and one correct configuration.
Use show ip interface brief and show ip route on the router to compare Layer 3 interface addressing with the endpoint plan.
Correct only the confirmed fictional addressing errors and document the original values.
Verify each endpoint can reach its local gateway and required remote server.
Use the final addressing table to explain why each required communication is local or routed.
Lesson checklist
Before moving on
I understand that an IPv4 address contains network and host portions.
I can explain the relationship between a subnet mask and CIDR prefix length.
I recognize common private, loopback, link-local, multicast, and broadcast ranges.
I can identify network and broadcast addresses for common prefixes.
I can identify the usable host range in a traditional IPv4 subnet.
I can use the block-size method for /25 through /30 examples.
I can determine whether two hosts are on the same subnet.
I understand that the default gateway must be reachable on the local subnet.
I do not assume every gateway is .1 or every network is /24.
I can inspect addressing on Cisco devices and endpoints before making changes.
I can recognize common symptoms of wrong address, mask, gateway, or DHCP configuration.
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.