What is an IP address, subnet, and gateway?

656 views

Please ELI5.

In: Technology

8 Answers

Anonymous 0 Comments

Let’s go with the standard metaphor of an IP address being like your home address.

There’s four numbers in an IP address; imagine it’s formatted as country.city.building.apartment

If you want to send a note to someone in the same building, you can just go stick it under their door. If you want to send a note somewhere else, you go put it in the mailroom in the basement, and let them deal with it – they’ll send it to the right building, or to the postoffice to get it to the right city, who might in turn send it to the airport to get it to the right country – and so on back down the chain until it’s delivered to the right apartment.

Well, that works fine if everywhere’s the same, if there’s 256 different countries, each with 256 cities, each of which has 256 apartment buildings, each of which has 256 apartments. Whether you’re a resident, mailroom worker, postoffice worker or cargo pilot, you just compare each number of the address with your own, and you know who to send it on to.

But the world isn’t neat and tidy. There’s tiny single homes and vast sprawling apartment complexes. Tiny hamlets and vast megacities, flyspeck countries and ones spanning entire continents.

So one number per level isn’t a good fit. If there’s thousands of apartments in your building (or thousands of buildings your mailroom covers, or thousands of cities in your country, etc) you can’t just look at one number of the address to tell if it’s local.

Exactly how much do you have to look at? That’s the *subnet mask* – it tells you exactly how many (binary) digits of the address it needs to compare, to tell if an address is local to you.

And of course, once you start dealing with arbitrary-sized buidings/cities/countries, you can’t make assumptions about where your mailroom / postoffice / airport is, either. You have to know exactly *where* to send stuff that’s not local to you, in order to have someone else deal with it. And the address of that place is the *default gateway*.

You are viewing 1 out of 8 answers, click here to view all answers.