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 3

Choosing a prefix for a requirement · 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

R2’s two links

R2 has a /30 link toward R1 and a /31 link toward R4. How do its address lines tell them apart?

You can tell them apart by the last octet of each mask, 252 for a /30 and 254 for a /31. R2’s settings hold one address line for each of its four interfaces (Figure 3.3), and the line of the one without an address reads “no ip address”.

R1HQ routerR2branch routerSW1switchR4branch routerEt0/0.226Et0/1.1Et0/2.228fourth interfaceno address
Figure 3.3 · R2 has four interfaces: three carry an address, toward R1, SW1 and R4, and one has none.

R2, the branch router, joined by one cable each to R1, the HQ router, above it, to the switch SW1 at its left and to R4, a branch router, under it. At R2’s end of each cable, the interface name on one side of the cable and the last octet of its address on the other: Et0/0 and .226 on the cable to R1; Et0/1 and .1 on the cable to SW1; Et0/2 and .228 on the cable to R4. A short stub at R2’s lower right, with no cable, ends beside the tag “fourth interface, no address”.

In show running-config | include ip address, each line with an address gives the address, then the mask.

Here every interface of R2 is as planned.

Tap a line, or “Not in the output”, then submit.

Find the line of the link that uses both addresses of its block.

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

R2 has a /30 toward R1, a /25 for LAN 1 and a /31 toward R4, and its fourth interface has none.

  1. The link toward R1 has 192.168.9.226 with 252, a /30. Two of its 4 addresses are hosts.
  2. Branch LAN 1 has 192.168.9.1 with 128, a /25.
  3. 192.168.9.228 is R2’s address. 255.255.255.254 is 31 ones and 1 host bit, so 2 addresses, and on this point-to-point link both are host addresses.
  4. The fourth interface, with no address.

show ip interface Ethernet0/2 | include Internet address shows R2’s interface toward R4.

Output · IOS XE 17.18.2
R2#show ip interface Ethernet0/2 | include Internet address1  Internet address is 192.168.9.228/31
  1. The address, then the prefix length. /31 leaves one host bit, so the pair is .228 and .229.

R2 tests R4 at the other address of the pair.

R4 answers every test, so the two addresses of one /31 work as the link’s two ends.

Output · IOS XE 17.18.2
R2#ping 192.168.9.229Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.229, timeout is 2 seconds:1!!!!!2Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
  1. Five exclamation marks, five replies.
  2. Success rate is 100 percent, five of five.

The link from R1 to R2 is renumbered as a /31 to save two addresses, starting with R1’s end.

These interface lines on R1 renumber its end of the link.

Output · IOS XE 17.18.2
R1#configure terminalEnter configuration commands, one per line.  End with CNTL/Z.R1(config)#interface Ethernet0/21R1(config-if)#ip address 192.168.9.224 255.255.255.2542% Warning: use /31 mask on non point-to-point interface cautiouslyR1(config-if)#end
  1. This line sets the new address and mask, 192.168.9.224 with 255.255.255.254, a /31. Before the change this line read ip address 192.168.9.225 255.255.255.252, a /30.
  2. A warning, not a refusal.

Impact Changing an interface’s address stops the packets sent to its old address, and can briefly stop the others that use that interface.

Why warn, when a /31 already works on R2’s Ethernet link to R4? Cisco documents 31-bit prefixes for point-to-point WAN interfaces, and the warning calls R1’s Ethernet interface non point-to-point, so IOS cautions but still accepts the line.

R2’s end is then renumbered to .225 with the same mask.

R1 shows its address lines after the change.

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.1921 ip address 192.168.9.224 255.255.255.254 no ip address
  1. The renumbered link, with the address, then the mask.
R1’s link address is now 192.168.9.224, the first address of its block. Is R1 using a network address as a host address?

R1 then tests R2 at .225 on the renumbered link.

R2 answers every test across the renumbered 192.168.9.224/31, where R1’s .224, the first address, is used as a host address.

Output · IOS XE 17.18.2
R1#ping 192.168.9.225Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.225, 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, five of five.

Key idea

A mask ending in 252 marks a /30 link, with two of its four addresses used, and 254 marks a /31, with both used.

Troubleshoot

A link whose ends disagree

One end of a link was given the wrong prefix or the wrong pair. What do the routers show?

Both cases start from the plan, where the link from R1 to R2 is a /30 again, with R1 at .225 and R2 at .226, and the link from R2 to R4 is a /31.

Three checks for a link that fails, in this order
CheckGoodBroken
Read both ends’ address and mask with show running-config | include ip address or show ip interfacethe same mask on both endsthe masks differ
Work out each end’s subnet, its block, network and broadcast addressboth ends in one blockone end’s address is outside the other end’s block
Check that each address is a host address of its blockbetween the network and the broadcast address, or on a /31 either of the pairit is the network or the broadcast address

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

  1. Case 1 · Symptom

    One day, R1 tests R2 on the link to the branch and gets no answer.

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

    Read R2’s address lines.

  3. Case 1 · Output

    Output · IOS XE 17.18.2
    R2#show running-config | include ip address1 ip address 192.168.9.226 255.255.255.254 ip address 192.168.9.1 255.255.255.128 ip address 192.168.9.228 255.255.255.254 no ip address
    1. Key line The address is the plan’s .226, but the mask ends in 254, a /31, not the plan’s 252.
  4. Case 1 · How far it reaches

    Does the fault reach beyond this link? R2 tests R4 on its other link.

    Output · IOS XE 17.18.2
    R2#ping 192.168.9.229Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.229, 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, so R4 answers.
  5. Case 1 · What it means

    R1HQ routerR2branch routerno answer.224.225 R1.226 R2.227R1: /30R2: /31
    Figure 3.4 · Case 1 · R1’s /30 holds all four addresses, but R2’s /31 holds only .226 and .227, so R1’s .225 is outside it.

    R1 at the top and R2 under it, joined by a cable; beside the cable, a cross tagged “no answer”. Under them, the link’s four addresses as a strip: .224, “.225 R1”, “.226 R2” and .227. A bracket above all four cells reads “R1: /30”; a highlighted bracket below only the last two reads “R2: /31”.

    • 254 is a /31, so R2’s subnet on this link is 192.168.9.226/31, only .226 and .227.
    • R1 still has a /30, 192.168.9.224/30, with R2 inside it. But R1’s .225 is outside R2’s new subnet, so the two ends no longer share a subnet, and no answer comes back to R1.
    • R2’s address matches the plan, but its mask does not. R2 still reaches R4, so R2 itself works and the problem is on this one link.
  6. Case 1 · Fix

    Give R2’s interface the plan’s mask again, 255.255.255.252, with the same address.

    On R2, these configuration lines make the fix.

    Output · IOS XE 17.18.2
    R2#configure terminalEnter configuration commands, one per line.  End with CNTL/Z.1R2(config)#interface Ethernet0/02R2(config-if)#ip address 192.168.9.226 255.255.255.252R2(config-if)#end
    1. Picks R2’s interface toward R1.
    2. The plan address with the plan’s /30 mask.

    Impact Changing an interface’s address stops the packets sent to its old address, and can briefly stop the others that use that interface.

  7. Case 1 · Proof

    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, so R2 answers again.

End of case 1. Solved: Both ends use a /30 again.

On the /31 link, you can work out the far end’s address from R2’s own.

R2’s end of its link to R4 is 192.168.9.228 with a /31. Which address must R4’s end have?

Case 2 of 2.R2’s test of R4 gets no answer

  1. Case 2 · Symptom

    On another day, R2 tests R4 on the /31 link and gets no answer. R4’s end of this link is its interface Et0/0.

    Output · IOS XE 17.18.2
    R2#ping 192.168.9.229Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.229, timeout is 2 seconds:1.....2Success rate is 0 percent (0/5)
    1. Five dots.
    2. Success rate is 0 percent, so 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
    R4#show running-config | include ip address ip address 192.168.9.230 255.255.255.254 ip address 192.168.9.193 255.255.255.224 no ip address no ip address
    Output · IOS XE 17.18.2
    R4#show ip interface Ethernet0/0 | include Internet address  Internet address is 192.168.9.230/31
    Output · IOS XE 17.18.2
    R2#show running-config | include ip address ip address 192.168.9.226 255.255.255.252 ip address 192.168.9.1 255.255.255.128 ip address 192.168.9.228 255.255.255.254 no ip address
    Output · IOS XE 17.18.2
    R2#ping 192.168.9.225Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.225, 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

    Is R2 itself fine? It tests R1 on its other link.

    Output · IOS XE 17.18.2
    R2#ping 192.168.9.225Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.225, 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, so R1 answers.
  5. Case 2 · What it means

    R2branch routerR4branch routerno answer.228 R2.229.230 R4.231R2: /31R4: /31
    Figure 3.5 · Case 2 · R2’s /31 is .228 and .229, and R4’s is .230 and .231, the same prefix but not the same pair.

    R2 at the top and R4 under it, joined by a cable; beside the cable, a cross tagged “no answer”. Under them, four addresses as a strip: “.228 R2”, .229, “.230 R4” and .231. A bracket above the first two reads “R2: /31”; a highlighted bracket below the last two reads “R4: /31”.

    • R4’s .230 starts the next pair, so R4’s subnet is 192.168.9.230/31, .230 and .231.
    • Both ends use a /31, but not the same pair. The address R2 tests, .229, is no longer R4’s, and R2’s .228 is outside R4’s subnet, so no answer comes back to R2.
    • R2’s own lines are as planned and R2 still reaches R1, so the fault lies on R4’s side.
  6. Case 2 · Fix

    Give R4 its plan address, 192.168.9.229, the other address of R2’s pair, with the same mask. Changing an interface’s address stops the packets sent to its old address, and can briefly stop the others that use that interface.

  7. Case 2 · Proof

    With R4 on its plan address, .229, every test from R2 gets an answer.

    Output · IOS XE 17.18.2
    R2#ping 192.168.9.229Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.229, 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, so R4 answers.

End of case 2. Solved: Both ends are in one pair again, .228 and .229.

What both cases share follows once you have answered case 2.

Both cases

Key idea

Both ends of a link need the same prefix and the same block.

Check

A LAN needs 30 hosts. Which is the longest prefix that holds them?
A /24 must make at least 12 equal subnets, with as many hosts in each as possible. Which prefix?

On R1, the HQ router, with every interface as planned:

Tap a line, or “Not in the output”, then submit.

Find the line of the link that would save two addresses as a /31.

Output · IOS XE 17.18.2
R1#show running-config | include ip address
A LAN needs 60 hosts. Which is the longest prefix that holds them?

Read both outputs, then choose the most likely cause.

Symptom: R1’s test of R2 on the /30 link gets no answer. On R2:

Output · IOS XE 17.18.2
R2#show ip interface Ethernet0/0 | include Internet address  Internet address is 192.168.9.226/31
Output · IOS XE 17.18.2
R2#ping 192.168.9.229Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 192.168.9.229, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
Cause

Summary

Branch LAN 1 needs 100 hosts5 host bits: 2⁵ − 2 = 306 host bits: 2⁶ − 2 = 627 host bits: 2⁷ − 2 = 126too fewtoo fewfits/25 · mask 255.255.255.128A link needs 2 hosts/30: 4 addresses, 2 hosts/31: 2 addresses, both hostsLAN 1: /25 · a link: /30 or /31
Figure 3.2, recap · Take the fewest host bits whose hosts still fit: LAN 1 gets /25. A two-router link gets a /30, or a /31, where both addresses are hosts.

“Branch LAN 1 needs 100 hosts” at the top. Under it, three rows: 5 host bits hold 30 hosts and 6 hold 62, both “too few”; 7 hold 126, “fits”. Then “/25 · mask 255.255.255.128”. Then a link: “/30: 4 addresses, 2 hosts” and “/31: 2 addresses, both hosts”. At the foot, “LAN 1: /25 · a link: /30 or /31”.

  • A need is a number of hosts per subnet or a number of subnets per block, and each decides the prefix in its own way.
  • For H hosts, take the fewest host bits h with 2ʰ − 2 ≥ H, and the prefix is 32 − h (branch LAN 1, 100 hosts, /25).
  • For N subnets, take the fewest subnet bits s with 2ˢ ≥ N, and the prefix is the block’s prefix plus s (HQ, 4 LANs, /26).
  • A point-to-point link needs two host addresses: a /30 gives them out of 4, a /31 out of 2, where both are host addresses. In show running-config | include ip address the mask octet tells them apart: 252 or 254.
  • Both ends of a link need the same prefix and the same block: a different mask (192.168.9.226/31) or the next pair of addresses leaves the ends in different subnets, and the test gets no answer.

Commands

  • show running-config | include ip address

    each configuration line that holds “ip address”; a last mask octet of 252 is a /30, 254 a /31.

  • show ip interface Ethernet0/2 | include Internet address

    the interface’s address with its prefix length; compare it with the other end’s.

  • ping 192.168.9.229

    a test of the other end of a link: the Success rate line says whether it answered.