Friday, 19 April 2024

Know your public IP with a simple command on Windows or Linux

When surfing the net we need to use different protocols. For example HTTPS, DNS, FTP or TCP/IP. But we also need a unique identifier that allows us to make requests and receive responses, and that is the public IP address. It will allow us to open a web page, for example. In this article we are going to explain what to do to know the public IP in Windows or Linux through a command. Sometimes it is necessary to know what it is to set up a web server, FTP or even play online.

What is public IP

First of all, we are going to explain what a public IP consists of and what it is for. In addition, we will see that there are several different types. Keep in mind that they could obtain certain information if they know what it is, such as where we are located, the operator, etc.

We can say that the IP is a logical and unique identifier for each of the computers that are connected to the network. Currently most are IPv4 addresses, but as there are more and more connected devices, networks are migrating to IPv6. In the latter case, the number of possible addresses is infinitely greater, so the problem of running out of addresses will not appear.

To give you an idea, this would be an example of an IPv6 address:

2011:0db8:85a3:0000:0000:8a2e:0370:7344

In the case of an IPv4 address, it would be like this:

80.34.48.125

 

But there are different types of public IP addresses. It will be the identifier of our network facing the Internet. It will be assigned by the operator, so we will not be able to use the one we want. It is the information that a web page will receive when we visit it or any online service. There are two kinds:

  • Static public IP: in this case the address is always fixed. It will not change and this is ideal for setting up an FTP server, for example.

  • Dynamic Public IP: This type is going to change. It is the most common and most likely it is your case. It will change as our operator decides, although in many cases we can change it by restarting the router.

It is different from the private IP, since in this case it is used to identify devices facing the router. This device is the one that automatically assigns addresses and this time you could change which one each one uses, in case you need to do it for something.

Steps to view public IP on Windows with one command

In Windows, no matter what version you use, you will be able to find out what your public IP address is in a very simple way through a command. Therefore, if you need to know what it is to configure a server or just out of curiosity, you just have to follow these steps that we are going to show.

  • You have to go to Home

  • You type Terminal or CMD and open it

Once there you will find a window where you will be able to execute commands. That's exactly what you need to find out the public IP through this method. You don't need to open it with administrator permissions.

 

 

When you are in that window you have to execute the following command:

nslookup myip.opendns.com resolver1.opendns.com

Next, different data will appear. You will see the Address section, which is the one that interests you. That is the public IP address of your connection. You can write it down and use it wherever you need. As you can see, you don't have to do anything else. It is simply to execute that command and the information will automatically appear in the Windows Terminal.

 

 

How to use a command to see the public IP in Linux

You will be able to do something similar if you have a Linux distribution. You will only have to execute a command and you will quickly get the information about what your public IP address is, in case you want to know it to configure a server or to see if it has changed correctly after restarting the router.

Once again, you have to go to the Terminal in your Linux distribution and there execute the same command that you did in the case of Windows:

nslookup myip.opendns.com resolver1.opendns.com

You will automatically find different data, among which is Address. That is what you are interested in knowing what your public IP address is. In this way you will be able to write down the numbering and be able to use it when configuring a server or in any situation that you need it.

 

 

As you have seen, it is very easy to know what the public IP address is through a command and OpenDNS. It is something that you can do both in Windows and in any Linux distribution that you have installed on your computer. You will quickly see the corresponding data and you will be able to use it.

Verify that this is your public IP

You have seen that it is possible to find out the public IP address with a simple command. However, you may want to verify it in some way. You will be able to do it simply by entering a web page and thus see if the IP that it shows you corresponds to what you have obtained through the Windows or Linux command line.

What you are going to do is use the What's My IP web page. There, just by entering, you will see the address. In addition, you will also be able to see information about the operator, if you are browsing through a proxy or even geolocate that address to have more data.

 

 

As you can see, the address is the same as the one shown to you when running the command on Windows or Linux. Does a different one appear to you? In that case it can happen if you are browsing through a VPN. For example, if we click Geolocate from a browser that uses a VPN extension, it will show us that we are on a different site and with another IP.

 

 

By geolocating the IP you will be able to obtain other data, such as the coordinates, the city or the country. This can be very useful if you are connected through a VPN and you want to verify that it really works and your public IP is that of that program and not your real one. Simply by geolocating the address you will be able to see that you do not appear on the Internet in the place where you are physically.

In short, as you have seen, it is very easy to check what the public IP is simply with a command in Windows and Linux, with the help of OpenDNS. In addition, you can verify this data through a web page and also geolocate the address to see if the VPN you are using works correctly.

If you want to hide your IP address, the best thing to do is use a VPN. You will also be able to browse through a proxy or use the Tor browser. Also, if at any time you need to change that public IP, you can usually do it by turning off the router and turning it back on after a few minutes. You would be assigned a different address, although you can never really choose which one to use.

 

Link: https://www.redeszone.net/tutoriales/redes-cable/ver-direccion-ip-publica-windows-linux/ 

NOCPERU - DATA CENTER, is the first corporate data center dedicated to companies, a robust and stable system developed with fiber optic connectivity and operated by the highest international standards.

Contact Us

Trujillo, La Libertad, Perú
01 641 1239
044 64 3108
01 305-749-5753
+51 902 524 298