IPv4 addressing · Fundamentals · Module 1
Borrowing host bits: masks beyond /8, /16, /24 · page 2 of 2
Show topologyHide topology
Interfaces and addresses · Et = Ethernet. LAN C, LAN D and branch LAN 2 are planned and not cabled yet.
- 192.168.8.0/26 · LAN AR1 Et0/0 192.168.8.1H1 eth0 192.168.8.10
- 192.168.8.64/26 · LAN BR1 Et0/1 192.168.8.65R3 Et0/0 192.168.8.126
- 192.168.9.224/30R1 Et0/2 192.168.9.225R2 Et0/0 192.168.9.226
- 192.168.9.228/31R2 Et0/2 192.168.9.228R4 Et0/0 192.168.9.229
- 192.168.9.0/25 · branch LAN 1 · SW1R2 Et0/1 192.168.9.1no other device yet
- 192.168.9.192/27 · branch LAN 3 · SW2R4 Et0/1 192.168.9.193no other device yet
Device icons joined by plain cables, each cable labeled with its subnet. Down the middle, top to bottom: R3, a router; R1, the HQ router; R2, the branch router; R4, a branch router; and the switch SW2. R3 is cabled to R1 (192.168.8.64/26), R1 to R2 (192.168.9.224/30), R2 to R4 (192.168.9.228/31) and R4 to SW2 (192.168.9.192/27). At the upper left, the host H1, a laptop, is cabled down from its base to R1 (192.168.8.0/26). Left of R2, the switch SW1 is cabled across to it (192.168.9.0/25).
Verify
Read R1’s masks
Which masks does R1 use on its interfaces, and how many host bits does each leave?
R1 has four interfaces (Figure 1.3), three with an address and one without. Its settings hold one address line per interface, and the one without an address reads no ip address.
R1, the HQ router, with R3 above it, H1, a laptop, at its upper left, and R2, the branch router, under it, each joined to it by a cable. At R1’s end of each cable, the interface name on one side and the last number of its address on the other: Et0/0 and .1 on the cable to H1; Et0/1 and .65 on the cable to R3; Et0/2 and .225 on the cable to R2. A short stub at R1’s lower right, with no cable, ends beside the tag “fourth interface, no address”.
show running-config | include ip address prints every line of R1’s settings that holds “ip address”, each with the address, then the mask. The lines do not name their interfaces, but the addresses do: .1 is toward H1, .65 toward R3 and .225 toward R2 (Figure 1.3).
Here every interface of R1 is as planned.
Tap a line, or “Not in the output”, then submit.
Find the line whose mask leaves only 2 host bits.
R1#show running-config | include ip addressScroll sideways to see the whole output
R1 uses /26 on both HQ LANs and /30 on the link to R2.
- 192, so /26, LAN A.
- 192, so /26, LAN B.
- Field by field, the address 192.168.9.225 is R1 on the link to R2, and the mask 255.255.255.252 is 24 ones and 6 more, a /30.
no ip address, so the fourth interface has none.
On another day, someone retyped R3’s settings for LAN B, and R3’s address line now carries a different mask.
R3 shows its address line after the retyping.
R3#show running-config | include ip address1 ip address 192.168.8.126 255.255.192.0 no ip address no ip address no ip address
Scroll sideways to see the whole output
- The address is the plan’s; read the mask.
Does anything stop working? R1 tests R3 with ping, where ! is a reply and . is none.
R3’s mask is still as retyped.
R3 still answers every test from R1.
R1#ping 192.168.8.126Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.8.126, timeout is 2 seconds:1!!!!!2Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
- Five replies.
Success rate is 100 percent, five of five.
Why do the replies come back? R3 itself reports a prefix much shorter than the plan’s /26.
R3 reports its interface toward LAN B.
R3 counts /18, not the plan’s /26.
R3#show ip interface Ethernet0/0 | include Internet address1 Internet address is 192.168.8.126/18
Scroll sideways to see the whole output
- Prefix length /18: two octets of ones and two bits of the third.
A /18 ends two bits into the third octet, so its subnets step by 64 in that octet, and the one that holds 192.168.8.126 is 192.168.0.0/18, which runs to 192.168.63.255. R1’s 192.168.8.65 is inside it, so R3 still counts R1 as part of its own network, and the replies come back.
Answers to a ping do not prove that both masks are right. R3’s /18 differs from the plan, and only reading the mask shows it.
Key idea
Read the first mask octet that is not 255: its value tells how many bits were borrowed and how many host bits are left. Check which octet it stands in.
Troubleshoot
When R3’s mask is wrong
R1 and R3 share LAN B. What does R1 see when R3’s mask borrows too many bits?
| Check | Good | Broken |
|---|---|---|
Read both ends’ address and mask with show running-config | include ip address or show ip interface | the same prefix length on both ends | the masks differ |
| Work out each end’s subnet from its address and prefix | each end’s subnet holds the other end’s address | one end’s subnet leaves the other out |
With R3 configured as planned, R1’s test of R3 gets every reply.
R1#ping 192.168.8.126Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.8.126, timeout is 2 seconds:1!!!!!2Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
- Five replies.
Success rate is 100 percent.
Case 1 of 2.R1’s test of R3 gets no answer
Case 1 · Symptom
R1 tests R3 and gets no answer.
R1#ping 192.168.8.126Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.8.126, timeout is 2 seconds:1.....2Success rate is 0 percent (0/5)
- Five dots, so no replies.
Success rate is 0 percent: no test was answered.
Case 1 · Command
Read R3’s address line, mask included.
Case 1 · Output
R3#show running-config | include ip address1 ip address 192.168.8.126 255.255.255.240 no ip address no ip address no ip address
Scroll sideways to see the whole output
- Key line The mask’s last octet is 240, so 4 bits are borrowed; the plan borrows two.
Case 1 · How far it reaches
Is R1 itself fine? It tests R2, on its link to the branch.
R1#ping 192.168.9.226Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.226, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Success rate is 100 percent: R2 answers.
Case 1 · What it means
Figure 1.4 · Case 1 · With /28, R3’s subnet is .112 to .127; R1’s .65 is outside it, so no answer comes back. R3 at the top and R1 under it, joined by a cable; beside the cable, a cross tagged “no answer”. Under R1, a bar for LAN B from .64 to .127. On the bar, a highlighted segment over its last quarter, from .112 to the right end, tagged /28 and named “R3’s view”. A tick near the bar’s left end marks R1’s .65, outside the segment.
- With 255.255.255.240, a /28, R3 has 4 host bits, so its subnets are 16 addresses long, and the one that holds .126 is 192.168.8.112/28, only .112 to .127.
- R1’s 192.168.8.65 is outside it, so R3 no longer counts R1 as part of its own network. No answer comes back to R1.
- R2 still answers, so R1 itself and its link to the branch work; the changed mask is on R3’s line.
Case 1 · Fix
R3’s own report confirms the longer prefix. The fix gives R3 the plan’s mask, 255.255.255.192.
R3 reports its interface toward LAN B.
R3#show ip interface Ethernet0/0 | include Internet address1 Internet address is 192.168.8.126/28
Scroll sideways to see the whole output
- Prefix length /28, where the plan has /26.
On R3, these configuration lines make the fix.
R3#configure terminalEnter configuration commands, one per line. End with CNTL/Z.1R3(config)#interface Ethernet0/02R3(config-if)#ip address 192.168.8.126 255.255.255.192R3(config-if)#end
- Picks R3’s interface toward LAN B.
- The same address with the plan’s mask.
Impact Changing an interface’s mask can briefly stop the packets that use that interface.
Case 1 · Proof
R1 tests R3 again.
R1#ping 192.168.8.126Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.8.126, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Success rate is 100 percent: R3 answers again.
End of case 1. Solved: R3 is back in 192.168.8.64/26.
Case 2 of 2.The same symptom on another day
Case 2 · Symptom
R1 tests R3 and again gets no answer.
R1#ping 192.168.8.126Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.8.126, timeout is 2 seconds:1.....2Success rate is 0 percent (0/5)
- Five dots again.
Success rate is 0 percent: no test was answered.
Case 2 · Command
Run commands to narrow the cause, then choose it.
Choose the next command
Best next command:
R3# show running-config | include ip addressThe test fails toward R3: read R3’s own address line first, mask included.R3#show running-config | include ip address ip address 192.168.8.126 255.255.255.224 no ip address no ip address no ip address
Scroll sideways to see the whole output
R3#show ip interface Ethernet0/0 | include Internet address Internet address is 192.168.8.126/27
Scroll sideways to see the whole output
R1#show running-config | include ip address ip address 192.168.8.1 255.255.255.192 ip address 192.168.8.65 255.255.255.192 ip address 192.168.9.225 255.255.255.252 no ip address
Scroll sideways to see the whole output
R1#ping 192.168.9.226Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.226, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
How to reason it out
Read both ends: R1’s masks are as planned, and R3’s reads 255.255.255.224.
Work out R3’s subnet: 192.168.8.96/27, from .96 to .127.
R1’s .65 is not in it, so no answer comes back to R1.
Answer to see what it means, the fix and the proof.
Case 2 · How far it reaches
R1 tests R2 again.
R1#ping 192.168.9.226Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.226, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Success rate is 100 percent: R2 answers.
Case 2 · What it means
Figure 1.5 · Case 2 · With /27, R3’s subnet is .96 to .127; R1’s .65 is still outside it. R3 at the top and R1 under it, joined by a cable; beside the cable, a cross tagged “no answer”. Under R1, a bar for LAN B from .64 to .127. On the bar, a highlighted segment over its second half, from .96 to the right end, tagged /27 and named “R3’s view”. A tick near the bar’s left end marks R1’s .65, outside the segment.
- With 255.255.255.224, R3’s subnet is 192.168.8.96/27, from .96 to .127.
- R1’s .65 is outside it again, so no answer comes back to R1.
- R2 still answers, which keeps the fault on R3’s side.
Case 2 · Fix
Give R3 the plan’s mask, 255.255.255.192, with the same address.
Case 2 · Proof
With the plan’s mask on R3, every test from R1 gets an answer.
R1#ping 192.168.8.126Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.8.126, timeout is 2 seconds:!!!!!1Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Success rate is 100 percent: R3 answers.
End of case 2. Solved: R3 uses /26 again.
What both cases share follows once you have answered case 2.
Both cases
Key idea
Both ends of a LAN need the same mask. In both cases R3’s mask was longer, R1’s address fell outside R3’s subnet, and no answer came back.
Check
On R2, the branch router, with every interface as planned:
Tap a line, or “Not in the output”, then submit.
Find the line whose mask borrows exactly one bit from a /24.
R2#show running-config | include ip addressScroll sideways to see the whole output
Read both outputs, then choose the most likely cause.
Symptom: R1’s test of R3 gets no answer. On R3 and on R1:
R3#show running-config | include ip address ip address 192.168.8.126 255.255.255.240 no ip address no ip address no ip address
Scroll sideways to see the whole output
R1#ping 192.168.9.226Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.226, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
How to reason it out
R3’s mask is 255.255.255.240, not the plan’s 255.255.255.192.
R3’s subnet is 192.168.8.112/28; R1’s .65 is not in it.
Summary
The last octet of the mask at /26 has two cells of 1 marked “subnet bits: 2”, six cells of 0 marked “host bits: 6”, worth 192. Under it, HQ’s block cut into four pieces, the second one, .64/26, highlighted, and the line “4 subnets · 64 addresses · 62 hosts”. At the foot, R1’s LAN B interface: 192.168.8.65, 255.255.255.192 = /26.
- Subnetting borrows bits from the host part to number the subnets of one block.
- n borrowed bits make 2ⁿ subnets; h host bits leave 2ʰ addresses and 2ʰ − 2 hosts in each.
- A mask octet holds only 128, 192, 224, 240, 248, 252, 254 or 255, or 0, in whichever octet the borrowed bits sit.
show running-config | include ip addressshows each mask in dotted form;show ip interfacecounts it as a prefix length.- A mask that is too long can leave the other end outside the subnet, and no answer comes back; R3’s /18, a mask in the wrong octet, still let R1’s test succeed.
Commands
show running-config | include ip addresseach configuration line that holds “ip address”; the mask octet that is not all ones shows the borrowed bits.
show ip interface Ethernet0/1 | include Internet addressthe same interface with its prefix length, the count of the mask’s ones.
ping 192.168.8.126the Success rate line: how many tests were answered.