Public and private IP

One IP outside, many inside Β· Part of Networking and infrastructure

Key idea

Practice

6 questions Β· about 3 min

Explained step by step

Private IP

Think of a building: it has one street address, but inside each apartment has its number (1A, 1B, 2A). The public IP is the building's address: the one the rest of the internet sees. Private IPs are the apartment numbers: they only work inside your home. The provider gives 1 public IP to the router, and the router gives a private one to each of your 5 devices.

Private IPs are like apartment numbers: there's a '1A' in thousands of buildings and nothing breaks, because each one only counts inside its building. There are ranges reserved for this, like those starting with 192.168: no device on the internet uses them as a public address. So millions of homes use 192.168.0.10 at the same time without clashing, and they save public addresses, of which there are only about 4.3 billion.

Not every number works as a private IP: there are ranges reserved only for inside networks, and the most common one at home starts with 192.168. It's like an office's extension numbers: 204 works for calling inside the building, but if you dial it from the street it reaches nothing. An IP like 8.8.8.8, on the other hand, is public: anyone on the internet can reach it. Just from the first numbers you can tell if an IP is inside or outside.

Public IP

From the outside, your whole home is one public IP, the router's. If 5 devices visit Google at once, Google sees 5 requests coming from the same address, for example 190.64.1.20. The router notes which request came from which device, like a doorman who receives the building's packages and knows which apartment each goes to. That's why blocking a public IP shuts out everyone who shares it.

A public IP has to be unique across the whole internet, like a phone number: if two homes had the same one, the call wouldn't know where to go. That's why public IPs are handed out by organizations and providers, and each one belongs to a single router or server at a time. IPv4 gives about 4.3 billion addresses, and there are more than 15 billion devices. Sharing one public IP among all the devices in a home is one of the ways to make them last.

Router

The router is the box that connects your home to the internet, like a building's doorman. Inward, it hands a private IP to each device that connects: 192.168.0.10, 192.168.0.11 and so on. Outward, it talks to the internet using the home's single public IP. When an answer comes back, it checks its notes to see which device it belongs to and hands it over.

Terms in this lesson

Arki, the beaver mascot

Your next interview starts with 5 minutes today.

Free on iOS and Android. Start from zero, no account needed.

Key idea

One IP outside, many inside