×


Methods to Find Your Public IP address in Ubuntu 20.04 LTS ?

You can determine the IP address or addresses of your Linux system by using the hostname, ifconfig , or ip commands. 

To display the IP addresses using the hostname command, use the -I option.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Ubuntu Server related queries.

As per our earlier posts, we dealt with some methods of finding your private IP address in Ubuntu 20.04

In this context, we shall look into the methods of finding your public IP address.


How to Find Your Public IP address in Ubuntu 20.04 LTS ?

Here, you will learn some methods to find Public IP Address in Ubuntu 20.04. You can also apply same on other Linux distributions. 


1. Using Google to Find Your Public IP address in Ubuntu ?

To implement this, Open your Google Chrome browser and search with the keyword "what is my ip". Google will show your public IP.


2. Querying the DNS providers to Find Your Public IP address in Ubuntu ?

Many DNS providers will let you access your public IP address information.


i. Using dig command

You can access your public IP address information from your DNS provider by using any of the following dig commands:

dig +short myip.opendns.com @resolver1.opendns.com
dig ANY +short @ns1-1.akamaitech.net ANY whoami.akamai.net

ii. Using host command

You can also query your public IP address information from your DNS provider by using the following host command.

host myip.opendns.com resolver1.opendns.com

Also,  You can further narrow the answer by using grep and awk in your command:

host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4}'


3. Using Online Services to to Find Your Public IP address in Ubuntu ?

Several online services provide your public IP address information. 

For example, you can access this information by downloading files from these service providers.

a. IP Echo Service: ipecho.net

b. icanhazip.com

c. ifconfig.co

d. Ifconfig.me

e. ipinfo.io


i. Using wget command

First, install wget using the following command and enter your password if prompted:

sudo apt update && sudo apt install wget -y

Then, you can use any following wget command to find your public IP from the mentioned service providers:

wget -qO- http://ipecho.net/plain | xargs echo
wget -qO- ifconfig.co
wget -qO- ifconfig.me | xargs echo
wget -qO- https://ipinfo.io/ip

ii. Using CURL command

First, install cURL using the following command and enter your password if prompted:

sudo apt update && sudo apt install curl -y

You can then use these CURL commands to find your public IP from service providers:

curl ifconfig.co
curl ifconfig.me && echo
curl icanhazip.com && echo
curl https://ipinfo.io/ip


[Need urgent assistance to perform Linux based Installation tasks? We are available. ]


Conclusion

This guide will help you to Find Your Public IP address in #Ubuntu 20.04 LTS. 

ipconfig stands for Internet Protocol Configuration, while ifconfig stands for Interface Configuration.

The #ifconfig command is supported by Unix-based operating systems.

The ipconfig command displays all the currently connected network interfaces whether they are active or not.

The presence of a #public IP #address on your router or computer will allow you to organize your own server (VPN, FTP, WEB, etc.), remote access to your computer, video surveillance cameras, and access them from anywhere in the global network.


To Find Local / Public IP Address in #Ubuntu 20.04:

1. Open Settings and navigate to Network in left pane.

2. Click on the gear icon under connected wired network.

3. In the pop-up it shows the detailed information including your IP address.


To find my IP address and port number in Linux:

i. All you have to do is type “netstat -a” on Command Prompt and hit the Enter button. 

ii. This will populate a list of your active TCP connections. 

iii. The port numbers will be shown after the IP address and the two are separated by a colon.