IT131 · SESSION 08 · FIELD NOTES

IPv4 Addressing & Subnetting

Session 6 introduced Logistics, the department that reads a packet's destination and picks the route. This week we open Logistics' address book: how every IPv4 address is built, which addresses are off-limits, who hands them out, and how one network gets carved into many. Most of the course's math is in this session.

New material Module 11 — IPv4 Addressing Practice Subnetting Field Manual Handout 7 Holy Steps (PDF)

Module 11

What Session 8 covers

Module 11 is the longest module in the course, and it has two halves. The first half is vocabulary: what the parts of an address are called, and which addresses are special. The second half is a skill: subnetting. You learn the vocabulary by reading. You learn the skill by doing problems.

Where the practice lives This page is the lecture recap. The practice is on its own page: the Subnetting Field Manual. It has a step-by-step calculator, a visual subnet slicer, and eight drills that generate new problems every time. The class method is also printed as a one-page handout, The 7 Holy Steps of Subnetting (PDF). Read a section here, then drill it there.

Module 11 · 11.1

IPv4 address structure

An IPv4 address is 32 bits, written as four decimal octets. Every address is split into two parts, and the subnet mask says where the split is.

Think of it like

A street address. The network portion is the street name, which every house on the street shares. The host portion is the house number, which is unique on that street. The subnet mask is the rule for where the street name stops and the house number starts. Logistics only ever reads the street name. Getting the packet to the right house is Local Dispatch's job, using ARP (Session 6).

TermWhat it isExample
Subnet mask32 bits: 1s mark network bits and 0s mark host bits. The 1s are always contiguous and always come first.255.255.255.0
Prefix lengthThe number of 1s in the mask, written after a slash./24
Network addressHost bits all 0. It names the network and can't be given to a device.192.168.10.0
Host addressesEverything between the network and broadcast addresses. These are the only ones you assign..1 – .254
Broadcast addressHost bits all 1. It reaches every host on the network and can't be given to a device.192.168.10.255

ANDing: how a device finds the network portion

A device ANDs an address with its mask, bit by bit. 1 AND 1 = 1, and every other combination gives 0. The result is the network address. Before sending, a host does this for its own address and for the destination, using its own mask for both. If the results match, the destination is local and the host ARPs for it directly. If they differ, the packet goes to the default gateway. This is the decision Session 6's ARP section depended on.

192.168.10.77/26, ANDed with its mask
Address 11000000.10101000.00001010.01001101 192.168.10.77 Mask AND 11111111.11111111.11111111.11000000 255.255.255.192 ───────────────────────────────────────────── Network 11000000.10101000.00001010.01000000 192.168.10.64
Hosts per network With h host bits, a network has 2h total addresses and 2h − 2 usable ones. The two you lose are the network address and the broadcast address. A /24 has 8 host bits: 256 − 2 = 254 hosts. The guide's Anatomy and Binary sections walk through this more slowly if you need them.

Module 11 · 11.2

Unicast, broadcast, and multicast

Three ways to address a packet: to one device, to every device, or to a group that asked to listen.

TypeWho receives itAddresses
UnicastExactly one device. Most traffic is unicast.Any host address. The source address of every packet is always unicast.
BroadcastEvery device on the networkA limited broadcast, 255.255.255.255, reaches the local network only. A directed broadcast, such as 172.16.4.255 for 172.16.4.0/24, is aimed at every host on one specific network.
MulticastOnly devices that joined the group (multicast clients)224.0.0.0 – 239.255.255.255. Routing protocols use it: for example, OSPF uses 224.0.0.5.
Routers stop broadcasts Routers don't forward limited broadcasts, and by default they don't forward directed broadcasts either. That's why a router is the edge of a broadcast domain, and it's the whole reason segmentation (below) works. Switches forward broadcasts out every port except the one they arrived on, so adding switches doesn't shrink a broadcast domain.

Module 11 · 11.3

Types of IPv4 addresses

Not every address can be used everywhere. Some are private, some are reserved for special jobs, and the rest are public addresses handed out through a chain of registries.

Public vs. private

Private addresses (RFC 1918) are free for anyone to use inside a network, but internet routers won't route them. To reach the internet, a private address is translated to a public one by NAT (Network Address Translation), usually on the edge router. That's how every home network can use 192.168.1.x at the same time. Public addresses are globally unique and routable on the internet.

Private blockRangeRemember
10.0.0.0/810.0.0.0 – 10.255.255.255One huge block
172.16.0.0/12172.16.0.0 – 172.31.255.255Stops at 172.31. 172.32.x.x is public.
192.168.0.0/16192.168.0.0 – 192.168.255.255The home-network block

Special-use addresses

AddressNameWhat it's for
127.0.0.0/8LoopbackThe device itself. ping 127.0.0.1 tests the local TCP/IP stack without touching the network. It's the first step of Session 9's troubleshooting ladder.
169.254.0.0/16Link-local (APIPA)Windows gives itself one of these when no DHCP server answers. If you see it in ipconfig, it usually means DHCP failed.

Legacy classful addressing

Before 1993, the first octet set a network's size. That scheme wasted enormous numbers of addresses: a company that needed 300 hosts couldn't use a Class C (254 hosts), so it got a Class B with 65,534. It was replaced by classless addressing (CIDR), where any prefix length is allowed. You still need the classes, because the exam and older documentation refer to them.

ClassFirst octetDefault maskNotes
A0 – 127/81–126 usable. 0 is reserved and 127 is loopback.
B128 – 191/16
C192 – 223/24
D224 – 239—Multicast
E240 – 255—Experimental / reserved

Who hands out public addresses

IANA (Internet Assigned Numbers Authority) manages the whole IPv4 space. It allocates large blocks to five Regional Internet Registries (RIRs), which allocate to ISPs and large organizations, which assign to customers.

RIRRegion
ARINNorth America (including us)
LACNICLatin America and parts of the Caribbean
RIPE NCCEurope, the Middle East, and Central Asia
APNICAsia-Pacific
AFRINICAfrica
Why this matters next week The free pool of public IPv4 addresses has run out. NAT and private addressing stretched IPv4 much further than anyone planned, but they're a workaround, not a fix. The real fix is IPv6, which is Session 9.

Module 11 · 11.4

Network segmentation

Why split a network at all? Because one big broadcast domain gets slow and hard to secure.

Common ways to divide a network

Divide byExample
LocationOne subnet per floor or per building
Group or functionEngineering, Accounting, and Sales each get a subnet
Device typePrinters, servers, IP phones, and guest devices each get a subnet

Module 11 · 11.5 – 11.7

Subnetting

Subnetting means borrowing bits from the host portion and using them as subnet bits. You end up with more networks, and fewer hosts in each.

The two formulas

You want…FormulaWhere the bits come from
Number of subnets2ⁿn = bits borrowed
Usable hosts per subnet2ʰ − 2h = host bits left over
The −2 is for hosts only Borrowing 3 bits gives 2³ = 8 subnets, not 6. Cisco NetAcad counts every subnet, including the first (subnet zero) and the last. The −2 applies only to hosts, because it removes each subnet's network and broadcast address.

The class method: the 7 holy steps

  1. 1. Determine the number of needed subnets.
  2. 2. Write out your host bits.
  3. 3. Determine how many bits to borrow: 2ⁿ ≥ subnets needed.
  4. 4. Turn on the borrowed bits, starting right after the existing network bits, and find the decimal value.
  5. 5. Add that value to the original mask to get the new mask.
  6. 6. Find the lowest-order bit turned on in the new mask. That's the subnet variable.
  7. 7. Count by the variable to list each subnet's range.

Printable copy: 7 Holy Steps of Subnetting (PDF). Three fully worked examples, including one that doesn't start from a default mask, are in the guide's Borrowing Bits section.

Subnetting on and across octet boundaries

NetAcad works through subnetting a /24, then a /16, then a /8. The method is the same each time. What changes is which octet the new boundary lands in.

Start withNeedBorrowNew prefix / maskSubnetsHosts eachCounts by
192.168.10.0/244 subnets2/26 · 255.255.255.19246264 in the 4th octet
172.16.0.0/16100 subnets7/23 · 255.255.254.01285102 in the 3rd octet
10.0.0.0/81,000 subnets10/18 · 255.255.192.01,02416,38264 in the 3rd octet

Subnetting to meet requirements

Every design balances two needs that pull against each other. More subnets means fewer hosts in each, and more hosts means fewer subnets.

Module 11 · 11.8 – 11.9

VLSM and structured design

Fixed-size subnets waste addresses whenever the segments are different sizes. VLSM fixes that, and a structured plan decides which address each device gets.

VLSM in one paragraph

Variable Length Subnet Masking gives each segment the smallest subnet that fits it. NetAcad describes it as subnetting a subnet: split the block into subnets for the LANs, then take one unused subnet and split it again, for example a /27 into eight /30s for point-to-point WAN links. Working largest-first gives the same kind of result. A point-to-point link needs only 2 addresses, one per router, so NetAcad uses a /30 for it. A /24 spent on a two-router link wastes 252 addresses.

Worked VLSM plans, including your class example (31, 15, and 6 hosts from 192.168.10.0/24), are in the guide's VLSM section. It also has a drill that checks a plan you type in.

Structured design: which device gets which address

An addressing plan decides before deployment which addresses are handed out by DHCP and which are set by hand. A good plan prevents duplicate addresses, makes it easy to provide and control access, and makes security and performance monitoring possible, because every address has a known owner. The rule of thumb: anything other devices need to find at a known address gets a static address.

DeviceAssignmentWhy
End devices (PCs, laptops, phones)DHCPToo many to set by hand, and they come and go.
Servers and peripherals (printers)StaticClients need to find them at a predictable address.
Internet-facing serversStatic public addressThe outside world has to reach them.
Intermediary devices (switch management, APs)StaticSo administrators can always reach them to manage them.
Router interface (default gateway)Static: the lowest or the highest usable address, used the same way in every subnet across the organizationEvery host's gateway setting points at it, and a consistent rule means nobody has to look it up.
A typical /24 plan (a convention, not a rule) For 192.168.10.0/24, one common layout is: .1 for the router, .2–.19 for switches and APs, .20–.49 for servers and printers, and .50–.254 for the DHCP pool. The exact ranges vary between organizations. What matters is that the plan is written down and followed, so two devices never end up with the same address.

Watch for this

The most common Module 11 mistakes

Nearly every wrong answer on this module comes from one of these.

Study

Flashcards

Click to flip. Double-click to mark as known.

Check yourself

Sample questions

Pick an answer to see if you're right. Same style as the module quiz. For unlimited subnetting practice, use the guide's drills.

Applied

Worked examples

Think it through before you expand the answer.

The six answers

172.16.45.200/20

Find the subnet mask, network address, broadcast address, first and last usable host, and the number of usable hosts.

Show answer

/20 → mask 255.255.240.0. The interesting octet is the 3rd, with mask value 240, so the block size is 256 − 240 = 16. Counting by 16 in the 3rd octet (0, 16, 32, 48), 45 falls in 32–47. Network 172.16.32.0, broadcast 172.16.47.255, hosts 172.16.32.1 – 172.16.47.254, and 2¹² − 2 = 4,094 usable.

7 holy steps

192.168.10.0/24 needs 6 subnets

Work the steps. What's the new mask, the subnet variable, the number of hosts per subnet, and the network address of the 3rd subnet?

Show answer

2² = 4 is too few and 2³ = 8 is enough, so borrow 3 bits. 11100000 = 224, added to the original mask gives 255.255.255.224 (/27). The lowest bit turned on is 32, so that's the variable. Subnets are .0, .32, .64, … and the 3rd is 192.168.10.64/27. 5 host bits remain, so each subnet has 2⁵ − 2 = 30 hosts.

Same network?

Will PC A ARP for PC B, or for the gateway?

PC A is 192.168.5.62/26. PC B is 192.168.5.65/26. They're plugged into the same switch.

Show answer

For a /26 the block size is 64, so subnets start at .0, .64, .128, and .192. PC A is in 192.168.5.0/26 and PC B is in 192.168.5.64/26. The ANDed results differ, so PC A treats PC B as remote and ARPs for its default gateway. Sharing a switch doesn't matter. Only the network portion does.

Address types

What kind of address is it?

Classify each one: 172.20.1.1, 172.40.1.1, 169.254.33.7, 127.0.0.1, 224.0.0.5.

Show answer

172.20.1.1: private (inside 172.16–172.31). 172.40.1.1: public (outside that range). 169.254.33.7: link-local/APIPA, meaning the host didn't get a DHCP address. 127.0.0.1: loopback. 224.0.0.5: multicast (OSPF routers).

VLSM

The point-to-point link

A designer has used 192.168.50.0/24 for three LANs and has only 192.168.50.240/28 left. There are three router-to-router links to address. What should they do?

Show answer

Subnet the subnet. A /28 (16 addresses) splits into four /30s: .240, .244, .248, and .252. Each has exactly 2 usable addresses, one for each router. Three links use three of them, and one /30 is left as a spare.

Reference

Glossary & index

Every term from this session, searchable and indexed A–Z.