IPv4 addressing · Introduction · Module 2
Private, public and broadcast: how far an IPv4 address reaches
Show topologyHide topology
Interfaces and addresses · Et = Ethernet; .1 = the end of the address after the network in the first column (.1 on 192.168.1.0/24 is 192.168.1.1)
- 192.168.1.0/24R1 Et0/0 .1H1 eth0 .10
- 203.0.113.0/24R1 Et0/1 .2R2 Et0/0 .1
- 172.16.0.0/16 through SW1R1 Et0/2 .1.1R3 Et0/0 .2.3R4 Et0/0 .3.4
- 10.0.34.0/24R3 Et0/1 .3R4 Et0/1 .4
At the top: R2, the provider router. Under it, R1, the office router, joined to R2 by a cable labeled 203.0.113.0/24. Left of R1 and a little higher: H1, a host, joined to R1 by a slanted cable from under the laptop, labeled 192.168.1.0/24. Under R1: the switch SW1, joined to R1 by a cable labeled 172.16.0.0/16. Under SW1, R3 at the left and R4 at the right, each a router with one cable to SW1, and a cable between them labeled 10.0.34.0/24.
What private and public addresses are
Addresses for inside and for the internet
Private and public addresses
H1’s IPv4 address, 192.168.1.10, names one interface, yet many other organizations can use it too. How?
It works because addresses differ in how far they are meant to reach. Some reach only inside one organization, others across the whole internet.
H1’s address is a private address, an address from one of three ranges set aside for use inside an organization.
Many organizations can use these ranges, each inside its own networks. A private address is unique only inside its own organization.
| Private range | In this topology |
|---|---|
| 10.0.0.0 to 10.255.255.255 | 10.0.34.0/24, the link between R3 and R4 |
| 172.16.0.0 to 172.31.255.255 | 172.16.0.0/16, the network through SW1 |
| 192.168.0.0 to 192.168.255.255 | 192.168.1.0/24, H1’s office network |
Addresses that start with 10, or with 172.16 to 172.31, are as private as those that start with 192.168.
If an address starts with 172, check its second octet. The middle range ends at 172.31.255.255, so 172.32.0.1 is outside it.
A public address is unique on the whole internet. An organization that needs such addresses gets them from an internet registry.
Inside its own organization, a private address works like any other. Of the four networks in this topology, all but the provider link use them.
Because many organizations can use the same private address, on the internet it would not tell which of them a packet is for. So packets with a private address should not cross from one organization to another.
The provider link between R1 and R2 uses 203.0.113.0/24, a range set aside for examples. Here it stands in for the public range a provider would give R1 (Figure 2.1).
The network: R2 at the top, R1 under it, H1 to the left of R1 and a little higher, the switch SW1 under R1, and R3 and R4 under SW1. Each network is labeled once, beside one of its cables, with its kind written next to the label. 192.168.1.0/24 between H1 and R1: private. 172.16.0.0/16 between R1 and SW1: private. 10.0.34.0/24 between R3 and R4: private. 203.0.113.0/24 between R1 and R2: “stand-in public range”, highlighted.
Where the ranges came from: address classes
Why are the private ranges shaped like this: one large range, a middle one and a small one?
They follow an older rule, from 1981. Under it, the first bits of an address fixed how long its network part was, so the first octet alone told where the network part ended. The group an address fell into was its address class.
Write the first octet as eight bits. An address whose first bit is 0 was class A. The bit worth 128 is then 0, so the first octet runs from 0 to 127, and the network part was one octet.
First bits 1, then 0, made class B, with first octets from 128 to 191 and a network part of two octets. First bits 1, 1, then 0 made class C, with first octets from 192 to 223 and a network part of three octets.
That is why the three ranges differ in size: each is built from whole networks of a single class, A, B or C. The 10 range is one class A network; 172.16 to 172.31 is 16 class B networks; 192.168 is 256 class C networks (Figure 2.2).
A bar for the first octet, from 0 at the left, with marks at 128, 192 and 224. It is split into class A from 0, class B from 128, class C from 192, and a gray rest from 224. Under the bands: network part one octet, two octets, three octets. Under them, the private range inside each band: 10 under A, 172.16 to 172.31 under B, 192.168 under C. A note reads “224 and up: not class A, B or C”. A highlighted box at the foot reads “Today the mask sets it: 10.0.34.0/24 on R3–R4”.
Classes are history. Today the first bits of an address do not tell you its mask.
A first octet of 10 once meant a network part of one octet. On the link between R3 and R4, 10.0.34.0/24, the /24 mask makes it three octets.
Key idea
The old classes explain the shape of the private ranges, but today the mask sets the network part.
How it works
One network, one broadcast
R3 wants to test every device of 172.16.0.0/16 with a single packet. Which address does it send to, and how far does that packet travel?
One packet sent to every device of a network at once is a broadcast, and it needs an address that means “all of them”.
The network address has every host-part bit set to zero. The broadcast address is its opposite, with every host-part bit set to one. Like the network address, it names no single device.
Take 172.16.0.0/16, the network R1, R3 and R4 share. Under /16 the host part is the last two octets. An octet of all ones is 255, so the host part becomes 255.255 and the broadcast address is 172.16.255.255.
There is one more broadcast address, 255.255.255.255, the all-ones address. It reaches every device of the network it is sent on, whatever that network’s number is. A router must not pass it on to its other networks. R3 is in two networks, and R4 shares both of them. So when R3 sends to 255.255.255.255, R4 answers on each, R1 answers only on 172.16.0.0/16, and no device beyond them answers.
All the devices that one broadcast can reach form a broadcast domain. In this topology, each broadcast domain ends at a router.
Step through Figure 2.3 to see where a broadcast from R3 and one from R2 stop.
Step 1 of 7
R3 tests every device of 172.16.0.0/16, one of its two networks, at once.
Step 2 of 7
R3 addresses the packet to 172.16.255.255, the broadcast address of 172.16.0.0/16.
Step 3 of 7
R3 sends one packet. SW1 brings it to every other device of the network, R1 and R4.
Step 4 of 7
R1 and R4 both answer. One packet has reached every other device of R3’s network.
Step 5 of 7
R2 sends to the all-ones address, 255.255.255.255, meant for every device of R2’s own network.
Does R2’s broadcast reach R3?
- Yes. A broadcast goes to every device everywhere.: A broadcast to 255.255.255.255 is not forwarded outside the network it is sent on. R3 has no address on the provider link, where R2 sent the packet.
- Yes, but only to R3, the next router.: From R2, the next router is R1. R3 lies beyond it, outside R2’s network.
- Only if R3’s address is private.: Whether an address is private has no bearing on where a broadcast goes.
- No. R1 does not pass the broadcast on. (Correct): 255.255.255.255 means every device of the sender’s own network, and R2 sends it on the provider link. A router must not pass 255.255.255.255 on to its other networks, so the broadcast ends at R1.
Step 6 of 7
R1 answers R2. A router must not pass 255.255.255.255 on, so R1 does not pass it on to 172.16.0.0/16 or to any other of its networks.
Step 7 of 7
Each of the four networks is one broadcast domain, with a router at its edge.
The network, drawn as in the topology. Step 1 highlights R3. Step 2 adds a message box at the top left: “R3: to 172.16.255.255”. Each packet is a short arrow beside its cable. Step 3: an arrow from R3 up to SW1, then arrows from SW1 to R1 and to R4. Step 4: in their places, arrows from R1 and R4 back through SW1 to R3. In step 5 the arrows of R3’s broadcast are gone; the box reads “R2: to 255.255.255.255”, and one arrow runs from R2 down to R1. Step 6: in its place an arrow from R1 back up to R2, a cross beside each of R1’s other cables (to SW1 and to H1), and the box reads “R1 does not pass it on”. Step 7: no arrows; a dashed frame around each network, four in all, each ending on the router icons where that network’s cables meet them. Domain 1: H1 and its cable, to R1’s left side. Domain 2: R2 and its cable, to R1’s top. Domain 3: SW1 and its three cables, to R1’s bottom and the tops of R3 and R4. Domain 4: the cable between R3 and R4, to the side of each. R1 is on the edge of three frames. The message box reads “Four broadcast domains”.
Answer here to see step 6, or tap “Skip, show me”.
How can you see which devices answer a broadcast? With the command ping, which sends five test packets to an address.
R3 tests every device of 172.16.0.0/16 at once.
Only R1 and R4, the other devices of R3’s network, answer.
R3#ping 172.16.255.255Type escape sequence to abort.1Sending 5, 100-byte ICMP Echos to 172.16.255.255, timeout is 2 seconds: 2Reply to request 0 from 172.16.1.1, 1 msReply to request 1 from 172.16.1.1, 1 ms3Reply to request 1 from 172.16.3.4, 1 msReply to request 2 from 172.16.1.1, 1 msReply to request 2 from 172.16.3.4, 1 msReply to request 3 from 172.16.3.4, 1 msReply to request 3 from 172.16.1.1, 1 msReply to request 4 from 172.16.1.1, 1 msReply to request 4 from 172.16.3.4, 1 ms
- The five test packets. Each line below is one reply to one of them.
- A reply from 172.16.1.1, R1’s address.
- A reply from 172.16.3.4, R4’s address.
R2 tests the all-ones address.
Only R1 replies. A router must not pass 255.255.255.255 on, so R2’s broadcast stays in R2’s own network.
R2#ping 255.255.255.255Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 255.255.255.255, timeout is 2 seconds: 1Reply to request 0 from 203.0.113.2, 1 msReply to request 1 from 203.0.113.2, 1 msReply to request 2 from 203.0.113.2, 1 msReply to request 3 from 203.0.113.2, 1 msReply to request 4 from 203.0.113.2, 1 ms
- A reply from 203.0.113.2, R1’s address on the provider link. Every reply comes from this one address.
Key idea
A network’s broadcast address has every host-part bit set to one, and 255.255.255.255 stands for the network it is sent on. Here, the routers mark where each broadcast stops.
Verify
Read R1’s interface list
R1 sits between the office and the provider. How do you find which of its addresses is not private?
List R1’s interfaces and check each address against the three private ranges. show ip interface brief lists every interface of the router with its address, and unassigned in the address column means that the interface has no address.
So R1 shows four interface lines but three addresses: Ethernet0/3 is listed as unassigned.
R1 lists its interfaces.
Tap a line, or “Not in the output”, then submit.
Find the interface whose address is not in a private range.
R1#show ip interface brief1Interface IP-Address
Scroll sideways to see the whole output
R1 has three addresses: two private, and one from the example range on the provider link.
- The column names: the interface, then its address.
- Private: the 192.168 range, H1’s network.
- Not private: the provider side, the link to R2.
- Private: the 172.16 to 172.31 range, shared with R3 and R4.
- Ethernet0/3 is
unassigned: no address, so it is in no network.
Full output · 5 lines
R1#show ip interface briefInterface IP-Address OK? Method Status ProtocolEthernet0/0 192.168.1.1 YES TFTP up up Ethernet0/1 203.0.113.2 YES TFTP up up Ethernet0/2 172.16.1.1 YES TFTP up up Ethernet0/3 unassigned YES unset administratively down down
Scroll sideways to see the whole output
Key idea
Addresses that start with 10, 172.16 to 172.31, or 192.168 are private. Any other address on the list is not.
Check
R3 lists its interfaces.
Tap a line, or “Not in the output”, then submit.
Find the interface whose address was class A under the old classes.
R3#show ip interface briefInterface IP-Address
Scroll sideways to see the whole output
Full output · 5 lines
R3#show ip interface briefInterface IP-Address OK? Method Status ProtocolEthernet0/0 172.16.2.3 YES TFTP up up Ethernet0/1 10.0.34.3 YES TFTP up up Ethernet0/2 unassigned YES unset administratively down down Ethernet0/3 unassigned YES unset administratively down down
Scroll sideways to see the whole output
Summary
The network, drawn as in the topology, with no arrows. A dashed frame surrounds each network, four in all, each ending on the router icons where that network’s cables meet them. Domain 1: H1 and its cable, to R1’s left side. Domain 2: R2 and its cable, to R1’s top. Domain 3: SW1 and its three cables, to R1’s bottom and the tops of R3 and R4. Domain 4: the cable between R3 and R4, to the side of each. R1 is on the edge of three frames. The message box at the top left reads “Four broadcast domains”.
- Three ranges are private: 10, 172.16 to 172.31, and 192.168. Many organizations reuse them, each inside its own networks.
- A public address is unique on the whole internet; a private address is unique only inside its own organization.
- The old classes fixed the network part by the first octet. Today the mask sets it.
- A broadcast reaches every device of one network. It goes to the network’s broadcast address, host part all ones (172.16.255.255 for 172.16.0.0/16), or to the all-ones address 255.255.255.255, which a router must not pass on.
- On R1,
show ip interface brieflists the interfaces and their addresses.