7. NetworkingNAT and subnets
NAT and subnets
A subnet is a block of IP addresses that belong together on one network, and NAT is the trick that lets many devices share a single public address. An IPv4 address is 32 bits; a subnet mask, written like /24, says how many leading bits identify the network, with the rest numbering the individual hosts, so a /24 holds 256 addresses. NAT, or network address translation, is what your home router does: your devices have private addresses, and when they go online the router rewrites outgoing packets to use its one public address, remembering which reply belongs to which device. It’s a big part of why the world hasn’t run out of IPv4 addresses.
In this lesson: A subnet calculator and a NAT translation table.