Today we’re going to talk about networking! What is the difference between a private IP and a public IP? When do you use one and when do you use the other? Why are there two types of logical IP addresses in the world of communications? See our explanation.
Basically, when devices are connected to a network, they need a configured IP address (either IPv4 (normally) to communicate. Regarding IP addresses, there are public addresses and private addresses. Most IP addresses are public , thus allowing our networks (or at least our router that borders our network and the Internet) to be publicly accessible via the Internet, from anywhere.
As for private addresses, it doesn't allow us direct access access to the Internet, however, such access is possible, but it is necessary to resort to NAT (Network Address Translation) mechanisms that translate our private address into a public address.
Private address ranges are:
- from 10.0.0.0 to 10.255.255.255 (10.0.0.0 /8)
- from 172.16.0.0 to 172.31.255.255 (172.16.0.0 /12)
- from 192.168.0.0 to 192.168.255.255 (192.168.0.0 /16)
Hence the addresses we often use 192.168.xx
By making an analogy with the telephone system, we can compare a public address to a phone/mobile number. This number is public, reserved, unique and uniquely identifies your telephone number.
Now imagine, for example, a company that owns a telephone switchboard. You know the extensions (private e.g.: 101, 302, 45) that you want to assign to the phones, but when someone from these extensions wants to call abroad or calls the operator to set up the call abroad (from a public number) or dial a prefix so that your exchange continues with the NAT mechanism, thus allowing your call to go out through a public number.
However, if you imagine that a friend wants to contact you from abroad, he will not be able to do so directly and in that case he will have to call the operator to forward the call. The private addressing I have on my switchboard may be the same as that of other companies. However, the public telephone number(s) (eg 232234567) that identify my company are unique.
Moving back to networks, we can say that machines on different networks can use the same private addresses and there is no regulatory entity to control the attribution, it is defined internally.
To allow multiple computers on the home or business network to communicate on the Internet, each computer had to have its own public address. This requirement places great demands on the pool of available public addresses, after creating the NAT mechanisms as previously mentioned.
Ox public addresses they are managed by a regulatory entity, are often paid and allow to uniquely identify a machine (computer, routers, etc.) on the Internet. The body that manages the public address space ("reputable" IP addresses) is the Internet Assigned Number Authority (IANA).
Obviously, we could have explained one more topic that usually has some complexity. But in this simple way you will also understand the utility of NAT, public and private addresses and, if you need, you can see in your router the area where the "magic" takes place.
If you need more clarification, you can leave your question in the comments and I will answer case by case and try to add details to the topic. You can also download here an interesting Cheat Sheets on the subject.