Skip to main content
p. 255

9.22 Private Networks (IPv4)

Say you decide to build your own network. You have your machines, router, and network hardware ready. Given what you know about a simple network so far, your next question is, “What IP subnet should I use?”

If you want a block of internet addresses that every host on the internet can see, you can buy one from your ISP. However, because the range of IPv4 addresses is very limited, this costs a lot and isn’t useful for much more than running a server that the rest of the internet can see. Most people don’t really need this kind of service because they access the internet as a client.

The conventional, inexpensive alternative is to pick a private subnet from the addresses in the RFC 1918/6761 internet standards documents, shown in Table 9-2.

Table 9-2: Private Networks Defined by RFC 1918 and 6761

NetworkSubnet maskCIDR form
10.0.0.0255.0.0.010.0.0.0/8
192.168.0.0255.255.0.0192.168.0.0/16
172.16.0.0255.240.0.0172.16.0.0/12

You can carve up private subnets as you wish. Unless you plan to have more than 254 hosts on a single network, pick a small subnet like 10.23.2.0/24, as we’ve been using throughout this chapter. (Networks with this netmask are sometimes called class C subnets. Although the term is technically obsolete, it’s still useful.)

What’s the catch? Hosts on the real internet know nothing about private subnets and won’t send packets to them, so without some help, hosts on private subnets can’t talk to the outside world. A router connected to the internet (with a true, nonprivate address) needs to have some way to fill in the gap between that connection and the hosts on a private network.