Ubuntu

How Do I Find My IP Address in Ubuntu

An IP address identifies any device connected to a network. The IP address is a numerical representation used by devices for communication, such that a package from device A can reach the target destination based on the IP of the given machine. Besides, when connected to the internet, each device has a public IP address unique to that device. So, how can you find your public or private IP address in Ubuntu?

4 Ways of Finding IP Address on Ubuntu

A public IP address is unique to every device on the internet and you should not share your public IP with anyone. However, the private IP can be dynamically assigned by the DHCP server on your local network, meaning it keeps changing.

To find your public IP, type whatismyipaddress on your browser and you will find it. Alternatively, you can use curl to find it using the command below.

$ curl ifconfig.me

 
For the private IP address, let us dig in on four ways you can quickly find it.

1. Using ifconfig

The ifconfig command comes as part of the net-tools on Ubuntu and you can use it to analyze and configure your system’s network interfaces.

The command does not come preinstalled on Ubuntu. Instead, you must install the net-tools package for you to access it.

$ sudo apt install net-tools -y

 

When you execute the command, it will return the available network interface and the IP address of the interface connected to the internet.

$ ifconfig

 
In this case, we are connected to the wireless network and our interface is wlan1 with the displayed IP address.

2. Using Hostname

The hostname command is used for displaying the DNS of the host system. However, if you add the -I flag, it will output the IP address of your system. It offers a quick way of getting an IP address on Ubuntu with minimal output.

$ ifconfig

 

3. Using IP a

Running the ip address command will display the network details of your system, including the different interfaces and their IP address. A shorthand for the command is ip a.

$ ip address

 
or

$ ip a

In this case, we are connected to the wlo1, and you can note the IP address is displayed as highlighted in the image.

4. Check from Network Settings

Aside from using the terminal, there is a graphical way of finding your IP address.

Start by opening the settings on your Ubuntu. You can search for it from your applications or click on it at the top of your window.


Once it opens, click the option for Wi-Fi if you are using a wireless network or Network if you are connected to a wired network.

For Wi-Fi, click on the gear icon next to the wireless network that you are connected to.


Once you click on the settings icon, a menu displaying the details of your Wi-Fi network will open. Your IP is the IPv4 address.


In the case of a wired network, click on Network. Next, click on the gear icon for the wired network on the right.


A window will appear, showing you all your network details, including the IP address, like in the case of Wi-Fi.

Conclusion

An IP address is how a device is recognized on a network. The public IP address is unique for each device connected to the internet and the private IP address is assigned to each device connected to your local network. You can use different ways to find your IP address, and this guide has presented multiple examples.

About the author

Denis Kariuki

Denis is a Computer Scientist with a passion for Networking and Cyber Security. I love the terminal, and using Linux is a hobby. I am passionate about sharing tips and ideas about Linux and computing.