Skills / Networking fundamentals / IP addresses and subnets

Networking fundamentals, lesson 2 of 8

IP addresses and subnets

Every device on a network, whether a laptop, phone, printer or server, needs an IP address so data can reach it, just as a letter needs a postal address.

IPv4 addresses look like 192.168.1.25: four numbers from 0 to 255, separated by dots. There are only about 4.3 billion of them, not enough for every device on Earth, which led to two solutions:

  • IPv6, a newer, much larger address system, written like 2001:db8::1
  • Private addresses used inside homes and offices, shared behind one public address

Private vs public. These ranges are reserved for private networks and never appear directly on the internet: 10.x.x.x, 172.16.x.x to 172.31.x.x, and 192.168.x.x. Your router gives devices private addresses, and uses NAT (network address translation) to let them all share the single public address your internet provider gives you.

Subnets. A network is defined by an address range. 192.168.1.0/24 means the first 24 bits (the first three numbers) identify the network, so devices from 192.168.1.1 to 192.168.1.254 are on the same local network and can talk directly. The /24 is the prefix length; the older way of writing it is a subnet mask of 255.255.255.0.

How devices get addresses. Usually automatically, from a DHCP server (often built into the router), which also tells them the default gateway: the router that leads to other networks and the internet.

On your computer, run ipconfig (Windows) or ip addr / ifconfig (Mac and Linux) to see your own address.

Try it: Find your computer's IP address and your router's address (the default gateway). Is your computer's address private or public? Which range is it in?

Check yourself

1. Which of these is a private IP address?

2. What does NAT let a home network do?

3. Which service usually gives devices their IP address automatically?