Have you ever written an application or website hosted locally on your personal laptop and works fine but the moment you move outside your local network you get this error, This site can’t be reached?
You might think that you are using the private IP and to switch to the public IP and then if you still get the same error you must read this article to know the reason, why you get such kind of error.
Understanding Router and Port Forwading
When you hook up to the modem you will get one IP address and that IP address is the public IP address, and you are identified to the entire internet with this IP address.
If you host an application on this IP address, they can consume your application anywhere on the internet, because it's a public IP address.
These days you have multiple devices and your local network, so you cannot assign a public IP address for your phone, Mac, your TV, and your PlayStation. So you connect it to a router and the router serves multiple purposes, here at first it is the one that connects you to the internet. The router is technically the machine that gets the public IP address right, and the rest of your network will become an internal local area network LAN.
Now coming to our reason we get such an error, because of the port forwarding. If someone forwards the request via 8080 to your website, in such cases, your router will not identify the application that you get through the 8080 and will not reach up to your page, showing an error to the user, in such cases you need to make your router to accept the entire request that comes from the port 8080. One way to route your application here is to do port routing.
Find Private IP address
To find the IP address, you need to go to start run and type in CMD. This opens up a command prompt and in your command prompt type in the following command.
$ ifconfig
This command will get your IP and this is your private IP address.
But often, you want to know your public IP address, and you probably want to know, what's the difference between a private IP address and a public IP address? Well, the private IP address means that you are on a local area network behind a firewall and that NAT (network address translation) is being used. These are private IP addresses, this is not how the world sees your location. People see your location through your public IP address, i.e., the network address your router gets; it is the IP address that your ISP (internet service provider) has given you.
How to find public IP?
If you want to know your public IP address, you need to go to Google and type in what is my IP address, and it usually leads you to a website and here it gives you your public IP address.
Conclusion
The article gives you a brief of what is the public IP address, how to access your public IP address, and how to maintain the public IP if any errors occur. Hope you like this article.