There may be times where, while debugging an issue, you need a machine’s IP just to check whether or not it is reachable. Or you have to quickly tell your machine’s internal/local or public IP to your colleagues. If you are on Ubuntu and want your machine’s IP address to be available to you, there’s always a solution. In this article we will discuss how you can do this.
How to have your machine’s IP displayed in Ubuntu’s system tray
There’s a tool – called Indicator-IP – that lets you do this. To download and install the tool on your Ubuntu system, run the following commands:
sudo apt-add-repository ppa:bovender/bovender sudo apt-get update sudo apt-get install indicator-ip
Once installed, you can launch the tool by running the following command either from the command line
or through Unity (by pressing “Alt + F2”).
Given that the sole purpose of Indicator-IP is to display the IP address-related information of your Ubuntu machine, its usage is pretty straightforward. After the tool is launched, no GUI will appear, rather a new indicator will appear on your machine’s system tray (the leftmost entry in the screenshot below), showing the public IP address of your machine.
Public IP is your computer’s identity on the Internet.
Not just public IP, but the tool also shows you Ubuntu box’s local IP addresses (IPs of any connected network interfaces); but for this, you have to click the indicator menu.
If you want the tool to display your machine’s local IP address as the indicator icon, just click the corresponding entry in the menu (for example, the one highlighted in the screenshot above).
If you want, you can control this behavior from the command line as well – the
-i option lets you do this. For example, the following command will launch the tool showing your machine’s public IP as the indicator icon:
indicator-ip -i public
And the following command will make sure the local IP (of interface eth0) gets displayed in the tray by default:
indicator-ip -u -i eth0
Moving on, from where the Indicator-IP tool fetches the public IP address information, the official documentation reveals that the default service is “checkip.amazonaws.com.” But you can also ask the tool to fetch the information from any alternative service, such as “icanhazip.com.”
To change the default service from “checkip.amazonaws.com” to “icanhazip.com” (or any other service of your choice), you can use the
-u option. Here’s an example:
indicator-ip -u icanhazip.com
For more information on the utility, head to its GitHub page.
There are some tricks that might not benefit you directly, but that doesn’t mean they aren’t useful and worth learning. What I mean to say is that having your machine’s IP address available to you may never be a direct requirement, but you never know when this ease of access can save you some of your precious time.