IP addressing and subnetting: where the network ends and the host begins
Every mechanism has a step-by-step animation, the configuration explained line by line and the exam notes. Where a parameter changes the outcome, you get a simulator where you change it yourself.
- Host A has 192.168.10.37 with the mask 255.255.255.128, written /25: the first 25 bits name the network, the last 7 name the host. AND-ing the address with the mask gives Host A's own subnet, 192.168.10.0/25.address 192.168.10.37 · mask 255.255.255.128 = /25 · network 192.168.10.0/25
- Host A wants to reach 192.168.10.150. It applies its own mask to the destination and gets 192.168.10.128, a different subnet. So Host A does not ARP for Host B: it ARPs for its default gateway, R1 (192.168.10.1), unless R1 is already in its ARP cache, and sends the frame to R1's MAC. The IP destination stays 192.168.10.150.destination 192.168.10.150 · AND /25 192.168.10.128 ≠ 192.168.10.0 · ARP for 192.168.10.1, the gateway (not Host B) · IP destination unchanged: 192.168.10.150
- R1 has a connected route for every subnet, and each one has the size it needs: Sales is a /25 (126 hosts), Engineering a /26 (62 hosts), management a /27 and the WAN link a /30. That is VLSM. R1 forwards the packet out Gi0/1 to Host B.
- Host A now opens a web page on 203.0.113.10. Its source, 192.168.10.37, is an RFC 1918 private address that no ISP routes, so R1 translates it to its public address 198.51.100.2 (NAT) before the packet leaves.source 192.168.10.37 → 198.51.100.2 · destination 203.0.113.10 · why private addresses are not routed on the Internet
- The same host also speaks IPv6: prefix 2001:db8:acad:10::/64 on its LAN, an interface ID built from its MAC (EUI-64) and a link-local fe80:: address for the local link. 128 bits, a /64 per LAN, no broadcast and no NAT: the packet keeps its source end to end.prefix 2001:db8:acad:10::/64 · interface ID 250:56ff:fea1:1b01 (EUI-64) · NAT none
TL;DR
An IP address has two parts: the network, which routers use to find the right subnet, and the host, which identifies one device inside it. The mask, or the prefix length /n, says where the line between them falls. In IPv4 (32 bits), the first and the last address of every subnet are reserved for the network and the broadcast, so a /n gives 232−n − 2 usable hosts; the exceptions are /31 on point-to-point links and /32 for a single host. The classes A to E are history, but their ranges still explain the default masks and the multicast (224.0.0.0/4) and reserved (240.0.0.0/4) blocks. The RFC 1918 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are reused in every company and need NAT to reach the Internet; 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 0.0.0.0/8, 255.255.255.255 and the documentation blocks are exceptions you must recognize on sight. Subnetting borrows host bits to make more, smaller subnets; VLSM gives every subnet the size it needs, largest first; summarization does the reverse for routing tables. IPv6 (128 bits) has no broadcast and no need for NAT: a /48 or /56 per site, a /64 per LAN, /127 on point-to-point links, a link-local fe80::/10 address on every interface, unique local fd00::/8 for private use and global unicast from 2000::/3.
How to read the notes: red = critical for the exam, green = theory, blue = numbers, yellow = pitfalls, cyan = differences between platforms (NX-OS, IOS-XE, IOS-XR) and RFCs. In the animations, the configuration lines used at the current step are highlighted automatically; the ← → arrows change the step while the animation is focused. Every address on this page comes from the documentation ranges (192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24, 2001:db8::/32) or from the private ranges, so you can copy the examples into a lab safely.
The analogy, in short
Think of a city with a land registry. Every address has a street part and a house-number part, and the mask tells you how much of the address is the street. On every street the first plot holds the street sign and the last one holds the town crier, so neither can be a home. Surveyors cut the land into streets of different sizes as needed. Inside office buildings, room numbers repeat everywhere, and the reception desk swaps them for the building's street address when a letter leaves.
The model holds up to §10. From §11 on (IPv6), the city is rebuilt on a planet-sized registry, and the analogy stretches; see the full analogy and its limits in §18.
What an IP address is: network part, host part and binary
TL;DRAn IPv4 address is a 32-bit number, written as four octets in dotted decimal: 192.168.10.37 is 11000000.10101000.00001010.00100101. The mask splits it into a network part, which routers forward on (one route per network, not one per host), and a host part, which names one interface; a host ANDs every destination with its own mask and either delivers locally or hands the packet to its default gateway.
- Octet
- A group of 8 bits, written as one decimal number from 0 to 255; an IPv4 address has four of them (192 · 168 · 10 · 37).
- Dotted decimal
- The usual way to write the 32 bits: the four octets in decimal, separated by dots, such as 192.168.10.37.
- Bit and place value
- Each bit of an octet is worth 128, 64, 32, 16, 8, 4, 2 or 1 from left to right; 37 = 32 + 4 + 1 = 00100101.
- Network part
- The leading bits shared by every address of one network: the first 25 bits of Host A, i.e. 192.168.10.0/25. Routers forward on it.
- Host part
- The remaining bits, which pick one interface on that network: the last 7 bits of Host A, value 37.
- Mask and prefix
- The mask marks the network part with 1s (255.255.255.128); the prefix
/25is the same thing written as the number of 1s. - Default gateway
- The router address a host sends to for every destination outside its own network: 192.168.10.1 (R1 Gi0/0) for Host A.
1.1The step-by-step animation
- Host A's address, 192.168.10.37, is one 32-bit number written as four decimal octets separated by dots. Every bit of an octet has a place value, 128 64 32 16 8 4 2 1 from left to right, and the octet is the sum of the places that hold a 1. To convert 37, take each place that still fits and subtract it: 32, then 4, then 1, so 37 = 00100101.dotted decimal 192.168.10.37 · binary 11000000.10101000.00001010.00100101 · size 4 octets × 8 bits = 32 bits
- Going back is the same table read the other way: add up the place values of the 1 bits. Host A's mask is 25 ones followed by 7 zeros. 11111111 is 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255, and 10000000 is 128, so the mask is 255.255.255.128. Counting the ones gives its short form, /25 (§3).binary 11111111.11111111.11111111.10000000 · dotted decimal 255.255.255.128 · prefix /25 = 25 ones
- Lay the mask under the address. Where the mask has 1s, the address bits are the network part (25 bits, cyan); where it has 0s, they are the host part (7 bits, green). Keeping the network bits and zeroing the host bits, a bitwise AND with the mask, gives the network 192.168.10.0/25; the host bits alone, 0100101, say that Host A is host number 37 on it. §3 and §4 do the full arithmetic.network part first 25 bits → 192.168.10.0/25 · host part last 7 bits → 37 · AND 1 AND 1 = 1, anything AND 0 = 0
- Host A wants to reach 192.168.10.100. It ANDs the destination with its own mask and gets 192.168.10.0, its own network: the destination is on the local link. So Host A sends an ARP request for 192.168.10.100 itself and delivers the frame straight through SW1, with no router involved.destination 192.168.10.100 · AND /25 192.168.10.0 = my network · ARP for 192.168.10.100, the destination itself
- Now the destination is 192.168.10.150. The same AND gives 192.168.10.128, not 192.168.10.0: Host B is on another network, even though both addresses start with 192.168.10. So Host A ARPs for its default gateway, 192.168.10.1, and sends the frame to R1's MAC; the IP destination stays 192.168.10.150, and R1 forwards the packet out Gi0/1.destination 192.168.10.150 · AND /25 192.168.10.128 ≠ 192.168.10.0 · ARP for 192.168.10.1, the gateway · IP destination unchanged: 192.168.10.150
- This is why the split exists: R1 keeps one entry per network, not one per host. 192.168.10.0/25 covers all 126 usable Sales addresses, Host A included, 192.168.10.128/26 covers 62 more, and a single default route covers the whole Internet. Asked about 192.168.10.37, R1 answers with the network that contains it,
Routing entry for 192.168.10.0/25. The Internet works the same way: about a million prefixes instead of four billion addresses.lookup 192.168.10.37 · match 192.168.10.0/25, connected, Gi0/0 · entries one per network, whatever the number of hosts
1.2Simulator: an address in decimal, binary and hex
Every octet is converted on its own with the place values 128 64 32 16 8 4 2 1. Pick a prefix to see which bits are the network part and which are the host part.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| Octet | Decimal | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | Sum of the 1s | Hex |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 192 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 128 + 64 = 192 | C0 |
| 2 | 168 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 128 + 32 + 8 = 168 | A8 |
| 3 | 10 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 8 + 2 = 10 | 0A |
| 4 | 37 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 32 + 4 + 1 = 37 | 25 |
| Form | Value |
|---|---|
| Dotted decimal | 192.168.10.37 |
| Binary, by octet | 11000000.10101000.00001010.00100101 |
| 32 bits in a row | 11000000101010000000101000100101 |
| Hexadecimal | 0xC0A80A25 |
| One 32-bit integer | 3,232,238,117 |
| Network part (/25) | 1100000010101000000010100 → 192.168.10.0/25 |
| Host part (7 bits) | 0100101 = host 37 |
- Octet by octet: 192 = 128+64 → 11000000 · 168 = 128+32+8 → 10101000 · 10 = 8+2 → 00001010 · 37 = 32+4+1 → 00100101.
- As one number: 3,232,238,117 = 0xC0A80A25; hex is just the same bits in groups of 4 (1100 0000 1010 1000 0000 1010 0010 0101).
- With /25 the first 25 bits are the network, 192.168.10.0/25; the last 7 bits (0100101) are host number 37 on it. §4 gives the first, last and broadcast addresses.
- First octet 192 = 11000000, class C (§2); Private-Use, RFC 1918 (§6).
1.3The configuration, line by line
R1 · IOS-XE
| 1 | interface GigabitEthernet0/0 | Sales LAN, VLAN 10: Host A's default gateway lives here. |
| 2 | description Sales LAN (VLAN 10) | |
| 3 | ip address 192.168.10.1 255.255.255.128 | Address and mask, the mask in dotted decimal. 255.255.255.128 = 25 ones = /25, so Gi0/0 owns 192.168.10.0/25 and R1 installs it as a connected route. |
| 4 | no shutdown | |
| 5 | ! | |
| 6 | interface GigabitEthernet0/1 | Engineering LAN, VLAN 20. |
| 7 | ip address 192.168.10.129 255.255.255.192 | /26: another network, so traffic between the two LANs has to cross R1. |
| 8 | no shutdown | |
| 9 | ! | |
| 10 | interface GigabitEthernet0/4 | Toward the ISP. |
| 11 | ip address 198.51.100.2 255.255.255.248 | /29 from the ISP (a documentation range in this guide). |
| 12 | ! | |
| 13 | ip route 0.0.0.0 0.0.0.0 198.51.100.1 | The default route: one entry for every network R1 does not know. |
| 14 | ! ip address 192.168.10.1/25 | Wrong on IOS and IOS-XE: the /n form is refused with "% Invalid input". It is the NX-OS syntax. |
show ip interface Gi0/0
| 1 | GigabitEthernet0/0 is up, line protocol is up | Layers 1 and 2 are up; an address on a down interface installs no connected route. |
| 2 | Internet address is 192.168.10.1/25 | The address with its prefix: configured as 255.255.255.128, displayed as /25. |
| 3 | Broadcast address is 255.255.255.255 | Not the subnet broadcast (192.168.10.127, §4): it is the address IOS uses for broadcasts it sends itself. |
| 4 | Address determined by non-volatile memory | Read from the startup configuration. |
| 5 | MTU is 1500 bytes | |
| 6 | Helper address is not set | |
| 7 | Directed broadcast forwarding is disabled | The default since IOS 12.0 (§7). |
| 8 | Outgoing access list is not set | |
| 9 | Inbound access list is not set | |
| 10 | Proxy ARP is enabled | On by default: R1 answers ARP for addresses it routes out another interface, which can hide a wrong host mask (§16). |
show ip interface brief
| 1 | Interface IP-Address OK? Method Status Protocol | |
| 2 | GigabitEthernet0/0 192.168.10.1 YES NVRAM up up | There is no mask column: brief shows the address only. |
| 3 | GigabitEthernet0/1 192.168.10.129 YES NVRAM up up | |
| 4 | GigabitEthernet0/2 192.168.10.225 YES NVRAM up up | The point-to-point link to R2 (§8). |
| 5 | GigabitEthernet0/3 192.168.10.193 YES NVRAM up up | |
| 6 | GigabitEthernet0/4 198.51.100.2 YES NVRAM up up | Toward the ISP. |
| 7 | GigabitEthernet0/5 unassigned YES NVRAM administratively down down | No address and shut down: no connected route. |
show ip route 192.168.10.37
| 1 | Routing entry for 192.168.10.0/25 | R1 looked up a host and found the network that contains it: there is no entry for .37 itself. |
| 2 | Known via "connected", distance 0, metric 0 (connected, via interface) | A connected route comes from the interface address and mask; administrative distance 0. |
| 3 | Routing Descriptor Blocks: | |
| 4 | * directly connected, via GigabitEthernet0/0 | Deliver on Gi0/0: R1 ARPs for 192.168.10.37 there. |
| 5 | Route metric is 0, traffic share count is 1 |
Host A · Windows and Linux
| 1 | C:\> ipconfig | |
| 2 | IPv4 Address. . . . . . . . . . . : 192.168.10.37 | Windows shows the address… |
| 3 | Subnet Mask . . . . . . . . . . . : 255.255.255.128 | …the mask in dotted decimal… |
| 4 | Default Gateway . . . . . . . . . : 192.168.10.1 | …and the gateway, used for every destination outside 192.168.10.0/25. |
| 5 | $ ip -4 addr show dev eth0 | |
| 6 | inet 192.168.10.37/25 brd 192.168.10.127 scope global eth0 | Linux shows /25 and the subnet broadcast it computed from the mask (.127, §4). |
| 7 | $ ip route | |
| 8 | default via 192.168.10.1 dev eth0 | Everything that is not local goes to the gateway. |
| 9 | 192.168.10.0/25 dev eth0 proto kernel scope link src 192.168.10.37 | The local decision in one line: this /25 is on the link, so the host ARPs for the destination itself. |
The outputs are typical for IOS-XE, Windows and Linux; details may vary between versions.
1.4Remember
no ip proxy-arp is configured (§16).show ip interface brief shows no mask at all, and "Broadcast address is 255.255.255.255" in show ip interface is not the subnet broadcast (192.168.10.127). Read the mask from "Internet address is 192.168.10.1/25" or from the running configuration.ip address 192.168.10.1 255.255.255.128), NX-OS takes ip address 192.168.10.1/25, IOS-XR ipv4 address 192.168.10.1 255.255.255.128 (§10). Windows ipconfig prints the dotted mask, Linux ip addr prints /25. IOS 15 and later also install an L /32 route for the router's own address.show ip interface GigabitEthernet0/0show ip interface briefshow ip route 192.168.10.37show running-config interface GigabitEthernet0/01.5Check yourself: exam-style questions
What is the octet 172 in binary?
- A11001100
- B10101100
- C10110100
- D10101010
Show answer
A mask is shown in binary as 11111111.11111111.11111111.11100000. What is it in dotted decimal, and what is its prefix length?
- A255.255.255.240, /28
- B255.255.255.224, /27
- C255.255.255.192, /26
- D255.255.255.224, /29
Show answer
Host A is 192.168.10.37/25 with default gateway 192.168.10.1. It sends its first packet to 192.168.10.150. What does Host A do?
- AIt ARPs for 192.168.10.150 directly, because both addresses begin with 192.168.10
- BIt ARPs for the gateway 192.168.10.1 and sends the frame to R1's MAC
- CIt rewrites the IP destination to 192.168.10.1 so that R1 accepts the packet
- DIt drops the packet, because 192.168.10.150 lies outside its own subnet
Show answer
In 192.168.10.37/25, how many bits form the host part, and what value do they carry?
- A8 bits, value 37
- B7 bits, value 37
- C7 bits, value 165
- D25 bits, value 192.168.10
Show answer
R1's routing table holds C 192.168.10.0/25 (Gi0/0), C 192.168.10.128/26 (Gi0/1) and S* 0.0.0.0/0 via 198.51.100.1. Host A (192.168.10.37) is up and has been talking through R1. What does show ip route 192.168.10.37 report?
- ARouting entry for 192.168.10.37/32, built from the ARP cache
- BRouting entry for 0.0.0.0/0, the default via 198.51.100.1
- C% Network not in table, since no host route exists for .37
- DRouting entry for 192.168.10.0/25, connected via Gi0/0
Show answer
Host A (192.168.10.37) is mistakenly configured with mask 255.255.255.0. R1 Gi0/0 is 192.168.10.1/25 with default settings, and Host B (192.168.10.150) sits behind R1 Gi0/1. Host A pings Host B. What happens?
- AIt fails: R1 never answers ARP requests for addresses it does not own
- BIt works: Host A ARPs for .150 and R1 replies with proxy ARP
- CHost A sends the ping to 192.168.10.1, because .150 is in another /25
- DSW1 floods the ARP request toward Gi0/1 and Host B answers it directly
Show answer
no ip proxy-arp the same misconfiguration breaks the ping. A host never uses the other side's mask, and the ARP broadcast stops at R1.R1 runs IOS-XE with Gi0/0 = 192.168.10.1/25. What do show ip route 192.168.10.1 and show ip route 192.168.10.37 return?
- AThe C route 192.168.10.0/25 for both, since .1 is inside it
- B% Subnet not in table for both: connected networks are not routes
- CThe L route 192.168.10.1/32, then the C route 192.168.10.0/25
- DAn L /32 for both: IOS 15 adds a /32 route per ARP entry too
Show answer
IPv4 classes A to E: first bits, ranges and default masks
TL;DRThe first bits of the first octet give the class: 0 = A (1–126, /8), 10 = B (128–191, /16), 110 = C (192–223, /24), 1110 = D (multicast) and 1111 = E (reserved). Fixed masks wasted addresses and bloated routing tables, so CIDR replaced the classes in 1993; they survive as default masks, classful network statements, auto-summary and the "is subnetted" headers, and auto-summary can still black-hole a discontiguous network.
- Class
- One of five groups, A to E, given by the first bits of the address; for A, B and C it also fixed the mask (/8, /16, /24).
- Leading bits
- The class pattern at the start of the first octet: 0, 10, 110, 1110 or 1111. 172 = 10101100 starts with 10, so it is class B.
- Default (classful) mask
- The mask the class implies: 255.0.0.0, 255.255.0.0 or 255.255.255.0. Classes D and E have none.
- Major (classful) network
- The class network an address belongs to: 172.16.1.10 → 172.16.0.0/16, 10.0.12.1 → 10.0.0.0/8.
- Auto-summary
- A RIP and EIGRP behaviour: advertise only the major network (172.16.0.0/16) out of an interface that belongs to another major network.
- Discontiguous network
- A major network split in two by another one, such as 172.16.1.0/24 and 172.16.2.0/24 separated by 10.0.0.0 links.
- CIDR
- Classless Inter-Domain Routing (RFC 1519 in 1993, now RFC 4632): any prefix length, written /n and carried with every route.
2.1The step-by-step animation
- The class of an IPv4 address is written in the first bits of its first octet, so one octet is enough to tell it. A leading 0 means class A, 10 class B, 110 class C, 1110 class D (multicast) and 1111 class E (reserved). Below, both sites use 172.16.x.x, class B, and the core links use 10.x.x.x, class A: keep that in mind, it is what breaks the routing later.0… A · 0–127 · /8 · 10… B · 128–191 · /16 · 110… C · 192–223 · /24 · 1110… / 1111… D multicast · E reserved
- Each class fixed where the network part ends: 8 bits for A, 16 for B, 24 for C. Class A is half of the whole address space, cut into only 126 usable networks of 16,777,214 hosts (0 is "this network", 127 is loopback). Class B is a quarter: 16,384 networks of 65,534 hosts. Class C is an eighth: 2,097,152 networks of only 254 hosts. Class D (224–239) carries multicast groups and class E (240–255) is reserved; neither has a default mask.A 126 networks × 16,777,214 hosts · B 16,384 × 65,534 · C 2,097,152 × 254
- Fixed sizes did not fit real networks. A company with 300 hosts was too big for a C (254) and got a B, leaving 65,234 addresses unused, so class B was running out by the early 1990s; handing out several Cs instead added one Internet route per C. CIDR (RFC 1519, 1993, now RFC 4632) removed the classes: a prefix carries its own length, so the same company gets a /23, 510 hosts and one route.300 hosts, classful a class B: 65,234 addresses unused · 300 hosts, CIDR a /23: 510 hosts, one route · CIDR RFC 1519 (1993) → RFC 4632 (2006)
- Classful habits survive in routing protocols. R1 and R3 run EIGRP with
auto-summary(typed on purpose here; RIPv2 still does it by default). When R1 advertises 172.16.1.0/24 out of an interface in another major network, 10.0.0.0, it sends only the classful network 172.16.0.0/16 and installs that summary toward Null0. R3 does exactly the same with 172.16.2.0/24.R1 sends 172.16.0.0/16, not 172.16.1.0/24 · R3 sends 172.16.0.0/16, not 172.16.2.0/24 · R1 and R3 install 172.16.0.0/16 → Null0 - The result is a discontiguous network: 172.16.0.0 is split in two by 10.0.0.0, and both halves claim all of it. PC 1 pings 172.16.2.10, and R1's best match is its own summary 172.16.0.0/16 to Null0: the packet is discarded right there. R2 holds two equal-cost paths for 172.16.0.0/16 and load-shares per flow (CEF hashes source and destination), so about half of the flows it sends toward Site 2 go to R1 and die the same way.ping 172.16.1.10 → 172.16.2.10 · R1 match 172.16.0.0/16 → Null0: discarded · R2 172.16.0.0/16 via R1 and via R3 (ECMP)
- The fix is to stop cutting at the class boundary:
no auto-summaryon R1 and R3 (the EIGRP default since IOS 15.0(1)M; for RIPv2 you must type it). Each router now advertises its real /24 with its mask, R2 learns two different routes,172.16.0.0/24 is subnetted, 2 subnets, and the ping goes through. This is classless routing: the mask travels with the prefix.R1 sends 172.16.1.0/24 · R3 sends 172.16.2.0/24 · ping 172.16.1.10 → 172.16.2.10: success - Classes are gone from forwarding, but they leave traces you meet every day:
show ip routestill groups subnets under their classful network ("is subnetted", "is variably subnetted"); RIPnetworkstatements, and EIGRP ones without a wildcard, take the class; BGPnetwork 10.0.0.0withoutmaskmeans 10.0.0.0/8; and hosts propose the class mask, 255.0.0.0 for a 10.x address. Know the classes, then always give the mask.show ip route 172.16.0.0/24 is subnetted · BGP network 10.0.0.0 = 10.0.0.0/8 · RIP network 172.16.1.0 saved as 172.16.0.0
2.2Simulator: which class is this address?
The class comes only from the first bits of the first octet. For classes A, B and C it implies a default mask; the special blocks are pointed to §6 and §7.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| Field | Value |
|---|---|
| First octet | 172 = 10101100 |
| Class | B |
| Leading bits | 10 |
| First-octet range | 128–191 |
| Default (classful) mask | 255.255.0.0 = /16 |
| Classful network | 172.16.0.0/16 |
| Hosts per classful network | 65,534 (216 − 2) |
| Networks in the class | 16,384 |
| With your /20 (CIDR) | 172.16.32.0/20 |
| IANA special-purpose | 172.16.0.0/12 · Private-Use · RFC 1918 → §6 |
- Private (RFC 1918, 172.16.0.0/12): usable inside any network, but it needs NAT to reach the Internet (§6). "Private" is not a class: the three RFC 1918 blocks sit in classes A, B and C.
- With /20 the real network is 172.16.32.0/20 (CIDR). The classful network 172.16.0.0/16 only matters for auto-summary, classful network statements and the "is subnetted" header in
show ip route.
2.3The configuration, line by line
R1 · EIGRP with auto-summary
| 1 | router eigrp 100 | |
| 2 | network 10.0.0.0 | No wildcard, so the class is assumed: every R1 interface in 10.0.0.0/8 runs EIGRP. |
| 3 | network 172.16.0.0 | Same: the whole class B network 172.16.0.0/16. |
| 4 | auto-summary | Advertise only 172.16.0.0/16 out of interfaces in another major network and install 172.16.0.0/16 → Null0. Off by default since IOS 15.0(1)M: here it was typed on purpose, and R3 has the same line. |
R1 · EIGRP fixed
| 1 | ip classless | The IOS default since 11.3, shown for clarity: a packet for an unknown subnet of a known major network may still follow the default route. |
| 2 | router eigrp 100 | |
| 3 | network 10.0.12.0 0.0.0.3 | With a wildcard: only the interface in 10.0.12.0/30. |
| 4 | network 172.16.1.0 0.0.0.255 | Only the LAN 172.16.1.0/24. |
| 5 | no auto-summary | Advertise 172.16.1.0/24 with its real mask. R3 needs the same line for 172.16.2.0/24. |
R1 · RIPv2
| 1 | router rip | |
| 2 | version 2 | RIPv2 sends the mask with every route; RIPv1 does not, so it cannot handle a discontiguous network at all. |
| 3 | network 10.0.0.0 | RIP network statements are always classful: there is no wildcard. |
| 4 | network 172.16.0.0 | Typing network 172.16.1.0 would be saved as 172.16.0.0. |
| 5 | no auto-summary | Required: RIPv2 still summarizes at the class boundary by default on most IOS and IOS-XE releases. |
R1 · show ip route (auto-summary)
| 1 | Gateway of last resort is not set | |
| 2 | ||
| 3 | 10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks | The classful parent header: 10.0.0.0/8 holds routes with 3 different masks (/8, /30, /32). |
| 4 | D 10.0.0.0/8 is a summary, 00:02:11, Null0 | Auto-summary the other way: R1 advertises 10.0.0.0/8 into Site 1. |
| 5 | C 10.0.12.0/30 is directly connected, GigabitEthernet0/1 | |
| 6 | L 10.0.12.1/32 is directly connected, GigabitEthernet0/1 | |
| 7 | D 10.0.23.0/30 [90/3072] via 10.0.12.2, 00:02:09, GigabitEthernet0/1 | No summary inside the same major network: the /30 arrives intact. |
| 8 | 172.16.0.0/16 is variably subnetted, 3 subnets, 3 masks | |
| 9 | D 172.16.0.0/16 is a summary, 00:02:11, Null0 | The trap: 172.16.2.10 matches this /16 and goes to Null0, i.e. it is discarded. |
| 10 | C 172.16.1.0/24 is directly connected, GigabitEthernet0/0 | |
| 11 | L 172.16.1.1/32 is directly connected, GigabitEthernet0/0 | The IOS 15+ local route for R1's own address. |
R2 · show ip route (auto-summary)
| 1 | 10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks | |
| 2 | C 10.0.12.0/30 is directly connected, GigabitEthernet0/0 | |
| 3 | L 10.0.12.2/32 is directly connected, GigabitEthernet0/0 | |
| 4 | C 10.0.23.0/30 is directly connected, GigabitEthernet0/1 | |
| 5 | L 10.0.23.1/32 is directly connected, GigabitEthernet0/1 | |
| 6 | D 172.16.0.0/16 [90/3072] via 10.0.23.2, 00:02:05, GigabitEthernet0/1 | The classful network itself, with no "is subnetted" header: R2 only knows 172.16.0.0/16… |
| 7 | [90/3072] via 10.0.12.1, 00:02:05, GigabitEthernet0/0 | …from both R1 and R3 with the same metric: equal-cost load sharing between the two sites. |
R2 · show ip route (fixed)
| 1 | 10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks | |
| 2 | C 10.0.12.0/30 is directly connected, GigabitEthernet0/0 | |
| 3 | L 10.0.12.2/32 is directly connected, GigabitEthernet0/0 | |
| 4 | C 10.0.23.0/30 is directly connected, GigabitEthernet0/1 | |
| 5 | L 10.0.23.1/32 is directly connected, GigabitEthernet0/1 | |
| 6 | 172.16.0.0/24 is subnetted, 2 subnets | The classful parent 172.16.0.0 with the one mask its subnets share: the class survives as a heading. |
| 7 | D 172.16.1.0 [90/3072] via 10.0.12.1, 00:00:07, GigabitEthernet0/0 | Site 1, toward R1. |
| 8 | D 172.16.2.0 [90/3072] via 10.0.23.2, 00:00:07, GigabitEthernet0/1 | Site 2, toward R3. |
The outputs are typical for IOS and IOS-XE; timers, metrics and details may vary between versions.
2.4Remember
no auto-summary whenever a major network is discontiguous and check show ip protocols: "Automatic network summarization is in effect" (RIP) or "Automatic Summarization: enabled" (EIGRP).auto-summary command, off by default since 12.2(8)T, and network 10.0.0.0 without mask still means /8. ip classless has been the IOS default since 11.3: with no ip classless, a packet for an unknown subnet of a known major network is dropped instead of following the default route.show ip protocolsshow ip routeshow ip route 172.16.2.10show ip eigrp topology2.5Check yourself: exam-style questions
The first octet of an address begins with the bits 110. Which class is it, and what is its default mask?
- AClass C, 255.255.0.0
- BClass D, no default mask
- CClass C, 255.255.255.0
- DClass B, 255.255.0.0
Show answer
How many class A networks can be assigned to hosts, and why not 128?
- A126: networks 0 and 255 are reserved in every class
- B127: only network 0 is reserved, as "this network"
- C128: every first octet from 0 to 127 can be assigned
- D126: network 0 is "this network" and 127 is loopback
Show answer
Which address is a class B address that is not private?
- A172.16.45.200
- B172.32.1.1
- C192.168.172.16
- D172.31.255.254
Show answer
Which first-octet range is class D, and what is it used for?
- A224–239, multicast groups
- B224–239, reserved for experiments
- C240–255, multicast groups
- D192–223, multicast groups
Show answer
R1 (LAN 172.16.1.0/24) and R3 (LAN 172.16.2.0/24) both connect to R2 over 10.0.12.0/30 and 10.0.23.0/30. EIGRP runs everywhere, and R1 and R3 are configured with auto-summary. What does R2 install for the 172.16 networks?
- ATwo routes, 172.16.1.0/24 via R1 and 172.16.2.0/24 via R3
- BA 172.16.0.0/16 summary route pointing to Null0
- CNothing, because EIGRP rejects two identical summaries from different neighbors
- DOne 172.16.0.0/16 route with two equal-cost next hops, R1 and R3
Show answer
On classic IOS 15.x, which statement about the automatic summarization defaults is correct?
- ABoth EIGRP and RIPv2 auto-summarize by default
- BNeither EIGRP nor RIPv2 auto-summarizes by default
- CEIGRP no longer auto-summarizes by default, while RIPv2 still does
- DOSPF auto-summarizes at classful boundaries unless no auto-summary is configured
Show answer
no auto-summary is still needed there (check the default on your IOS-XE release). OSPF has no auto-summary at all: it only summarizes where you configure area range or summary-address.An IOS router has router bgp 65001 with network 10.0.0.0 (no mask keyword). Its routing table holds 10.1.0.0/16 but no 10.0.0.0/8. What does BGP advertise from this statement?
- A10.0.0.0/16, with the mask copied from the first matching route
- B10.0.0.0/8, built as an aggregate of 10.1.0.0/16
- CNothing, unless 10.0.0.0/8 itself is in the routing table
- D10.1.0.0/16, because it falls inside 10.0.0.0/8
Show answer
network 10.1.0.0 mask 255.255.0.0; building a /8 from more specific routes needs aggregate-address (§9).R1 runs EIGRP with auto-summary and also has a static default route via R2. PC 1 in 172.16.1.0/24 cannot reach 172.16.2.10, which lives behind R3. Why does the default route not help?
- AR2 drops the packet because it arrived on the interface it would use to reach R1
- BR1's own summary 172.16.0.0/16 → Null0 is a longer match than 0.0.0.0/0
- Cip classless is disabled by default, so R1 ignores the default route for subnets of 172.16.0.0
- DEIGRP split horizon blocks traffic going back toward the summarizing router
Show answer
ip classless has been on by default since IOS 11.3, and split horizon filters route advertisements, not data packets.Subnet masks, prefix length and CIDR
TL;DRA subnet mask is 32 bits of contiguous 1s followed by 0s, so it can be written as a single count, the prefix length: 255.255.240.0 = /20, and every mask octet is one of only nine values. A wildcard is the same boundary inverted (0.0.15.255) and is what ACLs and OSPF network statements expect. CIDR made the length part of every prefix; IOS keeps the dotted mask in its configuration and prints /n in its routing table.
- Subnet mask
- 32 bits: 1s over the network part, then 0s over the host part. 255.255.240.0 = 11111111.11111111.11110000.00000000.
- Prefix length (/n)
- The number of 1 bits in the mask, written after a slash: 255.255.240.0 = /20.
- Contiguous
- All the 1s on the left, with no 0 between them. 255.0.255.0 is not contiguous, and IOS refuses it as a mask.
- Wildcard (inverse) mask
- The mask with every bit flipped, 0.0.15.255 for a /20: 0 = must match, 1 = ignore. Used by ACLs and by OSPF and EIGRP network statements.
- CIDR
- Classless Inter-Domain Routing (RFC 1519, now RFC 4632): any prefix length from /0 to /32, written address/length and carried with every route.
- Block size
- 256 minus the mask octet where the boundary falls: 256 − 240 = 16, so /20 networks start every 16 in the third octet (§5).
3.1The step-by-step animation
- A mask is 32 bits: a run of 1s on the left, the network part, then 0s, the host part. To build a /20, write 20 ones. The first two octets fill completely, 255.255; the third gets the remaining 4 ones, 11110000 = 128 + 64 + 32 + 16 = 240; everything after is 0. So /20 = 255.255.240.0, the mask of this branch LAN./20 20 ones + 12 zeros · octet 3 11110000 = 240 · dotted decimal 255.255.240.0
- Because the 1s must be contiguous, a mask octet can only hold nine values: 0, 128, 192, 224, 240, 248, 252, 254 and 255, that is zero to eight ones pushed to the left. 240 has four ones, so it means /4, /12, /20 or /28 depending on the octet it sits in. Any other value, such as 250 or 127, has a 1 after a 0 and is never a valid mask octet.valid octets 0 128 192 224 240 248 252 254 255 · 240 4 ones: /4, /12, /20 or /28 · never 250, 253, 127, 55…
- The PC has 172.16.45.200 with mask 255.255.240.0. Its 20 network bits give the network 172.16.32.0/20, a block of 4,096 addresses from 172.16.32.0 to 172.16.47.255. The same mask has two spellings: IOS configures it in dotted decimal,
ip address 172.16.32.1 255.255.240.0, whileshow ip route, NX-OS and every CIDR document write /20. Converting is just counting the ones.address 172.16.45.200 · mask 255.255.240.0 = /20 · network 172.16.32.0/20 · 4,096 addresses - ACLs and OSPF
networkstatements do not take masks but wildcards: the same boundary with every bit inverted, where 0 means "this bit must match" and 1 means "ignore it". Flip the bits of 255.255.240.0, or subtract each octet from 255, and you get 0.0.15.255.access-list 10 permit 172.16.32.0 0.0.15.255checks the first 20 bits and ignores the last 12, so the PC's traffic is permitted toward HQ.mask 255.255.240.0 · wildcard 0.0.15.255 = 255.255.255.255 − mask · 0 / 1 must match / ignore - The classic mistake is typing the mask where IOS expects a wildcard:
access-list 10 permit 172.16.32.0 255.255.240.0. IOS accepts it but reads "ignore the first 20 bits, check the last 12", and storespermit 0.0.0.0, wildcard bits 255.255.240.0: only addresses whose last 12 bits are zero match. 172.16.45.200 ends in 1101 11001000, so the implicit deny drops it. The fix is the wildcard, 0.0.15.255.typed permit 172.16.32.0 255.255.240.0 · stored permit 0.0.0.0, wildcard bits 255.255.240.0 · 172.16.45.200 last 12 bits ≠ 0 → implicit deny - Masks, unlike ACL wildcards, must be contiguous.
ip address 172.16.32.1 255.0.255.0on R1 is refused withBad mask 0xFF00FF00 for address 172.16.32.1: the 1s of the third octet come after the 0s of the second, so there is no single point where the network ends. RFC 950 only recommended contiguous masks; CIDR requires them, and IOS rejects 255.255.255.250 the same way.typed 255.0.255.0 · binary 11111111.00000000.11111111.00000000 · IOS Bad mask 0xFF00FF00 for address 172.16.32.1 - CIDR is why the length now travels with every prefix: since RFC 1519 (1993, replaced by RFC 4632) a route is an address plus a length, and any length from /0 to /32 is legal. On Cisco devices you meet four spellings of the same /20: dotted on IOS interfaces, /20 in routing tables and on NX-OS, the wildcard in ACLs and OSPF, and hex, which IOS prints with
ip netmask-format hexadecimaland inBad maskerrors.ip netmask-formatonly changes how IOS displays masks, never the configuration.IOS interface 255.255.240.0 · routes, NX-OS /20 · ACL, OSPF 0.0.15.255 · hex display 0xFFFFF000
3.2Simulator: one mask, every spelling
The converter checks that the 1s are contiguous and gives the dotted mask, the /n, the wildcard, the hex value, the addresses per block and the usable hosts.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| Form | Value |
|---|---|
| Prefix length | /20 |
| Subnet mask | 255.255.240.0 (octet 3 = 240, one of 0 128 192 224 240 248 252 254 255) |
| Wildcard | 0.0.15.255 |
| Mask in binary | 11111111.11111111.11110000.00000000 |
| Mask in hex | 0xFFFFF000 |
| Addresses per block | 4,096 (212) |
| Usable hosts | 4,094 (212 − 2) |
| Block size | 16 in octet 3 (networks start every 16: 0, 16, 32…) |
| How you type it | IOS: ip address … 255.255.240.0 · NX-OS: ip address …/20 · ACL / OSPF: … 0.0.15.255 |
- 20 ones followed by 12 zeros: the network part is 20 bits, the host part 12. The wildcard is 255.255.255.255 − 255.255.240.0 = 0.0.15.255.
- Each /20 block holds 4,096 addresses: the first is the network, the last the broadcast, 4,094 are left for hosts (§4).
- Block size 16 in octet 3 (256 − 240): §5 uses it to list the subnets without binary.
3.3The configuration, line by line
R1 · IOS-XE
| 1 | interface GigabitEthernet0/0 | Branch LAN. |
| 2 | ip address 172.16.32.1 255.255.240.0 | IOS and IOS-XE always take the dotted mask here: 255.255.240.0 = /20. |
| 3 | ! | |
| 4 | interface GigabitEthernet0/1 | Link to R2 at HQ. |
| 5 | ip address 10.0.12.1 255.255.255.252 | /30 = 255.255.255.252. |
| 6 | ip access-group 10 out | Filter what leaves toward HQ with ACL 10. |
| 7 | ! | |
| 8 | access-list 10 permit 172.16.32.0 0.0.15.255 | A wildcard, not a mask: 0 bits must match, 1 bits are ignored. Permits 172.16.32.0 to 172.16.47.255; everything else hits the implicit deny. |
| 9 | ! | |
| 10 | router ospf 1 | |
| 11 | network 172.16.32.0 0.0.15.255 area 0 | OSPF network statements take a wildcard too: every interface whose address falls in 172.16.32.0/20 joins area 0. |
| 12 | network 10.0.12.0 0.0.0.3 area 0 | The /30 link: wildcard 0.0.0.3. |
| 13 | ! | |
| 14 | line vty 0 4 | |
| 15 | ip netmask-format bit-count | Display only: show output on SSH sessions prints masks as /20; decimal prints 255.255.240.0 and hexadecimal 0xFFFFF000. The configuration does not change. terminal ip netmask-format does the same for the current session. |
NX-OS
| 1 | interface Ethernet1/1 | |
| 2 | no switchport | A routed port. |
| 3 | ip address 172.16.32.1/20 | NX-OS uses the prefix length; a dotted mask is also accepted and stored as /20. |
| 4 | ip router ospf 1 area 0.0.0.0 | No network statement and no wildcard: OSPF is enabled per interface. |
| 5 | ! | |
| 6 | ip access-list BRANCH | |
| 7 | 10 permit ip 172.16.32.0/20 any | NX-OS ACLs take /20 (a wildcard is accepted too). |
IOS-XR
| 1 | interface GigabitEthernet0/0/0/0 | |
| 2 | ipv4 address 172.16.32.1 255.255.240.0 | IOS-XR configures the dotted mask too (note ipv4, not ip); show route prints /20. |
| 3 | ! | |
| 4 | ipv4 access-list BRANCH | |
| 5 | 10 permit ipv4 172.16.32.0 0.0.15.255 any | A wildcard, as on IOS: 0 = must match, 1 = ignore. |
| 6 | ! | |
| 7 | router ospf 1 | |
| 8 | area 0 | |
| 9 | interface GigabitEthernet0/0/0/0 | As on NX-OS, interfaces are listed under the area: no wildcards. |
Wrong
| 1 | access-list 10 permit 172.16.32.0 255.255.240.0 | A mask typed as a wildcard: accepted, but it ignores the first 20 bits and checks only the last 12. |
| 2 | ! show access-lists → 10 permit 0.0.0.0, wildcard bits 255.255.240.0 | IOS clears the ignored bits, so only addresses ending in 12 zero bits match: 172.16.45.200 is denied. |
| 3 | interface GigabitEthernet0/0 | |
| 4 | ip address 172.16.32.1 255.0.255.0 | Not contiguous: 1s after 0s. |
| 5 | ! Bad mask 0xFF00FF00 for address 172.16.32.1 | Refused: the interface keeps its previous address. |
| 6 | ip address 172.16.32.1 255.255.255.250 | |
| 7 | ! Bad mask 0xFFFFFFFA for address 172.16.32.1 | 250 = 11111010: refused as well. |
show ip route connected
| 1 | 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks | |
| 2 | C 10.0.12.0/30 is directly connected, GigabitEthernet0/1 | |
| 3 | L 10.0.12.1/32 is directly connected, GigabitEthernet0/1 | |
| 4 | 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks | The classful parent (§2): the /20 and the /32 live under it. |
| 5 | C 172.16.32.0/20 is directly connected, GigabitEthernet0/0 | The configured 255.255.240.0, displayed as /20. |
| 6 | L 172.16.32.1/32 is directly connected, GigabitEthernet0/0 | R1's own address as a /32 (IOS 15 and later). |
show access-lists
| 1 | Standard IP access list 10 | |
| 2 | 10 permit 172.16.32.0, wildcard bits 0.0.15.255 (12 matches) | IOS prints the stored address and the wildcard bits; the counter grows as the PC's packets are permitted. |
The outputs and error messages are typical for IOS and IOS-XE; details may vary between versions.
3.4Remember
permit 172.16.32.0 255.255.240.0) is accepted without any warning and matches the wrong addresses. Check with show access-lists: IOS prints the address it stored and the wildcard bits.Bad mask 0xFFFFFFFA. Wildcards, on the other hand, may be non-contiguous: permit 10.1.0.5 0.0.255.0 legally matches 10.1.x.5.ip address and ip route and wildcards in ACLs and in OSPF and EIGRP network statements. NX-OS configures /20 and enables OSPF per interface; IOS-XR configures ipv4 address with a dotted mask and lists OSPF interfaces under the area. terminal ip netmask-format {bit-count | decimal | hexadecimal} changes only how show output prints masks.show running-config interface GigabitEthernet0/0show ip interface GigabitEthernet0/0show ip route connectedshow access-lists 10show ip ospf interface brief3.5Check yourself: exam-style questions
Which of these is a valid subnet mask?
- A255.255.255.253
- B255.0.255.0
- C255.255.248.0
- D255.255.250.0
Show answer
Which prefix length is the same as the mask 255.255.240.0?
- A/21
- B/20
- C/19
- D/28
Show answer
In a standard ACL, which wildcard matches exactly the addresses of 172.16.32.0/20?
- A0.0.16.255
- B255.255.240.0
- C0.0.15.255
- D0.0.31.255
Show answer
What is a /27 mask in dotted decimal, and how many usable hosts does a /27 subnet hold?
- A255.255.255.192, 62 hosts
- B255.255.255.224, 30 hosts
- C255.255.255.240, 14 hosts
- D255.255.255.224, 32 hosts
Show answer
To permit the branch 172.16.32.0/20, an engineer types access-list 10 permit 172.16.32.0 255.255.240.0 and applies it outbound toward HQ. What happens to traffic from 172.16.45.200?
- ADenied: read as a wildcard, it checks only the last 12 bits, which must be 0
- BPermitted: its first 20 bits match 172.16.32.0, exactly as the mask demands
- CPermitted: IOS rejects the line with Bad mask, and a missing ACL permits all
- DPermitted: IOS converts the mask into the wildcard 0.0.15.255 by itself
Show answer
Which OSPF statement matches every interface address in 172.16.32.0/20 and nothing outside it?
- Anetwork 172.16.32.0 0.0.15.255 area 0
- Bnetwork 172.16.32.0 0.0.16.255 area 0
- Cnetwork 172.16.32.0 0.0.31.255 area 0
- Dnetwork 172.16.45.0 0.0.0.255 area 0
Show answer
A router has ip prefix-list BR seq 5 permit 172.16.32.0/20 le 24. Which received route does it permit?
- A172.16.32.0/19
- B172.16.40.0/22
- C172.16.48.0/24
- D172.16.32.0/25
Show answer
Which addresses does access-list 20 permit 10.0.5.0 0.255.0.255 match?
- ANone: IOS rejects the entry, since wildcards must be contiguous like masks
- BOnly 10.0.5.0 to 10.0.5.255, because IOS converts the wildcard to a contiguous one
- CAny address in 10.0.0.0/8, because the first 1 bit makes the rest ignored
- DAny address whose first octet is 10 and third octet is 5, i.e. 10.x.5.y
Show answer
Network, broadcast and usable hosts: the formula, /31 and /32
TL;DRThe network address is the IP address AND the mask, the broadcast is the network OR the wildcard, and every address in between is a usable host: 2h − 2 of them, because the all-zeros and all-ones host values are reserved. The fast way is the block size of the interesting octet (256 − mask octet). Two exceptions: a /31 on a point-to-point link has two usable addresses and no broadcast (RFC 3021), and a /32 is a single host (loopbacks, host routes).
- Network address
- All host bits 0: the address AND the mask. For 172.16.45.200/20 it is 172.16.32.0, the name the routing table uses for the subnet.
- Broadcast address
- All host bits 1: the network OR the wildcard. For the same /20 it is 172.16.47.255; a packet sent to it reaches every host in the subnet.
- Wildcard mask
- The mask inverted bit by bit: /20 = 255.255.240.0, wildcard 0.0.15.255. The same value appears in ACLs and OSPF
networkstatements. - Usable hosts
- 2h − 2, with h = 32 − prefix: 212 − 2 = 4094 for a /20, 27 − 2 = 126 for Host A's /25.
- Interesting octet, block size
- The octet where the mask is neither 255 nor 0; block size = 256 − that octet (256 − 240 = 16), the step between consecutive networks.
- /31 (RFC 3021)
- Two addresses, both usable, no network and no broadcast: only for point-to-point links.
- /32 and host route
- One address, no host bits: loopbacks such as 10.255.0.1/32 and the
Lroutes IOS installs for its own interface addresses.
4.1The step-by-step animation
- Start with the classic exam example, 172.16.45.200/20. A /20 mask has 20 ones: the first 20 bits name the network, the last 12 the host. AND-ing the address with the mask bit by bit keeps every network bit and turns every host bit into 0, so the result is the network address, 172.16.32.0.address 172.16.45.200 · mask 255.255.240.0 = /20 · AND = network 172.16.32.0
- The broadcast is the other end of the same block: keep the 20 network bits and set all 12 host bits to 1. The wildcard (the inverted mask, 0.0.15.255) has ones exactly on the host bits, so network OR wildcard = 172.16.47.255. Every address from 172.16.32.0 to 172.16.47.255 shares the same first 20 bits.network 172.16.32.0 · wildcard 0.0.15.255 · OR = broadcast 172.16.47.255
- The fast way, without writing 32 bits. The interesting octet is the one where the mask is neither 255 nor 0: here the third, 240. Block size = 256 − 240 = 16, so the /20 networks start at 0, 16, 32, 48… in that octet. 45 falls in the block that starts at 32: network 172.16.32.0, next network 172.16.48.0, so the broadcast is one less, 172.16.47.255. Between them: 212 − 2 = 4094 usable hosts.interesting octet 3rd, mask 240 · block size 256 − 240 = 16 · usable 172.16.32.1 – 172.16.47.254 · hosts 2^12 − 2 = 4094
- Same method on the company network. Host A has 192.168.10.37/25: the interesting octet is the fourth (mask 128), block size 128, so the /25 subnets start at .0 and .128. 37 is in the first: network 192.168.10.0, broadcast 192.168.10.127, hosts .1 to .126 (27 − 2 = 126). R1's Gi0/0 takes the first usable address, .1, and becomes the gateway of the Sales LAN.Host A 192.168.10.37/25 · network 192.168.10.0 · broadcast 192.168.10.127 · usable .1 – .126, 126 hosts
- Why −2? Host bits all 0 give the subnet's own name (192.168.10.0, the entry in the routing table) and host bits all 1 give its broadcast (192.168.10.127, received by every host in the LAN). Neither can belong to one device. Give R1 the broadcast address and IOS refuses it with
Bad mask /25 for address 192.168.10.127; any address from .1 to .126 is accepted.host bits 0000000 192.168.10.0 = network · host bits 1111111 192.168.10.127 = broadcast · IOS Bad mask /25 for address 192.168.10.127 - A point-to-point link has exactly two devices, so a /30 wastes half of its block: .224 is the network, .227 the broadcast, and only .225 (R1) and .226 (R2) are hosts. RFC 3021 allows a /31 instead: two addresses, both usable, no network and no broadcast, because a link with a single neighbour has nobody else to broadcast to. IOS accepts it on Ethernet with a warning./30 4 addresses, 2 usable (50%) · /31 2 addresses, 2 usable · IOS % Warning: use /31 mask on non point-to-point interface cautiously
- At the other extreme, a /32 has no host bits: one address, and network = broadcast = the address itself. That is what a loopback uses (R1's Loopback0 10.255.0.1/32) and what a host route is. Since IOS 15 the router also installs a /32 L (local) route for each interface address next to the C route of its subnet; the /32 loopback gets only its C route, because it already is a host route.Loopback0 10.255.0.1/32, 1 address · C 192.168.10.0/25, the subnet · L 192.168.10.1/32, R1 itself
4.2Simulator: the subnet calculator
Type any IPv4 address as 172.16.45.200/20 or 172.16.45.200 255.255.240.0. The calculator does what this section does by hand: AND with the mask, OR with the wildcard, count the hosts, and show the bits of the interesting octet.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| Value | Result |
|---|---|
| Address | 172.16.45.200/20 · host 3,528 of 4,094 |
| Network address | 172.16.32.0 (host bits all 0) |
| First usable | 172.16.32.1 |
| Last usable | 172.16.47.254 |
| Broadcast address | 172.16.47.255 (host bits all 1) |
| Subnet mask | 255.255.240.0 = /20 |
| Wildcard mask | 0.0.15.255 |
| Addresses in the block | 212 = 4,096 |
| Usable hosts | 212 − 2 = 4,094 |
| Class (historical, §2) | B: first bits 10, default mask /16 |
| Address type | Private-Use · 172.16.0.0/12 · RFC 1918 · §6 |
The interesting octet, bit by bit: octet 3, block size 256 − 240 = 16: networks at 0, 16, 32… in this octet
| Octet 3 of | Bits (network · host) | Decimal |
|---|---|---|
| the address | 00101101 | 45 |
| the mask | 11110000 | 240 |
| AND = network | 00100000 | 32 |
| OR wildcard = broadcast | 00101111 | 47 |
- Network = 172.16.45.200 AND 255.255.240.0 = 172.16.32.0; broadcast = 172.16.32.0 OR 0.0.15.255 = 172.16.47.255.
- Usable = 212 − 2 = 4,094: the all-zeros host (172.16.32.0) and the all-ones host (172.16.47.255) are reserved.
- Block size check: octet 3 of the mask is 240, block = 256 − 240 = 16; 45 falls in 32–47, so the network has 32 and the broadcast 47 in that octet.
4.3The configuration, line by line
R1 · IOS-XE
| 1 | interface GigabitEthernet0/0 | Sales LAN, VLAN 10. |
| 2 | description Sales LAN 192.168.10.0/25 | |
| 3 | ip address 192.168.10.1 255.255.255.128 | The first usable host of 192.168.10.0/25 (.1 to .126); Host A uses it as its default gateway. |
| 4 | interface GigabitEthernet0/1 | Engineering LAN, VLAN 20. |
| 5 | ip address 192.168.10.129 255.255.255.192 | 192.168.10.128/26: network .128, hosts .129 to .190, broadcast .191. |
| 6 | interface GigabitEthernet0/2 | Point-to-point link to R2. |
| 7 | description P2P to R2 192.168.10.224/30 | |
| 8 | ip address 192.168.10.225 255.255.255.252 | /30: network .224, R1 .225, R2 .226, broadcast .227. Two usable addresses out of four. |
| 9 | interface Loopback0 | A virtual interface that is always up, often used as the router ID and the management address. |
| 10 | ip address 10.255.0.1 255.255.255.255 | /32: a single address, no network or broadcast to reserve. |
/31 link (RFC 3021)
| 1 | ! Alternative: the R1-R2 link renumbered as a /31 | Two addresses instead of four; the /30 plan is kept in the rest of the guide. |
| 2 | interface GigabitEthernet0/2 | R1 |
| 3 | ip address 192.168.10.224 255.255.255.254 | R1 takes .224: on a /31 the "all zeros" address is a normal host. |
| 4 | % Warning: use /31 mask on non point-to-point interface cautiously | IOS output on an Ethernet interface: a warning, not an error. The address is applied. |
| 5 | ! | |
| 6 | interface GigabitEthernet0/0 | R2 |
| 7 | ip address 192.168.10.225 255.255.255.254 | R2 takes .225, the "all ones" address. Both ends must use /31. |
NX-OS · IOS-XR
| 1 | ! NX-OS: the prefix length instead of a dotted mask | |
| 2 | interface Ethernet1/2 | |
| 3 | no switchport | A routed port; NX-OS switch ports are Layer 2 by default. |
| 4 | ip address 192.168.10.225/30 | Same /30 as on IOS-XE, written as a prefix length. |
| 5 | ! IOS-XR: the command is ipv4 address | |
| 6 | interface GigabitEthernet0/0/0/2 | |
| 7 | ipv4 address 192.168.10.225 255.255.255.252 | IOS-XR uses ipv4 address (and ipv6 address); interfaces are named rack/slot/module/port. |
Wrong
| 1 | interface GigabitEthernet0/0 | |
| 2 | ip address 192.168.10.127 255.255.255.128 | The broadcast address of 192.168.10.0/25 (all 7 host bits are 1). |
| 3 | Bad mask /25 for address 192.168.10.127 | IOS rejects the command and keeps the previous address. |
| 4 | ip address 192.168.10.0 255.255.255.128 | The network address itself (all 7 host bits are 0). |
| 5 | Bad mask /25 for address 192.168.10.0 | Same refusal. The fix: any host from .1 to .126, normally .1 for the gateway. |
show ip route connected
| 1 | R1#show ip route connected | |
| 2 | 10.0.0.0/32 is subnetted, 1 subnets | The loopback alone: a single /32 under the classful network 10.0.0.0. |
| 3 | C 10.255.0.1 is directly connected, Loopback0 | A /32 gets its C route and no separate L route. |
| 4 | 192.168.10.0/24 is variably subnetted, 6 subnets, 4 masks | Six entries with four masks: /25, /26 and /30 for the C routes (VLSM, §8), plus /32 for the L routes. |
| 5 | C 192.168.10.0/25 is directly connected, GigabitEthernet0/0 | C = the subnet (the network address, host bits 0). |
| 6 | L 192.168.10.1/32 is directly connected, GigabitEthernet0/0 | L = R1's own address on that subnet, as a /32 host route (IOS 15 and later). |
| 7 | C 192.168.10.128/26 is directly connected, GigabitEthernet0/1 | |
| 8 | L 192.168.10.129/32 is directly connected, GigabitEthernet0/1 | |
| 9 | C 192.168.10.224/30 is directly connected, GigabitEthernet0/2 | The /30 to R2. |
| 10 | L 192.168.10.225/32 is directly connected, GigabitEthernet0/2 |
show ip interface Gi0/0
| 1 | GigabitEthernet0/0 is up, line protocol is up | |
| 2 | Internet address is 192.168.10.1/25 | The address and the prefix: subnet 192.168.10.0/25. |
| 3 | Broadcast address is 255.255.255.255 | Not the subnet broadcast: it is the address R1 uses for its own broadcasts (limited broadcast). The directed broadcast of the subnet is still 192.168.10.127. |
| 4 | Address determined by non-volatile memory | |
| 5 | MTU is 1500 bytes | |
| 6 | Helper address is not set | |
| 7 | Directed broadcast forwarding is disabled | Packets to 192.168.10.127 arriving from other subnets are not turned into a LAN broadcast (the default since IOS 12.0, §7). |
The outputs are typical for IOS-XE; details may vary between versions.
4.4Remember
Bad mask /25 for address 192.168.10.127), has supported /31 since 12.2(2)T (on Ethernet with % Warning: use /31 mask on non point-to-point interface cautiously) and, since IOS 15, adds an L /32 route for every interface address. NX-OS writes ip address 192.168.10.225/30, IOS-XR ipv4 address 192.168.10.225 255.255.255.252.show ip interface briefshow ip route connectedshow ip interface GigabitEthernet0/04.5Check yourself: exam-style questions
A host is configured with 172.16.45.200/20. What is the broadcast address of its subnet?
- A172.16.47.255
- B172.16.63.255
- C172.16.45.255
- D172.16.32.255
Show answer
How many usable host addresses does a /21 subnet provide?
- A4094
- B1022
- C2048
- D2046
Show answer
Host A has 192.168.10.37/25. Which is the last usable host address of its subnet?
- A192.168.10.62
- B192.168.10.126
- C192.168.10.127
- D192.168.10.254
Show answer
Which of these addresses can be assigned to a host interface that uses the mask 255.255.255.240?
- A10.1.1.32
- B10.1.1.46
- C10.1.1.48
- D10.1.1.47
Show answer
R1 and R2 share a point-to-point Ethernet link numbered 10.0.0.0/31: R1 has 10.0.0.0 and R2 has 10.0.0.1. What happens?
- AThe link works only after both ends move to a /30, because a /31 has 0 usable hosts
- BThe routers can ping each other, but OSPF cannot form an adjacency over a /31
- CBoth work as hosts: a /31 has no network and no broadcast address (RFC 3021)
- DIOS rejects 10.0.0.0 on R1 because it is the network address of the /31
Show answer
% Warning: use /31 mask on non point-to-point interface cautiously. The 2h − 2 formula would give 0, which is exactly the case RFC 3021 changes; routing protocols, OSPF included, run over /31 links normally.On IOS-XE, R1 gets interface Loopback0 with ip address 10.255.0.1 255.255.255.255 and interface GigabitEthernet0/2 with ip address 192.168.10.225 255.255.255.252. Which routes do these two interfaces add to show ip route connected?
- AC 10.255.0.1/32, C 192.168.10.224/30 and L 192.168.10.225/32
- BC 10.255.0.1/32 and C 192.168.10.224/30 only
- CC and L 10.255.0.1/32, C 192.168.10.224/30 and L 192.168.10.225/32
- DC 10.255.0.1/32, C 192.168.10.225/30 and L 192.168.10.224/32
Show answer
show ip interface GigabitEthernet0/0 on R1 (192.168.10.1/25) displays Broadcast address is 255.255.255.255. A colleague concludes the interface is misconfigured. What is correct?
- ANothing is wrong: it is where R1 sends its own broadcasts; the subnet broadcast is still 192.168.10.127
- BIt reflects the default
no ip directed-broadcast; withip directed-broadcastit would read 192.168.10.127 - CThe interface is misconfigured: for a /25 the line must read 192.168.10.127
- DR1 now treats 255.255.255.255 as the broadcast of 192.168.10.0/25 and ignores packets sent to 192.168.10.127
Show answer
ip broadcast-address. The subnet's directed broadcast comes from the address and the mask: 192.168.10.0 OR 0.0.0.127 = 192.168.10.127. ip directed-broadcast only decides whether R1 forwards packets for 192.168.10.127 onto the LAN; it does not change this line, so the output is normal.A provider must number 500 point-to-point core links from one contiguous block, using /31s instead of /30s. What is the smallest block that holds them all?
- AA /21 (2048 addresses)
- BA /22 (1024 addresses)
- CA /23 (512 addresses)
- DA /24 (256 addresses)
Show answer
Subnetting step by step: borrowed bits and the block size
TL;DRTo subnet, you borrow host bits and turn them into subnet bits: s borrowed bits give 2s subnets, and the h host bits left give 2h − 2 hosts in each. The subnets start every block size (256 − the mask's interesting octet), so 192.168.1.0/24 cut into /27s gives eight subnets at .0, .32, .64 … .224, with 30 hosts each. To find a host's subnet, round its interesting octet down to a multiple of the block size.
- Borrowed bits (subnet bits)
- Host bits that become network bits: /24 → /27 borrows 3 bits, leaving 5 host bits.
- 2s subnets
- s borrowed bits give 2s subnets: 23 = 8 /27s in a /24, 24 = 16 /20s in a /16.
- Block size
- 256 − the mask's interesting octet, the value of the lowest borrowed bit: 256 − 224 = 32, so the /27s start at .0, .32, .64…
- Subnet ID
- The first address of a block, all host bits 0. For a host, round its interesting octet down to a multiple of the block: 130 → 128.
- Subnet zero, all-ones subnet
- The first (.0/27) and the last (.224/27) subnets. Both are usable (RFC 1878);
ip subnet-zerois the IOS default since 12.0. - Major (classful) network
- The class A, B or C network the subnets come from; IOS groups them under it, with the one mask they share:
192.168.1.0/27 is subnetted, 8 subnets.
5.1The step-by-step animation
- The lab has one block, 192.168.1.0/24, and needs eight separate LANs, VLANs 101 to 108. As it stands it is a single subnet: 24 network bits, 8 host bits, 254 hosts in one broadcast domain. The prefix of the block is fixed, so the only bits you can use to make more subnets are the 8 host bits.block 192.168.1.0/24 · host bits 8 → 2^8 − 2 = 254 hosts · need 8 subnets
- Borrow host bits and turn them into subnet bits. Eight subnets need 3 bits, because 23 = 8. The prefix grows from /24 to /27 (mask 255.255.255.224) and 5 host bits remain: 25 − 2 = 30 hosts per subnet. Every bit you borrow doubles the number of subnets and halves their size.borrowed s = 3 → 2^3 = 8 subnets · host bits left h = 5 → 2^5 − 2 = 30 hosts · new mask 255.255.255.224 = /27
- Now list them. The block size is 256 − 224 = 32, the value of the lowest borrowed bit, so a new /27 starts every 32 addresses: .0, .32, .64, .96, .128, .160, .192, .224. The 3 violet bits count from 000 to 111; in each block the first address is the subnet, the last is its broadcast and the 30 in between are hosts. R1 takes the first host of each as the gateway of its VLAN.block size 256 − 224 = 32 · subnets .0 .32 .64 .96 .128 .160 .192 .224 · each subnet, 30 hosts, broadcast
- Which /27 holds the PC, 192.168.1.130? Divide the interesting octet by the block size and keep the whole part: 130 ÷ 32 = 4.06, and 4 × 32 = 128. The binary says the same: the three borrowed bits of 130 are 100, subnet 4, and AND-ing with the mask gives 192.168.1.128/27: hosts .129 to .158, broadcast .159. The PC sends off-subnet traffic to .129, R1's Gi0/1.105.host 192.168.1.130 · 130 ÷ 32 4.06 → 4 × 32 = 128 · subnet 192.168.1.128/27 · range .129 – .158, broadcast .159
- Exam questions usually go the other way: "you need 6 subnets with up to 30 hosts each from 192.168.1.0/24". Subnets: 2s ≥ 6 gives s = 3. Hosts: 2h − 2 ≥ 30 gives h = 5. 3 + 5 = 8 bits, exactly what the /24 has, so the answer is /27. The trap: 31 hosts need h = 6 (25 − 2 is only 30), and 3 + 6 = 9 bits do not fit in 8: no equal-size answer exists.subnets 2^s ≥ 6 → s = 3 · hosts 2^h − 2 ≥ 30 → h = 5 · check 3 + 5 = 8 bits → /27 · 31 hosts 3 + 6 = 9 bits > 8: no fit
- R1 advertises its eight connected /27s with OSPF; a single
network 192.168.1.0 0.0.0.255statement covers them all. R2 lists them under their classful network, 192.168.1.0, with the one mask they all share: 192.168.1.0/27 is subnetted, 8 subnets. The first (.0, subnet zero) and the last (.224, the all-ones subnet) are ordinary usable subnets:ip subnet-zerohas been the IOS default since 12.0, so you count 2s subnets, not 2s − 2.R2 192.168.1.0/27 is subnetted, 8 subnets · subnet zero 192.168.1.0/27, usable · all-ones subnet 192.168.1.224/27, usable
5.2Simulator: the subnet splitter
Give the block and either the new prefix or a requirement (subnets needed, hosts per subnet, or both). The splitter counts the subnets, lists them (the table stops at 64 rows) and finds the subnet that holds the host.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
8 subnets of /27 · 30 hosts each · block size 32 in octet 4
| # | Subnet | Usable hosts | Broadcast |
|---|---|---|---|
| #0 | 192.168.1.0/27 | 192.168.1.1 – 192.168.1.30 | 192.168.1.31 |
| #1 | 192.168.1.32/27 | 192.168.1.33 – 192.168.1.62 | 192.168.1.63 |
| #2 | 192.168.1.64/27 | 192.168.1.65 – 192.168.1.94 | 192.168.1.95 |
| #3 | 192.168.1.96/27 | 192.168.1.97 – 192.168.1.126 | 192.168.1.127 |
| #4 | 192.168.1.128/27 | 192.168.1.129 – 192.168.1.158 | 192.168.1.159 |
| #5 | 192.168.1.160/27 | 192.168.1.161 – 192.168.1.190 | 192.168.1.191 |
| #6 | 192.168.1.192/27 | 192.168.1.193 – 192.168.1.222 | 192.168.1.223 |
| #7 | 192.168.1.224/27 | 192.168.1.225 – 192.168.1.254 | 192.168.1.255 |
- Borrowed bits: s = 27 − 24 = 3 → 23 = 8 subnets. Host bits left: h = 5 → 25 − 2 = 30 hosts.
- Block size: 256 − 224 = 32 in octet 4, so the subnets start every 32 in that octet.
- Subnet #0 (192.168.1.0/27, subnet zero) and #7 (192.168.1.224/27, the all-ones subnet) are usable like the others.
- 192.168.1.130 is in subnet #4, 192.168.1.128/27 (hosts 192.168.1.129 – 192.168.1.158, broadcast 192.168.1.159). Shortcut: octet 4 is 130; 130 ÷ 32 rounded down is 4, × 32 = 128.
5.3The configuration, line by line
R1 · IOS-XE
| 1 | ip subnet-zero | The default since IOS 12.0, so it does not even appear in the running configuration: subnet zero (192.168.1.0/27) is usable. |
| 2 | interface GigabitEthernet0/1 | The 802.1Q trunk to SW1; each subinterface is one VLAN and one /27. |
| 3 | no shutdown | |
| 4 | interface GigabitEthernet0/1.101 | Subnet 0, borrowed bits 000: subnet zero. |
| 5 | encapsulation dot1Q 101 | |
| 6 | ip address 192.168.1.1 255.255.255.224 | 192.168.1.0/27: gateway .1, hosts .1 – .30, broadcast .31. |
| 7 | interface GigabitEthernet0/1.102 | Subnet 1 (001), one block of 32 further. |
| 8 | encapsulation dot1Q 102 | |
| 9 | ip address 192.168.1.33 255.255.255.224 | 192.168.1.32/27: hosts .33 – .62, broadcast .63. |
| 10 | interface GigabitEthernet0/1.103 | |
| 11 | encapsulation dot1Q 103 | |
| 12 | ip address 192.168.1.65 255.255.255.224 | 192.168.1.64/27. |
| 13 | interface GigabitEthernet0/1.104 | |
| 14 | encapsulation dot1Q 104 | |
| 15 | ip address 192.168.1.97 255.255.255.224 | 192.168.1.96/27. |
| 16 | interface GigabitEthernet0/1.105 | Subnet 4 (100): the one that holds the PC, 192.168.1.130. |
| 17 | encapsulation dot1Q 105 | |
| 18 | ip address 192.168.1.129 255.255.255.224 | 192.168.1.128/27: hosts .129 – .158, broadcast .159. |
| 19 | interface GigabitEthernet0/1.106 | |
| 20 | encapsulation dot1Q 106 | |
| 21 | ip address 192.168.1.161 255.255.255.224 | 192.168.1.160/27. |
| 22 | interface GigabitEthernet0/1.107 | |
| 23 | encapsulation dot1Q 107 | |
| 24 | ip address 192.168.1.193 255.255.255.224 | 192.168.1.192/27. |
| 25 | interface GigabitEthernet0/1.108 | Subnet 7 (111): the all-ones subnet. |
| 26 | encapsulation dot1Q 108 | |
| 27 | ip address 192.168.1.225 255.255.255.224 | 192.168.1.224/27: its broadcast, .255, is also the broadcast of the whole /24, the old reason it was avoided. |
| 28 | interface GigabitEthernet0/2 | Point-to-point link to R2. |
| 29 | ip address 10.0.12.1 255.255.255.252 | |
| 30 | router ospf 1 | |
| 31 | network 192.168.1.0 0.0.0.255 area 0 | One statement with the /24 wildcard matches all eight /27 interfaces. |
| 32 | network 10.0.12.0 0.0.0.3 area 0 |
NX-OS · SVIs
| 1 | feature interface-vlan | On a Layer 3 switch the /27s live on SVIs; NX-OS needs the feature first. |
| 2 | interface Vlan101 | |
| 3 | no shutdown | |
| 4 | ip address 192.168.1.1/27 | Same subnet as Gi0/1.101, with a prefix length instead of a mask. |
| 5 | interface Vlan105 | |
| 6 | no shutdown | |
| 7 | ip address 192.168.1.129/27 | Subnet 4, the PC's gateway. |
| 8 | ! Vlan102-104 and Vlan106-108: the same pattern, every 32 addresses |
Wrong
| 1 | no ip subnet-zero | Brings back the pre-RFC 1878 rule. |
| 2 | interface GigabitEthernet0/1.101 | |
| 3 | ip address 192.168.1.1 255.255.255.224 | An address in subnet zero, 192.168.1.0/27. |
| 4 | Bad mask /27 for address 192.168.1.1 | IOS refuses it. The all-ones subnet (.224/27) has always been allowed. Fix: ip subnet-zero, the default. |
show ip route connected (R1)
| 1 | R1#show ip route connected | |
| 2 | 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks | |
| 3 | C 10.0.12.0/30 is directly connected, GigabitEthernet0/2 | |
| 4 | L 10.0.12.1/32 is directly connected, GigabitEthernet0/2 | |
| 5 | 192.168.1.0/24 is variably subnetted, 16 subnets, 2 masks | Eight /27 C routes plus eight /32 L routes: two masks, so "variably subnetted" on R1 even though every subnet is a /27. |
| 6 | C 192.168.1.0/27 is directly connected, GigabitEthernet0/1.101 | Subnet zero. |
| 7 | L 192.168.1.1/32 is directly connected, GigabitEthernet0/1.101 | |
| 8 | C 192.168.1.32/27 is directly connected, GigabitEthernet0/1.102 | |
| 9 | L 192.168.1.33/32 is directly connected, GigabitEthernet0/1.102 | |
| 10 | C 192.168.1.64/27 is directly connected, GigabitEthernet0/1.103 | |
| 11 | L 192.168.1.65/32 is directly connected, GigabitEthernet0/1.103 | |
| 12 | C 192.168.1.96/27 is directly connected, GigabitEthernet0/1.104 | |
| 13 | L 192.168.1.97/32 is directly connected, GigabitEthernet0/1.104 | |
| 14 | C 192.168.1.128/27 is directly connected, GigabitEthernet0/1.105 | |
| 15 | L 192.168.1.129/32 is directly connected, GigabitEthernet0/1.105 | |
| 16 | C 192.168.1.160/27 is directly connected, GigabitEthernet0/1.106 | |
| 17 | L 192.168.1.161/32 is directly connected, GigabitEthernet0/1.106 | |
| 18 | C 192.168.1.192/27 is directly connected, GigabitEthernet0/1.107 | |
| 19 | L 192.168.1.193/32 is directly connected, GigabitEthernet0/1.107 | |
| 20 | C 192.168.1.224/27 is directly connected, GigabitEthernet0/1.108 | The all-ones subnet, in the table like any other. |
| 21 | L 192.168.1.225/32 is directly connected, GigabitEthernet0/1.108 |
show ip route (R2)
| 1 | R2#show ip route | |
| 2 | Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP | |
| 3 | ! (rest of the legend omitted) | |
| 4 | Gateway of last resort is not set | |
| 5 | ||
| 6 | 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks | |
| 7 | C 10.0.12.0/30 is directly connected, GigabitEthernet0/0 | |
| 8 | L 10.0.12.2/32 is directly connected, GigabitEthernet0/0 | |
| 9 | 192.168.1.0/27 is subnetted, 8 subnets | The classful network 192.168.1.0, the one mask all its subnets share (/27, not the classful /24) and the count, 23 = 8. With a single mask the route lines below carry no length. |
| 10 | O 192.168.1.0 [110/2] via 10.0.12.1, 00:12:41, GigabitEthernet0/0 | Subnet zero, learned like any other. Cost 2 = R2's link (1) + R1's subinterface (1). |
| 11 | O 192.168.1.32 [110/2] via 10.0.12.1, 00:12:41, GigabitEthernet0/0 | |
| 12 | O 192.168.1.64 [110/2] via 10.0.12.1, 00:12:41, GigabitEthernet0/0 | |
| 13 | O 192.168.1.96 [110/2] via 10.0.12.1, 00:12:41, GigabitEthernet0/0 | |
| 14 | O 192.168.1.128 [110/2] via 10.0.12.1, 00:12:41, GigabitEthernet0/0 | The PC's subnet. |
| 15 | O 192.168.1.160 [110/2] via 10.0.12.1, 00:12:41, GigabitEthernet0/0 | |
| 16 | O 192.168.1.192 [110/2] via 10.0.12.1, 00:12:41, GigabitEthernet0/0 | |
| 17 | O 192.168.1.224 [110/2] via 10.0.12.1, 00:12:41, GigabitEthernet0/0 | The all-ones subnet. |
The outputs are typical for IOS-XE; details may vary between versions.
5.4Remember
ip subnet-zero by default since IOS 12.0). The −2 applies to hosts only. The old 2s − 2 rule comes from RFC 950 and still shows up in older study material.192.168.1.0/27 is subnetted, 8 subnets); with several it carries the classful mask (192.168.1.0/24 is variably subnetted, 16 subnets, 2 masks). On IOS 15+ the L /32 routes alone make a router's own connected subnets "variably subnetted". NX-OS prints each prefix on its own (192.168.1.0/27, ubest/mbest: 1/0, attached) with no classful parent line.show ip interface briefshow ip route connectedshow ip route 192.168.1.0 255.255.255.0 longer-prefixes5.5Check yourself: exam-style questions
192.168.1.0/24 is cut into /27 subnets. Which subnet holds the host 192.168.1.130?
- A192.168.1.192/27
- B192.168.1.96/27
- C192.168.1.160/27
- D192.168.1.128/27
Show answer
You must divide 192.168.1.0/24 into at least 6 subnets with at least 30 hosts each. Which mask do you use?
- A255.255.255.224
- B255.255.255.248
- C255.255.255.240
- D255.255.255.192
Show answer
How many /20 subnets does 172.16.0.0/16 contain, and how many usable hosts does each one have?
- A4096 subnets of 14 hosts
- B16 subnets of 4096 hosts
- C16 subnets of 4094 hosts
- D14 subnets of 4094 hosts
Show answer
ip subnet-zero.10.10.10.0/24 is subnetted with the mask 255.255.255.192. Counting subnet zero as the first, which is the third subnet?
- A10.10.10.96/26
- B10.10.10.192/26
- C10.10.10.64/26
- D10.10.10.128/26
Show answer
R1 has eight subinterfaces, each with a /27 from 192.168.1.0/24. On R1, show ip route shows 192.168.1.0/24 is variably subnetted, 16 subnets, 2 masks; R2, which learns the same subnets through OSPF, shows 192.168.1.0/27 is subnetted, 8 subnets. Why the difference?
- AR1 also holds an L /32 route for each of its eight interface addresses
- BOne of R1's subinterfaces has a different mask, which only R1 can see
- COSPF advertises only the /27 subnets that have active hosts
- DR2 summarizes the /27s in pairs, so it shows half of the entries
Show answer
On a router running IOS 15, ip address 192.168.1.1 255.255.255.224 is entered on a subinterface. The address lies in subnet zero of 192.168.1.0/24. What happens?
- AIt is rejected with a Bad mask error, because RFC 950 reserves subnet zero
- BIt is accepted only while the all-ones subnet 192.168.1.224/27 stays unused
- CIt is accepted:
ip subnet-zerois on by default since IOS 12.0 - DIt is accepted, but routing protocols will not advertise subnet zero
Show answer
ip subnet-zero the default in 12.0. Only after no ip subnet-zero would IOS refuse the address with Bad mask /27 for address 192.168.1.1. The all-ones subnet has always been allowed and does not depend on subnet zero.A provider holds 172.20.0.0/16 and must give at least 200 customers equal-size subnets with as many hosts as possible. Which prefix does it use?
- A/22: 64 subnets of 1022 hosts
- B/25: 512 subnets of 126 hosts
- C/23: 128 subnets of 510 hosts
- D/24: 256 subnets of 254 hosts
Show answer
An enterprise gives each branch a /26 from 10.64.0.0/16, in order, starting with 10.64.0.0/26 for branch 1. Which subnet does branch 600 receive?
- A10.64.150.0/26
- B10.64.149.128/26
- C10.64.150.64/26
- D10.64.149.192/26
Show answer
Private and public addresses: RFC 1918, shared space and NAT
TL;DRPrivate addresses (RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16) can be reused by every network because they are never routed on the Internet; public addresses are globally unique and come from IANA through a RIR and an ISP. A private host reaches the Internet only through NAT/PAT on the edge router, which swaps its source for a public address; a router that forgets NAT leaks private sources that the ISP drops. Carrier-grade NAT adds a second translation, using 100.64.0.0/10, the shared address space of RFC 6598.
- Private address (RFC 1918)
- An address from 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16: free to use inside any network, never routed on the Internet. HQ uses 192.168.10.0/24.
- Public address
- Globally unique, delegated by IANA to a RIR (RIPE NCC, ARIN, APNIC, LACNIC, AFRINIC) and by the RIR to an ISP: R1's 198.51.100.2 stands for one in this guide.
- NAT / PAT (overload)
- The edge router rewrites the private source to a public address; PAT also rewrites the port, so the whole LAN shares the single address 198.51.100.2.
- Inside local / inside global
- The same host seen before and after translation: 192.168.10.37 inside, 198.51.100.2 on the Internet.
- Bogon
- An address that must never appear as a source on the Internet: RFC 1918, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, multicast, class E and unallocated space.
- BCP 38 (RFC 2827)
- Ingress filtering: the ISP accepts from a customer only sources inside the customer's own block (198.51.100.0/29), so spoofed and leaked sources die at the first hop.
- CGN and shared address space
- Carrier-grade NAT: the ISP translates its customers a second time. The link between the customer and the CGN uses 100.64.0.0/10 (RFC 6598), which clashes with nobody's RFC 1918 LAN.
6.1The step-by-step animation
- IPv4 has 232 addresses, about 4.3 billion, and IANA handed its last five /8 blocks to the five RIRs on 3 February 2011. Long before that, RFC 1918 set aside three blocks that anyone may use inside a network and that are never routed on the Internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. That is why HQ can number its LANs out of 192.168.10.0/24 without asking anybody, while R1 needs one public address from its ISP to talk to the Internet.private 10/8 · 172.16/12 · 192.168/16 · public unique, IANA → RIR → ISP · HQ 192.168.10.0/24 (private) · R1 outside 198.51.100.2 (public)
- The exam trap is the middle block. /12 fixes the first 12 bits: the 8 bits of 172 plus the first 4 bits of the second octet,
0001. The second octet can only run from 00010000 = 16 to 00011111 = 31, so the block ends at 172.31.255.255. In 172.32.0.1 the second octet is 0010 0000: the prefix bits differ, so the address is public, not private.172.16.0.0/12 172.16.0.0 – 172.31.255.255 · mask 255.240.0.0 · 172.32.0.1 public - Host A opens https://203.0.113.10. The packet leaves with source 192.168.10.37:51000. R1 has
ip nat insideon Gi0/0 andip nat outsideon Gi0/4, and the source matches the NAT-LAN ACL, so PAT rewrites it to 198.51.100.2:51000 and records the pair. The server answers 198.51.100.2; R1 finds the entry by the port and rewrites the destination back to 192.168.10.37.inside local 192.168.10.37:51000 · inside global 198.51.100.2:51000 · outside 203.0.113.10:443 - Now a router that forgot NAT:
ip nat outsideis missing on Gi0/4, so nothing is translated and the packet leaves R1 with its private source, 192.168.10.37. The ISP filters what its customers send (bogon filtering and BCP 38, RFC 2827): a 192.168.0.0/16 source is dropped at the first hop. Even without the filter it would fail, because no Internet router has a route back to 192.168.10.37.source 192.168.10.37 (not translated) · ISP filter deny 192.168.0.0/16 → dropped · without the filter the reply has no route back - An ISP that has run out of public IPv4 puts its customers behind carrier-grade NAT. R1's WAN link is renumbered and R1 gets 100.64.1.1, from the shared address space 100.64.0.0/10 (RFC 6598), and R1 translates to it exactly as before (NAT #1). The ISP's CGN translates again, to an address of its public pool, 192.0.2.10 (NAT #2). The ISP could not safely use RFC 1918 space on this link: its customers already use it inside, and R1 could end up with the same prefix on both sides.inside 192.168.10.37:51000 · after R1 100.64.1.1:51000 · after the CGN 192.0.2.10:20480
- Private space has one more catch: it is unique only inside one organization. HQ buys a company that also numbered its LAN 192.168.10.0/24, and the two networks are joined. Host A asks for the new colleagues' file server, 192.168.10.150, but R1 has 192.168.10.128/26 as a connected route and delivers the packet to the local Host B. The fixes: renumber one side (the clean one); until then NAT one side into a free range such as 10.99.10.0/24; or keep the two in separate VRFs, which still need NAT to talk to each other.destination 192.168.10.150 · R1 route 192.168.10.128/26, connected · result delivered to the wrong host
6.2Simulator: can this host reach the Internet?
Host → R1 → ISP → server 203.0.113.10. Type any IPv4 address and switch NAT, the ISP's source filter and CGN on or off: the path shows the source address at every hop, and the verdict says whether the reply can come back.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
192.168.10.37: Private-Use · 192.168.0.0/16 · RFC 1918
| Hop | Source | Destination | What happens |
|---|---|---|---|
| Host → R1 | 192.168.10.37 | 203.0.113.10 | 203.0.113.10 is not on the host's subnet, so the packet goes to the default gateway, R1 |
| R1 → ISP | 198.51.100.2 | 203.0.113.10 | PAT on R1: 192.168.10.37:51000 → 198.51.100.2:51000 (inside local → inside global) |
| ISP → Internet | 198.51.100.2 | 203.0.113.10 | Forwarded: the source is in your /29, so the filter permits it |
| Reply | 203.0.113.10 | 198.51.100.2 | ✓ R1 finds the PAT entry and rewrites 198.51.100.2 back to 192.168.10.37 |
- R1 keeps the pair 192.168.10.37:51000 ↔ 198.51.100.2:51000 in its NAT table (
show ip nat translations): every inside host shares the one public address, told apart by the port.
6.3The configuration, line by line
R1 · IOS-XE
| 1 | ip access-list standard NAT-LAN | Which inside sources get translated. A deny here means "do not translate", not "drop". |
| 2 | permit 192.168.10.0 0.0.0.255 | The whole HQ block: Sales, Eng, Mgmt and the R1–R2 link (wildcard 0.0.0.255 = /24). |
| 3 | ! | |
| 4 | interface GigabitEthernet0/0 | Sales LAN, VLAN 10. |
| 5 | ip address 192.168.10.1 255.255.255.128 | |
| 6 | ip nat inside | Packets arriving here are candidates for inside source translation. |
| 7 | interface GigabitEthernet0/1 | Engineering LAN, VLAN 20. |
| 8 | ip address 192.168.10.129 255.255.255.192 | |
| 9 | ip nat inside | |
| 10 | interface GigabitEthernet0/4 | Toward the ISP: the only public address R1 has. |
| 11 | ip address 198.51.100.2 255.255.255.248 | 198.51.100.0/29 from the ISP: .1 the ISP, .2 R1, .3 to .6 free for public hosts. |
| 12 | ip nat outside | The translated side. Without it, nothing is translated at all. |
| 13 | ! | |
| 14 | ip nat inside source list NAT-LAN interface GigabitEthernet0/4 overload | PAT: every inside host shares 198.51.100.2, told apart by the source port. Without overload, one inside host at a time could use the single address. |
| 15 | ip route 0.0.0.0 0.0.0.0 198.51.100.1 | The default route to the ISP. Inside-to-outside translation happens after routing has chosen Gi0/4. |
Wrong · no NAT
| 1 | interface GigabitEthernet0/4 | |
| 2 | ip address 198.51.100.2 255.255.255.248 | |
| 3 | ! ip nat outside | Missing: R1 has inside interfaces but no outside one, so no packet crosses from inside to outside in the NAT sense. |
| 4 | ip nat inside source list NAT-LAN interface GigabitEthernet0/4 overload | Present, but useless on its own: show ip nat translations stays empty. |
| 5 | ! Result: 192.168.10.37 leaves R1 untranslated and the ISP drops it | The same leak happens when the ACL does not match the subnet (for example permit 192.168.1.0 0.0.0.255), because a deny in the NAT ACL means "send as it is". |
R1 behind a CGN
| 1 | interface GigabitEthernet0/4 | |
| 2 | description To ISP with CGN (shared address space) | |
| 3 | ip address 100.64.1.1 255.255.255.252 | The ISP has no public IPv4 left for R1: the WAN gets an address from 100.64.0.0/10 (often by DHCP: ip address dhcp). The ISP side of this /30 is 100.64.1.2. |
| 4 | ip nat outside | |
| 5 | ip nat inside source list NAT-LAN interface GigabitEthernet0/4 overload | Unchanged: R1 now translates to 100.64.1.1 (NAT #1). |
| 6 | ip route 0.0.0.0 0.0.0.0 100.64.1.2 | |
| 7 | ! the ISP's CGN translates 100.64.1.1 to its public pool 192.0.2.0/24 (NAT #2) | Inbound sessions now need a mapping on the CGN too: port forwarding on R1 alone no longer works. |
show ip nat translations
| 1 | R1#show ip nat translations | |
| 2 | Pro Inside global Inside local Outside local Outside global | |
| 3 | tcp 198.51.100.2:51000 192.168.10.37:51000 203.0.113.10:443 203.0.113.10:443 | Host A's HTTPS session: inside local (private) ↔ inside global (public). The outside columns are equal: the server is not translated. |
| 4 | tcp 198.51.100.2:51001 192.168.10.150:51000 203.0.113.10:443 203.0.113.10:443 | Host B picked the same source port, 51000: PAT gives it another free port on the global side (51001 here), so the replies can be told apart. |
| 5 | icmp 198.51.100.2:7 192.168.10.37:7 203.0.113.10:7 203.0.113.10:7 | ICMP has no ports: the echo identifier plays their role. |
| 6 | Total number of translations: 3 |
ISP · bogon ACL
| 1 | ip access-list extended CUST-R1-IN | On the ISP router, inbound on the port that faces R1: it checks the source of everything the customer sends. |
| 2 | deny ip 0.0.0.0 0.255.255.255 any | 0.0.0.0/8, "this network" (§7). |
| 3 | deny ip 10.0.0.0 0.255.255.255 any | RFC 1918. |
| 4 | deny ip 100.64.0.0 0.63.255.255 any | Shared address space: valid only between a CGN and its own subscribers. Wildcard 0.63.255.255 = /10. |
| 5 | deny ip 127.0.0.0 0.255.255.255 any | Loopback. |
| 6 | deny ip 169.254.0.0 0.0.255.255 any | Link-local (APIPA). |
| 7 | deny ip 172.16.0.0 0.15.255.255 any | RFC 1918: wildcard 0.15.255.255 = /12, so 172.16 to 172.31 only. |
| 8 | deny ip 192.168.0.0 0.0.255.255 any | RFC 1918: this line catches the 192.168.10.37 leak. |
| 9 | deny ip 224.0.0.0 31.255.255.255 any | 224.0.0.0/3: multicast and class E are never a valid source. |
| 10 | permit ip 198.51.100.0 0.0.0.7 any | BCP 38: the only sources R1 may use, its own /29. Public but foreign sources such as 172.32.1.1 fall to the implicit deny. |
| 11 | interface GigabitEthernet0/1 | |
| 12 | description Customer R1 | |
| 13 | ip address 198.51.100.1 255.255.255.248 | |
| 14 | ip access-group CUST-R1-IN in | |
| 15 | ! or: ip verify unicast source reachable-via rx | uRPF in strict mode: the same BCP 38 check, driven by the routing table instead of an ACL to maintain (BCP 84, RFC 3704). |
show access-lists (ISP)
| 1 | ISP#show access-lists CUST-R1-IN | |
| 2 | Extended IP access list CUST-R1-IN | |
| 3 | 10 deny ip 0.0.0.0 0.255.255.255 any | |
| 4 | 20 deny ip 10.0.0.0 0.255.255.255 any | |
| 5 | 30 deny ip 100.64.0.0 0.63.255.255 any | |
| 6 | 40 deny ip 127.0.0.0 0.255.255.255 any | |
| 7 | 50 deny ip 169.254.0.0 0.0.255.255 any | |
| 8 | 60 deny ip 172.16.0.0 0.15.255.255 any | |
| 9 | 70 deny ip 192.168.0.0 0.0.255.255 any (12 matches) | The leak from step 4: twelve packets from 192.168.10.37 dropped while NAT was broken. |
| 10 | 80 deny ip 224.0.0.0 31.255.255.255 any | |
| 11 | 90 permit ip 198.51.100.0 0.0.0.7 any (48210 matches) | Normal traffic, translated to 198.51.100.2. |
The outputs are typical for IOS-XE; details may vary between versions.
6.4Remember
ip nat outside, or whose NAT ACL does not match the LAN, sends private sources to the ISP: bogon filters drop them, and even without a filter the replies have no route back. The symptom: show ip nat translations is empty while the default route and the ISP link look fine.ip verify unicast source reachable-via rx (strict) or any (loose). RFC 6598 says packets from or to 100.64.0.0/10 must not cross provider boundaries, and RFC 6888 lists the CGN requirements. NX-OS needs feature nat before any NAT command; IOS-XR CGN (CGv6) typically runs on service cards, such as the ASR 9000 VSM, rather than as an interface command.show ip nat translationsshow ip nat statisticsshow ip interface GigabitEthernet0/4 | include translationshow access-lists CUST-R1-IN6.5Check yourself: exam-style questions
A junior admin plans four LAN ranges and wants every one of them to be RFC 1918 private space. Which range is not private?
- A10.255.0.0/24
- B192.168.200.0/24
- C172.31.255.0/24
- D172.32.10.0/24
Show answer
Which range is exactly the private block written as 172.16.0.0/12?
- A172.0.0.0 to 172.31.255.255
- B172.16.0.0 to 172.16.255.255
- C172.16.0.0 to 172.32.255.255
- D172.16.0.0 to 172.31.255.255
Show answer
On R1, show ip nat translations shows tcp 198.51.100.2:51000 192.168.10.37:51000 203.0.113.10:443 203.0.113.10:443. What is 198.51.100.2 in this entry?
- AThe outside local address of the web server, seen from the LAN
- BThe inside global address: Host A as the Internet sees it
- CThe inside local address: Host A's own configured address
- DThe outside global address of the web server
Show answer
R1 still has ip nat inside on its LAN interfaces and the overload rule, but someone removed ip nat outside from Gi0/4, its link to the ISP. Host A (192.168.10.37) opens a page on 203.0.113.10. What happens?
- AR1 drops it itself, because the NAT ACL matches but no interface is marked outside
- BIt leaves R1 untranslated, with source 192.168.10.37, and no reply ever comes back
- CR1 still translates it to 198.51.100.2, because the overload rule names Gi0/4
- DThe ISP's router translates 192.168.10.37 for R1, and the page loads normally
Show answer
ip nat outside nothing is translated and R1 routes the packet as it is. A private source is a bogon: the ISP's ingress filter drops it, and even without a filter no Internet router has a route back to 192.168.10.37. The overload rule naming Gi0/4 does not mark Gi0/4 as outside.Why does an ISP number the links between its customers' routers and its carrier-grade NAT from 100.64.0.0/10 rather than from 10.0.0.0/8?
- AA CGN cannot translate 10.0.0.0/8, because it is a classful class A network
- BCustomers already use RFC 1918 inside, so a 10.x link could overlap their own LAN
- C100.64.0.0/10 is routable on the Internet, so the CGN does not need a second translation
- DRFC 1918 forbids ISPs from using private addresses on any link they operate
Show answer
The ISP filters its port toward R1 so that it accepts only sources in 198.51.100.0/29 (BCP 38). Which packet sent by R1 is dropped?
- ASource 198.51.100.2, destination 203.0.113.10
- BSource 198.51.100.2, destination 172.32.1.1
- CSource 172.32.1.1, destination 203.0.113.10
- DSource 198.51.100.6, destination 192.0.2.25
Show answer
After an acquisition both companies use 192.168.10.0/24, and they must exchange traffic before anyone has time to renumber. Which design lets hosts on both sides reach each other?
- ANAT one side into a free range, such as 10.99.10.0/24, on the border router
- BEnable proxy ARP on the border router, so it answers ARP for the partner's hosts
- CPut each company in its own VRF on the border router and leak 192.168.10.0/24 between the two VRFs
- DAdd a static route for the partner's 192.168.10.0/24 with a lower administrative distance than the connected route
Show answer
A subscriber behind its home router (NAT #1) and the ISP's CGN (NAT #2) forwards TCP 8443 on the home router to an inside server. Users on the Internet still cannot connect. Why?
- AThe home router must forward the port to its own 100.64.x.x WAN address, not to the server
- BInbound connections reach the CGN's public address, where no mapping exists for TCP 8443
- CThe CGN blocks every destination port above 1023, so the server must use TCP 443
- DTCP sessions cannot cross two layers of NAT, so the server must switch to UDP
Show answer
Special IPv4 addresses: loopback, APIPA, broadcasts and the other exceptions
TL;DRSome IPv4 blocks are not ordinary host addresses, and the IANA special-purpose registry (RFC 6890) says for each one whether it may be a source, a destination, and whether routers forward it. The ones you meet daily: 0.0.0.0 (a host with no address yet), 127.0.0.0/8 (the host itself), 169.254.0.0/16 (APIPA, when DHCP fails), 255.255.255.255 (this link only), 224.0.0.0/4 (multicast, with 224.0.0.0/24 never routed) and 240.0.0.0/4 (reserved). Routers never forward 0.0.0.0, loopback, APIPA, the limited broadcast or 224.0.0.0/24, and since IOS 12.0 they also drop directed broadcasts such as 192.168.10.191 by default.
- Limited broadcast
- 255.255.255.255: every host on this link, never forwarded by a router. The DHCP Discover is sent to it.
- Directed broadcast
- The all-ones host address of one subnet, such as 192.168.10.191 for 192.168.10.128/26: routed like unicast to the last router, which drops it by default.
- Loopback (127.0.0.0/8)
- The host's own IP stack:
ping 127.0.0.1never touches the network card. Not the same as a router'sLoopback0interface. - APIPA (IPv4 link-local)
- 169.254.0.0/16, self-assigned when DHCP fails (RFC 3927): mask 255.255.0.0, no gateway, reachable only on the same link.
- 0.0.0.0
- "This host": the source of a DHCP Discover. Written 0.0.0.0/0 it is the default route, a prefix that matches every destination.
- DHCP relay (ip helper-address)
- R1 turns the client's broadcast into a unicast to the server, with giaddr = its own address on the client subnet (192.168.10.1).
- Link-local multicast (224.0.0.0/24)
- Groups for protocols on one link, such as 224.0.0.5 (OSPF) and 224.0.0.10 (EIGRP): never forwarded off the link, whatever the TTL.
7.1The step-by-step animation
- A new laptop on the Sales LAN boots with no address at all. Its first DHCP Discover uses the two addresses that need no configuration: source 0.0.0.0 ("this host", RFC 1122) and destination 255.255.255.255, the limited broadcast ("everyone on this link"). The destination MAC is ffff.ffff.ffff, so SW1 floods the frame to every port in VLAN 10: the printer and Host A ignore it, and R1's Gi0/0 receives it too.src 0.0.0.0:68 · dst 255.255.255.255:67 · dst MAC ffff.ffff.ffff · message DHCPDISCOVER
- R1 never forwards a limited broadcast: it is the edge of the broadcast domain. But Gi0/0 has
ip helper-address 192.168.10.226, so R1 acts as a DHCP relay: it rebuilds the Discover as a unicast from 192.168.10.1 to R2 and writes giaddr 192.168.10.1 into it, which tells R2 to lease from the pool that contains that subnet. Today R2's DHCP service is down: no Offer ever comes back.relayed src 192.168.10.1 · relayed dst 192.168.10.226 · giaddr 192.168.10.1 · answer none: the server is down - After its retries fail, the laptop configures itself (APIPA, RFC 3927). It picks a random address between 169.254.1.0 and 169.254.254.255, here 169.254.23.45, sends ARP probes with sender IP 0.0.0.0 to make sure nobody else has it, and keeps it with mask 255.255.0.0 and no default gateway. Windows shows it as "Autoconfiguration IPv4 Address": the classic sign that DHCP failed, not that someone typed a wrong address.address 169.254.23.45 · mask 255.255.0.0 (/16) · gateway none · ARP probe sender IP 0.0.0.0
- With a link-local address the laptop reaches only other 169.254.x.x hosts on the same link. The printer also failed DHCP and picked 169.254.77.3: same /16, so the laptop ARPs for it directly and the ping works. Anything else needs a router, and the laptop has no gateway; RFC 3927 also forbids routers to forward a packet with a 169.254.0.0/16 source or destination. In the background, Windows retries DHCP every five minutes.ping 169.254.77.3 reply: same link · ping 192.168.10.1 no route, no gateway · routers never forward 169.254.0.0/16
- Now Host A pings 192.168.10.191. With its /25 mask that is not its own subnet, so A sends an ordinary unicast to its gateway. R1 sees that .191 has all six host bits of the Engineering subnet 192.168.10.128/26 set to 1: it is that subnet's directed broadcast. Since IOS 12.0 the default is
no ip directed-broadcast(RFC 2644), so R1 drops it instead of flooding it on Gi0/1 as ffff.ffff.ffff.destination 192.168.10.191 · Host A (/25) not my subnet → gateway R1 · R1 Gi0/1 (/26) the subnet's broadcast - Why that default exists: someone types
ip directed-broadcaston Gi0/1, to wake PCs with Wake-on-LAN for example. Now a compromised Host A sends one ping to 192.168.10.191 with a spoofed source, R2's 192.168.10.226. R1 floods it on the Engineering LAN and every host that answers broadcast pings replies to the victim: one packet in, up to 62 replies out of a /26. That is the smurf attack, and the reason RFC 2644 changed the default for routers in 1999.src 192.168.10.226 (spoofed: the victim) · dst 192.168.10.191 · result the Eng hosts reply to R2 - The rule behind the whole section: R1 is the boundary. The limited broadcast, link-local 169.254.0.0/16, link-local multicast 224.0.0.0/24 (OSPF hellos to 224.0.0.5, EIGRP to 224.0.0.10) and loopback 127.0.0.0/8 never cross it; a directed broadcast is routed up to the last router, which drops it by default. DHCP crosses only because the helper turns the broadcast into a unicast: with R2's DHCP service back up, the laptop finally gets 192.168.10.50 from the SALES pool.crosses R1 unicast, and DHCP through the helper · stops at R1 255.255.255.255, 169.254/16, 224.0.0.x, directed bc
7.2Simulator: look an address up in the special-purpose registry
The lookup does what the IANA registry (RFC 6890) does: the most specific block, its purpose, and whether the address may be a source or a destination, whether routers forward it and whether it is reachable from the Internet. Add the subnet's prefix, as in 192.168.10.191/26, to spot network and directed-broadcast addresses.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| 127.1.2.3 | Registry answer |
|---|---|
| Most specific block | 127.0.0.0/8 · Loopback |
| Also inside | — |
| Standard | RFC 1122 |
| Purpose | The host itself; never leaves the IP stack |
| Valid as source | No: never on the wire |
| Valid as destination | No: never on the wire |
| Forwarded by routers | No: never leaves the host |
| Globally reachable | No |
| On Ethernet | None: it never reaches the network card |
| Class (historical, §2) | A: first bits 0 |
- The whole /8 is loopback, not only 127.0.0.1: 127.1.2.3 answers too, and none of it ever leaves the IP stack.
ping 127.0.0.1tests the host's own TCP/IP stack: it succeeds with the cable unplugged, so it proves nothing about the network.- A router's
interface Loopback0is a different thing: a virtual interface with an ordinary address such as 10.255.0.1/32 (§4).
7.3The configuration, line by line
R1 · IOS-XE
| 1 | interface GigabitEthernet0/0 | Sales LAN, VLAN 10: the DHCP clients live here. |
| 2 | ip address 192.168.10.1 255.255.255.128 | The relay's address on the client subnet: it becomes giaddr, and R2 picks the pool that contains it. |
| 3 | ip helper-address 192.168.10.226 | On the interface that faces the clients. UDP broadcasts arriving here (DHCP and seven other services by default) are relayed as unicasts to R2. |
| 4 | ! | |
| 5 | interface GigabitEthernet0/1 | Engineering LAN, VLAN 20: 192.168.10.128/26, directed broadcast .191. |
| 6 | ip address 192.168.10.129 255.255.255.192 | |
| 7 | ! no ip directed-broadcast | The default since IOS 12.0, so the running-config does not show it: packets to 192.168.10.191 from other subnets are dropped. |
| 8 | ! | |
| 9 | no ip forward-protocol udp tftp | Optional trimming. By default the helper relays TFTP (69), DNS (53), Time (37), NetBIOS (137, 138), TACACS (49), IEN-116 (42) and BOOTP/DHCP (67, 68); remove what must not cross. |
R2 · DHCP server
| 1 | ip dhcp excluded-address 192.168.10.1 192.168.10.49 | Never leased: the gateway .1 and the static hosts, Host A (.37) among them. |
| 2 | ip dhcp pool SALES | |
| 3 | network 192.168.10.0 255.255.255.128 | R2 chooses this pool because the relayed Discover carries giaddr 192.168.10.1, which falls inside it. |
| 4 | default-router 192.168.10.1 | Option 3: the gateway the clients receive. Without it they get an address but no way off the LAN. |
| 5 | dns-server 192.168.10.194 | Option 6: a DNS server in the Management subnet. |
| 6 | lease 0 8 | Eight hours instead of the default one day. |
| 7 | ! | |
| 8 | interface GigabitEthernet0/0 | R2's end of the R1–R2 link. |
| 9 | ip address 192.168.10.226 255.255.255.252 | |
| 10 | ip route 192.168.10.0 255.255.255.0 192.168.10.225 | The Offer goes back as a unicast to giaddr 192.168.10.1: R2 needs a route to it. |
Wrong
| 1 | interface GigabitEthernet0/1 | |
| 2 | ip directed-broadcast | Packets to 192.168.10.191 from any other subnet are now flooded on the Eng LAN as ffff.ffff.ffff: one spoofed ping, up to 62 replies (the smurf attack). |
| 3 | ! safer: ip directed-broadcast 110 | Only what ACL 110 permits is converted, for example Wake-on-LAN (UDP 9) from one management station. |
| 4 | ! access-list 110 permit udp host 192.168.10.194 host 192.168.10.191 eq 9 | |
| 5 | interface GigabitEthernet0/0 | |
| 6 | ! ip helper-address 192.168.10.226 | A missing helper: the Discover dies at R1 and every client ends up on 169.254.x.y, exactly as if the server were down. |
show ip interface
| 1 | R1#show ip interface GigabitEthernet0/0 | include Internet|Helper|Directed | |
| 2 | Internet address is 192.168.10.1/25 | |
| 3 | Helper address is 192.168.10.226 | The relay is set on the client side. |
| 4 | Directed broadcast forwarding is disabled | |
| 5 | R1#show ip interface GigabitEthernet0/1 | include Internet|Helper|Directed | |
| 6 | Internet address is 192.168.10.129/26 | |
| 7 | Helper address is not set | |
| 8 | Directed broadcast forwarding is disabled | The default: packets to 192.168.10.191 are dropped instead of flooded on this LAN. With the wrong configuration this line says "enabled". |
NX-OS · IOS-XR
| 1 | ! NX-OS: the relay is a feature | |
| 2 | feature dhcp | Without it, the relay command does not exist. |
| 3 | interface Vlan10 | NX-OS switches route on SVIs, which need feature interface-vlan. |
| 4 | ip address 192.168.10.1/25 | |
| 5 | ip dhcp relay address 192.168.10.226 | The NX-OS form of ip helper-address. |
| 6 | ! IOS-XR: a relay profile bound to the interface | |
| 7 | dhcp ipv4 | |
| 8 | profile RELAY relay | |
| 9 | helper-address vrf default 192.168.10.226 | |
| 10 | interface GigabitEthernet0/0/0/0 relay profile RELAY | The profile is attached per interface, under dhcp ipv4. |
Laptop · Windows
| 1 | C:\> ipconfig | |
| 2 | Ethernet adapter Ethernet: | |
| 3 | Autoconfiguration IPv4 Address. . : 169.254.23.45 | "Autoconfiguration" = APIPA: the laptop chose this address itself after DHCP got no answer. |
| 4 | Subnet Mask . . . . . . . . . . . : 255.255.0.0 | Always /16 for link-local. |
| 5 | Default Gateway . . . . . . . . . : | Empty: nothing beyond the link is reachable. |
| 6 | C:\> ipconfig /renew | |
| 7 | An error occurred while renewing interface Ethernet : unable to contact your DHCP server. Request has timed out. | The proof: Discovers leave, no Offer comes back. Check the VLAN, the helper and the server. |
| 8 | C:\> ping 127.0.0.1 | |
| 9 | Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 | Loopback answers even with the cable unplugged: it tests the TCP/IP stack, not the network. |
The outputs are typical for IOS-XE and Windows; details may vary between versions.
7.4Remember
ip helper-address), which turns the broadcast into a unicast carrying giaddr, and why a directed broadcast travels as unicast until the last router, which decides whether to flood it.ip helper-address on the client-facing interface, the server, its pool and its route back to the giaddr. Typing a 169.254 address by hand fixes nothing.no ip directed-broadcast is the default since IOS 12.0 (RFC 2644). Enabling it for Wake-on-LAN turns the LAN into a smurf amplifier unless an ACL limits it (ip directed-broadcast 110).ip helper-address, NX-OS with ip dhcp relay address after feature dhcp, IOS-XR with a dhcp ipv4 relay profile. The list itself is IANA's IPv4 Special-Purpose Address Registry (RFC 6890).show ip interface GigabitEthernet0/0show ip interface GigabitEthernet0/1 | include Directedshow ip dhcp bindingshow ip dhcp pool SALESdebug ip dhcp server packet7.5Check yourself: exam-style questions
A Windows PC shows Autoconfiguration IPv4 Address 169.254.37.5, mask 255.255.0.0 and no default gateway. What is the most likely cause?
- AThe DHCP server leased it an address from a 169.254.0.0/16 pool
- BIts default gateway stopped answering, so it swapped its address for a link-local one
- CIt detected a duplicate static address and moved to its 169.254 backup range
- DDHCP got no answer, so the PC assigned itself a link-local address (APIPA)
Show answer
ip helper-address, the server and its pool.Which source and destination addresses does a client use in its first DHCP Discover?
- A0.0.0.0 to 255.255.255.255
- B127.0.0.1 to its subnet's broadcast address
- C169.254.x.y to 255.255.255.255
- D0.0.0.0 to 224.0.0.1
Show answer
Which multicast address does EIGRP use for its hellos and updates?
- A224.0.0.5
- B224.0.0.18
- C224.0.0.9
- D224.0.0.10
Show answer
Host A (192.168.10.37/25) pings 192.168.10.191. R1 is its gateway and has 192.168.10.129/26 on Gi0/1, with the default configuration. What happens?
- AR1 floods it on Gi0/1 and every host in 192.168.10.128/26 replies to Host A
- BHost A floods it in its own VLAN, because .191 is a broadcast address
- CA sends it to R1 as a unicast, and R1 drops it as a directed broadcast
- DR1 sends it toward the ISP, because .191 is outside every connected subnet
Show answer
no ip directed-broadcast has been the default since IOS 12.0 (RFC 2644). Only with ip directed-broadcast on Gi0/1 would every Engineering host reply.R1 has ip helper-address 192.168.10.226 on Gi0/0 and no other related commands. Besides DHCP, which client broadcast does it also relay to 192.168.10.226 by default?
- AAn OSPF hello sent to 224.0.0.5
- BA TFTP request to UDP port 69
- CAn ICMP echo sent to 255.255.255.255
- DAn ARP request for the server's MAC address
Show answer
ip helper-address relays UDP broadcasts for eight services by default: TFTP (69), DNS (53), Time (37), NetBIOS name and datagram (137, 138), TACACS (49), IEN-116 (42) and BOOTP/DHCP (67, 68). ARP is not IP at all, OSPF hellos are link-local multicast, and ICMP is not UDP. no ip forward-protocol udp tftp removes TFTP from the list.Clients behind R1's Gi0/0 (192.168.10.1/25, helper 192.168.10.226) get no address. On R2 the pool is network 192.168.10.0 255.255.255.128, and a debug shows the relayed Discovers arriving. What most likely breaks it?
- AThe pool must use 192.168.10.224/30, the subnet where R2 itself is
- BThe clients must send their Discover to 192.168.10.226 instead of 255.255.255.255
- CR1 needs ip directed-broadcast on Gi0/0 to deliver the Offer to the clients
- DR2 has no route back to the giaddr 192.168.10.1, so its Offers are lost
Show answer
R1's Gi0/0 (192.168.10.1/25, ip helper-address 192.168.10.226) gets an inbound anti-spoofing ACL: permit ip 192.168.10.0 0.0.0.127 any, then the implicit deny. Hosts with static addresses keep working, but new DHCP clients get no lease. Which entry must be added before the permit?
- Apermit udp host 0.0.0.0 eq 68 host 255.255.255.255 eq 67
- Bpermit udp any host 192.168.10.226 eq 67
- Cpermit udp host 192.168.10.1 eq 67 any eq 68
- Dpermit udp 169.254.0.0 0.0.255.255 host 255.255.255.255 eq 67
Show answer
Which statement about 224.0.0.0/24 is true?
- AIt is the administratively scoped range, private to one organization
- BRouters forward it only on interfaces where PIM sparse mode is enabled
- CHosts may use an address from it as the source of a multicast stream
- DRouters never forward it, even with PIM enabled on every interface
Show answer
VLSM: subnets of different sizes, largest first
TL;DRVLSM gives every subnet the prefix length its own need calls for, instead of one mask for all. Sort the needs largest first, round each one up to a power of two that also holds the 2 reserved addresses, and place each block at the next free address, which is then always on its boundary. HQ's 192.168.10.0/24 becomes Sales /25, Engineering /26, Management /27 and the R1–R2 link /30, with 28 addresses left to grow; a classless routing protocol carries each mask.
- VLSM
- Variable-length subnet masking: different prefix lengths inside one block, here a /25, a /26, a /27 and a /30 inside 192.168.10.0/24.
- FLSM
- Fixed-length subnet masking: one mask for every subnet (§5). The /24 cut into /26s gives 4 subnets of 62 hosts, too small for Sales (100).
- Block size
- 232 − prefix addresses: 128 for a /25, 64 for a /26, 32 for a /27, 4 for a /30. A need of h hosts takes the smallest block with 2n − 2 ≥ h.
- Block boundary
- A block starts at a multiple of its own size: a /26 at .0, .64, .128 or .192 only. 192.168.10.4 cannot start a /27.
- Largest first
- Allocating in decreasing size puts every block on its boundary with no gaps: .0/25, .128/26, .192/27, .224/30.
- Classless routing protocol
- Sends the mask with every prefix (OSPF, EIGRP, IS-IS, BGP, RIPv2), which VLSM needs. RIPv1 sends none.
8.1The step-by-step animation
- HQ has one block, 192.168.10.0/24 (256 addresses), and four needs of very different sizes: Sales 100 hosts, Engineering 50, Management 20 and the R1–R2 link 2. One mask for everybody cannot serve them: a /25 gives 126 hosts but only 2 subnets, a /26 gives 4 subnets but only 62 hosts, too few for Sales. VLSM gives each subnet its own prefix length.The plan: block 192.168.10.0/24 · 256 addresses · needs 100 · 50 · 20 · 2 · one mask /25: 2 subnets · /26: 62 hosts max
- The method: list the needs, sort them largest first, and round each one up to a power of two that also holds the 2 reserved addresses (network and broadcast). 100 + 2 = 102 → 128, a /25; 50 + 2 = 52 → 64, a /26; 20 + 2 = 22 → 32, a /27; the link 2 + 2 = 4, a /30. Together 228 of the 256 addresses: it fits, with 28 left.The plan: Sales 100 + 2 → 128 = /25 · Eng 50 + 2 → 64 = /26 · Mgmt 20 + 2 → 32 = /27 · link 2 + 2 → 4 = /30 · total 228 of 256
- Sales goes first, at the start of the block: 192.168.10.0/25, hosts .1 to .126, broadcast .127, gateway .1 on Gi0/0. In binary the /25 adds one prefix bit to the /24 (violet) and keeps 7 host bits (green), all 0 at the start of the block. The next free address is .128, and 128 is a multiple of 64: the next block can start there.The plan: Sales 192.168.10.0/25 · hosts .1 – .126 · broadcast .127 · gateway 192.168.10.1 (Gi0/0) · next free .128
- Engineering takes the next free address, 192.168.10.128/26 (hosts .129 – .190, broadcast .191), and Management the one after it, 192.168.10.192/27 (hosts .193 – .222, broadcast .223). No gap is needed: 128 is a multiple of 64 and 192 a multiple of 32. Decreasing sizes guarantee it, because every earlier block was a larger power of two.The plan: Eng 192.168.10.128/26 · gw .129 · Mgmt 192.168.10.192/27 · gw .193 · next free .224
- The point-to-point link goes last, as a /30: 192.168.10.224/30, R1 .225, R2 .226, broadcast .227 (a /31 would also do, RFC 3021). What remains, .228 to .255, stays together at the end for growth: a /30, a /29 and a /28 that can still be handed out. Because the four blocks are contiguous, the whole site can still be advertised as one route, 192.168.10.0/24 (§9).The plan: R1–R2 192.168.10.224/30 · .225 and .226 · free .228 – .255 (28 addresses) · summary 192.168.10.0/24 (§9)
- Wrong: the same needs, smallest first and packed end to end. The /30 takes .0 – .3, so Management would start at .4, Engineering at .36 and Sales at .100. None of these is a boundary: a /27 must start on a multiple of 32, so 192.168.10.4/27 is only a host inside 192.168.10.0/27 (.0 – .31), which already holds the link. IOS refuses it:
% 192.168.10.0 overlaps with GigabitEthernet0/2. Aligning the blocks would cure the overlap, at the cost of a hole (.4 – .31) between them.The plan: R1–R2 192.168.10.0/30 · Mgmt "at .4" .4 AND /27 = .0 → .0 – .31 · result overlaps the /30: refused - Fix and verify: allocate largest first, as in steps 3 to 5, and run a classless routing protocol, which carries every prefix with its own mask. R1 advertises the /25, /26 and /27 with OSPF; R2 files them under 192.168.10.0/24 is variably subnetted, 5 subnets, 5 masks. RIPv1 puts no mask in its updates and cannot carry this plan; OSPF, EIGRP, IS-IS, BGP and RIPv2 can.Routing table: R2 learns /25 · /26 · /27 via OSPF · R2 table variably subnetted, 5 subnets, 5 masks · RIPv1 no mask: no VLSM
8.2Simulator: the VLSM planner
Type the base network and the needs as a list (a name before a number is optional: Sales 100). Count the router's interface as a host; a need of exactly 2 is treated as a point-to-point link. The planner rounds each need up, sorts largest first and places every block on its boundary.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
192.168.10.0/24 · 256 addresses · 4 subnets, largest first
| # | Need | Hosts + 2 → block | Subnet | Usable hosts | Broadcast | Waste |
|---|---|---|---|---|---|---|
| 1 | Sales | 100 + 2 → 128 | 192.168.10.0/25 | 192.168.10.1 – 192.168.10.126 (126) | 192.168.10.127 | 26 |
| 2 | Eng | 50 + 2 → 64 | 192.168.10.128/26 | 192.168.10.129 – 192.168.10.190 (62) | 192.168.10.191 | 12 |
| 3 | Mgmt | 20 + 2 → 32 | 192.168.10.192/27 | 192.168.10.193 – 192.168.10.222 (30) | 192.168.10.223 | 10 |
| 4 | R1-R2 (link) | 2 + 2 → 4 | 192.168.10.224/30 | 192.168.10.225 – 192.168.10.226 (2) | 192.168.10.227 | 0 |
| free | 28 | 192.168.10.228 – 192.168.10.255 = 192.168.10.228/30 + 192.168.10.232/29 + 192.168.10.240/28 | ||||
- Each need is rounded up to a power of two that holds hosts + 2, then the blocks are placed largest first: 128 + 64 + 32 + 4 = 228. Every block starts where the previous one ended, which is always a multiple of its own size: no gaps, no overlaps.
- Free for growth: 192.168.10.228 – 192.168.10.255 (28 addresses) = 192.168.10.228/30 + 192.168.10.232/29 + 192.168.10.240/28, all at the end of the block.
- The 1 point-to-point link uses /30 (2 usable of 4). /31 (RFC 3021) would save 2 addresses per link.
- All blocks are contiguous inside 192.168.10.0/24, so the rest of the network can reach them through that single route (§9).
8.3The configuration, line by line
R1 · IOS-XE
| 1 | interface GigabitEthernet0/0 | Sales, VLAN 10: the largest need gets the first block. |
| 2 | description Sales VLAN 10 - 100 hosts | |
| 3 | ip address 192.168.10.1 255.255.255.128 | /25: 192.168.10.0 – .127, 126 usable hosts, gateway .1. |
| 4 | interface GigabitEthernet0/1 | Engineering, VLAN 20. |
| 5 | description Eng VLAN 20 - 50 hosts | |
| 6 | ip address 192.168.10.129 255.255.255.192 | /26: .128 – .191, 62 usable hosts. It starts exactly where Sales ends. |
| 7 | interface GigabitEthernet0/3 | Management, VLAN 99. |
| 8 | description Mgmt VLAN 99 - 20 hosts | |
| 9 | ip address 192.168.10.193 255.255.255.224 | /27: .192 – .223, 30 usable hosts. |
| 10 | interface GigabitEthernet0/2 | The link to R2, allocated last. |
| 11 | description P2P to R2 | |
| 12 | ip address 192.168.10.225 255.255.255.252 | /30: .224 – .227; R1 .225, R2 .226. Free after it: .228 – .255. |
| 13 | ! | |
| 14 | router ospf 1 | OSPF is classless: every LSA carries the prefix with its mask. |
| 15 | network 192.168.10.0 0.0.0.255 area 0 | One statement matches all four interfaces; each subnet is still advertised with its own mask. |
NX-OS · IOS-XR
| 1 | ! NX-OS: a prefix length instead of a mask | |
| 2 | interface Ethernet1/1 | |
| 3 | no switchport | A routed port. |
| 4 | ip address 192.168.10.1/25 | The same Sales /25. |
| 5 | interface Ethernet1/2 | |
| 6 | no switchport | |
| 7 | ip address 192.168.10.129/26 | |
| 8 | ! IOS-XR: ipv4 address, with a mask | |
| 9 | interface GigabitEthernet0/0/0/2 | |
| 10 | ipv4 address 192.168.10.225 255.255.255.252 | The /30 link. IOS-XR also accepts 192.168.10.225/30. |
Wrong
| 1 | ! smallest first, packed end to end | |
| 2 | interface GigabitEthernet0/2 | |
| 3 | ip address 192.168.10.1 255.255.255.252 | The /30 at .0 – .3. |
| 4 | interface GigabitEthernet0/3 | |
| 5 | ip address 192.168.10.5 255.255.255.224 | Meant as "the /27 that starts at .4". With a /27 mask, .5 belongs to 192.168.10.0/27 (.0 – .31). |
| 6 | % 192.168.10.0 overlaps with GigabitEthernet0/2 | IOS refuses it: that /27 contains the /30 already on Gi0/2. The fix is the largest-first plan, not a different host address. |
| 7 | ! | |
| 8 | router rip | |
| 9 | version 1 | Classful: the updates carry no mask. |
| 10 | network 192.168.10.0 | RIPv1 on IOS sends a subnet of the same major network only out of interfaces with the same mask, so R2 (on the /30) never learns the /25, /26 or /27. |
show ip route connected (R1)
| 1 | R1#show ip route connected | |
| 2 | 192.168.10.0/24 is variably subnetted, 8 subnets, 5 masks | 4 connected (C) and 4 local /32 (L) routes; masks /25, /26, /27, /30 and /32. |
| 3 | C 192.168.10.0/25 is directly connected, GigabitEthernet0/0 | Sales. |
| 4 | L 192.168.10.1/32 is directly connected, GigabitEthernet0/0 | |
| 5 | C 192.168.10.128/26 is directly connected, GigabitEthernet0/1 | Engineering. |
| 6 | L 192.168.10.129/32 is directly connected, GigabitEthernet0/1 | |
| 7 | C 192.168.10.192/27 is directly connected, GigabitEthernet0/3 | Management. |
| 8 | L 192.168.10.193/32 is directly connected, GigabitEthernet0/3 | |
| 9 | C 192.168.10.224/30 is directly connected, GigabitEthernet0/2 | The link to R2. |
| 10 | L 192.168.10.225/32 is directly connected, GigabitEthernet0/2 |
show ip route ospf (R2)
| 1 | R2#show ip route ospf | |
| 2 | Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP | |
| 3 | ! (rest of the legend omitted) | |
| 4 | ||
| 5 | 192.168.10.0/24 is variably subnetted, 5 subnets, 5 masks | The parent line counts every route of the major network on R2: 3 OSPF + its connected /30 and local /32, with 5 different masks. |
| 6 | O 192.168.10.0/25 [110/2] via 192.168.10.225, 00:03:11, GigabitEthernet0/0 | Sales, with its own /25: OSPF carried the mask. |
| 7 | O 192.168.10.128/26 [110/2] via 192.168.10.225, 00:03:11, GigabitEthernet0/0 | |
| 8 | O 192.168.10.192/27 [110/2] via 192.168.10.225, 00:03:11, GigabitEthernet0/0 | Cost 2: R2's Gi0/0 (1) + R1's LAN interface (1). |
The outputs are typical for IOS-XE; details may vary between versions.
8.4Remember
% 192.168.10.0 overlaps with GigabitEthernet0/2), but it cannot see an overlap between subnets on different routers: that one only shows up as unreachable hosts.ip address 192.168.10.1/25, IOS-XR ipv4 address 192.168.10.1 255.255.255.128.show ip interface briefshow ip route connectedshow ip route 192.168.10.0 255.255.255.0 longer-prefixesshow ip ospf interface brief8.5Check yourself: exam-style questions
You cut 192.168.10.0/24 with VLSM, largest first. Sales (100 hosts) already has 192.168.10.0/25. Engineering needs 50 hosts. Which subnet should it get next?
- A192.168.10.128/25
- B192.168.10.128/26
- C192.168.10.100/26
- D192.168.10.127/26
Show answer
One /24 must hold a 20-host LAN, a 2-address WAN link, a 100-host LAN and a 50-host LAN. In which order should you allocate them with VLSM?
- A100, 50, the WAN link, then 20: links go next to their LANs
- BAny order works, as long as each block is rounded up to a power of two
- C100, 50, 20, then the WAN link
- DWAN link, 20, 50, 100: smallest first saves space
Show answer
A VLSM plan gives the Management VLAN 192.168.10.192/27. What are its broadcast address and its number of usable hosts?
- A192.168.10.255 and 30 hosts
- B192.168.10.223 and 32 hosts
- C192.168.10.223 and 30 hosts
- D192.168.10.224 and 30 hosts
Show answer
R1 has ip address 192.168.10.1 255.255.255.252 on Gi0/2. You then enter ip address 192.168.10.5 255.255.255.224 on Gi0/3. What happens?
- AIOS accepts it: .5 is outside the /30, which ends at .3
- BIOS accepts it but shuts down Gi0/2 to avoid the overlap
- CIOS accepts it and creates the subnet 192.168.10.4/27
- DIOS rejects it: 192.168.10.0/27 overlaps the /30 on Gi0/2
Show answer
R2 shows 192.168.10.0/24 is variably subnetted, 5 subnets, 5 masks. What does this line tell you?
- A5 equal-cost paths toward 192.168.10.0/24 are installed
- BOne of the 5 routes is a summary hiding the other 4
- C192.168.10.0/24 was cut into 5 subnets of the same size
- D5 routes inside the classful 192.168.10.0/24, with 5 different masks
Show answer
R1 holds a VLSM plan (/25, /26, /27 and /30 inside 192.168.10.0/24) and must share it with R2 dynamically. Which protocol cannot carry the plan, and why?
- ARIPv1, because its updates carry no subnet mask
- BRIPv2, because it only supports /24 and longer prefixes
- COSPF, because a single area cannot hold different masks
- DEIGRP, because auto-summary cannot be disabled
Show answer
A site owns 10.20.0.0/22. It needs LANs of 300, 200 and 100 hosts plus six point-to-point links as /31, allocated largest first. Where does the first /31 start?
- A10.20.0.0/31
- B10.20.2.128/31
- C10.20.3.0/31
- D10.20.3.128/31
Show answer
Route summarization and supernetting
TL;DRSummarization advertises one prefix for several networks: write them in binary, keep the leading bits they all share and set the rest to zero. 172.16.0.0/24 to 172.16.3.0/24 share 22 bits, so BR1 advertises 172.16.0.0/22, installs a Null0 discard route for it, and HQ keeps one route that does not change when a single LAN flaps. A summary must cover only space you own: a /21 would also claim Branch 2's 172.16.4.0/24 and black-hole it whenever Branch 2's own route is missing.
- Summary route
- One prefix that stands for several networks, also called an aggregate: 172.16.0.0/22 covers 172.16.0.0/24 to 172.16.3.0/24.
- Common leading bits
- The bits that are identical in every network to be summarized; their count is the prefix length of the summary (22 here).
- Supernet
- A summary shorter than the classful mask, e.g. 192.168.0.0/23 from two class C /24s. 172.16.0.0/22 sits inside the class B 172.16.0.0/16, so it is a summary, not a supernet.
- CIDR
- Classless Inter-Domain Routing (RFC 4632): any prefix length, so blocks can be split (subnetting) or merged (supernetting) on any bit.
- Discard route
- The route to Null0 that EIGRP, OSPF and BGP install for their own summary, so traffic for an unused part of it is dropped instead of looping.
- Over-summarization
- A summary that includes space the router does not own; it attracts and black-holes that traffic whenever the specific route is missing.
9.1The step-by-step animation
- Branch 1 owns four LANs, 172.16.0.0/24 to 172.16.3.0/24; Branch 2 owns 172.16.4.0/24. Without summarization BR1 advertises its four /24s one by one, so HQ, and every router behind it, carries four routes for one branch. A LAN that flaps sends an update across the whole network, and EIGRP queries chase it everywhere.Routing table: from BR1 4 × /24 · from BR2 172.16.4.0/24 · HQ table 5 routes
- Find the common bits: write the four networks in binary. The first two octets, 172.16, are identical (16 bits). In the third octet, 0 to 3 are 00000000 to 00000011: 6 more bits match and only the last 2 differ. 16 + 6 = 22 common bits, so the summary is 172.16.0.0/22, mask 255.255.252.0. A /22 holds 224 − 22 = 4 /24s: exactly these four, no more.The summary: common bits 16 + 6 = 22 · summary 172.16.0.0/22 · mask 255.255.252.0 · wildcard 0.0.3.255
- BR1 advertises the summary out of its WAN interface:
ip summary-address eigrp 100 172.16.0.0 255.255.252.0. HQ now holds one route for the whole branch instead of four. BR1 also installs 172.16.0.0/22 → Null0, the discard route: a packet for a part of the /22 that has no LAN is dropped right there.Routing table: advertised 172.16.0.0/22 · suppressed the four /24s · BR1 itself 172.16.0.0/22 is a summary, Null0 - The summary hides instability. BR1's VLAN 102 subinterface (172.16.2.0/24) goes down, but the /22 still has three live LANs: BR1 sends nothing and HQ's table does not change. Host A's packet for 172.16.2.50 still follows the /22 to BR1, where the longest match is now the Null0 route, so it is dropped. Without that route BR1 would send it back along its default route to HQ, and the two would bounce it until the TTL ran out.Longest match: 172.16.2.50 /24 gone → /22 → Null0 · HQ no update · without Null0 default → HQ → loop
- Wrong: someone widens the summary to 172.16.0.0/21 "to leave room for growth". A /21 keeps only 21 common bits, so it claims 172.16.0.0 to 172.16.7.255: eight /24s, including 172.16.4.0/24, which belongs to Branch 2. Nothing breaks yet: HQ also has BR2's own /24, and the longest match (/24 beats /21) still sends 172.16.4.20 to BR2.Longest match: summary 172.16.0.0/21 = .0.0 – .7.255 · Branch 2 owns 172.16.4.0/24 · HQ picks /24 → BR2 (longest match)
- Then BR2's WAN link fails and its /24 leaves HQ's table. The /21 still matches 172.16.4.20, so HQ sends that traffic across the WAN to BR1, which has no such LAN and drops it in its Null0 route: a black hole at the wrong site. The /21 also beats any default or backup route HQ might have toward Branch 2, and a traceroute now ends at BR1, pointing at the wrong branch. 172.16.5.0 to 172.16.7.255 are attracted the same way.Longest match: HQ table 172.16.0.0/21 → BR1 only · 172.16.4.20 → BR1 → Null0 · result black hole at the wrong site
- Fix: a summary covers only what the router owns. BR1 goes back to 172.16.0.0/22, exactly its four LANs. With BR2 still down, HQ now has no route for 172.16.4.20: it answers Host A itself with an ICMP unreachable, nothing crosses the WAN to Branch 1, and the failure points at Branch 2, where it is. In a clean design each site owns one aligned block (Branch 2 gets 172.16.4.0/22) and summarizes exactly that block (§8).The fix: BR1 advertises 172.16.0.0/22 · 172.16.4.20 no route → ICMP unreachable · design one aligned block per site
9.2Simulator: the summarizer
Type the networks (a.b.c.d/p or a.b.c.d with a mask, separated by commas). The summarizer finds the common leading bits, the single smallest prefix that covers them, the extra space it would also advertise, and the exact minimal list of CIDR blocks. Add networks owned elsewhere to check for black holes.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
Summary 172.16.0.0/22 · mask 255.255.252.0 · 1,024 addresses · 4 networks listed, 1,024 addresses
| # | Network | First address in binary (common bits in bold) | Note |
|---|---|---|---|
| 1 | 172.16.0.0/24 | 10101100.00010000.00000000.00000000 | |
| 2 | 172.16.1.0/24 | 10101100.00010000.00000001.00000000 | |
| 3 | 172.16.2.0/24 | 10101100.00010000.00000010.00000000 | |
| 4 | 172.16.3.0/24 | 10101100.00010000.00000011.00000000 | |
| 172.16.0.0/22 | 10101100.00010000.00000000.00000000 | summary, 22 common bits |
What 172.16.0.0/22 contains, block by block (the listed ones are the exact list: 1 prefix)
| Block | Range | Addresses | Status |
|---|---|---|---|
| 172.16.0.0/22 | 172.16.0.0 – 172.16.3.255 | 1,024 | yours (listed) |
- Lowest address 172.16.0.0, highest 172.16.3.255: they agree on the first 22 bits, so the summary is 172.16.0.0/22, mask 255.255.252.0 (wildcard 0.0.3.255).
- The 1,024 addresses of the list fill the 1,024 of 172.16.0.0/22 exactly: no address outside your networks is advertised.
- On IOS:
ip summary-address eigrp 100 172.16.0.0 255.255.252.0,area 1 range 172.16.0.0 255.255.252.0on an OSPF ABR, oraggregate-address 172.16.0.0 255.255.252.0 summary-onlyin BGP.
9.3The configuration, line by line
BR1 · EIGRP classic
| 1 | interface GigabitEthernet0/1.100 | One of the four branch LANs (VLANs 100 – 103 on the trunk to the branch switch). |
| 2 | encapsulation dot1Q 100 | |
| 3 | ip address 172.16.0.1 255.255.255.0 | 172.16.0.0/24. |
| 4 | ! Gi0/1.101 – .103: 172.16.1.1, 172.16.2.1, 172.16.3.1, all /24 | The other three LANs, the same way. |
| 5 | interface GigabitEthernet0/0 | The WAN link to HQ. |
| 6 | ip address 10.0.1.1 255.255.255.252 | |
| 7 | ip summary-address eigrp 100 172.16.0.0 255.255.252.0 | Advertise one /22 out of this interface instead of the four /24s, and install the Null0 discard route locally. |
| 8 | ! | |
| 9 | router eigrp 100 | |
| 10 | network 172.16.0.0 0.0.3.255 | The wildcard 0.0.3.255 is the inverse of the /22 mask: it matches the four LAN interfaces. |
| 11 | network 10.0.1.0 0.0.0.3 | |
| 12 | no auto-summary | The default since IOS 15.0(1)M. On older releases EIGRP summarized to the classful 172.16.0.0/16 on its own. |
| 13 | ! | |
| 14 | ip route 0.0.0.0 0.0.0.0 10.0.1.2 | A default toward HQ. Without the Null0 route, traffic for an unused part of the /22 would follow it back to HQ and loop. |
BR1 · EIGRP named
| 1 | router eigrp BRANCH | Named mode: the same summary, configured under the address family. |
| 2 | address-family ipv4 unicast autonomous-system 100 | |
| 3 | network 172.16.0.0 0.0.3.255 | |
| 4 | network 10.0.1.0 0.0.0.3 | |
| 5 | af-interface GigabitEthernet0/0 | Per-interface settings of named mode. |
| 6 | summary-address 172.16.0.0 255.255.252.0 | Same effect as ip summary-address eigrp on the interface: one /22 out of Gi0/0 and a Null0 discard route locally. |
| 7 | exit-af-interface | |
| 8 | exit-address-family |
OSPF · ABR and ASBR
| 1 | router ospf 1 | BR1 as an ABR: the LANs in area 1, the WAN link in area 0. |
| 2 | network 172.16.0.0 0.0.3.255 area 1 | |
| 3 | network 10.0.1.0 0.0.0.3 area 0 | |
| 4 | area 1 range 172.16.0.0 255.255.252.0 | Inter-area summary: area 0 receives one type 3 LSA for the /22 instead of four. Only an ABR can do it, for an area it is attached to; the ABR also installs a discard route to Null0. |
| 5 | ! on an ASBR, for redistributed routes: | |
| 6 | summary-address 172.20.0.0 255.255.252.0 | Summarizes external (type 5) routes, e.g. four redistributed static /24s 172.20.0.0 – 172.20.3.0. area range does not touch externals. |
BGP · static
| 1 | router bgp 65010 | |
| 2 | aggregate-address 172.16.0.0 255.255.252.0 summary-only | BGP creates the /22 when at least one more-specific route is in its table; summary-only suppresses the /24s. A /22 to Null0 appears in the RIB. |
| 3 | ! network 172.16.0.0 mask 255.255.252.0 | The alternative: a network statement for the /22, anchored by the static route below. |
| 4 | ip route 172.16.0.0 255.255.252.0 Null0 | Keeps an exact /22 in the RIB, so the network statement can advertise it, even if every LAN is down. |
| 5 | ! | |
| 6 | ! HQ: a static summary toward Branch 1 | |
| 7 | ip route 172.16.0.0 255.255.252.0 10.0.1.1 | One static route covers the four LANs: a manual summary. |
Wrong
| 1 | interface GigabitEthernet0/0 | |
| 2 | ip summary-address eigrp 100 172.16.0.0 255.255.248.0 | A /21 "to leave room": it claims 172.16.0.0 – 172.16.7.255, including 172.16.4.0/24 of Branch 2. |
| 3 | ! HQ: D 172.16.0.0/21 via 10.0.1.1 + D 172.16.4.0/24 via 10.0.2.1 | While BR2 is up, its /24 wins (longest match): no symptom. |
| 4 | ! BR2 link down: 172.16.4.20 → /21 → BR1 → Null0: black hole | The failure appears only when the specific route is gone. |
show ip route (BR1)
| 1 | BR1#show ip route | |
| 2 | Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP | |
| 3 | D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area | |
| 4 | ! (rest of the legend omitted) | |
| 5 | Gateway of last resort is 10.0.1.2 to network 0.0.0.0 | |
| 6 | ||
| 7 | S* 0.0.0.0/0 [1/0] via 10.0.1.2 | The default toward HQ. |
| 8 | 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks | |
| 9 | C 10.0.1.0/30 is directly connected, GigabitEthernet0/0 | |
| 10 | L 10.0.1.1/32 is directly connected, GigabitEthernet0/0 | |
| 11 | 172.16.0.0/16 is variably subnetted, 9 subnets, 3 masks | 1 summary + 4 connected /24s + 4 local /32s; masks /22, /24 and /32. |
| 12 | D 172.16.0.0/22 is a summary, 00:12:05, Null0 | The discard route EIGRP installs with the summary (administrative distance 5). It beats the default for any address in the /22 that has no LAN. |
| 13 | C 172.16.0.0/24 is directly connected, GigabitEthernet0/1.100 | |
| 14 | L 172.16.0.1/32 is directly connected, GigabitEthernet0/1.100 | |
| 15 | C 172.16.1.0/24 is directly connected, GigabitEthernet0/1.101 | |
| 16 | L 172.16.1.1/32 is directly connected, GigabitEthernet0/1.101 | |
| 17 | C 172.16.2.0/24 is directly connected, GigabitEthernet0/1.102 | The LAN that flaps in step 4: when it goes, the /22 stays. |
| 18 | L 172.16.2.1/32 is directly connected, GigabitEthernet0/1.102 | |
| 19 | C 172.16.3.0/24 is directly connected, GigabitEthernet0/1.103 | |
| 20 | L 172.16.3.1/32 is directly connected, GigabitEthernet0/1.103 |
show ip route eigrp (HQ)
| 1 | HQ#show ip route eigrp | |
| 2 | ! (legend omitted) | |
| 3 | ||
| 4 | 172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks | Two routes for the whole 172.16.0.0/16: Branch 1's summary and Branch 2's /24. |
| 5 | D 172.16.0.0/22 [90/3072] via 10.0.1.1, 00:12:05, GigabitEthernet0/1 | One route for four LANs. 3072 = 256 × (10 + 2): the lowest metric among the components. |
| 6 | D 172.16.4.0/24 [90/3072] via 10.0.2.1, 00:12:01, GigabitEthernet0/2 | Branch 2's LAN, outside the /22. |
The outputs are typical for IOS-XE; details may vary between versions.
9.4Remember
ip summary-address eigrp 100 … on the interface (classic) or summary-address under af-interface (named); OSPF area 1 range on an ABR (type 3) and summary-address on an ASBR (type 5); BGP aggregate-address … summary-only; or a static route. EIGRP auto-summary is off by default since IOS 15.0(1)M. NX-OS takes prefix lengths: ip summary-address eigrp 100 172.16.0.0/22, area 1 range 172.16.0.0/22.show ip route eigrpshow ip route 172.16.0.0 255.255.252.0 longer-prefixesshow ip eigrp topology 172.16.0.0/22show ip protocolsshow ip ospf database summary9.5Check yourself: exam-style questions
What is the smallest single summary route for 172.16.0.0/24, 172.16.1.0/24, 172.16.2.0/24 and 172.16.3.0/24?
- A172.16.0.0/23 (255.255.254.0)
- B172.16.3.0/22 (255.255.252.0)
- C172.16.0.0/21 (255.255.248.0)
- D172.16.0.0/22 (255.255.252.0)
Show answer
Which address range does the summary route 10.1.8.0/21 cover?
- A10.1.8.0 to 10.1.16.255
- B10.1.8.0 to 10.1.15.255
- C10.1.8.0 to 10.1.11.255
- D10.1.0.0 to 10.1.15.255
Show answer
HQ has D 172.16.0.0/21 via 10.0.1.1 (Branch 1) and D 172.16.4.0/24 via 10.0.2.1 (Branch 2). A packet arrives for 172.16.4.20. Where does HQ send it?
- ATo Branch 1: the summary was learned first
- BTo both branches: the two routes are load-shared
- CTo Branch 2: the /24 is the longest match
- DTo Branch 1: the /21 covers more addresses
Show answer
Which pair of /24 networks can be summarized exactly into a single /23?
- A192.168.4.0/24 and 192.168.5.0/24
- B192.168.3.0/24 and 192.168.4.0/24
- C192.168.5.0/24 and 192.168.6.0/24
- D192.168.4.0/24 and 192.168.6.0/24
Show answer
BR1 runs ip summary-address eigrp 100 172.16.0.0 255.255.252.0 on its WAN interface. Which new route appears in BR1's own routing table?
- AD 172.16.0.0/22 via 10.0.1.2: the summary learned back from HQ
- BD EX 172.16.0.0/22: EIGRP treats its summaries as external routes
- CNone: a summary is only advertised, never installed locally
- DD 172.16.0.0/22 is a summary, Null0: a discard route against loops
Show answer
In OSPF, where and how do you summarize the routes of area 1 so that area 0 receives one prefix?
- AOn the ABR, with ip summary-address ospf on the interface
- BOn any router of area 1, with summary-address under router ospf
- COn the ABR, with area 1 range under router ospf
- DOn the ASBR, with area 1 range under router ospf
Show answer
BR1 owns only 172.16.0.0/22 but advertises 172.16.0.0/21; 172.16.4.0/24 is at Branch 2. Branch 2's WAN link fails. What happens to HQ's traffic for 172.16.4.20?
- ABR1 forwards it to Branch 2 over its default route
- BHQ load-shares it between both branches until the link returns
- CIt follows the /21 to BR1, which drops it in its Null0 discard route
- DHQ answers with ICMP unreachable, because 172.16.4.0/24 is gone
Show answer
Which minimal set of prefixes advertises exactly 172.16.1.0/24 through 172.16.4.0/24, and nothing else?
- A172.16.1.0/23, 172.16.3.0/23
- B172.16.1.0/24, 172.16.2.0/23, 172.16.4.0/24
- C172.16.0.0/21
- D172.16.1.0/24, 172.16.2.0/22
Show answer
IPv4 on Cisco devices: configuring and verifying interfaces
TL;DRAn IOS interface routes once it has an address, a mask and no shutdown, and its link is up/up. Then IOS installs a C route for the subnet and, since IOS 15, an L /32 route for its own address. Before accepting the address it checks it: a non-contiguous mask, a network or broadcast address and a subnet that overlaps another interface are all refused. The rest of the reference: secondary addresses, ip unnumbered, /31 links, DHCP clients, SVIs, NX-OS and IOS-XR syntax, and the show commands that prove it.
- Connected route (C)
- The subnet of an up/up interface, address AND mask: 192.168.10.0/25 on Gi0/0. Administrative distance 0.
- Local route (L)
- A /32 for the interface's own address, 192.168.10.1/32, added since IOS 15: a packet that matches it is for the router itself.
- Administratively down
- The state of an interface with
shutdown, the default on router interfaces. No route is installed untilno shutdownand a working link. - Secondary address
- A second subnet on the same interface (
ip address … secondary). A secondip addresswithout the keyword replaces the primary. - ip unnumbered
- A point-to-point interface that borrows the address of another interface, usually Loopback0, instead of using a subnet of its own.
- SVI
- Switched virtual interface (
interface Vlan20): the Layer 3 gateway of a VLAN on a multilayer switch, up/up only while the VLAN has an active port.
10.1The step-by-step animation
- R1 starts with no addresses, and every router interface starts administratively down. On Gi0/0, the Sales LAN, you enter the first usable host of 192.168.10.0/25 with its dotted mask:
ip address 192.168.10.1 255.255.255.128. IOS checks the address and accepts it, but the interface is still shut, soshow ip interface briefsays administratively down and the routing table stays empty.R1 · Gi0/0: interface GigabitEthernet0/0 · ip address 192.168.10.1 255.255.255.128 · status administratively down / down no shutdownbrings Gi0/0 up, and SW1 answers on the other end, so the line protocol comes up too: up/up. Only now does IOS install two routes. C 192.168.10.0/25 is the connected subnet, the address AND the mask: R1 ARPs for any destination inside it. L 192.168.10.1/32 is the local route for R1's own address (IOS 15 and later): a packet that matches it is for R1 itself.R1 · Gi0/0: status up / up · C 192.168.10.0/25 → Gi0/0 · L 192.168.10.1/32 → R1 itself- Same two commands on Gi0/1 for Engineering:
ip address 192.168.10.129 255.255.255.192andno shutdown. IOS checks that .129 is neither the network (.128) nor the broadcast (.191) of its /26, then that 192.168.10.128/26 overlaps no other interface: it starts right after Sales ends at .127. Gi0/1 comes up and two more routes appear, C 192.168.10.128/26 and L 192.168.10.129/32.R1 · Gi0/1: ip address 192.168.10.129 255.255.255.192 · subnet 192.168.10.128/26 · .128 – .191 · new routes C .128/26 · L .129/32 - Wrong: on Gi0/2, the link to R2, the engineer pastes the Sales mask:
ip address 192.168.10.225 255.255.255.128. With a /25, .225 belongs to 192.168.10.128/25 (.128 – .255), which contains Engineering's 192.168.10.128/26 on Gi0/1. A connected subnet must lead to exactly one interface, so IOS refuses the command:% 192.168.10.128 overlaps with GigabitEthernet0/1. Gi0/2 keeps no address, nothing is installed and R2 cannot be reached.R1 · Gi0/2: typed 192.168.10.225 255.255.255.128 · .225 AND /25 192.168.10.128/25 ⊃ Gi0/1's /26 · IOS % 192.168.10.128 overlaps with GigabitEthernet0/1 - Fix: the link needs only two addresses, so the mask is a /30:
ip address 192.168.10.225 255.255.255.252. Now .225 AND /30 = 192.168.10.224, a block of four (.224 – .227) that overlaps nothing. Withno shutdownthe link comes up, C 192.168.10.224/30 and L 192.168.10.225/32 appear, and a ping to R2's .226 answers.R1 · Gi0/2: ip address 192.168.10.225 255.255.255.252 · subnet 192.168.10.224/30 · R1 .225 · R2 .226 · new routes C .224/30 · L .225/32 - Verify from two angles.
show ip interface brief: three interfaces up/up, Method manual (typed in this session; NVRAM after a reload).show ip route connected: one C and one L route per interface, filed under 192.168.10.0/24 is variably subnetted, 6 subnets, 4 masks (/25, /26, /30 and the /32 L routes). When a C route is missing, the interface is not up/up: read the Status and Protocol columns first.Verification: interfaces 3 × up / up, Method manual · routing table 6 subnets, 4 masks · missing C route check Status / Protocol
10.2Simulator: what does IOS say?
IOS runs its checks in order and stops at the first failure. List the existing interfaces as name and address (Gi0/0 192.168.10.1/25, …), pick the interface and type the address with its dotted mask (or /prefix). Messages as typical IOS-XE releases print them.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| IOS check, in order | Result |
|---|---|
| Address and mask parse | ✓ |
| Mask is contiguous (1s, then 0s) | ✓ |
| Unicast host address (not 0/8, 127/8, class D or E) | ✓ |
| Not the network or broadcast address of its subnet | ✓ |
| No overlap with another interface (same VRF) | ✗ |
| /31 on a point-to-point interface | not reached |
R1(config)#interface GigabitEthernet0/2
R1(config-if)#ip address 192.168.10.225 255.255.255.128
% 192.168.10.128 overlaps with GigabitEthernet0/1show ip route connected (unchanged: the command was refused)
192.168.10.0/24 is variably subnetted, 4 subnets, 3 masks C 192.168.10.0/25 is directly connected, GigabitEthernet0/0 L 192.168.10.1/32 is directly connected, GigabitEthernet0/0 C 192.168.10.128/26 is directly connected, GigabitEthernet0/1 L 192.168.10.129/32 is directly connected, GigabitEthernet0/1
- 192.168.10.225 AND /25 = 192.168.10.128/25 (192.168.10.128 – 192.168.10.255). GigabitEthernet0/1 already has 192.168.10.129/26, subnet 192.168.10.128/26 (192.168.10.128 – 192.168.10.191): the new subnet contains it.
- A connected subnet must lead to exactly one interface, so IOS refuses the command and the interface keeps its previous address. It checks only its own interfaces in the same VRF: the same overlap between two routers goes unnoticed (§16).
- Fix: the mask you meant. With the same address, /26 (255.255.255.192) is the shortest mask that overlaps nothing: 192.168.10.192/26. A point-to-point link needs only a /30: 192.168.10.224/30.
10.3The configuration, line by line
R1 · IOS-XE
| 1 | interface GigabitEthernet0/0 | Sales LAN, VLAN 10. A router interface starts shut down and without an address. |
| 2 | description Sales LAN - VLAN 10 | Free text for humans and SNMP; it changes nothing in forwarding. |
| 3 | ip address 192.168.10.1 255.255.255.128 | Address and dotted mask. IOS checks them first: a contiguous mask, not the network (.0) or broadcast (.127) of the /25, no overlap with another interface in the same VRF. |
| 4 | no shutdown | Router interfaces are administratively down by default. Once Gi0/0 is up/up, IOS installs C 192.168.10.0/25 and L 192.168.10.1/32. |
| 5 | interface GigabitEthernet0/1 | Engineering LAN, VLAN 20. |
| 6 | description Eng LAN - VLAN 20 | |
| 7 | ip address 192.168.10.129 255.255.255.192 | 192.168.10.128/26: hosts .129 to .190, broadcast .191. |
| 8 | no shutdown | |
| 9 | interface GigabitEthernet0/2 | The point-to-point link to R2. |
| 10 | description P2P to R2 | |
| 11 | ip address 192.168.10.225 255.255.255.252 | /30: network .224, R1 .225, R2 .226, broadcast .227. The same address with the Sales /25 mask is refused (Wrong tab). |
| 12 | no shutdown | |
| 13 | ! | |
| 14 | interface Loopback0 | A virtual interface, up as soon as it is created: no no shutdown needed. |
| 15 | ip address 10.255.0.1 255.255.255.255 | A /32 is its own subnet: IOS installs only a C route, no separate L route. |
| 16 | ! | |
| 17 | line vty 0 4 | |
| 18 | ip netmask-format bit-count | Display only, for SSH sessions: masks in show output appear as /25. terminal ip netmask-format bit-count does the same for the current session. ip address still takes a dotted mask. |
Wrong
| 1 | ! 1. A mask that makes Gi0/2 overlap Gi0/1 | |
| 2 | interface GigabitEthernet0/2 | |
| 3 | ip address 192.168.10.225 255.255.255.128 | The Sales mask pasted onto the /30 link: .225 AND /25 = 192.168.10.128/25 (.128 – .255). |
| 4 | % 192.168.10.128 overlaps with GigabitEthernet0/1 | Refused. IOS prints the subnet it computed from the new address and mask, then the interface it collides with. Gi0/2 keeps its previous address (here none). |
| 5 | ! 2. The network or the broadcast address of the subnet | |
| 6 | ip address 192.168.10.224 255.255.255.252 | Host bits 00: the network address of 192.168.10.224/30. |
| 7 | Bad mask /30 for address 192.168.10.224 | Refused; the same message for .227 (host bits 11). Only .225 and .226 are usable. |
| 8 | ! 3. A mask that is not contiguous | |
| 9 | ip address 192.168.10.225 255.255.0.252 | 255.255.0.252 has 1s after a 0 (third octet 00000000, fourth 11111100). |
| 10 | Bad mask 0xFFFF00FC for address 192.168.10.225 | A non-contiguous mask is printed in hexadecimal, because it has no prefix length. |
| 11 | ! 4. Typing ip address again replaces the address | |
| 12 | interface GigabitEthernet0/0 | |
| 13 | ip address 10.1.10.1 255.255.255.0 | Meant as a second subnet for Sales. Without secondary it replaces 192.168.10.1/25 silently: C 192.168.10.0/25 disappears and every Sales host loses its gateway. |
| 14 | ! 5. An address on a subinterface before its VLAN tag | |
| 15 | interface GigabitEthernet0/1.30 | |
| 16 | ip address 10.1.30.1 255.255.255.0 | |
| 17 | % Configuring IP routing on a LAN subinterface is only allowed if that subinterface is already configured as part of an IEEE 802.10, IEEE 802.1Q, or ISL vLAN. | Router-on-a-stick order: encapsulation dot1Q 30 first, then the address (§5). |
Secondary · unnumbered · DHCP
| 1 | ! Two subnets on one interface (a renumbering in progress) | |
| 2 | interface GigabitEthernet0/0 | |
| 3 | ip address 192.168.10.1 255.255.255.128 | The primary address. |
| 4 | ip address 10.1.10.1 255.255.255.0 secondary | A second subnet on the same wire: C 10.1.10.0/24 and L 10.1.10.1/32 appear too. Hosts of the two subnets still talk through R1, not directly. |
| 5 | ! A point-to-point link with no subnet of its own | |
| 6 | interface Serial0/1/0 | |
| 7 | ip unnumbered Loopback0 | Borrows Loopback0's 10.255.0.1: packets leave with that source, no subnet is spent on the link and no C route is created for it. Routes to the far end point out Serial0/1/0. Meant for point-to-point interfaces such as serial links and tunnels. |
| 8 | ! BR1, a branch router: the uplink is addressed by the provider's DHCP server | |
| 9 | interface GigabitEthernet0/0/0 | |
| 10 | ip address dhcp | The router is a DHCP client. Method DHCP in show ip interface brief; the gateway from the offer (option 3) becomes S* 0.0.0.0/0 [254/0]. |
| 11 | no shutdown | |
| 12 | %DHCP-6-ADDRESS_ASSIGN: Interface GigabitEthernet0/0/0 assigned DHCP address 192.0.2.10, mask 255.255.255.0, hostname BR1 | The log when the lease arrives; show dhcp lease shows the server, the lease time and the renewal timers. |
Multilayer switch · SVI
| 1 | ! DSW1: the same gateways on a multilayer switch instead of R1 | |
| 2 | ip routing | Routing between the SVIs. Off by default on many Catalyst models; without it the switch only bridges. |
| 3 | vlan 20 | The VLAN must exist, or the SVI stays down. |
| 4 | name ENG | |
| 5 | interface Vlan20 | The SVI: the gateway of VLAN 20, with no physical port of its own. |
| 6 | ip address 192.168.10.129 255.255.255.192 | Hosts in VLAN 20 use .129 as their gateway, exactly as with R1 Gi0/1. |
| 7 | no shutdown | New SVIs are usually created shut down. |
| 8 | interface GigabitEthernet1/0/10 | |
| 9 | switchport mode access | |
| 10 | switchport access vlan 20 | Autostate: Vlan20 is up/up only while at least one port in VLAN 20 (access, or a trunk that allows it) is up and forwarding in STP. |
| 11 | interface GigabitEthernet1/0/48 | A routed port toward R2: no VLAN, the address sits on the port itself. |
| 12 | no switchport | |
| 13 | ip address 192.168.10.225 255.255.255.252 |
NX-OS · IOS-XR
| 1 | ! NX-OS (Nexus): prefix length, SVIs need a feature | |
| 2 | feature interface-vlan | Without it, interface Vlan20 does not exist. |
| 3 | interface Vlan20 | |
| 4 | no shutdown | |
| 5 | ip address 192.168.10.129/26 | NX-OS shows the mask as a prefix length in its configuration. |
| 6 | ip address 10.1.20.1/24 secondary | Secondary addresses work the same way. |
| 7 | interface Ethernet1/49 | |
| 8 | no switchport | Ports on most Nexus models (9000, 5000) are Layer 2 by default: a routed port needs this first. |
| 9 | ip address 192.168.10.225/30 | |
| 10 | ! IOS-XR: ipv4 address, and nothing happens before commit | |
| 11 | interface GigabitEthernet0/0/0/2 | |
| 12 | ipv4 address 192.168.10.225 255.255.255.252 | The keyword is ipv4; 192.168.10.225/30 is accepted too. |
| 13 | no shutdown | IOS-XR interfaces start shut down as well. |
| 14 | commit | The candidate configuration takes effect only now; show ipv4 interface brief then lists the address. |
show ip interface brief
| 1 | R1#show ip interface brief | |
| 2 | Interface IP-Address OK? Method Status Protocol | |
| 3 | GigabitEthernet0/0 192.168.10.1 YES manual up up | Method manual: typed in this session. After a reload it reads NVRAM; ip address dhcp shows DHCP. |
| 4 | GigabitEthernet0/1 192.168.10.129 YES manual up up | |
| 5 | GigabitEthernet0/2 192.168.10.225 YES manual up up | up/up: Layer 1 and the line protocol are both fine, so the C and L routes are installed. |
| 6 | GigabitEthernet0/3 unassigned YES unset administratively down down | The factory state: no address (unset) and shut down. down/down instead means no cable or no light from the other end; up/down points to Layer 2 (encapsulation, keepalives). |
| 7 | Loopback0 10.255.0.1 YES manual up up |
show ip route
| 1 | R1#show ip route connected | include subnetted | |
| 2 | 192.168.10.0/24 is variably subnetted, 6 subnets, 4 masks | 3 C and 3 L routes inside the classful 192.168.10.0/24, with masks /25, /26, /30 and /32. |
| 3 | R1#show ip route 192.168.10.225 | |
| 4 | Routing entry for 192.168.10.225/32 | R1's own address on Gi0/2 matches the L route: a /32 beats the /30. |
| 5 | Known via "connected", distance 0, metric 0 (connected) | L routes are connected routes: AD 0. They are not redistributed into routing protocols; the C route is. |
| 6 | Routing Descriptor Blocks: | |
| 7 | * directly connected, via GigabitEthernet0/2 | |
| 8 | R1#show ip route 192.168.10.226 | |
| 9 | Routing entry for 192.168.10.224/30 | R2's address matches only the C route of the link: R1 ARPs for it out Gi0/2. |
| 10 | Known via "connected", distance 0, metric 0 (connected, via interface) | |
| 11 | Routing Descriptor Blocks: | |
| 12 | * directly connected, via GigabitEthernet0/2 |
show ip interface Gi0/0
| 1 | R1#show ip interface GigabitEthernet0/0 | |
| 2 | GigabitEthernet0/0 is up, line protocol is up | The same up/up as in the brief output. |
| 3 | Internet address is 192.168.10.1/25 | Address and prefix length: the subnet is 192.168.10.0/25. |
| 4 | Broadcast address is 255.255.255.255 | |
| 5 | Address determined by setup command | Typed in the CLI. "non-volatile memory" after a reload, "DHCP" with ip address dhcp. |
| 6 | MTU is 1500 bytes | |
| 7 | Secondary address 10.1.10.1/24 | Each secondary address is listed on its own line. |
| 8 | Proxy ARP is enabled | On by default on IOS: R1 answers ARP for addresses it reaches through another interface, which can hide a host with a wrong mask (§16). |
show running-config interface
| 1 | R1#show running-config interface GigabitEthernet0/0 | |
| 2 | Building configuration... | |
| 3 | ||
| 4 | Current configuration : 168 bytes | |
| 5 | ! | |
| 6 | interface GigabitEthernet0/0 | |
| 7 | description Sales LAN - VLAN 10 | |
| 8 | ip address 10.1.10.1 255.255.255.0 secondary | IOS lists the secondary addresses before the primary. |
| 9 | ip address 192.168.10.1 255.255.255.128 | The primary: the source of routing protocol hellos, of ICMP errors and the giaddr of a DHCP relay. |
| 10 | duplex auto | |
| 11 | speed auto | |
| 12 | end |
The outputs and messages are typical for IOS-XE; details may vary between versions and platforms.
10.4Remember
ip address with a dotted mask, no shutdown (router interfaces start administratively down) and a working link (up/up). IOS then installs C 192.168.10.0/25 and, since IOS 15, L 192.168.10.1/32. It refuses a network or broadcast address (Bad mask /25 for address 192.168.10.0) and any subnet that overlaps another interface (% 192.168.10.128 overlaps with GigabitEthernet0/1).ip address again replaces the primary address, without a warning; a second subnet needs secondary. And secondaries are second-class: routing protocols send their hellos from the primary, so OSPF and EIGRP form no adjacency with a neighbour addressed only in the secondary subnet (EIGRP logs "not on common subnet"), and a DHCP relay uses the primary as giaddr.show ip interface brief, column Method: manual (typed in this session), NVRAM (read from startup-config), DHCP, unset (no address). AD 0 for C and L routes, AD 254 for the default route learned by ip address dhcp. A /32 (Loopback0 10.255.0.1) gets only a C route. /31 on Ethernet is accepted with % Warning: use /31 mask on non point-to-point interface cautiously (RFC 3021).ip routing a multilayer switch does not route between its SVIs. On a router, a subinterface needs encapsulation dot1Q 20 before IOS accepts an address on it.ip address 192.168.10.1/25, needs feature interface-vlan for SVIs and no switchport for routed ports. IOS-XR uses ipv4 address 192.168.10.1 255.255.255.128 (or /25), starts interfaces shut and applies nothing until commit; it checks with show ipv4 interface brief. On IOS, terminal ip netmask-format bit-count only changes how show output displays masks.show ip interface briefshow ip route connectedshow ip interface GigabitEthernet0/0show running-config interface GigabitEthernet0/0show ip interface brief vrf all (NX-OS)show ipv4 interface brief (IOS-XR)10.5Check yourself: exam-style questions
R1 already has ip address 192.168.10.129 255.255.255.192 on Gi0/1. On Gi0/2 you type ip address 192.168.10.190 255.255.255.128. What does IOS do?
- AIt refuses it:
Bad mask /25 for address 192.168.10.190 - BIt accepts it, because .190 is not the address configured on Gi0/1
- CIt refuses it:
% 192.168.10.128 overlaps with GigabitEthernet0/1 - DIt accepts it: longest match keeps the /26 on Gi0/1 working as before
Show answer
On an IOS 15 router you configure Gi0/3 with ip address 192.168.10.193 255.255.255.224 and no shutdown, and the link comes up. Which routes does Gi0/3 add to the routing table?
- AC 192.168.10.192/27 only: L routes exist only for loopbacks
- BC 192.168.10.192/27 and L 192.168.10.223/32
- CC 192.168.10.193/27 and L 192.168.10.192/32
- DC 192.168.10.192/27 and L 192.168.10.193/32
Show answer
With the mask 255.255.255.224, which of these addresses does IOS refuse on an interface with a Bad mask /27 message?
- A192.168.10.193
- B192.168.10.226
- C192.168.10.222
- D192.168.10.223
Show answer
On a multilayer switch, interface Vlan20 has an address and no shutdown, and VLAN 20 exists. show ip interface brief still shows Vlan20 as up / down. What is the most likely cause?
- AThe SVI needs
no switchportbefore its line protocol comes up - BNo port carrying VLAN 20 is up and forwarding in STP
- CThe SVI's address overlaps another interface of the switch
- D
ip routingis disabled, and an SVI needs routing to come up
Show answer
ip routing the SVI still comes up; the switch simply does not route between VLANs. no switchport is for routed physical ports, and an overlapping address would have been refused when it was typed.On R1's Ethernet interface Gi0/2 you enter ip address 192.168.10.224 255.255.255.254. What happens?
- AIt is accepted with a /31 warning; C 192.168.10.224/31 and L 192.168.10.224/32 appear
- BIt is accepted with no message, and only C 192.168.10.224/31 appears, with no L route
- CIt is refused: IOS allows a /31 mask only on serial and other point-to-point interfaces
- DIt is refused with
Bad mask /31 for address 192.168.10.224: .224 is the network address
Show answer
% Warning: use /31 mask on non point-to-point interface cautiously because Ethernet is multi-access. The interface gets its C /31 and an L /32 like any address shorter than /32.Gi0/0 is the Sales gateway with 192.168.10.1/25. To add a temporary subnet on the same LAN, an engineer enters ip address 10.1.10.1 255.255.255.0 under Gi0/0. What is the result?
- ABoth subnets are active: IOS keeps the first and adds the new one as a secondary
- BIOS refuses it, because the interface already has a primary address configured
- CIOS refuses it with
% 10.1.10.0 overlaps with GigabitEthernet0/0 - DIt replaces 192.168.10.1/25, and the Sales hosts lose their gateway
Show answer
ip address without the secondary keyword replaces the primary, with no warning: C 192.168.10.0/25 and L 192.168.10.1/32 disappear and every Sales host loses .1. The command that was meant is ip address 10.1.10.1 255.255.255.0 secondary. The two subnets do not overlap, so no error is printed either.BR1's uplink is configured with ip address dhcp. The DHCP offer carries 192.0.2.10/24 and the router option 192.0.2.1. Which additional route appears in BR1's routing table?
- ANone: a default route must always be configured by hand
- BS* 0.0.0.0/0 [1/0] via 192.0.2.1
- CS* 0.0.0.0/0 [254/0] via 192.0.2.1
- DC 0.0.0.0/0 [0/0], directly connected to the uplink
Show answer
show ip interface brief shows the Method DHCP.R1 has 192.168.10.1/25 on Gi0/0 in the global routing table. On Gi0/5 you enter vrf forwarding LAB and then ip address 192.168.10.1 255.255.255.128. What happens?
- AIt is refused:
% 192.168.10.0 overlaps with GigabitEthernet0/0 - BIt is accepted: the overlap check compares only interfaces in the same VRF
- CIt is refused: an IPv4 address can be configured only once per router
- DIt is accepted, and the global table gets a second C 192.168.10.0/25 via Gi0/5
Show answer
vrf forwarding removes any IPv4 address already on the interface, so the address is entered after it.IPv6 address format: 128 bits, hextets and compression rules
TL;DRAn IPv6 address is 128 bits, written as 8 hextets of 4 hex digits separated by colons, so every hex digit is one 4-bit nibble. Two rules shorten it: drop the leading zeros of each hextet, and replace one run of consecutive zero hextets with ::, once per address. RFC 5952 turns that into a single canonical form (lowercase, :: on the longest run of two or more, the first one on a tie, never for a single zero), and expanding works backwards: 8 minus the hextets written is what :: hides.
- Hextet
- One of the 8 groups of 16 bits, written as up to 4 hex digits: 2001, 0db8, 0000… 8 × 16 = 128 bits.
- Nibble
- 4 bits, exactly one hex digit. A full address is 32 nibbles, and a /64 is the first 16 of them.
- Leading zeros (rule 1)
- Zeros at the start of a hextet may be dropped: 0db8 → db8, 0000 → 0, 0800 → 800. Zeros at the end never.
- Double colon :: (rule 2)
- Replaces one run of consecutive all-zero hextets, once per address: 2001:db8:0:0:8:800:200c:417a → 2001:db8::8:800:200c:417a.
- Canonical form
- The one text form RFC 5952 recommends for output: lowercase, no leading zeros, :: on the longest run (the first on a tie), never for a single zero hextet.
- Prefix length
- /n after the address: the first n bits are the prefix, as in IPv4 CIDR but with no dotted mask. 2001:db8:acad:10::1/64.
- Zone ID
- %name after a link-local address, naming the interface to use: fe80::1%eth0 on Linux, fe80::1%12 on Windows. It never goes into the packet.
11.1The step-by-step animation
- An IPv6 address is 128 bits: 2128 ≈ 3.4 × 1038 addresses, against 232 ≈ 4.3 billion in IPv4. Written in full it is 8 groups of 16 bits, the hextets, each in 4 hex digits and separated by colons. One hex digit is one nibble (4 bits), so the whole address is 32 hex digits. The example from RFC 4291: 2001:0db8:0000:0000:0008:0800:200c:417a.The address: bits 128 = 8 hextets × 16 · written 32 hex digits, 7 colons · address space 2^128 ≈ 3.4 × 10^38
- Rule 1: in every hextet, drop the leading zeros. 0db8 becomes db8, 0000 becomes 0, 0008 becomes 8 and 0800 becomes 800. Only leading zeros go: the two zeros at the end of 0800 are part of its value (0x800 = 2048), so writing 8 would name another address. Every hextet keeps at least one digit.The address: in full 2001:0db8:0000:0000:0008:0800:200c:417a · rule 1 2001:db8:0:0:8:800:200c:417a · kept trailing zeros: 0800 → 800, never 8
- Rule 2: replace one run of consecutive all-zero hextets with ::. Hextets 3 and 4 are both 0, so 2001:db8:0:0:8:800:200c:417a becomes 2001:db8::8:800:200c:417a. To expand it again, count what is written: 6 hextets, so the :: stands for 8 − 6 = 2 zero hextets.The address: rule 1 2001:db8:0:0:8:800:200c:417a · rule 2 2001:db8::8:800:200c:417a · :: 8 − 6 written = 2 zero hextets
- Wrong: 2001:db8::1::2. Each :: hides some zero hextets, and with 4 hextets written, 8 − 4 = 4 must be shared between two of them: 1 + 3, 2 + 2 or 3 + 1. Those are three different addresses, so the text is ambiguous and invalid: :: may appear only once. R1 refuses the line (
% Invalid input detected), and every host refuses it too.The address: typed 2001:db8::1::2 · written 4 hextets → 4 hidden · readings 1 + 3 · 2 + 2 · 3 + 1 → invalid - Many spellings, one address: 2001:DB8:0:0:8:800:200C:417A, 2001:0db8::0008:0800:200c:417a and 2001:db8::8:800:200c:417a are all valid. RFC 5952 picks one canonical form so that logs, configs and searches match: lowercase, no leading zeros, :: on the longest run of zero hextets, the first run on a tie, and never :: for a single zero hextet.RFC 5952: tie 2001:db8:0:0:1:0:0:1 → 2001:db8::1:0:0:1 · longest wins 2001:db8:0:0:1:0:0:0 → 2001:db8:0:0:1:: · single 0 2001:db8:0:1:1:1:1:1 stays as it is
- Expanding works backwards. R1's Gi0/0 has 2001:db8:acad:10::1/64: 5 hextets are written, so :: hides 8 − 5 = 3, and every hextet is padded back to 4 digits: 2001:0db8:acad:0010:0000:0000:0000:0001. A /64 is 16 nibbles, exactly the first 4 hextets: the prefix is 2001:db8:acad:10::/64 and the last 4 hextets are the interface ID. Host A pings it.The address: typed 2001:db8:acad:10::1/64 · expanded 2001:0db8:acad:0010:0000:0000:0000:0001 · prefix | interface ID 2001:db8:acad:10 | ::1
- Two more notations. A zone ID after % names the interface for a link-local address: every interface owns fe80::/64, so Host A types
ping fe80::1%eth0(Linux; Windows uses the interface number, %12). Mixed notation writes the last 32 bits as dotted IPv4: ::ffff:192.0.2.1 is the IPv4-mapped form of 192.0.2.1 (§12). Neither changes the 128 bits: the zone never goes on the wire.The address: zone ID fe80::1%eth0 → interface eth0, not sent · mixed ::ffff:192.0.2.1 = ::ffff:c000:201 · in a URL http://[2001:db8:acad:10::1]:8080/
11.2Simulator: compress, expand and validate an IPv6 address
Type the address the way you saw it: in full, compressed, uppercase, with :: in the wrong place. The simulator checks it, expands it to all 32 hex digits, applies the two rules and gives the RFC 5952 canonical form, with the reason when your text is not canonical or not valid.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| Step | Result |
|---|---|
| Typed | 2001:0db8:0000:0000:0008:0800:200c:417a |
| Hextets written | 8, no :: |
| Full form (expanded) | 2001:0db8:0000:0000:0008:0800:200c:417a |
| Rule 1: drop leading zeros | 2001:db8:0:0:8:800:200c:417a |
| Rule 2: :: on the longest zero run | 2001:db8::8:800:200c:417a |
| Canonical (RFC 5952) | 2001:db8::8:800:200c:417a |
| Runs of zero hextets | hextets 3–4 (2) |
| If it is a /64 (a LAN) | prefix 2001:db8::/64, interface ID 8:800:200c:417a |
| Hextet | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
|---|---|---|---|---|---|---|---|---|
| nibbles | 2 0 0 1 | 0 d b 8 | 0 0 0 0 | 0 0 0 0 | 0 0 0 8 | 0 8 0 0 | 2 0 0 c | 4 1 7 a |
| bits | 0–15 | 16–31 | 32–47 | 48–63 | 64–79 | 80–95 | 96–111 | 112–127 |
| Hextet 1 = 2001 | 2 | 0 | 0 | 1 |
|---|---|---|---|---|
| 4 bits per digit | 0010 | 0000 | 0000 | 0001 |
| value | 0x2001 = 8,193 in decimal, bits 0–15 of the address | |||
- Leading zeros kept in
0db8,0000,0000,0008,0800: rule 1 writesdb8,0,0,8,800. - The run of 2 zero hextets (hextets 3–4) is not shortened with ::.
- Rule 1 (leading zeros):
2001:db8:0:0:8:800:200c:417a. Rule 2 (::):2001:db8::8:800:200c:417a— :: replaces hextets 3–4, 2 zero hextets.
11.3The configuration, line by line
R1 · IOS-XE
| 1 | interface GigabitEthernet0/0 | The Sales LAN, VLAN 10. |
| 2 | ipv6 address 2001:0DB8:ACAD:0010:0000:0000:0000:0001/64 | Typed in full and in capitals: IOS accepts any valid text form of the same 128 bits. The prefix length follows a slash; IPv6 has no dotted mask. |
| 3 | ipv6 address FE80::1 link-local | A short link-local address, easy to read in neighbor tables and as the hosts' default gateway (§12). |
| 4 | no shutdown | |
| 5 | interface GigabitEthernet0/1 | The Engineering LAN, VLAN 20. |
| 6 | ipv6 address 2001:DB8:ACAD:20::1/64 | Typed compressed: stored the same way. |
| 7 | ipv6 address FE80::1 link-local | The same link-local on a second interface is legal: it only has to be unique on its own link. That is why a link-local destination needs a zone. |
show ipv6 interface brief
| 1 | R1#show ipv6 interface brief | |
| 2 | GigabitEthernet0/0 [up/up] | |
| 3 | FE80::1 | The link-local address is listed first. |
| 4 | 2001:DB8:ACAD:10::1 | Typed as 2001:0DB8:ACAD:0010:0000:0000:0000:0001: IOS shows the compressed form, in uppercase. |
| 5 | GigabitEthernet0/1 [up/up] | |
| 6 | FE80::1 | |
| 7 | 2001:DB8:ACAD:20::1 |
NX-OS · IOS-XR
| 1 | ! NX-OS: the same slash notation; output in lowercase | |
| 2 | interface Ethernet1/1 | |
| 3 | no switchport | A routed port. |
| 4 | ipv6 address 2001:db8:acad:10::1/64 | Shown back exactly like this, in the RFC 5952 form. |
| 5 | ipv6 link-local fe80::1 | NX-OS sets a static link-local with its own keyword. |
| 6 | ! IOS-XR | |
| 7 | interface GigabitEthernet0/0/0/0 | |
| 8 | ipv6 address 2001:db8:acad:10::1/64 | |
| 9 | ipv6 address fe80::1 link-local | The same keyword as IOS. |
Wrong
| 1 | interface GigabitEthernet0/0 | |
| 2 | ipv6 address 2001:DB8::1::2/64 | Two :: in one address: there is no way to tell how many zero hextets each one hides. |
| 3 | % Invalid input detected at '^' marker. | The parser rejects the line; nothing is configured. |
| 4 | ipv6 address 2001:DB8:ACAD:00010::1/64 | Five digits in one group: a hextet holds at most 4 hex digits (16 bits). Rejected the same way. |
| 5 | ipv6 address 2001:DB8:ACAD:10:0:0:0:0:1/64 | Nine groups is 144 bits. Rejected. |
| 6 | ipv6 address 2001:DB8:ACAD:1::1/64 | Accepted, and wrong: 0010 shortens to 10, never to 1. Only leading zeros go, so this is subnet 1, not the Sales subnet 10. |
Host A · zone ID
| 1 | $ ping -c 2 fe80::1%eth0 | Linux: the zone is the interface name. |
| 2 | PING fe80::1%eth0(fe80::1%eth0) 56 data bytes | |
| 3 | 64 bytes from fe80::1%eth0: icmp_seq=1 ttl=64 time=0.412 ms | The reply carries the zone too: the address alone does not say which link it came from. |
| 4 | 64 bytes from fe80::1%eth0: icmp_seq=2 ttl=64 time=0.388 ms | |
| 5 | $ ping -c 1 fe80::1 | Without the zone… |
| 6 | ping: connect: Invalid argument | … the host cannot pick an interface for a link-local destination. Windows: ping fe80::1%12, the interface index. |
| 7 | $ curl http://[2001:db8:acad:10::1]:8080/ | In a URL the address goes in square brackets, so its colons are not read as the port separator (RFC 3986). |
R1 · ping a link-local
| 1 | R1#ping FE80::250:56FF:FEA1:1B01 | |
| 2 | Output Interface: GigabitEthernet0/0 | IOS asks for the zone: every interface has an fe80:: address, so the address alone does not say which link. |
| 3 | Type escape sequence to abort. | |
| 4 | Sending 5, 100-byte ICMP Echos to FE80::250:56FF:FEA1:1B01, timeout is 2 seconds: | |
| 5 | Packet sent with a source address of FE80::1%GigabitEthernet0/0 | IOS writes the zone after % as well. |
| 6 | !!!!! | |
| 7 | Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms |
The outputs are typical for IOS-XE and Linux; details may vary between versions.
11.4Remember
::, once per address (RFC 5952 output: only a run of two or more). To expand, 8 minus the hextets written is what :: hides: 2001:db8::8:800:200c:417a has 6, so :: = 2 zero hextets.Output Interface: when you ping a link-local address.show ipv6 interface briefshow running-config interface GigabitEthernet0/0 | include ipv6show ipv6 interface GigabitEthernet0/011.5Check yourself: exam-style questions
What is the shortest valid way to write 2001:?
- A2001:
db8:: 0008: 0800: 200c: 417a - B2001:db8::8:800:200c:417a
- C2001:db8::8:8:200c:417a
- D2001:
db8: 0: 8: 800: 200c: 417a
Show answer
R1's Gi0/0 shows 2001:DB8:ACAD:10::1/64. What is the address written in full?
- A2001:
0db8: acad: 1000: 0000: 0000: 0000: 0001 - B2001:
0db8: acad: 0010: 0000: 0000: 0000: 0001 - C2001:
0db8: acad: 0010: 0000: 0000: 0001 - D2001:
0db8: acad: 0010: 0001: 0000: 0000: 0000
Show answer
Following RFC 5952, how is 2001: written?
- A2001:db8::1:0:0:1
- B2001:db8::1::1
- C2001:db8::1:0:0:0:1
- D2001:db8:0:0:1::1
Show answer
What is the RFC 5952 text form of 2001:?
- A2001:db8:0:1:1:1:1:1
- B2001:db8:0:1::1
- C2001:db8::1:1:1:1:1
- D2001:db8:0000:1:1:1:1:1
Show answer
To filter the Sales LAN, 2001:db8:acad:0010::/64, an engineer adds permit ipv6 2001:DB8:ACAD:1::/64 any to an IPv6 ACL on R1. What happens to traffic from the Sales hosts?
- AIt is matched: IOS stores 0010 as 1, so both forms name exactly the same /64 prefix
- BIt is not matched: 1 expands to 0001, so the entry names subnet 1, not subnet 10
- CThe line is rejected: a /64 prefix must be written with its four hextets in full
- DIt is matched: a /64 entry compares only the first three hextets of the source
Show answer
On R1 you type ping FE80::250:56FF:FEA1:1B01 and IOS answers Output Interface:. Why does it ask?
- AAn extended ping is always required when the destination is an EUI-64 address learned from a neighbor
- BIOS treats any address that starts with FE as multicast, so it needs to know the outgoing interface first
- CEvery interface owns an fe80::/64 address, so a link-local destination does not say which link to use
- DLink-local addresses are not in the routing table, so IOS first needs a source address for the echo request
Show answer
A syslog server stores 2001:DB8:0:0:1::1 from one router and 2001:db8::1:0:0:1 from another. A correlation rule matches source addresses as plain strings. What happens, and what is the fix?
- AThe first one is invalid, because uppercase hex digits and :: cannot be combined in one address
- BThey are the same address but never match as strings; normalize to the RFC 5952 form first
- CThey are different addresses, because the :: hides different zero hextets in each of the two
- DThey match, because RFC 5952 requires every device to log addresses in exactly the same form
Show answer
IPv6 address types: global, unique local, link-local, multicast and the special ones
TL;DRThe first hex digits tell you the type: 2000::/3 global unicast (routed on the Internet), fc00::/7 unique local (fd00::/8 in practice, private), fe80::/10 link-local (on every interface, never routed), ff00::/8 multicast, plus ::1, :: and a few special blocks. There is no broadcast: multicast groups such as ff02::1 and the solicited-node groups replace it. One interface always holds several addresses at once, and each reaches only as far as its scope.
- GUA
- Global unicast address, 2000::/3 (first 3 bits 001, so 2xxx or 3xxx): routed on the Internet. Usually a /48 site prefix + 16-bit subnet ID + 64-bit interface ID.
- ULA
- Unique local address, fc00::/7, in practice fd00::/8 with a random 40-bit Global ID (fd12:3456:789a::/48): private, never on the Internet.
- Link-local
- fe80::/10 (fe80::/64 in practice): created on every IPv6 interface, valid only on its link, never forwarded. NDP and routing protocols run on it.
- Multicast scope
- The 4th hex digit of an ff00::/8 address: 1 interface, 2 link, 5 site, 8 organization, e global. ff02::1 never leaves the link.
- Solicited-node group
- ff02::1:ff + the last 24 bits of a unicast address: ff02::1:ffa1:1b01 for Host A. Neighbor Solicitations go there instead of a broadcast.
- Anycast
- One unicast address on several devices; the routing picks the nearest. It looks like any unicast address; the Subnet-Router anycast (prefix + all-zero interface ID) is predefined.
- Unspecified and loopback
- :: (all zeros) means "no address yet" and is only a source; ::1 is the host itself and never leaves it.
12.1The step-by-step animation
- Host A boots on the Sales LAN. Before any router speaks, it gives itself a link-local address: the prefix fe80::/64 plus a 64-bit interface ID, here built from its MAC (EUI-64, §14): fe80::250:56ff:fea1:1b01. Every IPv6 interface has one, it is valid only on this link, and routers never forward it. Everything Host A sends next uses it as the source.Host A: type link-local unicast, fe80::/10 · address fe80::250:56ff:fea1:1b01 · scope this link only
- IPv6 has no broadcast: one-to-many traffic is multicast, ff00::/8. Host A joins ff02::1, all nodes on the link, and its solicited-node group ff02::1:ffa1:1b01: ff02::1:ff plus the last 24 bits of its address. Neighbor Solicitations for its address go to that group, so they disturb only the hosts whose addresses end the same way. An MLD report announces the solicited-node group to snooping switches; ff02::1 is never reported, because every node is in it.Host A: ff02::1 all nodes, link scope · ff02::1:ffa1:1b01 solicited-node = ff02::1:ff + a1:1b01 · on Ethernet 33:33 + last 32 bits = 3333.ffa1.1b01
- Host A needs a prefix and a gateway, so it sends a Router Solicitation (ICMPv6 type 133) from its link-local address to ff02::2, all routers on the link. R1 is a member of ff02::2 because it routes IPv6; the printer is not, so its network card drops the frame. The whole exchange runs on link-local and multicast addresses, because Host A has no global address yet.On the wire: src fe80::250:56ff:fea1:1b01 · dst ff02::2 (all routers) · ICMPv6 type 133 Router Solicitation · hop limit 255
- R1 answers with a Router Advertisement (ICMPv6 type 134) from fe80::1 to ff02::1, so every node on the link hears it. It carries the prefix 2001:db8:acad:10::/64 with the A flag (build your own address) and a router lifetime of 1800 s. The source is link-local on purpose: hosts take fe80::1 as their default gateway, which stays the same if the global prefix is ever renumbered.On the wire: src fe80::1 (R1 Gi0/0) · dst ff02::1 (all nodes) · prefix 2001:db8:acad:10::/64, A = 1 · router lifetime 1800 s
- Host A builds its global unicast address from the advertised /64 and the same interface ID: 2001:db8:acad:10:250:56ff:fea1:1b01 (how, and the duplicate check, in §14). It lies in 2000::/3, the block of every global address, and here in 2001:db8::/32, the documentation prefix this guide uses as a stand-in. The interface now holds several addresses at once, and both unicast addresses share one solicited-node group, because they end in the same 24 bits.Host A: global 2001:db8:acad:10:250:56ff:fea1:1b01/64 · link-local fe80::250:56ff:fea1:1b01/64 · gateway fe80::1
- Who is on my link? ping ff02::1 reaches every IPv6 node on the Sales LAN at once (Host A itself included), and each answers from its link-local address: R1 from fe80::1, the printer from its own. It is the closest thing IPv6 has to a broadcast, but its scope is 2, link-local: R1 never forwards it, so Host B on the Engineering LAN does not see it.On the wire: dst ff02::1 (scope 2 = link) · replies fe80::1 (R1) · fe80::1c2b:… (printer) · forwarded by R1 never
- Wrong: a packet for Host B leaves Host A with its link-local address as the source. R1 must drop it, because a link-local address is meaningless beyond its link, and it may answer with ICMPv6 Destination Unreachable, code 2, "beyond scope of source address". From the global address the same packet is routed to Host B. Each type reaches as far as its scope.On the wire: src fe80::250:56ff:fea1:1b01 dropped at R1 · ICMPv6 type 1, code 2: beyond scope of source · src 2001:db8:acad:10:250:56ff:fea1:1b01 routed to Host B
12.2Simulator: what type of IPv6 address is this?
The finder does what you should do at a glance on the exam: read the first hex digits, find the most specific block, and say where the address is valid and how far it travels. The four flags come from the IANA special-purpose registry (RFC 6890).
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| fe80::1 | Answer |
|---|---|
| Type | Link-local unicast |
| Most specific block | fe80::/10 · Link-local unicast |
| Also inside | — |
| Standard | RFC 4291 |
| Scope | Link |
| Valid as source | Yes, on its own link |
| Valid as destination | Yes, on its own link |
| Forwarded by routers | No: never forwarded (RFC 4291) |
| Reachable from | This link only |
| Used for | Every IPv6 interface has one (fe80::/64 in practice); never routed |
| Structure | fe80::/10 · 54 bits that must be 0 · interface ID 0:0:0:1 |
| Solicited-node group | ff02::1:ff00:1 (on Ethernet 3333.ff00.0001) |
In full: fe80:0000:0000:0000:0000:0000:0000:0001
- Every IPv6 interface creates one, even with no global prefix. NDP, router advertisements and the routing protocols (OSPFv3, EIGRP, next hops) use it; routers never forward a packet with a link-local source or destination to another link.
- Because every interface has one, pinging it needs the interface too:
ping fe80::1%eth0on Linux,Output Interface:on IOS (§11).
12.3The configuration, line by line
R1 · IOS-XE
| 1 | ipv6 unicast-routing | R1 forwards IPv6, joins ff02::2 and sends Router Advertisements (§15). |
| 2 | interface GigabitEthernet0/0 | Sales LAN, VLAN 10. |
| 3 | ipv6 address FE80::1 link-local | Replaces the automatic EUI-64 link-local. It is the source of R1's RAs, so the hosts use FE80::1 as their gateway. |
| 4 | ipv6 address 2001:DB8:ACAD:10::1/64 | The global address (a documentation prefix standing in for a real GUA). The all-zero interface ID, 2001:DB8:ACAD:10::, stays free: RFC 4291 reserves it as the Subnet-Router anycast address of this subnet. |
| 5 | ! ipv6 address FD12:3456:789A:10::1/64 | Optional ULA on the same interface: the RA would carry both prefixes, and every host would build both addresses. |
| 6 | interface Loopback0 | |
| 7 | ipv6 address 2001:DB8:ACAD:FFFF::1/128 | A /128: one address, for the router ID and management. |
show ipv6 interface Gi0/0
| 1 | R1#show ipv6 interface GigabitEthernet0/0 | |
| 2 | GigabitEthernet0/0 is up, line protocol is up | |
| 3 | IPv6 is enabled, link-local address is FE80::1 | The link-local address, always there. |
| 4 | No Virtual link-local address(es): | |
| 5 | Global unicast address(es): | |
| 6 | 2001:DB8:ACAD:10::1, subnet is 2001:DB8:ACAD:10::/64 | The global address and its /64. |
| 7 | Joined group address(es): | |
| 8 | FF02::1 | All nodes: every IPv6 interface joins it. |
| 9 | FF02::2 | All routers: joined because of ipv6 unicast-routing. |
| 10 | FF02::1:FF00:1 | The solicited-node group of both FE80::1 and 2001:DB8:ACAD:10::1: they share the last 24 bits (00:0001), so one group serves both. |
| 11 | MTU is 1500 bytes | |
| 12 | ND DAD is enabled, number of DAD attempts: 1 | |
| 13 | ND router advertisements are sent every 200 seconds | |
| 14 | ND router advertisements live for 1800 seconds | The router lifetime carried in each RA. |
| 15 | Hosts use stateless autoconfig for addresses. |
Host A · Linux
| 1 | $ ip -6 addr show dev eth0 | |
| 2 | 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000 | |
| 3 | inet6 2001:db8:acad:10:250:56ff:fea1:1b01/64 scope global dynamic | The GUA built from the RA; "dynamic" because it has lifetimes from the RA. |
| 4 | valid_lft 2591998sec preferred_lft 604798sec | IOS advertises 30 days valid, 7 days preferred by default. |
| 5 | inet6 fe80::250:56ff:fea1:1b01/64 scope link | The link-local address: scope link. |
| 6 | valid_lft forever preferred_lft forever | |
| 7 | $ ip -6 maddr show dev eth0 | |
| 8 | 2: eth0 | |
| 9 | link 33:33:ff:a1:1b:01 | The Ethernet MAC of the solicited-node group: 33:33 + its last 32 bits. |
| 10 | inet6 ff02::1:ffa1:1b01 | The solicited-node group. |
| 11 | inet6 ff02::1 | All nodes. |
| 12 | $ ip -6 route show default | |
| 13 | default via fe80::1 dev eth0 proto ra metric 1024 expires 1797sec | The gateway is R1's link-local address, learned from the RA. |
| 14 | $ ping -c 1 ff02::1%eth0 | A link-scope group needs the zone, like a link-local address. |
| 15 | 64 bytes from fe80::250:56ff:fea1:1b01%eth0: icmp_seq=1 ttl=64 time=0.041 ms | Host A itself: it is a member of ff02::1 too, so it answers its own echo. |
| 16 | 64 bytes from fe80::1%eth0: icmp_seq=1 ttl=64 time=0.402 ms (DUP!) | R1. Every further reply to the same echo is marked DUP!. |
| 17 | 64 bytes from fe80::1c2b:9e4f:a7d0:3b61%eth0: icmp_seq=1 ttl=64 time=0.913 ms (DUP!) | The printer. |
NX-OS · IOS-XR
| 1 | ! NX-OS | |
| 2 | interface Ethernet1/1 | |
| 3 | no switchport | |
| 4 | ipv6 address 2001:db8:acad:10::1/64 | |
| 5 | ipv6 link-local fe80::1 | NX-OS has its own keyword for a static link-local address. |
| 6 | ! IOS-XR | |
| 7 | interface GigabitEthernet0/0/0/0 | |
| 8 | ipv6 address fe80::1 link-local | Same keyword as IOS. |
| 9 | ipv6 address 2001:db8:acad:10::1/64 |
Wrong
| 1 | interface GigabitEthernet0/0 | |
| 2 | ipv6 address FEC0:0:0:10::1/64 | Site-local fec0::/10, deprecated by RFC 3879 in 2004: current stacks treat it as an ordinary global address. For private addressing use a ULA from fd00::/8. |
| 3 | ipv6 address FD00::1/64 | A ULA with a Global ID of 0: legal syntax, but every network that does this uses the same prefix, and they collide at the first merger or VPN. RFC 4193 wants a random 40-bit Global ID, as in fd12:3456:789a::/48. |
| 4 | ! ping FF02::1 from Host B to find the Sales hosts | Link scope: R1 never forwards ff02::/16 off its link. There is no "all nodes of the site" group; reach hosts by their global addresses. |
The outputs are typical for IOS-XE and Linux; details may vary between versions.
12.4Remember
show ipv6 interface; Linux in ip -6 maddr, Windows in netsh interface ipv6 show joins. Cisco IOS builds its link-local addresses with EUI-64; Windows uses random interface IDs by default (§14).show ipv6 interface briefshow ipv6 interface GigabitEthernet0/0show ipv6 routeshow ipv6 neighbors12.5Check yourself: exam-style questions
Host A has the global address 2001:. Which solicited-node multicast group does it join?
- Aff02::1:ffa1:1b01
- Bff02::1:fea1:1b01
- Cff05::1:ffa1:1b01
- Dff02::1:ff00:1b01
Show answer
What does IPv6 use instead of the IPv4 broadcast?
- AAnycast to the all-routers address ff02::2 on the link
- BMulticast, for example ff02::1 for all nodes on the link
- CUnicast copies sent to every address in the /64 prefix
- DA broadcast to ffff:
ffff: ffff: ffff: ffff: ffff: ffff: ffff
Show answer
Which prefix follows RFC 4193 for a company's unique local addresses?
- Afe80:3456:789a::/48
- Bfd12:3456:789a::/48
- Cfec0:3456:789a::/48
- Dfc12:3456:789a::/48
Show answer
Which of these addresses can be routed on the Internet?
- A2001:db8:acad::1
- B2606:4700::1111
- Cfd00:1::1
- Dfe80::2606:4700
Show answer
An application on Host A sends a packet to Host B (2001:db8:acad:20::/64, behind R1) with the link-local source fe80::250:56ff:fea1:1b01. What does R1 do?
- ADrops it, because a link-local source cannot leave its link; it may return ICMPv6 type 1, code 2
- BForwards it after replacing the source with its own global address on Gi0/1, the way NAT would
- CDrops it silently, because any source in fe80::/10 is treated as a multicast group address
- DForwards it, because only the destination address decides whether a packet is routed off the link
Show answer
OSPFv3 runs on R1's Gi0/0, where R1 is a DROther. From which source and to which destination does it send its Hellos?
- AFrom its global address to ff05::5
- BFrom its global address to ff02::5
- CFrom its link-local address to ff02::5
- DFrom its link-local address to ff02::6
Show answer
An IPv6-only host receives 64:ff9b::c000:221 from DNS64. Which IPv4 address will the NAT64 gateway contact?
- A192.0.0.221
- B12.0.2.33
- C192.0.2.33
- D192.0.2.21
Show answer
R1's Gi0/0 has FE80::1, 2001:DB8:ACAD:10::1/64 and FD12:3456:789A:10::1/64, with ipv6 unicast-routing and OSPFv3 (R1 is a DROther). Which joined-group list does show ipv6 interface show?
- AFF02::1, FF02::2, FF02::5 and FF02::1:FF00:1
- BFF02::1, FF02::5 and FF02::1:FF00:1, without FF02::2 until R1 is DR
- CFF02::1, FF02::2, FF02::5, FF02::6 and FF02::1:FF00:1
- DFF02::1, FF02::2, FF02::5 and three solicited-node groups, one per address
Show answer
IPv6 subnetting: /48, /56, /64, /127 and nibble boundaries
TL;DRAn IPv6 global address is a global routing prefix (the /48 a site receives), a 16-bit subnet ID the site chooses, and a 64-bit interface ID. Every LAN is a /64, point-to-point links are /127 and loopbacks /128, so a /48 gives 65,536 LANs and a /56 gives 256. You count subnets with 2^(new − old) exactly as in IPv4, but the goal is the opposite of VLSM: plan on nibble boundaries (/52, /56, /60) and let the hex digits carry meaning (building, VLAN), because readability matters and addresses do not run out.
- Global routing prefix
- The part assigned from outside: the ISP holds 2001:db8::/32, the site receives 2001:db8:acad::/48 and is one of the 65,536 /48s in it.
- Subnet ID
- The bits between the site prefix and the /64: 16 bits in a /48 (65,536 subnets), 8 bits in a /56 (256). Sales uses 0010, i.e. 2001:db8:acad:10::/64.
- Interface ID
- The last 64 bits, chosen by the host (EUI-64, random or static, §14). Fixed at 64 on every LAN, so SLAAC works.
- Nibble boundary
- A prefix length that is a multiple of 4 (/48, /52, /56, /60, /64): it ends between two hex digits, so the subnet can be read straight from the text.
- /127 and /128
- A /127 holds exactly two addresses, the two ends of a router link (RFC 6164); a /128 is a single address, for a loopback.
- 2^(new − old)
- How many subnets a prefix gives: /48 → /64 = 2^16 = 65,536, /48 → /52 = 16, /56 → /64 = 256.
13.1The step-by-step animation
- An IPv6 global address has three parts. The RIR gave the ISP 2001:db8::/32; the ISP gives the site 2001:db8:acad::/48, its global routing prefix. The site owns the next 16 bits, the subnet ID, and the last 64 bits are each host's interface ID. Every hex digit is one nibble (4 bits), so /32, /48 and /64 end exactly between digits: after the 8th, the 12th and the 16th.The plan: ISP 2001:db8::/32 · site 2001:db8:acad::/48 · global routing prefix · subnet ID 16 bits → 65,536 /64s · interface ID 64 bits
- The site cuts its /48 by choosing the subnet ID, and nothing stops it from making the ID mean something. Sales is VLAN 10, so its subnet ID is written 10: 2001:db8:acad:10::/64. Careful: that is hexadecimal 0x0010, subnet number 16. Engineering, :20:, is subnet 32 and Management, :99:, subnet 153. The digits read like the VLAN; the arithmetic stays in hex.The plan: Sales 2001:db8:acad:10::/64 · subnet 0x10 = 16 · Eng 2001:db8:acad:20::/64 · subnet 32 · Mgmt 2001:db8:acad:99::/64 · subnet 153
- Two more buildings join, so the plan needs one more level. Spend the first hex digit of the subnet ID on the building: each building gets a /52, 16 of them in the /48, and each /52 holds 2^(64 − 52) = 4,096 /64s. HQ is building 0, so its LANs keep their addresses (:10: is really :0010:); building 1 starts at 2001:db8:acad:1000::/52 and its VLAN 10 is 2001:db8:acad:1010::/64. Digit f is kept for infrastructure: links and loopbacks.The plan: building first digit of the subnet ID → /52 · per building 4,096 /64s · bldg 1 · VLAN 10 2001:db8:acad:1010::/64
- Wrong: "we have only 4 buildings, so a /50 each" (2 bits, 4 blocks). The routers do not care, but people do: a /50 boundary cuts a hex digit in two. The blocks are 2001:db8:acad::/50, :4000::/50, :8000::/50 and :c000::/50, and is 2001:db8:acad:5a10:: in building 1? Only the binary of 5 (0101) tells you. Prefix-lists, ACLs and log reading all turn into binary. Fix: stay on nibble boundaries, /48, /52, /56, /60, /64.The plan: /50 the boundary falls inside a hex digit · :5a10: → building? 5 = 0101 → 01 → building 1 · readable /48 · /52 · /56 · /60 · /64
- Infrastructure lives in digit f. The R1–R2 link is a /127 (RFC 6164): exactly two addresses, 2001:db8:acad:ff00:: for R1 and 2001:db8:acad:ff00::1 for R2, and no room for a scan to fill the neighbor cache, which a /64 on a two-router link invites. RFC 6164 also has the routers disable the Subnet-Router anycast on a /127. The loopback is a /128, a single address: 2001:db8:acad:ffff::1. Most operators still reserve a whole /64 per link, so a later change needs no renumbering.The plan: R1–R2 2001:db8:acad:ff00::/127 · 2 addresses · R1 · R2 ff00:: · ff00::1 · Lo0 2001:db8:acad:ffff::1/128
- The counting rule is the same as in IPv4, 2^(new − old): /32 → /48 gives 65,536 sites, /48 → /52 gives 16 buildings, /52 → /64 gives 4,096 LANs, /56 → /64 gives 256. What changes is the goal. IPv4 VLSM (§8) sizes every subnet to its hosts to save addresses; in IPv6 every LAN is a /64 whether it has 5 hosts or 5,000, and the plan is about readability and summarization: one /48 per site, one /52 per building, one route each. R1 sends the ISP a single route, 2001:db8:acad::/48.The plan: rule 2^(new − old) subnets · /48 → /64 65,536 · /56 → /64 256 · every LAN /64
13.2Simulator: the IPv6 subnetter
Subnets are counted from 0. Type the number in decimal (16) or in hex with 0x (0x10): the subnet ID is hexadecimal, so 2001:db8:acad:10::/64 is subnet 0x10 = 16 of the /48.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
2001:db8:acad::/48 → /64: 65,536 subnets · prefix (cyan), subnet ID (violet), the rest (green)
| # | Subnet | First address | Last address |
|---|---|---|---|
| 0 | 2001:db8:acad::/64 | 2001:db8:acad:: | 2001:db8:acad:0:ffff:ffff:ffff:ffff |
| … | |||
| 15 | 2001:db8:acad:f::/64 | 2001:db8:acad:f:: | 2001:db8:acad:f:ffff:ffff:ffff:ffff |
| 16 ◀ | 2001:db8:acad:10::/64 | 2001:db8:acad:10:: | 2001:db8:acad:10:ffff:ffff:ffff:ffff |
| 17 | 2001:db8:acad:11::/64 | 2001:db8:acad:11:: | 2001:db8:acad:11:ffff:ffff:ffff:ffff |
| … | |||
| 65,535 | 2001:db8:acad:ffff::/64 | 2001:db8:acad:ffff:: | 2001:db8:acad:ffff:ffff:ffff:ffff:ffff |
- /48 → /64: 16 bits of subnet ID, so 2^16 = 65,536 subnets of 2^64 addresses each, each one a single /64.
- Subnet 16 (0x10) starts 16 × 2^64 addresses after the prefix: 2001:db8:acad:10::/64, from 2001:db8:acad:10:: to 2001:db8:acad:10:ffff:ffff:ffff:ffff.
- /48 and /64 are both nibble boundaries: the subnet ID is exactly hex digits 13–16 of the address, readable straight from the text.
- A /64: the size of every LAN, so SLAAC can build 64-bit interface IDs (§14).
13.3The configuration, line by line
R1 · IOS-XE
| 1 | ipv6 unicast-routing | R1 forwards IPv6 and sends Router Advertisements (§15). |
| 2 | interface GigabitEthernet0/0 | Sales, VLAN 10. |
| 3 | ipv6 address 2001:DB8:ACAD:10::1/64 | Subnet ID 0010 (hex) = subnet 16 of the /48. Always a /64 on a LAN: SLAAC needs a 64-bit interface ID. |
| 4 | interface GigabitEthernet0/1 | Engineering, VLAN 20. |
| 5 | ipv6 address 2001:DB8:ACAD:20::1/64 | Subnet 0x20 = 32. |
| 6 | interface GigabitEthernet0/3 | Management, VLAN 99. |
| 7 | ipv6 address 2001:DB8:ACAD:99::1/64 | Subnet 0x99 = 153. |
| 8 | interface GigabitEthernet0/2 | The link to R2, in the infrastructure digit f. |
| 9 | ipv6 address 2001:DB8:ACAD:FF00::/127 | RFC 6164: R1 takes ff00::, R2 ff00::1. The /64 2001:DB8:ACAD:FF00::/64 stays reserved for this link. RFC 6164 says not to use the all-zero interface ID (ff00::) when several /127s are cut from one shared /64, because it is that /64's Subnet-Router anycast address; with a /64 kept per link, it is safe. |
| 10 | interface Loopback0 | |
| 11 | ipv6 address 2001:DB8:ACAD:FFFF::1/128 | A /128: one address, the router's stable identity (router ID, management, iBGP). |
| 12 | ! | |
| 13 | ipv6 route 2001:DB8:ACAD::/48 Null0 | The site aggregate: advertised to the ISP as one route, and traffic for unused subnet IDs is discarded instead of following the default route back out. |
| 14 | ipv6 prefix-list BLDG-1 seq 5 permit 2001:DB8:ACAD:1000::/52 le 64 | Building 1 and every /64 inside it, in one readable line: the building is the first digit of the subnet ID. |
Wrong
| 1 | ipv6 prefix-list BLDG-1 seq 5 permit 2001:DB8:ACAD:4000::/50 le 64 | A /50 per building: building 1 is :4000: to :7FFF:. Valid, but whether :5A10: belongs to it takes binary. |
| 2 | interface GigabitEthernet0/0 | |
| 3 | ipv6 address 2001:DB8:ACAD:A::1/64 | VLAN 10 converted to hex (0xA): valid, but the next engineer reads "A" and looks for VLAN 10 elsewhere. Pick one convention: digits that read like the VLAN. |
| 4 | ipv6 address 2001:DB8:ACAD:10::1/80 | A /80 "to save addresses": the RA carries it, but hosts build SLAAC addresses only from a /64, so they keep only their link-local addresses (§15). |
| 5 | interface GigabitEthernet0/2 | |
| 6 | ipv6 address 2001:DB8:ACAD:FF00::1/64 | A /64 on a two-router link: it works, but 2^64 unused addresses invite a scan that fills the neighbor cache. RFC 6164: /127. |
show ipv6 route
| 1 | R1#show ipv6 route | |
| 2 | IPv6 Routing Table - default - 11 entries | 4 C + 4 L + 1 LC + the static aggregate + L FF00::/8. |
| 3 | Codes: C - Connected, L - Local, S - Static, U - Per-user Static route | |
| 4 | ! (rest of the legend omitted) | |
| 5 | S 2001:DB8:ACAD::/48 [1/0] | The aggregate toward Null0: the only route the ISP needs. |
| 6 | via Null0, directly connected | |
| 7 | C 2001:DB8:ACAD:10::/64 [0/0] | Each LAN is a /64, whatever its number of hosts. |
| 8 | via GigabitEthernet0/0, directly connected | |
| 9 | L 2001:DB8:ACAD:10::1/128 [0/0] | R1's own address, as a /128 (§15). |
| 10 | via GigabitEthernet0/0, receive | |
| 11 | C 2001:DB8:ACAD:20::/64 [0/0] | |
| 12 | via GigabitEthernet0/1, directly connected | |
| 13 | C 2001:DB8:ACAD:99::/64 [0/0] | |
| 14 | via GigabitEthernet0/3, directly connected | |
| 15 | C 2001:DB8:ACAD:FF00::/127 [0/0] | The link: a /127, two addresses. |
| 16 | via GigabitEthernet0/2, directly connected | |
| 17 | LC 2001:DB8:ACAD:FFFF::1/128 [0/0] | A loopback /128 is local and connected at once. |
| 18 | via Loopback0, receive | |
| 19 | ! (the other L /128 routes and L FF00::/8 omitted) |
The outputs are typical for IOS-XE; details may vary between versions.
13.4Remember
ipv6 address 2001:DB8:ACAD:10::1/64); IOS displays uppercase, while the RFC 5952 canonical text form is lowercase (§11). Current IOS-XE, NX-OS and IOS-XR accept /127 on links. Sites often receive their prefix by DHCPv6 prefix delegation (RFC 8415); an ISP that hands a home only a /60 leaves it 16 LANs, a /64 only one.show ipv6 interface briefshow ipv6 route connectedshow ipv6 route 2001:DB8:ACAD::/48 longer-prefixes13.5Check yourself: exam-style questions
Your company receives 2001:db8:acad::/48 and gives every LAN a /64. How many LANs can the site number?
- A4,096
- B65,534
- C256
- D65,536
Show answer
Subnets of 2001:db8:acad::/48 are numbered from 0 using the 16-bit subnet ID. Which /64 is subnet number 26?
- A2001:db8:acad:26::/64
- B2001:db8:acad:1a::/64
- C2001:db8:acad:1a00::/64
- D2001:db8:acad:0:26::/64
Show answer
R1 and R2 are connected by a dedicated router-to-router link. Which prefix gives the link exactly two addresses, as RFC 6164 recommends?
- A2001:db8:acad:ff00::/64
- B2001:db8:acad:ff00::/127
- C2001:db8:acad:ff00::/126
- D2001:db8:acad:ff00::/128
Show answer
An ISP delegates 2001:db8:acad:ab00::/56 to a home router, which numbers one /64 per LAN. How many LANs can the home have?
- A65,536
- B254
- C8
- D256
Show answer
The site 2001:db8:acad::/48 gives each building a /52, and the first hex digit of the subnet ID is the building number. Which prefix-list entry matches building 3 and every /64 inside it?
- Aipv6 prefix-list B3 permit 2001:DB8:ACAD:3000::/52 ge 65
- Bipv6 prefix-list B3 permit 2001:DB8:ACAD:300::/52 le 64
- Cipv6 prefix-list B3 permit 2001:DB8:ACAD:3000::/52 le 64
- Dipv6 prefix-list B3 permit 2001:DB8:ACAD:3::/52 le 64
Show answer
A customer cuts its delegated 2001:db8:acad:ab00::/56 into /62s. Which /62 is subnet number 3, and which /64s does it contain?
- A2001:db8:acad:ab0c::/62: ab0c, ab0d, ab0e and ab0f
- B2001:db8:acad:ab03::/62: ab03, ab04, ab05 and ab06
- C2001:db8:acad:ab08::/62: ab08, ab09, ab0a and ab0b
- D2001:db8:acad:ab30::/62: ab30 to ab3f
Show answer
An inter-router link is numbered 2001:db8:acad:ff00::/64. An attacker sends a fast stream of packets to random addresses in that /64. What is the effect, and what does RFC 6164 recommend?
- AThe router drops them, because a /64 configured on a point-to-point link only accepts its two configured addresses; RFC 6164 makes /64 mandatory
- BNothing, because Ethernet point-to-point links do not use NDP; RFC 6164 only applies to serial links
- CThe router tries to resolve each destination with NDP and fills its neighbor cache with INCOMPLETE entries; RFC 6164 recommends a /127
- DEvery packet is answered as the Subnet-Router anycast address; RFC 6164 recommends a /126 to disable it
Show answer
IPv6 interface IDs: EUI-64, SLAAC, privacy addresses and DHCPv6
TL;DROn a /64, a host builds the last 64 bits of its address itself. Modified EUI-64 derives them from the MAC (split it, insert ff:fe, flip the U/L bit); current Windows and macOS use random or stable opaque IDs plus temporary addresses instead, so the MAC does not follow the device around. SLAAC takes the prefix from the router's RA, Duplicate Address Detection checks that nobody else has the address, and the RA's M and O flags decide what DHCPv6 adds: addresses (stateful) or only options such as DNS (stateless). The default gateway always comes from the RA.
- SLAAC
- Stateless address autoconfiguration (RFC 4862): prefix from the RA (2001:db8:acad:10::/64, A = 1) + an interface ID the host makes itself. No server keeps any state.
- Modified EUI-64
- MAC 0050.56a1.1b01 → split, insert ff:fe, flip bit 0x02 of the first byte → 0250:56ff:fea1:1b01 (RFC 4291 appendix A).
- U/L bit
- Bit 0x02 of the first MAC byte: 0 = universally administered (burned-in), 1 = locally administered. Modified EUI-64 inverts it.
- DAD
- Duplicate Address Detection: an NS from :: to the solicited-node group (ff02::1:ffa1:1b01) before the address is used; an NA in reply means "duplicate".
- M and O flags
- RA flags: M = 1 "get addresses from DHCPv6" (stateful), O = 1 "get other settings, such as DNS, from DHCPv6" (stateless).
- Temporary address
- RFC 8981: a random interface ID used as the source of outgoing connections and replaced regularly, so the host cannot be tracked.
- Stable opaque IID
- RFC 7217: a hash of the prefix, the interface and a secret: the same on this LAN every day, different on every other LAN, with no MAC inside.
14.1The step-by-step animation
- Host A is a VMware virtual machine with the MAC 0050.56a1.1b01: 48 bits, the first 24 the vendor's OUI (00:50:56 is VMware), the last 24 chosen for this NIC. SLAAC needs a 64-bit interface ID, so modified EUI-64 stretches the MAC: split it in the middle and insert ff:fe, 16 bits, giving 0050:56ff:fea1:1b01. One more move is needed before it becomes the interface ID.Host A: MAC 0050.56a1.1b01 · 48 bits · split 00:50:56 | a1:1b:01 · insert ff:fe in the middle → 64 bits
- Step 3: flip the 7th bit of the first byte, the U/L bit (value 0x02). In a MAC, 0 means universally administered, a burned-in vendor address; modified EUI-64 inverts the meaning, so 1 says "globally unique" and hand-written IDs such as ::1 can keep it 0. 0x00 becomes 0x02 and the interface ID is 0250:56ff:fea1:1b01, written 250:56ff:fea1:1b01. With fe80::/64 in front, it is Host A's link-local address, fe80::250:56ff:fea1:1b01.Host A: first byte 0x00 = 0000 0000 → 0000 0010 = 0x02 · interface ID 250:56ff:fea1:1b01 · link-local fe80::250:56ff:fea1:1b01
- With a link-local address Host A can talk. It sends a Router Solicitation to ff02::2, and R1 answers with a Router Advertisement to ff02::1 from fe80::1. The RA carries the prefix 2001:db8:acad:10::/64 with A = 1 (autonomous: build your own address) and L = 1 (on-link), the flags M = 0 (no addresses from DHCPv6) and O = 1 (other settings, such as DNS, from DHCPv6), and a router lifetime of 1800 s: fe80::1 becomes Host A's default gateway.On the wire: RS fe80::250:56ff:fea1:1b01 → ff02::2 · RA fe80::1 → ff02::1 · prefix 2001:db8:acad:10::/64 · A = 1 · L = 1 · flags M = 0 · O = 1 · router lifetime 1800 s
- Host A combines the advertised prefix with its interface ID: 2001:db8:acad:10:250:56ff:fea1:1b01. The address stays tentative until Duplicate Address Detection passes: a Neighbor Solicitation from :: (it may not use the address yet) to the solicited-node group ff02::1:ffa1:1b01, asking "does anyone have this address?". The switch floods the frame (no MLD snooping here), nobody answers within a second, and the address becomes preferred. Its link-local address went through the same check.On the wire: NS src :: (unspecified) · NS dst ff02::1:ffa1:1b01 · target 2001:db8:acad:10:250:56ff:fea1:1b01 · reply none in 1 s → preferred
- O = 1, so Host A asks for the rest with stateless DHCPv6: an Information-Request from its link-local address to ff02::1:2, all DHCPv6 servers and relays (UDP 547). R1's pool replies with the DNS server and the domain name and keeps no record of Host A: the address came from SLAAC. With M = 1 the host would instead run Solicit, Advertise, Request, Reply and lease an address from the pool. Either way, the gateway comes only from the RA.On the wire: Information-Request fe80::250:56ff:fea1:1b01 → ff02::1:2 · Reply DNS 2001:db8:acad:99::53 · sales.example.com · state on R1 none (stateless)
- Wrong: someone clones Host A's VM, MAC included, and boots the copy as Host A2. It builds the same EUI-64 interface ID, so the same link-local address, and runs DAD: this time Host A owns fe80::250:56ff:fea1:1b01 and answers with a Neighbor Advertisement to ff02::1. Host A2 marks the address duplicate (Linux:
dadfailed) and never uses it. RFC 4862 even recommends disabling IPv6 on that interface, because every address built from this MAC would collide too.On the wire: NS (DAD) src :: · target fe80::250:56ff:fea1:1b01 · NA from Host A "this address is mine" → ff02::1 · Host A2 duplicate: not used - The fix is to stop deriving the ID from the MAC. Give the clone a new MAC, or use IDs that do not come from the MAC at all, as Windows and macOS do by default: stable opaque IDs (RFC 7217: a hash of the prefix, the interface and a secret, stable on this LAN, different on every other) or random ones, plus temporary addresses (RFC 8981: random, renewed regularly, used for outgoing connections). The Windows laptop has a random interface ID and a temporary address: neither contains its MAC, so it cannot be followed from network to network.Laptop: address 2001:db8:acad:10:9c41:5e2b:d0f3:7a19 (random ID) · temporary 2001:db8:acad:10:61d8:2fa0:b34c:e605 · MAC in the address no
14.2Simulator: the EUI-64 generator
Any common format works: Cisco 0050.56a1.1b01, colons 00:50:56:a1:1b:01 or Windows 00-50-56-A1-1B-01. The generator splits the MAC, inserts ff:fe and flips the U/L bit, then builds the link-local, the global address and the solicited-node group.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| Step | Value |
|---|---|
| MAC | 00:50:56:a1:1b:01 (0050.56a1.1b01) |
| 1. split + 2. insert ff:fe | 0050:56ff:fea1:1b01 |
| 3. flip U/L (0x02) of the first byte | 0x00 = 00000000 → 00000010 = 0x02 · U/L 0 → 1 |
| Interface ID | 0250:56ff:fea1:1b01 → 250:56ff:fea1:1b01 |
| Link-local | fe80::250:56ff:fea1:1b01 |
| Global (prefix + ID) | 2001:db8:acad:10:250:56ff:fea1:1b01 |
| On IOS (eui-64) | 2001:DB8:ACAD:10:250:56FF:FEA1:1B01 [EUI] |
| Solicited-node group | ff02::1:ffa1:1b01 |
| Its Ethernet MAC | 3333.ffa1.1b01 |
- Split 00:50:56:a1:1b:01 after the third byte (the OUI) and insert ff:fe: 0050:56ff:fea1:1b01.
- Flip the U/L bit, 0x02 of the first byte: 0x00 = 00000000 → 00000010 = 0x02. The MAC is burned-in (U/L = 0), so the flip sets the bit: in modified EUI-64, 1 means "globally unique".
- Interface ID 0250:56ff:fea1:1b01, written 250:56ff:fea1:1b01; link-local fe80::250:56ff:fea1:1b01.
- With 2001:db8:acad:10::/64 (Documentation): 2001:db8:acad:10:250:56ff:fea1:1b01. On a Cisco router (
ipv6 address … eui-64),show ipv6 interfacewould list it as 2001:DB8:ACAD:10:250:56FF:FEA1:1B01 [EUI]. - Solicited-node group ff02::1:ff + the last 24 bits = ff02::1:ffa1:1b01 (Ethernet 3333.ffa1.1b01): DAD and neighbor resolution for all of this interface's EUI-64 addresses use it.
- Every network this host joins sees the same 250:56ff:fea1:1b01, with the MAC inside it: that is why Windows and macOS use random or stable opaque IDs (RFC 7217) and temporary addresses (RFC 8981) instead.
14.3The configuration, line by line
R1 · IOS-XE
| 1 | ipv6 unicast-routing | Without it R1 sends no RA, and the hosts never hear of the prefix (§15). |
| 2 | interface GigabitEthernet0/1 | Engineering LAN: R1 builds its own address with EUI-64. |
| 3 | ipv6 address 2001:DB8:ACAD:20::/64 eui-64 | Prefix from the command, interface ID from Gi0/1's MAC 00a1.b2c3.d401: 2001:DB8:ACAD:20:2A1:B2FF:FEC3:D401. |
| 4 | interface GigabitEthernet0/0 | Sales LAN: SLAAC for addresses, stateless DHCPv6 for DNS. |
| 5 | ipv6 address FE80::1 link-local | A static, readable gateway; without it IOS would use FE80::2A1:B2FF:FEC3:D400 (EUI-64 of Gi0/0). |
| 6 | ipv6 address 2001:DB8:ACAD:10::1/64 | The prefix the RA advertises, by default with A = 1 and L = 1. |
| 7 | ipv6 nd other-config-flag | O = 1: "ask DHCPv6 for DNS and other options". |
| 8 | ipv6 dhcp server SALES-STATELESS | R1 answers Information-Requests arriving on this interface. |
| 9 | ! ipv6 nd managed-config-flag | M = 1 instead: addresses from stateful DHCPv6 (next tab). |
| 10 | ! | |
| 11 | ipv6 dhcp pool SALES-STATELESS | No address prefix in the pool: nothing per host to remember. |
| 12 | dns-server 2001:DB8:ACAD:99::53 | |
| 13 | domain-name sales.example.com |
Stateful DHCPv6
| 1 | ipv6 dhcp pool SALES-STATEFUL | |
| 2 | address prefix 2001:DB8:ACAD:10::/64 lifetime 172800 86400 | Addresses are leased from the /64: valid 2 days, preferred 1 day. |
| 3 | dns-server 2001:DB8:ACAD:99::53 | |
| 4 | interface GigabitEthernet0/0 | |
| 5 | ipv6 nd managed-config-flag | M = 1: hosts run Solicit, Advertise, Request, Reply. IOS then shows "Hosts use DHCP to obtain routable addresses." |
| 6 | ipv6 nd prefix 2001:DB8:ACAD:10::/64 2592000 604800 no-autoconfig | A = 0: hosts stop building SLAAC addresses, so DHCPv6 is the only source. Without it, every host ends up with both. |
| 7 | ipv6 dhcp server SALES-STATEFUL | |
| 8 | ! or, with a central server: | |
| 9 | ! ipv6 dhcp relay destination 2001:DB8:ACAD:99::547 | The relay forwards the client's messages to the server; the RA (and so the gateway) still comes from R1. |
show ipv6 interface Gi0/1
| 1 | R1#show ipv6 interface GigabitEthernet0/1 | |
| 2 | GigabitEthernet0/1 is up, line protocol is up | |
| 3 | IPv6 is enabled, link-local address is FE80::2A1:B2FF:FEC3:D401 | EUI-64 of 00a1.b2c3.d401: 00 → 02, FFFE in the middle. IOS builds every link-local it is not given this way. |
| 4 | No Virtual link-local address(es): | |
| 5 | Global unicast address(es): | |
| 6 | 2001:DB8:ACAD:20:2A1:B2FF:FEC3:D401, subnet is 2001:DB8:ACAD:20::/64 [EUI] | [EUI] marks an address built with eui-64. |
| 7 | Joined group address(es): | |
| 8 | FF02::1 | |
| 9 | FF02::2 | |
| 10 | FF02::1:FFC3:D401 | One solicited-node group for both addresses: they share the last 24 bits. |
| 11 | MTU is 1500 bytes | |
| 12 | ND DAD is enabled, number of DAD attempts: 1 | One NS per address, then a 1-second wait. |
| 13 | ND reachable time is 30000 milliseconds (using 30000) | |
| 14 | ND router advertisements are sent every 200 seconds | |
| 15 | ND router advertisements live for 1800 seconds | The router lifetime in each RA. |
| 16 | Hosts use stateless autoconfig for addresses. | M = 0. |
Hosts
| 1 | $ sysctl net.ipv6.conf.eth0.addr_gen_mode | Host A, Linux. |
| 2 | net.ipv6.conf.eth0.addr_gen_mode = 0 | 0 = EUI-64, the kernel default: Host A's 250:56ff:fea1:1b01. 2 or 3 = stable privacy (RFC 7217). |
| 3 | $ sysctl net.ipv6.conf.eth0.use_tempaddr | |
| 4 | net.ipv6.conf.eth0.use_tempaddr = 0 | 0 = no temporary addresses; 2 = create them and prefer them as the source (RFC 8981). |
| 5 | $ ip -6 addr show dev eth0 (Host A2, the clone) | |
| 6 | inet6 fe80::250:56ff:fea1:1b01/64 scope link tentative dadfailed | DAD failed: Host A already owns this address, so the clone never uses it. |
| 7 | $ dmesg | grep duplicate | |
| 8 | IPv6: eth0: IPv6 duplicate address fe80::250:56ff:fea1:1b01 used by 00:50:56:a1:1b:01 detected! | The kernel names the MAC that answered: Host A's. |
| 9 | C:\> ipconfig | A Windows laptop on the same LAN, default settings. |
| 10 | IPv6 Address. . . . . . . . . . . : 2001:db8:acad:10:9c41:5e2b:d0f3:7a19 | A random interface ID, not derived from the MAC. |
| 11 | Temporary IPv6 Address. . . . . . : 2001:db8:acad:10:61d8:2fa0:b34c:e605 | RFC 8981: the source of outgoing connections, replaced regularly. |
| 12 | Default Gateway . . . . . . . . . : fe80::1%12 | From the RA; %12 is the interface index (the zone). |
| 13 | C:\> netsh interface ipv6 set global randomizeidentifiers=disabled | Would switch the main address to EUI-64; netsh interface ipv6 set privacy state=disabled stops temporary addresses. |
The outputs are typical for IOS-XE, Linux and Windows; details may vary between versions.
14.4Remember
ipv6 nd prefix … no-autoconfig). And DHCPv6 never gives a gateway or a prefix length: without an RA, a DHCPv6 address alone does not get a host off its LAN.addr_gen_mode 0), while NetworkManager-based distributions usually generate stable-privacy (RFC 7217) IDs; Cisco IOS uses EUI-64 for its link-local addresses and for eui-64 and autoconfig. RFC 8064 recommends RFC 7217 over EUI-64; RFC 8981 (2021) replaced RFC 4941.show ipv6 interface GigabitEthernet0/1show ipv6 dhcp poolshow ipv6 dhcp bindingshow ipv6 routersdebug ipv6 nd14.5Check yourself: exam-style questions
Host B has the MAC 0050.56a1.2c02 and builds its address with modified EUI-64 from the RA prefix 2001:db8:acad:20::/64. Which address does it get?
- A2001:
db8: acad: 20: 250: 56fe: ffa1: 2c02 - B2001:
db8: acad: 20: 250: 56ff: fea1: 2c02 - C2001:
db8: acad: 20: 250: 56a1: fffe: 2c02 - D2001:
db8: acad: 20: 50: 56ff: fea1: 2c02
Show answer
A container has the locally administered MAC 02:42:ac:11:00:02. What interface ID does modified EUI-64 produce?
- A0642:acff:fe11:0002
- B0042:acff:fe11:0002
- C0242:acff:fe11:0002
- D0042:acfe:ff11:0002
Show answer
You want the Sales hosts to take their IPv6 addresses only from a stateful DHCPv6 server, never from SLAAC. What must R1's Router Advertisements on that LAN carry?
- ANothing: disable RAs, DHCPv6 gives the address and the gateway
- BM = 1 only; the prefix flags do not matter
- CM = 1, and the /64 prefix with A = 0 (no-autoconfig)
- DO = 1, and the /64 prefix with A = 1
Show answer
Before using 2001:
- ASource ::, destination ff02::1:ffa1:1b01
- BSource fe80::250:56ff:fea1:1b01, destination ff02::1
- CSource 2001:
db8: acad: 10: 250: 56ff: fea1: 1b01, destination ff02::1:ffa1:1b01 - DSource ::, destination ff02::2
Show answer
R1's Gi0/0 has ipv6 address 2001:DB8:ACAD:10::1/64, ipv6 nd other-config-flag and ipv6 dhcp server with a pool that holds only dns-server and domain-name. What does a host on that LAN end up with?
- AOnly the DNS server: O = 1 turns SLAAC off
- BA DHCPv6 address and the DNS server, both from the pool
- CA SLAAC address only: the O flag is ignored unless M is also set
- DA SLAAC address from the RA, plus the DNS server from DHCPv6
Show answer
Out of the box, a current Windows laptop and a Cisco IOS router join the same /64. How do they build their interface IDs?
- AWindows: a random ID plus a temporary address; IOS: EUI-64
- BBoth: only RFC 8981 temporary addresses, renewed every day
- CBoth: modified EUI-64 from the MAC, as in RFC 4291
- DWindows: EUI-64 from the MAC; IOS: RFC 7217 stable IDs
Show answer
A VMware VM using EUI-64 is cloned with its MAC unchanged, and the copy boots on the same LAN while the original is running. What happens to the copy's link-local address?
- AR1 sees the conflict and gives the copy a new interface ID in its next RA
- BNothing: DAD checks only global addresses, so the copy uses its link-local
- CThe original answers its DAD probe with an NA, so the copy marks the address duplicate
- DBoth VMs use the address, and the switch sends each frame to whichever port sent last
Show answer
Which property explains why RFC 8064 recommends RFC 7217 stable opaque interface IDs as the default instead of modified EUI-64?
- AThe ID is assigned by DHCPv6, so the network keeps a record of every host
- BIt is stable on one network, different on every other one, and has no MAC inside
- CThe ID keeps the vendor's OUI, so devices remain identifiable for troubleshooting
- DThe ID is renewed every day, so connections cannot be correlated even on one network
Show answer
IPv6 on Cisco devices: dual stack, link-local and verification
TL;DRDual stack runs IPv4 and IPv6 side by side on the same interfaces. On IOS one global command, ipv6 unicast-routing, makes the router forward IPv6 and send the Router Advertisements hosts need; each interface then gets a global address (ipv6 address …/64) and usually a static link-local such as fe80::1, which becomes every host's gateway. Verify in order: show ipv6 interface brief, show ipv6 interface (FF02::2 joined, RAs sent), show ipv6 route (C and L /128), show ipv6 neighbors, ping.
- Dual stack
- IPv4 and IPv6 on the same interface, each with its own addresses, routing table and neighbor table (RFC 4213). Gi0/0 has 192.168.10.1/25 and 2001:db8:acad:10::1/64.
- ipv6 unicast-routing
- The global IOS command that turns on IPv6 forwarding, membership of FF02::2 and Router Advertisements. Without it the router is just an IPv6 host.
- Static link-local
ipv6 address fe80::1 link-local: replaces the EUI-64 link-local; the hosts see it as their gateway. The same fe80::1 on every LAN interface is legal.- C and L routes
- For each address IOS installs a C route for the /64 and an L /128 route for the address itself (LC for a loopback).
- Neighbor table
- The IPv6 equivalent of the ARP table, filled by NS/NA:
show ipv6 neighbors, with states such as REACH and STALE. - ipv6 enable
- Turns IPv6 on with a link-local address only: enough for OSPFv3 or EIGRP neighbors, no global address.
15.1The step-by-step animation
- R1 already routes IPv4 for Sales and Engineering. Dual stack means adding IPv6 next to it, on the same interfaces. Right now Gi0/0 has no IPv6, so Host A only has the link-local address it always makes for itself, fe80::250:56ff:fea1:1b01; its Router Solicitation to ff02::2 finds no router.Host A: IPv4 192.168.10.37/25 · gateway .1 · IPv6 fe80::250:56ff:fea1:1b01 only · RS → ff02::2 no answer
ipv6 unicast-routingturns R1 into an IPv6 router: it forwards IPv6, joins ff02::2 (all routers) and sends Router Advertisements. Then each interface gets its addresses:ipv6 address fe80::1 link-localreplaces the EUI-64 link-local with one that is easy to read, andipv6 address 2001:db8:acad:10::1/64adds the global one. IPv4 stays as it was. Before using its new addresses, R1 runs DAD on them like any host.R1: global ipv6 unicast-routing · Gi0/0 fe80::1 · 2001:db8:acad:10::1/64 · Gi0/1 fe80::1 · 2001:db8:acad:20::1/64 · IPv4 unchanged- From now on R1 sends a Router Advertisement out each interface every 200 seconds, and at once in answer to an RS: from fe80::1, with 2001:db8:acad:10::/64 on Gi0/0 and 2001:db8:acad:20::/64 on Gi0/1, A = 1. Host A builds 2001:db8:acad:10:250:56ff:fea1:1b01 and Host B 2001:db8:acad:20:250:56ff:fea1:2c02 (EUI-64, §14), and both take fe80::1 as their gateway. The same link-local on two interfaces is legal: each is valid only on its own link.On the wire: RA Gi0/0 2001:db8:acad:10::/64 · A = 1 · RA Gi0/1 2001:db8:acad:20::/64 · A = 1 · gateway fe80::1 on both LANs
- Verify on R1.
show ipv6 interface brieflists every interface with its status, its link-local and its global addresses.show ipv6 routeholds, for each LAN, a C route for the /64 and an L /128 route for R1's own address, the same pair IPv4 has shown since IOS 15 (§10), plus L FF00::/8.show ipv6 interface Gi0/0adds the joined groups: FF02::1, FF02::2 (because of unicast-routing) and FF02::1:FF00:1.R1: interface brief [up/up] · FE80::1 · 2001:DB8:ACAD:10::1 · route C …:10::/64 · L …:10::1/128 · groups FF02::1 · FF02::2 · FF02::1:FF00:1 - Host A pings 2001:db8:acad:20:250:56ff:fea1:2c02. The destination is off-link, so the packet goes to fe80::1. R1 routes it out Gi0/1, but first needs Host B's MAC: instead of ARP it sends a Neighbor Solicitation to B's solicited-node group ff02::1:ffa1:2c02, and Host B answers with a Neighbor Advertisement. The echo is delivered and the reply comes back the same way: IPv6 end to end, IPv4 untouched.On the wire: src 2001:db8:acad:10:250:56ff:fea1:1b01 · dst 2001:db8:acad:20:250:56ff:fea1:2c02 · NS R1 → ff02::1:ffa1:2c02 · hop limit 64 → 63 at R1
- Wrong: during a cleanup someone removes
ipv6 unicast-routing. Nothing looks broken: the interfaces keep their addresses and stay up/up inshow ipv6 interface brief. But R1 is now an IPv6 host: it stops forwarding, so Host A's next ping dies at R1; it leaves FF02::2 and stops sending RAs, so a host that boots now gets only its link-local address, and the hosts already up lose their gateway, at the latest when its 1800 s router lifetime runs out.R1: ipv6 unicast-routing removed · forwarding off: the ping dies at R1 · RAs none: new hosts get link-local only - Fix: put
ipv6 unicast-routingback, and check it first whenever hosts have only fe80:: addresses (§16). R1 rejoins FF02::2, sends RAs again and forwards: the ping works. The verification order for any IPv6 interface:show ipv6 interface brief(addresses, up/up),show ipv6 interface(FF02::2 joined, RAs sent),show ipv6 route(C and L),show ipv6 neighbors, then ping.R1: ipv6 unicast-routing restored · FF02::2 joined again · ping works
15.2Simulator: will the hosts get IPv6?
Change one thing at a time and watch what Host A (MAC 0050.56a1.1b01, SLAAC with EUI-64) ends up with: a global address, a gateway, a DNS server, or only its link-local address.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| R1 · GigabitEthernet0/0 | |
|---|---|
| IPv6 on Gi0/0 | FE80::1 + 2001:DB8:ACAD:10::1/64 |
| Routes IPv6 · member of FF02::2 | yes |
| Router Advertisements | every 200 s and in answer to an RS |
| RA content | router lifetime 1800 s · M = 0 · O = 0 · 2001:db8:acad:10::/64, A = 1 |
| DHCPv6 on R1 | none |
| Host A gets | |
| Link-local | fe80::250:56ff:fea1:1b01 (always, self-made) |
| SLAAC global | 2001:db8:acad:10:250:56ff:fea1:1b01/64 |
| DHCPv6 global | — |
| Default gateway | fe80::1 (from the RA) |
| IPv6 DNS server | — (IPv4 DNS still works: dual stack) |
| Reaches other subnets over IPv6 | yes |
- SLAAC: Host A combines the advertised /64 with its interface ID into 2001:db8:acad:10:250:56ff:fea1:1b01 (EUI-64, §14), runs DAD and uses fe80::1 as its gateway.
- No DNS server over IPv6 (no O flag, no RDNSS option in the RA): with dual stack the hosts keep asking the IPv4 DNS server, which also returns AAAA records.
15.3The configuration, line by line
R1 · IOS-XE
| 1 | ipv6 unicast-routing | Global: R1 forwards IPv6, joins FF02::2 and sends RAs. Without it the interfaces still get addresses, but R1 behaves as a host. |
| 2 | ! | |
| 3 | interface GigabitEthernet0/0 | Sales, VLAN 10: both protocols on one interface (dual stack). |
| 4 | ip address 192.168.10.1 255.255.255.128 | IPv4 stays as it was (§10). |
| 5 | ipv6 address FE80::1 link-local | A static link-local: the gateway the hosts see, easy to read and the same on every LAN. |
| 6 | ipv6 address 2001:DB8:ACAD:10::1/64 | The global address. The /64 goes into the RA with A = 1 and becomes a C route; the address becomes an L /128. |
| 7 | no shutdown | |
| 8 | interface GigabitEthernet0/1 | Engineering, VLAN 20. |
| 9 | ip address 192.168.10.129 255.255.255.192 | |
| 10 | ipv6 address FE80::1 link-local | FE80::1 again: legal, because a link-local address only has to be unique on its own link. |
| 11 | ipv6 address 2001:DB8:ACAD:20::1/64 | |
| 12 | interface Loopback0 | |
| 13 | ipv6 address 2001:DB8:ACAD:FFFF::1/128 | A /128 (§13). |
Address forms
| 1 | ! the ways to give an IOS interface IPv6 | |
| 2 | ipv6 address 2001:DB8:ACAD:10::1/64 | 1. A static address and prefix length: the usual form on routers. |
| 3 | ipv6 address 2001:DB8:ACAD:20::/64 eui-64 | 2. A static prefix, the interface ID from the MAC (§14). |
| 4 | ipv6 address FE80::1 link-local | 3. A static link-local; replaces the automatic EUI-64 one. |
| 5 | ipv6 address autoconfig default | 4. SLAAC, like a host: the prefix from a received RA (e.g. on an ISP-facing interface); default adds a default route through the RA's sender. |
| 6 | ipv6 address dhcp | 5. A stateful DHCPv6 client. |
| 7 | ipv6 enable | 6. Link-local only (EUI-64): enough for OSPFv3 or EIGRP adjacencies. |
| 8 | ! forms 1, 2, 4 and 5 also create the EUI-64 link-local, unless one is configured |
show ipv6 interface brief · route
| 1 | R1#show ipv6 interface brief | |
| 2 | GigabitEthernet0/0 [up/up] | Status, then every address of the interface, link-local first. |
| 3 | FE80::1 | |
| 4 | 2001:DB8:ACAD:10::1 | |
| 5 | GigabitEthernet0/1 [up/up] | |
| 6 | FE80::1 | The same link-local on another link: no conflict. |
| 7 | 2001:DB8:ACAD:20::1 | |
| 8 | Loopback0 [up/up] | |
| 9 | FE80::2A1:B2FF:FEC3:D400 | A loopback has no MAC: IOS borrows one from an Ethernet interface for its EUI-64 link-local. |
| 10 | 2001:DB8:ACAD:FFFF::1 | |
| 11 | R1#show ipv6 route | |
| 12 | IPv6 Routing Table - default - 6 entries | |
| 13 | Codes: C - Connected, L - Local, S - Static, U - Per-user Static route | |
| 14 | ! (rest of the legend omitted) | |
| 15 | C 2001:DB8:ACAD:10::/64 [0/0] | C: the /64 of Gi0/0, directly connected. |
| 16 | via GigabitEthernet0/0, directly connected | |
| 17 | L 2001:DB8:ACAD:10::1/128 [0/0] | L: R1's own address as a /128; "receive" = the packet is for R1 itself. |
| 18 | via GigabitEthernet0/0, receive | |
| 19 | C 2001:DB8:ACAD:20::/64 [0/0] | |
| 20 | via GigabitEthernet0/1, directly connected | |
| 21 | L 2001:DB8:ACAD:20::1/128 [0/0] | |
| 22 | via GigabitEthernet0/1, receive | |
| 23 | LC 2001:DB8:ACAD:FFFF::1/128 [0/0] | LC: a loopback /128 is local and connected at once. |
| 24 | via Loopback0, receive | |
| 25 | L FF00::/8 [0/0] | Multicast is received, never routed by default: always in the table. |
| 26 | via Null0, receive |
show ipv6 interface · neighbors
| 1 | R1#show ipv6 interface GigabitEthernet0/0 | |
| 2 | GigabitEthernet0/0 is up, line protocol is up | |
| 3 | IPv6 is enabled, link-local address is FE80::1 | The static link-local. |
| 4 | No Virtual link-local address(es): | |
| 5 | Global unicast address(es): | |
| 6 | 2001:DB8:ACAD:10::1, subnet is 2001:DB8:ACAD:10::/64 | |
| 7 | Joined group address(es): | |
| 8 | FF02::1 | All nodes. |
| 9 | FF02::2 | All routers: present only with ipv6 unicast-routing. Missing = R1 is not routing IPv6. |
| 10 | FF02::1:FF00:1 | The solicited-node group of both FE80::1 and 2001:DB8:ACAD:10::1 (same last 24 bits). |
| 11 | MTU is 1500 bytes | |
| 12 | ND DAD is enabled, number of DAD attempts: 1 | |
| 13 | ND router advertisements are sent every 200 seconds | This part changes when RAs are suppressed or routing is off. |
| 14 | ND router advertisements live for 1800 seconds | The router lifetime the hosts receive. |
| 15 | Hosts use stateless autoconfig for addresses. | |
| 16 | R1#show ipv6 neighbors | |
| 17 | IPv6 Address Age Link-layer Addr State Interface | |
| 18 | 2001:DB8:ACAD:20:250:56FF:FEA1:2C02 0 0050.56a1.2c02 REACH Gi0/1 | Host B, resolved with NS / NA just now: the IPv6 ARP table. |
| 19 | FE80::250:56FF:FEA1:1B01 1 0050.56a1.1b01 STALE Gi0/0 | Host A by its link-local, learned from its RS. STALE is normal: re-checked on the next use. |
| 20 | 2001:DB8:ACAD:10:250:56FF:FEA1:1B01 0 0050.56a1.1b01 REACH Gi0/0 |
NX-OS · IOS-XR
| 1 | ! NX-OS: no ipv6 unicast-routing command | |
| 2 | interface Ethernet1/1 | |
| 3 | no switchport | A routed port. |
| 4 | ipv6 address 2001:db8:acad:10::1/64 | |
| 5 | ipv6 link-local fe80::1 | NX-OS has its own keyword for a static link-local. |
| 6 | ! IOS-XR: no ipv6 unicast-routing command either | |
| 7 | interface GigabitEthernet0/0/0/0 | |
| 8 | ipv6 address fe80::1 link-local | The same keyword as IOS. |
| 9 | ipv6 address 2001:db8:acad:10::1/64 | |
| 10 | ! on both: show ipv6 interface brief, show ipv6 route, show ipv6 neighbors | The same verification commands; NX-OS shows them per VRF. |
Wrong
| 1 | no ipv6 unicast-routing | The interfaces keep their addresses and stay up/up, but R1 stops forwarding IPv6, leaves FF02::2 and stops sending RAs. |
| 2 | interface GigabitEthernet0/0 | |
| 3 | ipv6 address FE80::1/64 | Not how IOS sets a link-local: use the link-local keyword, without a prefix length. |
| 4 | ipv6 address 2001:DB8:ACAD:10::1/80 | Not a /64: the RA carries the prefix, but the hosts ignore it for SLAAC and keep only link-local addresses. |
| 5 | ipv6 nd ra suppress all | No RA at all, not even in answer to an RS: SLAAC hosts get no prefix and no gateway. |
| 6 | ipv6 address 2001:DB8:ACAD:10::1 255.255.255.0 | IPv4 habit: IPv6 never uses a dotted mask; IOS rejects the syntax. |
The outputs are typical for IOS-XE; details may vary between versions.
15.4Remember
ipv6 unicast-routing is the one global command that makes IOS an IPv6 router: forwarding, membership of FF02::2 and Router Advertisements. Without it the interfaces still have addresses and show up/up, but hosts receive no RA and keep only their link-local addresses. Dual stack = IPv4 and IPv6 on the same interfaces, each with its own routing table.ipv6 address fe80::1 link-local on every LAN interface is a common design: every host shows default via fe80::1, and renumbering the global prefix does not touch it.show ipv6 interface. The classic exam trap: the addresses look fine and ipv6 unicast-routing is missing.show ip interface brief. The IPv6 commands are separate: show ipv6 interface brief, show ipv6 route, show ipv6 neighbors.ipv6 unicast-routing command. A static link-local is ipv6 address fe80::1 link-local on IOS and IOS-XR, ipv6 link-local fe80::1 on NX-OS. IOS uses EUI-64 for every link-local it is not given, and interfaces without a MAC (loopbacks, serial) borrow one. Standards: RFC 4213 (dual stack), RFC 4861 (NDP), RFC 4862 (SLAAC).show ipv6 interface briefshow ipv6 interface GigabitEthernet0/0show ipv6 routeshow ipv6 neighborsping 2001:db8:acad:20:250:56ff:fea1:2c0215.5Check yourself: exam-style questions
R1's Gi0/0 has ipv6 address 2001:DB8:ACAD:10::1/64 and is up/up, but the global configuration has no ipv6 unicast-routing. What do the SLAAC hosts on that LAN end up with?
- AGlobal SLAAC addresses, but no default gateway
- BNothing at all, not even link-local addresses
- COnly their link-local addresses: R1 sends no Router Advertisements
- DGlobal addresses and a gateway: unicast-routing only matters for routing protocols
Show answer
Which IOS interface command gives GigabitEthernet0/0 the link-local address fe80::1?
- Aipv6 address fe80::1/64
- Bipv6 address fe80::1 link-local
- Cipv6 link-local fe80::1
- Dipv6 address fe80::1/10 link-local
Show answer
show ipv6 route on R1 lists C 2001:DB8:ACAD:10::/64 and L 2001:DB8:ACAD:10::1/128, both via GigabitEthernet0/0. What is the L route?
- AThe summary route R1 advertises for the whole site
- BA route to the link-local address FE80::1 of Gi0/0
- CA host route learned from a neighbor's Neighbor Advertisement
- DR1's own address on Gi0/0, as a /128 for traffic to R1 itself
Show answer
Host A (2001:
- AAn ARP request to the broadcast ffff.ffff.ffff
- BA Neighbor Solicitation to all nodes, ff02::1
- CA Neighbor Solicitation to ff02::1:ffa1:2c02
- DA Router Solicitation to all routers, ff02::2
Show answer
Gi0/0 has ipv6 unicast-routing, fe80::1 and ipv6 address 2001:DB8:ACAD:10::1/80. show ipv6 interface brief shows it up/up. What do the SLAAC hosts on the LAN get?
- AGlobal addresses from the /80, with 48-bit interface IDs
- BNo RA at all, because IOS refuses to advertise a prefix that is not /64
- CA gateway (fe80::1) but no global address: SLAAC needs a /64
- DGlobal addresses through DHCPv6, which the hosts start automatically
Show answer
On R1's Gi0/0 you configure ipv6 nd ra suppress, without the all keyword. A laptop is plugged into the LAN a minute later. What happens?
- AIt receives no RA at all and keeps only its link-local address
- BIts RS still gets an RA in reply, so SLAAC works; only periodic RAs stop
- CIt receives periodic RAs without the prefix information
- DIt gets its address from DHCPv6 instead, because suppress sets the M flag
Show answer
R1 runs ipv6 unicast-routing. Gi0/0, MAC 00a1.b2c3.d400, has ipv6 address FE80::1 link-local and ipv6 address 2001:DB8:ACAD:10::/64 eui-64. Which groups does show ipv6 interface Gi0/0 list as joined?
- AFF02::1, FF02::2, FF02::1:FF00:1 and FF02::1:FFC3:D400
- BFF02::1, FF02::2 and FF02::1:FFC3:D400 only: one solicited-node group per interface
- CFF02::1, FF02::2, FF02::1:FF00:1 and FF02::1:FF00:D400
- DFF02::1, FF02::1:FF00:1 and FF02::1:FFC3:D400: a router does not join FF02::2
Show answer
Troubleshooting: wrong masks, overlapping subnets and missing IPv6
TL;DRTroubleshoot addressing from the host outwards: what the host believes (address, mask, gateway, ARP cache), then what the router believes (interfaces, routes, ARP, proxy ARP). The incident replayed here: Host B has 192.168.10.150/24 instead of /26, so it ARPs for 192.168.10.37 instead of sending to its gateway; R1's default proxy ARP hid the mistake for weeks, and no ip proxy-arp exposed it. Two shorter cases follow: a lab /28 on R2 that overlaps a LAN on R1 and wins by longest match, and an IPv6 LAN with only fe80:: addresses because ipv6 unicast-routing is missing.
- On-link / off-link
- The host's own decision: destination AND its mask = its network → on-link, ARP for the destination; otherwise off-link, ARP for the gateway.
- Proxy ARP
- RFC 1027: a router answers an ARP request for an address it reaches through another interface, with its own MAC. On by default on IOS interfaces.
- ARP cache
- The host's IP → MAC table (
arp -a,ip neigh). Several IPs on the router's MAC are the signature of proxy ARP. - Destination host unreachable
- On Windows, a reply that comes from the host's own address means its own ARP failed: the packet never left. "Request timed out" means it left and nothing came back.
- ICMP redirect
- A router that sends a packet back out the interface it came in on tells the host a better next hop on its own LAN.
- Router Advertisement (RA)
- The ICMPv6 message that gives IPv6 hosts their prefix and default gateway. IOS sends it only with
ipv6 unicast-routing.
16.1The step-by-step animation
- Monday, 09:10. The ticket: "Host B (Engineering) cannot open the file share on 192.168.10.37 (Host A, Sales). The Internet works." On Friday evening R1 was hardened with
no ip proxy-arpon every interface. Replay it: a web request from Host B reaches 203.0.113.10, but every ping to 192.168.10.37 gets Destination host unreachable, and that reply comes from Host B's own address.Symptom: ping 203.0.113.10 Reply from 203.0.113.10 · ping 192.168.10.37 Reply from 192.168.10.150: Destination host unreachable. · Friday's change no ip proxy-arp on R1 - Start at the host that complains.
ipconfigon Host B: 192.168.10.150, mask 255.255.255.0, gateway 192.168.10.129. Engineering is a /26: the NIC was replaced last month and configured by hand. AND-ing 192.168.10.37 with the /24 gives 192.168.10.0, Host B's own network, so Host B treats Host A as on-link and ARPs for 192.168.10.37 itself. Nobody on VLAN 20 owns that address. With the right /26 the AND gives .0 against .128: off-link, send it to the gateway.Host B: address 192.168.10.150 · mask 255.255.255.0 (Eng is a /26) · .37 AND /24 192.168.10.0 = mine → ARP for .37 - Now R1, to rule it out.
show ip interface brief: Gi0/0 and Gi0/1 up/up.show ip route 192.168.10.37: connected, out Gi0/0.show ip arp: Host A (.37) and Host B (.150) are both there, so R1 reaches both LANs and a ping from R1 to .37 works.show ip interface Gi0/1 | include Proxy: Proxy ARP is disabled, Friday's change. R1 is healthy: it simply no longer answers ARP requests for addresses that are not its own.R1: Gi0/1 up / up, 192.168.10.129/26 · route to .37 C 192.168.10.0/25 via Gi0/0 · Proxy ARP disabled - Why did it work for a month? Replay it as it was before Friday, with proxy ARP on (
ip proxy-arp, the IOS default). Host B's ARP request for 192.168.10.37 reaches R1 Gi0/1; R1 reaches .37 through another interface, Gi0/0, so it answers with its own MAC. Host B sends the frames to R1, which routes them. The evidence is in last week'sarp -a: .37, .129 and the switch at .200 all map to one MAC, R1's 00-a1-b2-c3-d4-01, and the broadcast entry is .255 instead of .191. Several IPs on one MAC: a wrong mask hidden by proxy ARP.Proxy ARP: ARP request who has 192.168.10.37? tell .150 · proxy reply .37 is at 00a1.b2c3.d401 (R1 Gi0/1) · arp -a .37 · .129 · .200 → one MAC - Fix the cause, not the symptom: give Host B the mask of its LAN, 255.255.255.192, and fix the template or DHCP scope it came from. Keep
no ip proxy-arp: it exposed the error instead of hiding it. Now .37 AND /26 = 192.168.10.0, not Host B's 192.168.10.128, so Host B sends the packet to its gateway, and the only off-link address it ever ARPs for is 192.168.10.129. Verify: the ping works andarp -aholds .129 and Engineering hosts only.Fix: mask 255.255.255.192 (/26) · .37 AND /26 192.168.10.0 ≠ 192.168.10.128 → gateway · ARP only for 192.168.10.129 - Second case, same week: Engineering hosts .176 to .190 cannot be reached from Sales, while Host B (.150) can. On R1,
show ip route 192.168.10.180answers 192.168.10.176/28 via 192.168.10.226, learned by OSPF from R2: a new lab LAN on R2 was numbered 192.168.10.176/28, inside Engineering's 192.168.10.128/26. IOS checks overlaps only between its own interfaces, so nothing complained, and longest match prefers the /28 (AD 110) to the connected /26 (AD 0). Fix: renumber the lab into free space, 192.168.10.240/28.Overlap: R1 → .180 O 192.168.10.176/28 via .226 · connected C 192.168.10.128/26 (AD 0) · rule longest match first; AD only breaks ties - Third case: the Sales LAN got IPv6 last week (§15), but its hosts still have only fe80:: addresses.
ip -6 addron Host A shows fe80::250:56ff:fea1:1b01 and nothing in 2001:db8:acad:10::/64.show ipv6 interface Gi0/0on R1 lists 2001:db8:acad:10::1, but R1 has not joined FF02::2 (all routers) and sends no Router Advertisements: the globalipv6 unicast-routingis missing, so R1 is an IPv6 host, not a router. One command fixes it: R1 answers the RS, and Host A builds its SLAAC address and uses fe80::1 as its gateway.IPv6: Host A fe80::250:56ff:fea1:1b01 only · R1 Gi0/0 no FF02::2, no RA · fix ipv6 unicast-routing
16.2Simulator: what does the host do with the packet?
The network is the HQ plan: R1 Gi0/0 192.168.10.1/25 (Sales), Gi0/1 192.168.10.129/26 (Engineering), Gi0/3 .193/27 (Management), Gi0/2 .225/30 (R2), and a default route to the ISP; 203.0.113.0/24 and the other documentation ranges stand in for the Internet. Type the host's address with its mask, as the host is (mis)configured.
This simulator is interactive and needs JavaScript. Below is its result with the starting values.
| Step | What happens |
|---|---|
| 1. Host: on-link? | 192.168.10.37 AND /24 = 192.168.10.0 = 192.168.10.0 (mine) → on-link: ARP for the destination itself |
| 2. Host ARPs for | 192.168.10.37 (a broadcast on the Engineering LAN) |
| 3. ARP reply from | R1 Gi0/1 by proxy ARP · 00a1.b2c3.d401 |
| Host ARP cache gains | 192.168.10.37 → 00a1.b2c3.d401 |
| 4. Packet path | Host B (192.168.10.150) → R1 Gi0/1 → Gi0/0 → Host A (192.168.10.37) |
| Result | ping: Reply from 192.168.10.37 |
- Nobody on the Engineering LAN owns 192.168.10.37. R1 receives the ARP request on Gi0/1, reaches 192.168.10.37 through Gi0/0, and answers with its own MAC (proxy ARP, the IOS default). The host now has 192.168.10.37 → 00a1.b2c3.d401 in its ARP cache, and R1 routes the frames.
- It works by accident: with
no ip proxy-arpon Gi0/1 (or behind a Nexus or IOS-XR gateway, where it is off by default) the same ping fails. - Fix the host: mask 255.255.255.192 (/26), the mask of the Engineering LAN (192.168.10.128/26).
16.3The configuration, line by line
Host B · Windows
| 1 | C:\> ipconfig | |
| 2 | Ethernet adapter Ethernet0: | |
| 3 | IPv4 Address. . . . . . . . . . . : 192.168.10.150 | |
| 4 | Subnet Mask . . . . . . . . . . . : 255.255.255.0 | The cause: Engineering is 192.168.10.128/26, mask 255.255.255.192. |
| 5 | Default Gateway . . . . . . . . . : 192.168.10.129 | Correct, and inside both the /24 and the /26: that is why the Internet still works. |
| 6 | C:\> ping 192.168.10.37 | |
| 7 | Reply from 192.168.10.150: Destination host unreachable. | The answer comes from Host B itself: its ARP for .37 failed, so the packet never left. "Request timed out" would mean it left and no answer came back. |
| 8 | ! Last week, with proxy ARP still on R1: | |
| 9 | C:\> arp -a | |
| 10 | Interface: 192.168.10.150 --- 0x7 | |
| 11 | Internet Address Physical Address Type | |
| 12 | 192.168.10.37 00-a1-b2-c3-d4-01 dynamic | Host A's address with R1's MAC: R1 answered for it by proxy ARP. |
| 13 | 192.168.10.129 00-a1-b2-c3-d4-01 dynamic | The real gateway, the same MAC. |
| 14 | 192.168.10.200 00-a1-b2-c3-d4-01 dynamic | A switch in the Management /27: R1's MAC again. Three IPs on one MAC = proxy ARP. |
| 15 | 192.168.10.255 ff-ff-ff-ff-ff-ff static | Windows lists its own subnet broadcast: .255 means a /24. With the /26 it would be .191. |
Host B · Linux
| 1 | $ ip -4 addr show dev eth0 | |
| 2 | inet 192.168.10.150/24 brd 192.168.10.255 scope global eth0 | The /24 and its broadcast .255, on one line. |
| 3 | $ ip route | |
| 4 | default via 192.168.10.129 dev eth0 | |
| 5 | 192.168.10.0/24 dev eth0 proto kernel scope link src 192.168.10.150 | The kernel's connected route: all of 192.168.10.0/24 is "on-link", .37 included. |
| 6 | $ ping -c 2 192.168.10.37 | |
| 7 | From 192.168.10.150 icmp_seq=1 Destination Host Unreachable | The same local ARP failure as on Windows. |
| 8 | $ ip neigh show 192.168.10.37 | |
| 9 | 192.168.10.37 dev eth0 FAILED | No ARP reply (INCOMPLETE while it is still asking). With proxy ARP on, this line read: lladdr 00:a1:b2:c3:d4:01 REACHABLE. |
R1 · show
| 1 | R1#show ip interface brief | |
| 2 | Interface IP-Address OK? Method Status Protocol | |
| 3 | GigabitEthernet0/0 192.168.10.1 YES NVRAM up up | |
| 4 | GigabitEthernet0/1 192.168.10.129 YES NVRAM up up | Both LANs are up/up: Layers 1 and 2 are fine. |
| 5 | R1#show ip route 192.168.10.37 | |
| 6 | Routing entry for 192.168.10.0/25 | |
| 7 | Known via "connected", distance 0, metric 0 (connected, via interface) | R1 knows exactly where .37 is. |
| 8 | Routing Descriptor Blocks: | |
| 9 | * directly connected, via GigabitEthernet0/0 | |
| 10 | R1#show ip arp | |
| 11 | Protocol Address Age (min) Hardware Addr Type Interface | |
| 12 | Internet 192.168.10.1 - 00a1.b2c3.d400 ARPA GigabitEthernet0/0 | "-" = R1's own address. |
| 13 | Internet 192.168.10.37 3 0050.56a1.1b01 ARPA GigabitEthernet0/0 | |
| 14 | Internet 192.168.10.129 - 00a1.b2c3.d401 ARPA GigabitEthernet0/1 | |
| 15 | Internet 192.168.10.150 1 0050.56a1.2c02 ARPA GigabitEthernet0/1 | Host B is known: R1 can reach it. Only the direction Host B → .37 is broken. |
| 16 | R1#show ip interface GigabitEthernet0/1 | include Proxy | |
| 17 | Proxy ARP is disabled | Friday's hardening. |
| 18 | Local Proxy ARP is disabled | A different feature (answering between hosts of the same subnet); off by default. |
Fix
| 1 | ! Host B (Windows): the mask of the Engineering LAN | |
| 2 | netsh interface ipv4 set address name="Ethernet0" static 192.168.10.150 255.255.255.192 192.168.10.129 | Address, mask and gateway in one command; or the same values in the adapter's IPv4 settings. |
| 3 | ! R1: if the Engineering hosts use DHCP, the mask comes from the pool | |
| 4 | ip dhcp pool ENG | |
| 5 | network 192.168.10.128 255.255.255.192 | The pool's mask is the mask every client receives (option 1). |
| 6 | default-router 192.168.10.129 | Option 3, the gateway. |
| 7 | ! R1: keep the hardening | |
| 8 | interface GigabitEthernet0/1 | |
| 9 | no ip proxy-arp | It stays: without proxy ARP a wrong mask fails at once, instead of working by accident. |
Overlap · R1 and R2
| 1 | R2#show running-config interface GigabitEthernet0/1 | |
| 2 | interface GigabitEthernet0/1 | |
| 3 | description Lab LAN | |
| 4 | ip address 192.168.10.177 255.255.255.240 | The lab /28: 192.168.10.176 – .191, inside Engineering's /26 on R1. R2 has no other interface in that range, so it accepted it. |
| 5 | R1#show ip route 192.168.10.180 | |
| 6 | Routing entry for 192.168.10.176/28 | Not the connected /26: the /28 is a longer match for .180. |
| 7 | Known via "ospf 1", distance 110, metric 2, type intra area | |
| 8 | Routing Descriptor Blocks: | |
| 9 | * 192.168.10.226, from 10.255.0.2, 00:41:12 ago, via GigabitEthernet0/2 | Toward R2: Engineering hosts .176 – .190 are unreachable from every other subnet. |
| 10 | C:\> tracert -d 192.168.10.180 | |
| 11 | 1 <1 ms <1 ms <1 ms 192.168.10.1 | |
| 12 | 2 1 ms 1 ms 1 ms 192.168.10.226 | Hop 2 is R2: the packet went the wrong way. |
| 13 | 3 * * * Request timed out. | |
| 14 | ! Fix on R2: renumber the lab into free space | |
| 15 | interface GigabitEthernet0/1 | |
| 16 | ip address 192.168.10.241 255.255.255.240 | 192.168.10.240/28 is free in the HQ plan (.228 – .255). |
IPv6 · R1 and Host A
| 1 | [Host A]$ ip -6 addr show dev eth0 | |
| 2 | inet6 fe80::250:56ff:fea1:1b01/64 scope link | Only the link-local address: no RA has ever arrived. |
| 3 | [Host A]$ ip -6 route | |
| 4 | fe80::/64 dev eth0 proto kernel metric 256 | No default route either. |
| 5 | R1#show ipv6 interface GigabitEthernet0/0 | |
| 6 | GigabitEthernet0/0 is up, line protocol is up | |
| 7 | IPv6 is enabled, link-local address is FE80::1 | |
| 8 | Global unicast address(es): | |
| 9 | 2001:DB8:ACAD:10::1, subnet is 2001:DB8:ACAD:10::/64 | The address is there: the interface is configured. |
| 10 | Joined group address(es): | |
| 11 | FF02::1 | |
| 12 | FF02::1:FF00:1 | All nodes and the solicited-node group of ::1. FF02::2, all routers, is missing: R1 is not acting as a router, and no "ND router advertisements are sent" line follows. |
| 13 | R1(config)#ipv6 unicast-routing | The fix: R1 joins FF02::2, answers Router Solicitations and sends RAs every 200 s (the default) with 2001:db8:acad:10::/64. |
| 14 | R1#show ipv6 route | |
| 15 | C 2001:DB8:ACAD:10::/64 [0/0] | Excerpt: the two entries of Gi0/0. In IPv6 the L routes are their own source (show ipv6 route local), not part of connected. |
| 16 | via GigabitEthernet0/0, directly connected | |
| 17 | L 2001:DB8:ACAD:10::1/128 [0/0] | |
| 18 | via GigabitEthernet0/0, receive | The IPv6 L route is a /128. |
| 19 | [Host A]$ ip -6 addr show dev eth0 | |
| 20 | inet6 2001:db8:acad:10:250:56ff:fea1:1b01/64 scope global dynamic | SLAAC: the /64 from the RA plus the EUI-64 interface ID (§14). |
| 21 | [Host A]$ ip -6 route | grep default | |
| 22 | default via fe80::1 dev eth0 proto ra metric 1024 expires 1797sec | The gateway is R1's link-local address, learned from the RA (router lifetime 1800 s). |
The outputs are typical for IOS-XE, Windows 10/11 and a current Linux distribution; details may vary between versions.
16.4Remember
ip proxy-arp, on by default on IOS interfaces), and then fails the day proxy ARP is disabled.no ip proxy-arp is good hardening, and it exposes every latent wrong mask at once. Before the change, look for the signature in host ARP caches: several IP addresses on the router's MAC. After it, the same hosts report "Destination host unreachable" from their own address. Fix the masks (or the DHCP pool), not the router.arp timeout 14400), and traffic does not refresh them: an IOS device with a wrong mask, such as the switch at .200, keeps its proxy-learned entries and fails up to 4 hours after no ip proxy-arp. Windows keeps a neighbour entry reachable for a random 15 – 45 s, so a Windows host fails within a minute. Windows: "Reply from <own IP>: Destination host unreachable" = local ARP failure; "Request timed out" = sent, no answer. IOS sends an IPv6 RA every 200 s by default, with a router lifetime of 1800 s.show ip route <address> and a traceroute that turns off at the wrong router show it.ipconfig /all, arp -a, route print; Linux ip addr, ip route, ip neigh (FAILED / INCOMPLETE), ip -6 addr. Router side: show ip arp, show ip interface | include Proxy, show ipv6 interface. NX-OS and IOS-XR leave proxy ARP disabled by default (ip proxy-arp / proxy-arp per interface), so the same wrong mask fails at once behind them.ipconfig /all · arp -aip addr · ip route · ip neighshow ip interface briefshow ip route 192.168.10.37show ip arpshow ip interface GigabitEthernet0/1 | include Proxyshow ipv6 interface GigabitEthernet0/0show ipv6 route16.5Check yourself: exam-style questions
Host B is on the Engineering LAN (192.168.10.128/26) but is configured with 192.168.10.150, mask 255.255.255.0, gateway 192.168.10.129. R1 has no ip proxy-arp. Host B pings 192.168.10.37 on the Sales LAN. What happens?
- AR1 answers the ARP with its own MAC, and the ping works
- BHost B refuses to send anything, because its gateway is outside its subnet
- CHost B ARPs for 192.168.10.37 itself, nobody answers, and the ping fails
- DHost B sends the packet to its gateway 192.168.10.129, and the ping works
Show answer
Host B has the address 192.168.10.150 with the mask 255.255.255.192. Which of these can be its default gateway?
- A192.168.10.129
- B192.168.10.128
- C192.168.10.191
- D192.168.10.1
Show answer
On a Windows host whose LAN is a /26, arp -a lists 192.168.10.37, 192.168.10.129 and 192.168.10.200, all with the same physical address, the MAC of the router's LAN interface. What is the most likely explanation?
- AThe switch is flooding frames because its MAC address table is full
- BThe router answers for every address because its own mask is too short
- CThe host's mask is too short, and the router answers its ARPs by proxy ARP
- DThree hosts were cloned from one image and share the same MAC address
Show answer
A Windows host pings a server and gets Reply from 192.168.10.150: Destination host unreachable., where 192.168.10.150 is the host's own address. What does this tell you?
- AA router on the path had no route and returned an ICMP unreachable
- BThe server received the request, but a firewall filtered its reply
- CThe packet's TTL expired on the way before it reached the server
- DThe host's ARP for the next hop failed, so the packet never left it
Show answer
R1 has C 192.168.10.128/26 on Gi0/1 (Engineering). R2 advertises 192.168.10.176/28, a lab LAN, into OSPF. A Sales host pings 192.168.10.180. Where does R1 send the packet?
- AOut Gi0/1: a connected route (AD 0) always beats OSPF (AD 110)
- BBoth ways: R1 load-balances between the two routes
- CNowhere: R1 rejects an OSPF route that overlaps a connected subnet
- DTo R2: the /28 is a longer match than the connected /26
Show answer
On R1's Gi0/0 (2001:DB8:ACAD:10::1/64), show ipv6 interface lists FF02::2 and ND router advertisements are sent every 200 seconds. The Sales hosts install a default route via fe80::1, yet they still have only fe80:: addresses. Which interface setting explains it?
- AThe RA carries M = 1 (
ipv6 nd managed-config-flag) - BThe prefix is advertised with A = 0 (
ipv6 nd prefix … no-autoconfig) - CThe RA carries O = 1 (
ipv6 nd other-config-flag) - DPeriodic RAs are suppressed (
ipv6 nd ra suppress)
Show answer
ipv6 unicast-routing is on. They skip SLAAC because the prefix information carries A = 0, which is what ipv6 nd prefix 2001:DB8:ACAD:10::/64 2592000 604800 no-autoconfig sends. O = 1 only adds options through stateless DHCPv6, M = 1 adds DHCPv6 addresses without switching SLAAC off, and ipv6 nd ra suppress stops only the periodic RAs (and the output would say so): with any of those the hosts would still build 2001:db8:acad:10::/64 addresses.The management switch at 192.168.10.200 (IOS, gateway 192.168.10.193) has the mask 255.255.255.0 instead of /27. It has been reaching Host A (192.168.10.37) thanks to R1's proxy ARP. At 18:00 you enter no ip proxy-arp on R1. When does the switch lose Host A?
- AWithin a minute: R1 sends a gratuitous ARP to withdraw it
- BWhen its ARP entry for .37 ages out, up to 4 hours later
- CNever: each packet to .37 refreshes the cached ARP entry
- DAt once: R1 stops routing frames for addresses it proxied
Show answer
no ip proxy-arp change can seem to break things hours later.Host B is 192.168.10.150 with the mask 255.255.255.224 (the LAN is really 192.168.10.128/26) and gateway 192.168.10.129. It pings 192.168.10.170, another host on the same LAN with a correct /26. What happens?
- AIt fails: R1 never forwards a packet out the interface it arrived on
- BIt works via R1, which routes it back out Gi0/1 and sends an ICMP redirect
- CIt fails: Host B ARPs for .170 on the LAN, and nobody answers the request
- DIt works directly: Host B ARPs for .170, because both hosts are in 192.168.10.128/26
Show answer
Recap: IP addressing and subnetting on a single page
TL;DREverything to re-read before the exam: the numbers, the ranges you must recognize on sight, the subnetting method, VLSM and summarization, the IPv6 address types and prefixes, the Cisco commands and the exam mapping.
The numbers you need
| Number | What it means |
|---|---|
| 32 / 128 bits | an IPv4 address (4 octets, dotted decimal) / an IPv6 address (8 hextets, 32 hex digits) |
| 232 ≈ 4.3 billion · 2128 ≈ 3.4 × 1038 | the size of the IPv4 / IPv6 address space; IANA gave out its last five IPv4 /8s on 3 February 2011 |
| 128 64 32 16 8 4 2 1 | the place values of an octet: every conversion starts here (37 = 32 + 4 + 1 = 00100101) |
| 0 128 192 224 240 248 252 254 255 | the only nine values a mask octet can take; anything else (255.255.255.250) is refused |
| 2h − 2 | usable hosts with h host bits (h = 32 − prefix): /20 → 4,094, /25 → 126 |
| 2s | subnets from s borrowed bits, subnet zero and the all-ones subnet included (RFC 1878; ip subnet-zero by default since IOS 12.0) |
| 256 − mask octet | the block size in the interesting octet: 256 − 240 = 16, 256 − 224 = 32 |
| 255.255.255.255 − mask | the wildcard: /20 → 0.0.15.255, /30 → 0.0.0.3 (0 = must match, 1 = ignore) |
| /24 254 · /25 126 · /26 62 · /27 30 · /28 14 · /29 6 · /30 2 | usable hosts per prefix; /16 = 65,534 |
| /31 | 2 usable addresses, no network and no broadcast: point-to-point links only (RFC 3021) |
| /32 | a single address: loopbacks, host routes and the IOS 15+ L routes |
| /8 · /16 · /24 | the default masks of classes A (1–126), B (128–191) and C (192–223); D 224–239 multicast, E 240–255 reserved |
| /12 | 172.16.0.0–172.31.255.255, the RFC 1918 block everybody gets wrong (172.32.0.1 is public) |
| /10 | 100.64.0.0/10, shared address space for carrier-grade NAT (RFC 6598), not RFC 1918 |
| /48 · /56 | an IPv6 site (65,536 /64s) · a small site or a home (256 /64s); RFC 6177, RIPE-690 |
| /64 | every IPv6 LAN, whatever its size: SLAAC needs a 64-bit interface ID (RFC 4862, RFC 7421) |
| /127 · /128 | an IPv6 router-to-router link (RFC 6164) · an IPv6 loopback |
| ff:fe · 0x02 | modified EUI-64: insert ff:fe in the middle of the MAC, flip bit 0x02 of the first byte (0050.56a1.1b01 → 250:56ff:fea1:1b01) |
| AD 0 · AD 5 | connected and local routes · the EIGRP summary route to Null0 |
| ICMPv6 133 / 134 / 135 / 136 | Router Solicitation / Router Advertisement / Neighbor Solicitation / Neighbor Advertisement |
| UDP 67/68 · UDP 546/547 | DHCPv4 server/client · DHCPv6 client/server and relay (group ff02::1:2) |
| 200 s · 1800 s | IOS Router Advertisement interval · router lifetime carried in each RA |
| 4 hours | the IOS ARP timeout: a stale proxy-ARP entry can hide a wrong mask that long |
| RFC 791 · 950 · 1878 · 4632 | IPv4 · the subnet mask (1985) · subnet zero allowed · CIDR (first RFC 1519 in 1993) |
| RFC 1918 · 6598 · 3927 · 5737 · 6890 | private space · CGN shared space · APIPA · documentation ranges · the special-purpose registry |
| RFC 4291 · 5952 · 4193 · 4862 · 8981 · 7217 | IPv6 addressing · canonical text form · ULA · SLAAC · temporary addresses · stable opaque interface IDs |
The ranges to recognize on sight
| IPv4 block | What it is | RFC | The rule |
|---|---|---|---|
| 0.0.0.0/8 | "This network"; 0.0.0.0 = "this host" | RFC 791, RFC 1122 | source only (the DHCP Discover); written 0.0.0.0/0 it is the default route |
| 10.0.0.0/8 | Private-Use | RFC 1918 | reused everywhere; needs NAT to reach the Internet |
| 100.64.0.0/10 | Shared Address Space | RFC 6598 | between a carrier-grade NAT and its customers; never across provider boundaries |
| 127.0.0.0/8 | Loopback | RFC 1122 | the whole /8 is the host itself; never leaves the IP stack |
| 169.254.0.0/16 | Link-local (APIPA) | RFC 3927 | self-assigned when DHCP fails; mask /16, no gateway, never routed |
| 172.16.0.0/12 | Private-Use | RFC 1918 | 172.16.0.0 to 172.31.255.255 only |
| 192.168.0.0/16 | Private-Use | RFC 1918 | reused everywhere; needs NAT to reach the Internet |
| 192.0.2.0/24 · 198.51.100.0/24 · 203.0.113.0/24 | Documentation (TEST-NET-1, 2, 3) | RFC 5737 | books and examples only, as on this page |
| 198.18.0.0/15 | Benchmarking | RFC 2544 | device testing in labs |
| 224.0.0.0/4 | Multicast (class D) | RFC 5771 | groups, destination only; 224.0.0.0/24 (224.0.0.5 OSPF, 224.0.0.10 EIGRP) never forwarded |
| 240.0.0.0/4 | Reserved (class E) | RFC 1112 | not usable on hosts |
| 255.255.255.255/32 | Limited broadcast | RFC 919, RFC 8190 | every host on this link; routers never forward it |
In IPv6, the first hex digits give the type away:
| IPv6 block | What it is | RFC | The rule |
|---|---|---|---|
| ::/128 · ::1/128 | Unspecified · loopback | RFC 4291 | :: is a source only (DAD, DHCPv6 Solicit); ::1 never leaves the host |
| ::ffff:0:0/96 | IPv4-mapped IPv6 address | RFC 4291 | an IPv4 address inside an IPv6 socket; never on the wire |
| 64:ff9b::/96 | NAT64 well-known prefix | RFC 6052 | IPv4 hosts reached through NAT64/DNS64 |
| 2000::/3 | Global unicast (GUA) | RFC 4291 | starts with 2 or 3; routed on the Internet; /48 site + 16-bit subnet ID + 64-bit interface ID |
| 2001:db8::/32 · 3fff::/20 | Documentation | RFC 3849, RFC 9637 | inside 2000::/3, but examples only: never "global" in an exam answer |
| fc00::/7 | Unique local (ULA) | RFC 4193 | fd00::/8 in practice, with a random 40-bit Global ID (fd12:3456:789a::/48); routed inside, filtered at the edge |
| fe80::/10 | Link-local unicast | RFC 4291 | fe80::/64 in practice, on every IPv6 interface; never routed; next hops and default gateways use it |
| fec0::/10 | Site-local | RFC 3879 | deprecated in 2004: never the answer for "private IPv6" |
| ff00::/8 | Multicast | RFC 4291 | replaces broadcast; the 4th hex digit is the scope (2 link, 5 site, e global) |
| ff02::1 · ff02::2 | All nodes · all routers (link scope) | RFC 4291 | RAs go to ff02::1, RSs to ff02::2; ff02::5/::6 OSPFv3, ff02::a EIGRP |
| ff02::1:ff00:0/104 | Solicited-node multicast | RFC 4291 | ff02::1:ff + the last 24 bits: Host A → ff02::1:ffa1:1b01; NS for DAD and address resolution |
| ff02::1:2 | All DHCPv6 servers and relay agents | RFC 8415 | the DHCPv6 Solicit and Information-Request go here |
The subnetting method
- Turn the prefix into a mask and find the interesting octet, the one that is neither 255 nor 0: 172.16.45.200/20 → 255.255.240.0, the third octet, 240.
- Block size = 256 − the interesting octet: 256 − 240 = 16. Networks start every 16 in that octet: .0, .16, .32, .48…
- Network: round the address's interesting octet down to a multiple of the block and set the octets to its right to 0: 45 → 32, so 172.16.32.0.
- Broadcast: the next network minus one, the octets to the right at 255: 172.16.48.0 − 1 = 172.16.47.255 (not 172.16.45.255).
- Hosts: network + 1 to broadcast − 1, and 2h − 2 of them: 172.16.32.1 – 172.16.47.254, 212 − 2 = 4,094.
- To cut a block, borrow s bits with 2s ≥ the subnets needed and check that the h bits left give 2h − 2 ≥ the hosts needed: 6 subnets of 30 hosts from 192.168.1.0/24 → /27, eight subnets at .0, .32 … .224.
- Check both sides of the requirement: 6 subnets of 31 hosts need 3 + 6 = 9 bits, one more than a /24 has.
- Exceptions: /31 on point-to-point links (2 hosts, no broadcast), /32 for one address. When an octet looks ambiguous, write it in binary: the AND with the mask settles it.
VLSM and summarization rules
- VLSM: list the needs, sort them largest first, and give each the smallest block with 2h − 2 ≥ hosts (the gateway counts): 100 → /25, 50 → /26, 20 → /27, a router link → /30 or /31.
- Allocate each block at the next free address. A block starts on a multiple of its own size, so largest first never leaves a gap: 192.168.10.0/25, .128/26, .192/27, .224/30, free .228 – .255.
- A block that does not start on its boundary does not exist: 192.168.10.4/27 is just a host in 192.168.10.0/27. IOS refuses an overlap between its own interfaces, never between two routers.
- VLSM needs a classless protocol that carries the mask (OSPF, EIGRP, IS-IS, BGP, RIPv2) and
no auto-summarywherever a major network is discontiguous. - Summarize: write the networks in binary and keep the leading bits they all share: 172.16.0.0/24 – 172.16.3.0/24 share 22 bits → 172.16.0.0/22 (255.255.252.0).
- 2n networks fit one summary only if the first is a multiple of 2n: 192.168.1.0 + 192.168.2.0 are not a /23, and 172.16.1.0 – 172.16.4.0 are not a /22.
- Summarize only space you own. The router installs a discard route to Null0 for its own summary; a too-wide summary attracts another site's traffic the day that site's specific route disappears, and drops it.
- Longest match always wins: a summary never overrides a more specific route, which is why over-summarization looks harmless on a normal day.
IPv4 vs IPv6
| Topic | IPv4 | IPv6 |
|---|---|---|
| size and text | 32 bits, 4 octets in dotted decimal | 128 bits, 8 hextets in hex; drop leading zeros, one :: per address, lowercase (RFC 5952) |
| prefix | a dotted mask or /n | /n only; a dotted mask is refused |
| LAN size | sized to the hosts with VLSM (/24 – /28) | always /64, whatever the number of hosts |
| router link · loopback | /30 or /31 · /32 | /127 · /128 |
| site | a few public addresses + RFC 1918 inside | a /48 or /56 of global space, 65,536 or 256 LANs |
| private space | RFC 1918 + NAT/PAT at the edge | ULA fd00::/8, routed inside, no NAT needed |
| link-local | 169.254.0.0/16, only when DHCP fails | fe80::/10 on every interface, always; gateways and routing protocols use it |
| one-to-all | broadcast: 255.255.255.255 and directed broadcasts | no broadcast: multicast ff02::1 and the solicited-node groups |
| address resolution | ARP, a broadcast request | NDP: NS/NA (ICMPv6 135/136) to the solicited-node group |
| automatic addressing | DHCP; APIPA as a fallback | SLAAC from the RA (EUI-64 or random ID), stateless or stateful DHCPv6 by the O and M flags |
| default gateway | typed or DHCP option 3 | always from the RA (the router's link-local), never from DHCPv6 |
| loopback · unspecified · documentation | 127.0.0.0/8 · 0.0.0.0 · 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | ::1 · :: · 2001:db8::/32, 3fff::/20 |
| on IOS | routes by default; C + L /32 per address | needs ipv6 unicast-routing; C + L /128 per address, LC for a loopback |
The Cisco commands
| Function | IOS-XE | NX-OS | IOS-XR |
|---|---|---|---|
| IPv4 address | ip address 192.168.10.1 255.255.255.128 | ip address 192.168.10.1/25 | ipv4 address 192.168.10.1 255.255.255.128 (or /25) |
| second subnet | ip address 10.1.10.1 255.255.255.0 secondary | ip address 10.1.20.1/24 secondary | ipv4 address 10.1.10.1 255.255.255.0 secondary |
| routed port · SVI | no switchport · ip routing, interface Vlan20 | no switchport · feature interface-vlan | interfaces are routed; nothing applies before commit |
| ACL wildcard | access-list 10 permit 172.16.32.0 0.0.15.255 | 10 permit ip 172.16.32.0/20 any | 10 permit ipv4 172.16.32.0 0.0.15.255 any |
| OSPF on an interface | network 172.16.32.0 0.0.15.255 area 0 | ip router ospf 1 area 0.0.0.0 on the interface | router ospf 1 / area 0 / interface … |
| OSPF inter-area summary | area 1 range 172.16.0.0 255.255.252.0 | area 1 range 172.16.0.0/22 | area 1 / range 172.16.0.0/22 |
| DHCP relay | ip helper-address 192.168.10.226 | feature dhcp, ip dhcp relay address 192.168.10.226 | dhcp ipv4 / profile RELAY relay / helper-address vrf default 192.168.10.226 |
| NAT | ip nat inside, ip nat outside, ip nat inside source list … overload | feature nat first | CGN (CGv6), typically on service cards |
| IPv6 routing | ipv6 unicast-routing | no command needed | no command needed |
| IPv6 address | ipv6 address 2001:db8:acad:10::1/64 | the same | the same |
| static link-local | ipv6 address fe80::1 link-local | ipv6 link-local fe80::1 | ipv6 address fe80::1 link-local |
| verify | show ip interface brief, show ip route connected | show ip interface brief vrf all | show ipv4 interface brief |
| verify IPv6 | show ipv6 interface brief, show ipv6 route, show ipv6 neighbors on all three | ||
And the IOS-XE commands each section adds, by task:
| Task on IOS-XE | Command | § |
|---|---|---|
| masks as /n in show output | terminal ip netmask-format bit-count | 3 |
| subnet zero (default since 12.0) | ip subnet-zero | 5 |
| directed broadcasts off (default since 12.0) | no ip directed-broadcast | 7 |
| DHCP client · unnumbered link | ip address dhcp · ip unnumbered Loopback0 | 10 |
| stop classful summaries | no auto-summary (RIPv2, old EIGRP) | 2 |
| EIGRP summary | ip summary-address eigrp 100 172.16.0.0 255.255.252.0; named mode: summary-address under af-interface | 9 |
| OSPF external · BGP summary | summary-address 172.20.0.0 255.255.252.0 · aggregate-address 172.16.0.0 255.255.252.0 summary-only | 9 |
| IPv6 interface ID from the MAC | ipv6 address 2001:db8:acad:20::/64 eui-64 | 14 |
| IPv6 as a host | ipv6 address autoconfig · ipv6 address dhcp · ipv6 enable (link-local only) | 15 |
| RA flags | ipv6 nd other-config-flag (O) · ipv6 nd managed-config-flag (M) · ipv6 nd prefix … no-autoconfig (A = 0) | 14 |
| DHCPv6 server · relay | ipv6 dhcp server SALES-STATELESS · ipv6 dhcp relay destination 2001:db8:acad:99::547 | 14 |
| IPv6 site aggregate | ipv6 route 2001:db8:acad::/48 Null0 | 13 |
| hardening that exposes wrong masks | no ip proxy-arp | 16 |
The classic traps
- 172.16.0.0/12 ends at 172.31.255.255: 172.32.1.1 is public, and 100.64.0.0/10 is shared space, not RFC 1918.
- Addresses and hosts are different counts: a /26 has 64 addresses but 62 hosts, so 64 hosts need a /25. Subnets are 2s, not 2s − 2.
- The block counts in the interesting octet only: the broadcast of 172.16.45.200/20 is 172.16.47.255.
- A mask typed where IOS expects a wildcard is accepted without a warning and matches the wrong addresses.
::appears once; 0010 shortens to 10, never to 1; 2001:db8:: is documentation, fec0:: is deprecated.- EUI-64 flips bit 0x02, it does not set it: a MAC starting with 02 gives 00.
- A second
ip addresswithoutsecondaryreplaces the first; IPv6 hosts with only fe80:: addresses usually meanipv6 unicast-routingis missing. - A host always decides with its own mask; a wrong mask can work for weeks behind proxy ARP and fail the day
no ip proxy-arpis applied.
Where IP addressing appears at each exam
Indicative mapping, based on the public blueprints.
| Exam | What it covers from this page | Sections |
|---|---|---|
| CCNA 200-301 v1.1 | the core: IPv4 addressing and subnetting, private ranges, IPv6 addressing, prefixes and types (global, unique local, link-local, anycast, multicast, modified EUI-64), host IP parameters on Windows, macOS and Linux, NAT and DHCP relay | 1–16 |
| ENCOR 350-401 v1.2 | assumed knowledge behind OSPF, EIGRP, BGP and NAT/PAT: masks and wildcards, private and special space, summarization, IPv6 format and types for dual-stack designs | 3–7, 9, 11, 12 |
| ENARSI 300-410 | troubleshooting: summarization in EIGRP, OSPF and BGP, DHCP relay, DHCPv6 and SLAAC, IPv6 neighbor discovery, wrong masks and overlapping subnets | 2–5, 7–10, 12–16 |
| SPCOR 350-501 v1.1 | carrier-grade NAT and 100.64.0.0/10, IPv6 customer prefixes (/48, /56, prefix delegation), NAT64 and the transition prefixes | 6, 12, 13 |
| CCIE EI v1.1 | all of it at lab speed: VLSM and summary design inside routing tasks, dual stack with SLAAC and DHCPv6, troubleshooting by symptom | 2, 4–16 |
17.QCheck yourself: exam-style questions
A laptop is configured with 172.20.77.130/21. Which statement is correct?
- AIt is a private address in 172.20.72.0/21, broadcast 172.20.79.255
- BIt is a private address in 172.20.76.0/21, broadcast 172.20.83.255
- CIt is a public address in 172.20.72.0/21, broadcast 172.20.79.255
- DIt is a private address in 172.20.72.0/21, broadcast 172.20.77.255
Show answer
Which answer gives the RFC 5952 form of 2001: and its address type?
- A2001:db8::a0:0:0:1, a global unicast address routed on the Internet
- B2001:db8:0:0:a0::1, a documentation address
- C2001:db8::a0::1, a documentation address
- D2001:db8::a0:0:0:1, a documentation address
Show answer
A branch gets 10.1.4.0/24 and needs LANs of 60, 28 and 12 hosts plus one router-to-router link. The engineer allocates largest first, each block at the next free address. Which subnet does the 12-host LAN receive?
- A10.1.4.80/28
- B10.1.4.128/28
- C10.1.4.96/28
- D10.1.4.96/29
Show answer
R1's Gi0/1 is up/up with ip address 192.168.10.129 255.255.255.192, ipv6 address 2001:DB8:ACAD:20::1/64 and ipv6 address FE80::1 link-local. How many entries does Gi0/1 add to the IPv4 and IPv6 routing tables together?
- A2: one C route per protocol, since L routes exist only for loopbacks
- B6: the link-local FE80::1 adds its own C and L routes as well
- C3: C and L for the IPv4 /26, and only a C route for the IPv6 /64
- D4: C and L for 192.168.10.128/26, C and L for 2001:DB8:ACAD:20::/64
Show answer
show ipv6 route. L routes exist for every interface address; only an IPv4 /32 loopback gets its C route alone, and an IPv6 /128 loopback shows as LC.BR1 owns 10.20.0.0/24 to 10.20.5.0/24 and advertises ip summary-address eigrp 100 10.20.0.0 255.255.248.0 to HQ. BR2 owns 10.20.6.0/24, and its WAN link to HQ fails; HQ still has a default route toward its Internet edge. What happens to HQ's traffic for 10.20.6.10, and what is the right fix?
- AIt follows HQ's default route toward the Internet edge; no change is needed, because the summary only affects BR1
- BHQ drops it because no /24 for 10.20.6.0 is left; advertise 10.20.0.0/20 from BR1 instead
- CIt follows the /21 to BR1 and dies in BR1's Null0 route; advertise 10.20.0.0/22 and 10.20.4.0/23 instead
- DIt follows the /21 to BR1, which forwards it on its default route to BR2; advertise 10.20.0.0/22 only
Show answer
The full analogy: a city with a land registry
TL;DRA single story that covers everything you saw in sections 1–16, with the correspondence table and the places where the analogy breaks down.
One universe, taken all the way: a city with a land registry. The model holds closely up to §10; from §11 on the city moves to a planet-sized registry, and the comparison stretches (see where it breaks, at the end).
- The street and the house number
Every plot in the city has one long number of 32 binary digits, which people write as four groups (192.168.10.37). The registry reads it in two parts: the street, then the house number. A card attached to every deed says how many digits are the street; since the street always comes first, the card can be written as a single count, /25. When Anna, in house 37, posts a letter, she compares the street part of the address with her own, using her own card: same street, she walks over and knocks; another street, she drops it at the post office on her corner, and the postmen look only at streets, one line per street in their book. Gate clerks (ACLs, OSPF) use a stencil instead, with holes over the digits to compare. When the city was founded, land came in three fixed district sizes, told apart by the first digits: huge (A), medium (B) and small (C), plus a square for public announcements (D) and a fenced-off field (E). A firm of 300 people got a medium district and left 65,000 plots empty, so the city scrapped fixed sizes: every deed now carries its own card. Old maps still group streets under the old district names, and a few old postmen still announce whole districts, which misroutes mail when a district is split in two.
- The street sign, the town crier and the surveyor
On every street the first plot holds the street sign, which gives the street its name in the books, and the last one holds the town crier, who shouts a message to every house on the street. Neither can be a home, so a street of 128 plots has 126 homes. A lane between exactly two houses needs neither (a /31), and a kiosk with one number and no street around it is a street of one (a /32). When a developer needs more streets than he has, the surveyor takes digits from the house number and uses them for the street: every digit he borrows doubles the streets and halves the plots on each, and the streets start every block, so to find a plot's street you round its number down to the last corner.
- Room numbers and the reception desk
Inside office buildings, rooms are numbered from three reserved series, 10, 172.16 to 172.31, and 192.168. The same room numbers exist in thousands of buildings, so no city postman ever delivers to a room. When a letter leaves, the reception desk crosses out the room number in the return address, writes the building's street address, and notes in a ledger which room sent it, with a ticket number, so the reply finds its way back upstairs. A reception that forgets to swap sends out letters signed "room 37", and the city's first sorting counter throws them in the bin. Room 172.32 is not in the reserved series at all: it is a real house somewhere in the city. And when the city runs out of street addresses, the district opens a big reception of its own that swaps a second time, with corridor numbers from the series 100.64.
- Numbers that are not homes
Some numbers are on no map. "My own house" (127): a letter to it never leaves your hands. Tent numbers that people pitch for themselves on the field while the registry office is closed (169.254): neighbours on the same field can find them, but no postman delivers to a tent. "123 Example Street" (192.0.2, 198.51.100 and 203.0.113): printed only in textbooks. "Nobody yet" (0.0.0.0), the return address of a newcomer writing to the registry office for a number. And the shout "everyone on this street!" (255.255.255.255), which never goes round the corner. The newcomer's shout reaches the registry office only because the post office on the corner carries it there as a letter, and the post office no longer lets outsiders hire another street's crier.
- Streets of every size and the sorting office
A developer with one block and four needs, a big shopping street, a medium one, a small one and a lane, has the surveyor cut streets of different sizes. He cuts the biggest first, and each street starts on a corner that is a multiple of its own size, so nothing overlaps and the leftover land stays in one piece. Cutting the lane first would make the next street start mid-block, right across the lane, and the registry refuses that deed. Far away, the regional sorting office reads only the postcode, the leading digits that all four streets share: one line in its book for the whole quarter. The office always prefers a more detailed line when it has one, so a postcode drawn too wide looks harmless, until the neighbouring quarter's own line disappears: then the neighbour's mail goes to this quarter's office, which keeps a shredder for letters to streets that do not exist.
- The registry clerk
Before a post office can serve a street, the clerk registers its counter: the address, the card, and the door opened. The clerk refuses the street-sign plot and the crier's plot, a card with gaps in it, and a street that runs into one the same post office already serves; a second street on the same counter must be marked "secondary", or it replaces the first. Once registered, the post office's book gets two lines, one for the street and one for its own door. Clerks in other cities have their own forms: one writes the card as a count, another stamps nothing until you sign at the bottom.
- The planet-sized registry
Running out of plots, the world builds a new registry the size of a planet. Numbers are 128 digits long, written in hexadecimal in eight groups, with two shorthand rules: drop the zeros at the front of a group, and write one run of empty groups as a double colon, once. Every residential street is the same huge size, 264 plots, whatever lives on it, and nobody saves plots: a company receives a whole district of 65,536 streets, a home 256, and the streets are numbered on whole hex digits so the number itself says building and floor. Every house also has a yard name that is valid only on its own street, private estates use numbers starting with fd and a random estate code, and there are no town criers any more: messages go to mailing lists, one of them for every house-number ending. The old "district-local" numbers were abolished in 2004.
- Self-made house numbers, the noticeboard and the inspector
In the new registry a house usually picks its own number on the street: from the serial number of its front door, split in two with ff:fe in the middle and one digit flipped, or drawn by lot so it cannot be followed from street to street. Before moving in, it calls out "does anyone live at this number?". It learns the street name from the post office's noticeboard, which also says whether to ask the registry office for a number or only for other information, and the post office's yard name becomes its way to the rest of the planet. The post office puts up that noticeboard only once it is licensed as a post office; without the licence, houses know only their yard names. When something goes wrong, the inspector starts at the house: a resident with the wrong card who knocks on doors in other streets, long covered by a post office that answered for the neighbours; a street drawn twice by two surveyors; a street where nobody put up the noticeboard.
The correspondence table
| In the analogy | In IP addressing |
|---|---|
| the plot number, 32 binary digits | the IPv4 address (32 bits, dotted decimal) |
| the street part | the network part (prefix) |
| the house number | the host part |
| the card: how many digits are street | the subnet mask / prefix length /n |
| the clerk's stencil with holes | the wildcard mask (ACLs, OSPF network statements) |
| comparing streets with your own card | the host's AND with its own mask: on-link or off-link |
| walking over and knocking | ARP for an on-link destination |
| the post office on the corner | the default gateway (192.168.10.1) |
| one line per street in the postmen's book | the routing table: one route per network |
| the three fixed district sizes | classes A, B, C with the default masks /8, /16, /24 |
| the announcements square | class D multicast (224.0.0.0/4) |
| the fenced-off field | class E reserved (240.0.0.0/4) |
| every deed carrying its own card | CIDR (RFC 1519, now RFC 4632) |
| old postmen announcing whole districts | auto-summary at the classful boundary |
| the street sign | the network address (host bits all 0) |
| the town crier | the broadcast address (host bits all 1) |
| a lane between two houses | a /31 point-to-point link (RFC 3021) |
| a kiosk with one number | a /32: loopback or host route |
| digits borrowed from the house number | borrowed (subnet) bits: 2s subnets |
| the distance between two street corners | the block size, 256 − the mask octet |
| room numbers that repeat in every building | RFC 1918 private addresses |
| the reception desk that swaps the return address | NAT / PAT on the edge router |
| the ledger with ticket numbers | the NAT translation table, with ports |
| letters signed "room 37", binned | bogon filtering and BCP 38 at the ISP |
| the district reception, corridor numbers | carrier-grade NAT and 100.64.0.0/10 (RFC 6598) |
| "my own house" | loopback 127.0.0.0/8 |
| tent numbers while the registry office is closed | APIPA 169.254.0.0/16 (RFC 3927) |
| "123 Example Street" | the documentation ranges (RFC 5737; 2001:db8::/32 in IPv6) |
| the registry office | the DHCP server |
| the post office carrying the shout | the DHCP relay (ip helper-address) |
| the shout that never goes round the corner | the limited broadcast 255.255.255.255 |
| hiring another street's crier | a directed broadcast (dropped by default since IOS 12.0) |
| streets of different sizes, biggest first | VLSM |
| the postcode | the summary route (the common leading bits) |
| the regional sorting office | the router that receives the summary |
| the more detailed line wins | longest-prefix match |
| the shredder | the discard route to Null0 |
| the clerk refusing a deed | IOS checks: Bad mask, % … overlaps with … |
| two lines: the street, its own door | the C route and the L /32 route |
| the planet-sized registry | IPv6, 128 bits in hexadecimal |
| empty groups as a double colon | zero compression with ::, once per address |
| every street the same huge size | a /64 on every LAN |
| a district of 65,536 streets | a /48 site prefix |
| the yard name | the link-local address fe80::/10 |
| private estates, random estate code | unique local addresses fd00::/8 (RFC 4193) |
| mailing lists instead of town criers | multicast (ff02::1, solicited-node groups); no broadcast |
| the number from the door's serial | modified EUI-64 from the MAC |
| a number drawn by lot | random, stable opaque and temporary interface IDs (RFC 7217, RFC 8981) |
| "does anyone live at this number?" | Duplicate Address Detection |
| the noticeboard | the Router Advertisement (SLAAC, M and O flags) |
| the post office licence | ipv6 unicast-routing |
| a post office answering for neighbours | proxy ARP (RFC 1027) |
Where the analogy breaks
- Addresses belong to interfaces, not to buildings. A router has a different address on each of its doors, one per subnet, and an IPv6 host holds several at once (link-local, global, temporary). A house has one number.
- The street is not painted on the ground. The mask is each host's own setting, so two hosts on the same wire can disagree about where their street ends: Host B with a /24 inside a /26 LAN knocks on doors that are not on its street, and nothing in the network stops it.
- Real postcodes follow geography and can have any size. A summary only works on a power-of-two block that starts on its own boundary: 172.16.1.0 to 172.16.4.0 cannot share one postcode, whatever the map says.
- No real registry would give three houses a street of 18 billion billion plots, or accept a house that renames itself every day. In IPv6 both are normal: the /64 is about how SLAAC works, not about need, and temporary addresses change on purpose.
18.QCheck yourself: exam-style questions
In the city analogy, the first plot of every street holds the street sign and the last one holds the town crier. Which two addresses of the Sales LAN, 192.168.10.0/25, do they stand for?
- A192.168.10.1, the network address, and 192.168.10.128, the broadcast
- B192.168.10.1, the gateway, and 192.168.10.126, the last usable host
- C192.168.10.0, the network address, and 192.168.10.255, the broadcast
- D192.168.10.0, the network address, and 192.168.10.127, the broadcast
Show answer
In the analogy, an office building's reception desk replaces a room number in the return address with the building's street address and notes a ticket number in a ledger. What do the room number, the street address and the ledger stand for?
- AThe inside local private address, the inside global address and the PAT translation table
- BA public address, an RFC 1918 address and the DHCP binding table
- CThe inside global address, the inside local address and the ARP cache
- DA 169.254 link-local address, the default gateway and the routing table
Show answer
In the planet-sized registry, every house has a yard name that is valid only on its own street, and the post office puts up its noticeboard only once it is licensed. Which pair matches these two ideas?
- ASolicited-node ff02::1:ff00:0/104 groups, and Router Advertisements sent after ipv6 enable
- BLink-local fe80::/10 addresses, and DHCPv6 Advertise messages sent only when the M flag is set
- CUnique local fd00::/8 addresses, and DHCPv6 replies sent only with ipv6 dhcp server
- DLink-local fe80::/10 addresses, and Router Advertisements sent only with ipv6 unicast-routing