How to find your IP address in Linux

It is important when you want to configure a firewall, set up a new connection, or troubleshooting network issues.
We can classify IP address into two categories, public and private. A public IP is an IP address that is unique and can be accessed from the Internet. Otherwise, a private IP are reserved for internal use within your private network without being directly exposed to the Internet. For example, If you are using your computer at the office, and connect the network there. That’s mean you are in a private network, it is manged by network system administrator and all of your behavior will be monitored.

By following, I give you ways to find IP addresses for both private and public in Linux (Ubuntu).

Find your private network

Open your terminal by press Ctrl + Alt + T, the use ifconfig command:

If you got the error

-bash: ifconfig: command not found

then please install the net-tools package first: $ sudo apt-get install net-tools

Find your public network
Open your terminal by press Ctrl + Alt + T, and do one of these commands below:

then please install the net-tools package first: $ sudo apt-get install net-tools

Find your public network
Open your terminal by press Ctrl + Alt + T, and do one of these commands below:

then please install the net-tools package first: $ sudo apt-get install net-tools

Find your public network
Open your terminal by press Ctrl + Alt + T, and do one of these commands below:

$ curl -s http://tnx.nl/ip
or 
$ curl -s api.infoip.io/ip
or 
$ curl -s api.infoip.io/ip

On Desktop machines, the easiest way to find out your public IP address is to type “what is my ip” in your browser:

Conclusion
I have shown you several different ways that you can use to find out your IP addresses (private and public). If you have any questions, please leave a comment below.

Thanks for reading!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s