xkonekt
Language: EN
  • English
  • Türkçe
  • Español, Coming soon
  • Português, Coming soon
  • Deutsch, Coming soon
  • Français, Coming soon

IPv4 addressing · Fundamentals · Module 1

Borrowing host bits: masks beyond /8, /16, /24 · page 2 of 2

Show topologyHide topology
R3routerH1hostR1HQ routerR2branch routerSW1switchR4branch routerSW2switch192.168.8.0/26192.168.8.64/26192.168.9.224/30192.168.9.228/31192.168.9.0/25192.168.9.192/27

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
Topology · R1 joins HQ’s LAN A and LAN B and the link to the branch; the branch block is split into LANs and links of different sizes, and R2 and R4 hold the branch LANs.

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.

R3routerH1hostR1HQ routerR2branch routerEt0/0.1Et0/1.65Et0/2.225fourth interfaceno address
Figure 1.3 · Three of R1’s interfaces carry an address, toward H1, R3 and R2, and one has none.

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.

Output · IOS XE 17.18.2
R1#show running-config | include ip address

R1 uses /26 on both HQ LANs and /30 on the link to R2.

  1. 192, so /26, LAN A.
  2. 192, so /26, LAN B.
  3. 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.
  4. 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.

Output · IOS XE 17.18.2
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
  1. The address is the plan’s; read the mask.
R3’s mask reads 255.255.192.0. What prefix does R3 use, and is it the plan’s /26?

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.

Output · IOS XE 17.18.2
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
  1. Five replies.
  2. 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.

Output · IOS XE 17.18.2
R3#show ip interface Ethernet0/0 | include Internet address1  Internet address is 192.168.8.126/18
  1. 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?

Two checks for a wrong mask, in this order
CheckGoodBroken
Read both ends’ address and mask with show running-config | include ip address or show ip interfacethe same prefix length on both endsthe masks differ
Work out each end’s subnet from its address and prefixeach end’s subnet holds the other end’s addressone end’s subnet leaves the other out

With R3 configured as planned, R1’s test of R3 gets every reply.

Output · IOS XE 17.18.2
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
  1. Five replies.
  2. Success rate is 100 percent.

Case 1 of 2.R1’s test of R3 gets no answer

  1. Case 1 · Symptom

    R1 tests R3 and gets no answer.

    Output · IOS XE 17.18.2
    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)
    1. Five dots, so no replies.
    2. Success rate is 0 percent: no test was answered.
  2. Case 1 · Command

    Read R3’s address line, mask included.

  3. Case 1 · Output

    Output · IOS XE 17.18.2
    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
    1. Key line The mask’s last octet is 240, so 4 bits are borrowed; the plan borrows two.
  4. Case 1 · How far it reaches

    Is R1 itself fine? It tests R2, on its link to the branch.

    Output · IOS XE 17.18.2
    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
    1. Success rate is 100 percent: R2 answers.
  5. Case 1 · What it means

    R3routerR1HQ routerno answerLAN B, 192.168.8.64/26.64.127/28.112R3’s viewR1 .65
    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.
  6. 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.

    Output · IOS XE 17.18.2
    R3#show ip interface Ethernet0/0 | include Internet address1  Internet address is 192.168.8.126/28
    1. Prefix length /28, where the plan has /26.

    On R3, these configuration lines make the fix.

    Output · IOS XE 17.18.2
    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
    1. Picks R3’s interface toward LAN B.
    2. The same address with the plan’s mask.

    Impact Changing an interface’s mask can briefly stop the packets that use that interface.

  7. Case 1 · Proof

    R1 tests R3 again.

    Output · IOS XE 17.18.2
    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
    1. 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

  1. Case 2 · Symptom

    R1 tests R3 and again gets no answer.

    Output · IOS XE 17.18.2
    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)
    1. Five dots again.
    2. Success rate is 0 percent: no test was answered.
  2. Case 2 · Command

    Run commands to narrow the cause, then choose it.

    Choose the next command

    Output · IOS XE 17.18.2
    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
    Output · IOS XE 17.18.2
    R3#show ip interface Ethernet0/0 | include Internet address  Internet address is 192.168.8.126/27
    Output · IOS XE 17.18.2
    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
    Output · IOS XE 17.18.2
    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
    Cause
  3. Answer to see what it means, the fix and the proof.

  4. Case 2 · How far it reaches

    R1 tests R2 again.

    Output · IOS XE 17.18.2
    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
    1. Success rate is 100 percent: R2 answers.
  5. Case 2 · What it means

    R3routerR1HQ routerno answerLAN B, 192.168.8.64/26.64.127/27.96R3’s viewR1 .65
    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.
  6. Case 2 · Fix

    Give R3 the plan’s mask, 255.255.255.192, with the same address.

  7. Case 2 · Proof

    With the plan’s mask on R3, every test from R1 gets an answer.

    Output · IOS XE 17.18.2
    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
    1. 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.

R3 keeps its plan address, 192.168.8.126, but its mask is typed 255.255.255.128. Is R1’s .65 inside or outside R3’s subnet, and is the mask right?

Check

Which mask is /27?
A mask reads 255.255.240.0. Which prefix is it?

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.

Output · IOS XE 17.18.2
R2#show running-config | include ip address
A /24 is split with /29. How many subnets does that make, and how many hosts in each?

Read both outputs, then choose the most likely cause.

Symptom: R1’s test of R3 gets no answer. On R3 and on R1:

Output · IOS XE 17.18.2
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
Output · IOS XE 17.18.2
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
Cause

Summary

mask, last octet/26110000001286432168421host bits: 6subnetbits: 2octet = 192.64/264 subnets · 64 addresses · 62 hostsR1 Et0/1 · 192.168.8.65255.255.255.192 = /26
Figure 1.2, recap · Borrowed bits number the subnets; the bits left number the hosts. HQ borrows two bits and gets four LANs of 62 hosts each.

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 address shows each mask in dotted form; show ip interface counts 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 address

    each 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 address

    the same interface with its prefix length, the count of the mask’s ones.

  • ping 192.168.8.126

    the Success rate line: how many tests were answered.