What are Public and Private IPs?

An IP (Internet Protocol) address is a unique address that identifies a device on the internet or a local network.

 

Learning Objectives

After reading this article you’ll understand:

  • Public and Private IP Addresses

  • Static IPs

  • Dynamic IPs

  • Shared IPs

 

Introduction

A private IP address is used within a private network to connect securely to other devices within that same network. A public IP address identifies you to the wider internet so that all the information you're searching for can find you. Each device within the same network has a unique privateIP address.

Public and Private IP Addresses

An IP (Internet Protocol) address is a unique address that identifies a device on the internet or a local network.

Just like your home address identifies your house on the map.

When it comes to sending and receiving data, you need to know who to send the data to and the receiver needs to know who sent the data.

Just like when you send someone a letter and you have to write your details as a sender and the details of the person that you are trying to reach.

IP addresses can be Public or Private. With the examples above, the IP address would be public, because you know who the sender and receiver is.

Since the beginning of the internet, the number of users has exploded. Internet Protocol version 4 (IPv4) has a limit of 3,706,452,992 public addresses. Since everything from phones, cars, and smart devices needs one, they have become scarce. That is where Private IPs come into play. Private IPs cannot reach the Internet as many devices have the same Private IP (e.g 192.168.0.1), so if you tried reaching the internet, you would simply not be allowed as there would be no way to distinguish your device from millions of other devices that have that same IP.

As an example, Private IP would be like your friend trying to send a letter to 'John’s Apartment', a postman would have no clue where to deliver the letter as there are thousands of Johns in the city. Instead of having Public IP for each of your devices, you can have one device with Public IP (such as your router), and all other devices that are connected to your router will have Private IPs. So when you want to reach the internet, you send information to your router and the router uses its Public IP to send data to the internet along with some details of your device. Then data from the internet gets sent back to your router and the router will send data to your device.

A good example would be the post office (PO) box. Maybe you change your apartment every few days, weeks, or months, which means your address changes frequently. When you have your own post office box, instead of receiving goods or letters to your actual house address, you get them in your own personal post office box which has its own fixed address that never changes. Then you can ask the postman to deliver some of these items from your PO box to your current apartment or somewhere else. That way you do not need to reveal your house address (which might have changed already because you moved out) to whoever is sending you something, but you still get all the things delivered.

Essentially, a router is like a PO box, it has a Public address and once it receives something it acts as a 'postman' and delivers that data to whichever place is needed.

Static, Dynamic, and Shared IPs

Internet service providers (ISPs) provide you with internet access by giving you a Public IP in one way or another. There are three types of public IPs that you can have and each of them differs from the other.


Static IPs

The public IP address can stay the same all the time, which means that it is Static. Because of that, your device can be associated with that IP and reaching it is really easy as the IP is always the same. However, it can be more insecure as static IP is associated with one and only device which can help hackers target you more easily.

Dynamic IPs

IP can also be Dynamic, which means that it changes once in a while (when you reconnect to the Internet, ISP decides to change it periodically, etc.). That is a bit of an issue, as you have to know your device’s IP each time before connecting to it. However, it is more secure as your IP changes from time to time, therefore, hackers cannot target you as easily.

Shared IPs

And there are Shared IPs, which means that your ISP becomes like a router and it has the Public IP that it uses to get your data to and from the internet. Just like you can have many devices connected to your router, an ISP can have many routers connected to it and becomes a main router to the internet. That means that you have the same Public IP as your neighbour and many other people around your apartment and city.

Shared IPs are the cheapest and provide some security benefits as it is harder to identify the specific customer using them.

Conclusion

Public IPs are necessary for accessing the internet. There are three types of Public IPs and each one of them has its advantages and disadvantages. For daily use, the type of IP does not really matter as you still get access to the internet. For companies that want to host something and access something remotely, static IP is the best option as it stays the same all the time, so there are no additional inconveniences.