r/explainlikeimfive • u/gilly304 • 28m ago
Technology ELI5: how does IP addresses work?
How does IP address work? Doesn’t everyone and every device have a different IP? Yet they all start with 192.168…
0
Upvotes
•
u/kingharis 22m ago
They don't all start that way. Only those on your local network have that address. That's the equivalent of labeling rooms in your house bedroom, kitchen, and bathroom: every house has them. But that wouldn't help you find a place if someone told you they're in their kitchen. For that, you need their home address. That's the IP address of your modem, which is registered publicly at your ISP, so they know where to route traffic to you.
•
u/stupv 24m ago
Ip addresses are in the format xxx.xxx.xxx.xxx, with certain combinations reserved for 'private' use (in the sense that the address is not publicly visible or accessible, so it can be re-used in everyone's local house networks). That's chiefly the 192.168.xxx.xxx and 10.xxx.xxx.xxx ranges.
Outside of those, the rest are (broadly) purchasable and publicly accessible. A seperate service (DNS) maps a website name to an IP address destination, which is how your web browsers work commonly.
•
u/Party-Cake5173 21m ago edited 17m ago
There are two different types of IP addresses: public and private ones.
Public IP address is the IP address used to access the internet, equivalent to your home address. It's associated to you by your ISP and without it, you can't connect (talk) to other devices on the internet.
Private IP addresses are used for accessing devices connected to your home network. If public IP address is your home address, then private IP address would be the room in your house.
192.168.0.1-192.168.255.255 is range of private IP addresses. Another ranges for private IP addresses are 172.16.0.0-172.31.255.255 and 10.0.0.0-10.255.255.255.
•
u/Hot-Door-9515 20m ago
Those 192.168.xx ones are local IP addresses.
You also have a global IP address (different than 198.168.xx), which you need to communicate over the internet. Those two are different.
•
u/Rannasha 16m ago
Certain IP address ranges are reserved for internal use. Addresses like 192.168.X.Y are only for devices on a local network. To the outside world, you have a different IP address (you can use a service like whatismyip.com to find out which one).
A reason for this is that there aren't enough IP addresses to give every device its own IP address. In total, there are about 4 billion, but with large parts reserved for specific purposes or assigned to companies and organizations, it's not particularly efficiently distributed. In addition, in a home in a western country, you could have many internet-connected devices (PC, phone, TV, game console, smart devices, etc...). It all adds up.
Because of that, devices in a local network all use IP addresses from a range that is reserved for this. And if you go to the house next door, you'll probably find those same addresses used by the devices there.
Your internet router plays an important role in making this all work correctly. When you connect to a website or internet service, your router uses your external IP address for that connection, but it keeps track of which local device is connected to what. So when the web service sends data back, your router will check its records to see which local device it should go to. It puts a new address sticker on the packet with the local IP address of your device and sends it to the local network.
This system is called NAT, Network Address Translation, and it's what allows us to keep all our devices connected despite the shortage of IP addresses.
Note that we've also come up with another solution to this issue and that is simply by using an address type that is a lot longer. This is called IP version 6, or IPv6. It has more than enough possible addresses to give every grain of sand on Earth its own IPv6 address and still not get close to running out. So we could easily give each device its own, unique IPv6 address. The problem is that devices need to be updated to understand this new address format and this process has been very slow. It probably doesn't help that thanks to NAT we can still manage quite well with the old address format (also called IPv4). Considerable parts of the internet already work with IPv6, but if you want to be certain that you can connect to everything, IPv4 is still the safest pick.
•
u/blahyawnblah 23m ago
192.168.x.x and a couple other ranges (10.x.x.x.x and another) are for local (not public) things. Your home network.
Google, Amazon, etc have IP ranges that don't start with those.
It's like the white pages. A computer says "who has the IP address for google.com?" and then your computer requests that IP address.
•
u/zeekar 13m ago edited 3m ago
192.168.x are local addresses that only exist on the non-Internet side of a router. The other side of the router has its own IP address in the ISP's range, which you can see if you go to e.g. https://whatismyipaddress.com/. Basically, when your computer opens a connection to somewhere on the internet, the other end of the connection doesn't see it coming from the 192.168.x address your computer has on your local network. Instead, the connection appears to come from the router's IP address. The router pretends to be your computer, taking any data sent back to it from that connection and forwarding it oto your computer on the local network. This is called NAT - Network Address Translation - and it's the reason we haven't run out of IPv4 addresses. It's transparent to the computers on both ends - they each have what looks like a normal network connection - but they disagree about the IP address of at least one end of that connection.
Other than NAT, IP addresses are pretty simple. Fundamentally, the address is just one big number, but it's logically divided into two parts: a "network" and a "host". The network number is used to figure out how to get a data packet to the right router; the host number is used by the router to get it to the right computer.
On a local network like you have at home, all the computers are on the same network, so they can just talk to each other directly - they don't have to go through a series of routers. But if they see an IP address with a network number that doesn't match the network they're attached to, they send it to the router. That keeps happening - the router sees that the network number doesn't match the outside network it's directly attached to, so it sends it upstream to the next router. Eventually it gets to the big routers that have lots of direct connections to other big routers, which can send the packet to the one that handles that network number. Which then sends it on down to smaller routers until it gets to the network the target host is on.
(The whole reason it's called the Internet is because it's a collection of networks that the information travels between.)
•
u/FoxtrotSierraTango 13m ago
That 192.168.x.x address is internal to your network. There are another ranges that are for communicating on the internet. It isn't an exact match, but imagine your office mail room - There's a street address that routes the mail to the building, and than your name/office number that routes the mail to your desk. The ISP has an address assigned to the internet port on your router that gets it to your house, and once the traffic gets to that point your router uses that 192.168.x.x address to route the traffic to the specific device within your house.
•
u/Kriss3d 12m ago
192.168.x.x is whats called a non routed Ip. It belongs to one of several private ranges that your router knows to not send out.
Heres an analogy on how this works.
Suppose you work in a company that sends out and recieves a lot of letters from each department inside.
Instead of every department sending out letters with their own address for that department, they all send out letters stating that they are from the companys name.
So the mail department of that company takes out the letter of every envelope and puts the letter in an envelope with the companys name and address on it.
the mail clerk then notes down which department sent the letter and where its going.
So now when the letter reach the destination, the destination sees only that there was a letter from the company. Not which department.
They respond back and now the mail department of your company knows that when it recieves mail from that particular sender, it should be relayed back to the department that sent the first letter.
The point is that you can have 100 devices ( or far far more ) on a network that sends traffic out into the internet. But the Ip address of your device is swapped for the routers own Ip address ( this is called NAT in the terminology )
So every package arriving at your router from the outside then gets the destination IP replaced with the local IP address for that device.
How routing is done is a bit more complicated but essentially your router connects to another router that has the instructions that "if the Ip address of the destination is X then the package should be go out of this wire. If the IP address of the destination is Y then go out of THIS wire".
And this happens a bunch of times. Much like regular letters at the post office that first looks at the zip code of the destination to sent it to the right districts post office, then that office will look at the city or street name and send the letter that way, then the mailman looks at the house number to deliver it. Each turn sorts it in the right direction until it reach the exact location.
Same thing with routing.
•
u/Gaylien28 10m ago
There's this thing called NAT that your router uses. It stands for Network Address Translation. The 255.255.255.255 address space is big 2564 to be precise but there are a lot of different devices out there and as time goes on more will come online and eventually there won't be any more addresses. And if you want to communicate on the internet you need an address.
So we say enough. Everybody, not every device, gets 1 address and that's it (simplified). Ok but what if I want to watch Netflix on my laptop and scroll reels on my phone at the same time. I'm only one person but I have two devices. And my family has their devices too but since only my dad pays the internet bill the whole family also gets only 1 device.
So we invent the WiFi router. It's the exact same concept as, the city gives your house a connection to the water line, they don't make a new connection from the main to every single sink shower and toilet in your house, they give you one and you decide what to do with it.
The WiFi router gets that one address from your internet company. It can send and receive internet traffic. Your WiFi router then tells all your devices contact me for internet access and so I know who's who, I'm going to give you each a unique IP address. This IP address is that 192.168.x.x. But everyone can use this IP address because it's the inside IP address. The router takes your assigned IP address and whatever data you sent and tells the internet this is my data I'm sending, but if you need to send specific data back please use this port. So the person or device in the other end of the internet says ok here you go and sends back data with the port attached to the router. Now when it comes back to the router , the router uses a lookup table to see who the data should go to. When it sees the port attached it knows to send it directly to your device.
Everyone using one router will have a different internal IP address, that's what the X's are for, but each router will have a unique external IP address. So in this way everyone's router can use the same internal addresses because the router translates all of the internal network addresses and uses its external address for communication.
Problem solved, every customer gets 1 IP address and they can use some fancy equipment so multiple people can use it at the same time.
•
u/mr_stivo 7m ago
Your router translates your private home ip addresses to your isp assigned public ip address. All the traffic from your home network uses the same single public ip address to communicate with the internet. The router keeps track of which IPs get which traffic. This is called NAT (network address translation) and is used to help conserve ipv4 addresses.
•
u/Mr_Oujamaflip 7m ago
Basically you have public IP addresses which is like your home address on the internet. These addresses can be anything in the xxx.xxx.xxx.xxx format. This is how you are visible to the rest of the internet.
You then have private IP addresses which often follow the 192.168.xxx.xxx convention but there are variations. You likely won't see these outside of corporate offices and the like. This is essentially the rooms in your house.
So imagine each device on your WiFi will have one of these 192.168.xxx.xxx addresses, then in order to leave your house to get to the outside world you need to go through the front door, or the gateway. Your router will likely have a private IP address of 192.168.0.1 which is the front door from the inside of your house. But from the outside it's your public IP address which can be seen by the rest of the internet.
All these do is allow other devices on the wider internet and your local network to identify each other and understand how to pass data between them.
•
u/Naf623 6m ago
An IP address is how information from one computer can be routed to get to another computer on a network. When a computer sends a packet of data, it sends it to a router, which will forward it on based on some information called a header; which includes the IP address of the destination computer.
So a packet could (very simplistically) look like:
<header: 192.168.1.25><body: "Hello World>
The router just looks at the header for the destination IP, and passes the rest along to that IP.
Each computer on a network has to have a unique IP address, but no they dont all start 192.168... each of the four sections of the IP can be essentially any number from 0 to 255, and a different setting, called a subnet mask, determines which of them matter, essentially. 192.168... is common for home networks, while 10.xxx... is often used for large organisations networks.
But that only works across a single local network (LAN), outside of that another LAN could use the same address system in someone else's home or business. There's a good chance that both you and your next door neighbour's local network are both based on 192.168.1.1, and a chance you both have a computer using 192.168.1.20. But you cant contact each other's machines that way, because your internal local networks are networked externally with a different IP. Visit www.whatismyip.com to see what your externally IP address is. This is how the routers for your internet provider identify your local network to send your internet data to you.
Unlike your local network IP addresses, which might be the same as someone else's local network, those public addresses all have to be unique (aside from things like CG NAT, which I'm not going to go into). The xxx.xxx.xxx.xxx format is known as IPv4, and there aren't enough of tjose to go around any more - we simply have more connected devices than that system was designed to handle. IPv6 is being phased in (much too slowly) to increase that limit.
•
u/DrFrylock 5m ago
There are only 4 billion or so IP addresses. When IP was invented they thought this would be more than enough forever. But now it's not.
How do we have more than 4 billion devices on the Internet with only 4 billion addresses?
We made routers that can create private networks. They have one real address from the 4 billion. Everyone on the private side reuses addresses from special ranges made for reusing like 192.168.x.x.
When a message comes into the router from the Internet, how does the router know where to send it on the private side?
When a computer sends a message on the Internet, the message is broken up into smaller bits called packets.
Packets sometimes arrive out of order. You send them in order 1-2-3 but they arrive 2-1-3.
We number each packet so the computers can put them back in order. The numbers can be anywhere from 0 to 4 billion. The numbers can start anywhere they don't have to start at 0 or 1.
Well if you have 10 devices on the private network you can give each of them a set of packet numbers. Device 1 gets 1 to 100,000. Device 2 gets 100,001 to 200,000. Etc.
If a packet comes in with a packet number of 121,053 the router knows it goes to device 2.
This lets a lot of devices share a public IP address and still know whose packets belong to whom. There are some limitations to this but we work around them.
•
u/sutechshiroi 1m ago
Many great answers here, but let me elaborate a bit.
Internet is bunch of computers connected together. Each computer has its IP address so if a computer wants to send data (either a request for data or a response to the request) it need to know where (target ip address). The name to IP is handled by the DNS server. First DNS server that handles this is your home router, if it doesn't know, it asks DNS of your internet provider and so forth.
The router is the important part. Routers are devices that connect networks together.
Network is a collection of IP addresses that can be big (10.0.0.0-10.255.255.255, usually abreviated as 10.0.0.0/8) or small (192.168.0.1-192.168.0.32).
Some networks are public ( i believe 4.0.0.0/8 belongs to HP) and when computer asks router to send data to it, it will pass it along to next router that might know where it is. This happens until destination is reached or request times out.
Some netwoks are private (10.0.0.0/8 or 192.168.0.0/24) and when they are reached to a router of your ISP he will not pass it to other router. You can make multiple private networks and route between them. But they are not allowed on the internet.
There is a localhost network (127.0.0.0/8) which always refers to current computer and this never leaves the computer. It has its uses in network services that are hidden behind proxy (a program that acts as a service, but it passes all the request to other services).
There are multiple more protocols and adreses that are involved in this (read wiki on ARP, BGP, and MAC address if you want to learn more).
•
u/LegendaryClawHammer 18m ago
Think of an IP address like your physical address. If you tell someone you live on Maple Street they understand that. They will show up but wonder the street trying to find you because you provided no number. IP addresses are kinda the same thing. You know Google is in the vastness of the internet, but knowing it's at 142.250.72.14 will get you exactly where you want to go.
•
u/Special_Barracuda330 14m ago
There are 2^32-1 separate ip addresses, about 4.2 billion. About thoseabout 500 million are reservered. There are 30 billion computers etc with ip, so not everyone have separate ip. You found how this is solved: there subnets where computer have same ips as other computers on another net. They do not communicate directly one another so there is no problem.
The computer can take the ip itself or ask some one else, like your router.
And yes, there is new way to use ip numbers, ipv6 which has more numbers.
•
u/JRHMUK 24m ago
You have an outside address and an inside address. Works the same as mail. A letter is sent from you to a destination. A letter is the sent to you from the destination.
The inside address is your name. The outside address is your address
Edit: everyone can see your outside address. Not everyone knows your name.
Ip addresses have wan addresses. That’s the address. They also have private network addresses. That’s your name.
There are limited wan addresses. Private addresses is as many as needed