How to Find IP Address in Ubuntu
The IP address is the number used to identify your computer on networks and the internet. IP Address in Ubuntu is used to view the local IP address, default gateway, and DNS servers. There are two methods to Find IP Address in Ubuntu. In this article, you will learn how to use the Command line and GUI to have your Ubuntu IP address and communicate with routers on the network or other devices. In Linux, a network interface is identified by its IP address, which is also used to direct network packets to their intended locations.
Like any other language, Internet Protocol communicates by following predefined rules to convey information. This protocol is used by all linked devices to locate, send, and share information with one another. Any computer, wherever, can communicate with any other computer by speaking the same language. Join us with this guide to review both mentioned ways to be able to do your tasks on Ubuntu Server and Ubuntu Desktop. Before that, let’s see what an IP Address is to freshen your mind.
What is an IP Address and Why Check it?
An IP Address (Internet Protocol Address) is a numerical address that is assigned to all connected devices to a computer on a network to be identified and localization of that machine. The internal IP address is different from the external IP of the system. Communication between all plugged-in devices is possible thanks to the IP address, which is particular to the network. According to the type of IP addresses you use (public and private), their usage will be different on your network. Similar to how your physical address is used for postal mail, the public IP address is utilized for Internet communication. Nevertheless, each device on a local network is given its private IP address within this sub-network. Without immediately disclosing the public IP address, this is utilized within this local network. Before diving into the methods you can Find IP Address in Ubuntu, have a look on below notes about public and private address.
To find your public IP address, you can use the ”ipinfo.io/ip” link by running the command below:
$ curl http://ipinfo.io/ip
And to find your private IP address, you need to install the package of net-tools first:
$ sudo apt install net-tools -y
Then run the following command to view the private IP address of your Ubuntu.
You may wish to check your IP address for a variety of reasons. For instance, if you wish to forward a router to your PC, this information is crucial. The procedures for obtaining a Linux IP address change slightly from those for Windows or Mac, even though the address’ fundamental structure stays the same. Also, if you’re experiencing problems connecting to the internet or other networked devices, looking up your IP address will help you figure out whether the problem is with the way your network is set up.
Prerequisites to Find IP Address in Ubuntu
To let this tutorial work correctly, provide the options below and move on.
- A Server running Ubuntu VPS.
- A non-root user with
How to Find IP Address in Ubuntu Using Command Line
As we mentioned, it is possible to Find IP Address in Ubuntu using two different methods. If you are not interested in and comfortable using Command Line, skip this part to read the next one. Otherwise, stay with us to go through the steps of this part.
A quick way to check IP address in Ubuntu is to run the command below:
$ ip a
ip addr show
Both of the above commands show the same output including IPv4 and IPv6 addresses, the network interface hardware address that is called MAC address.
To find IP address for a specific network interface in Ubuntu, you must use the command with a particular interface option. Otherwise, the output displays information about all network interfaces. For example, to view information only for your considered interface, run:
ip addr show eth0
In the above example, when you specify the eth0 interface, you will see the information for eth0 interface.
Also, you can use the following command to find the current DNS server IP address:
$ systemd-resolve --status | grep Current
And, to view the default gateway IP address, type:
$ ip r
You can also use the hostname command to obtain only the most basic information:
The output displayed only the IP address of the system.
How to Find IP Address in Ubuntu Using GUI
So far, you learned to find IP address in Ubuntu using Command Line. It is time to learn how to use GUI to check IP address in Ubuntu. To find IP address in Ubuntu graphically, open up the Ubuntu Application menu and search for the Settings icon to click on it.
Now, go to Network:
A window containing further options and details about your connection to the network, including your IP address, should appear when you click the gear icon next to it:
The above graphic also displays the IP address of your router. “Default Route” is shown with it.
After running the
ip a command, simply look beside inet for IPv4 and inet6 for IPv6.
This command has been deprecated. This package is no longer included in certain more recent Linux versions, and if you attempt to execute it, you'll get an ''ifconfig command not found'' error.
On the internet, the public IP address is used to let the browser know that this HTML request is coming from the machine below or that this email should be delivered to the following IP address while a private IP address is used when connecting to a device in a private network to transfer data.
In this tutorial, you learned How to Find IP Address in Ubuntu Using Command Line and GUI. Both methods were explained to let you select your preferred one. Be careful in sharing your IP address since it means you are sharing your personal address. Checking internal network configuration helps you enable networking functionality. Configuring Static IP address on Ubuntu is also possible using a command line tool that sets up a network interface.
If you follow any one of the explained methods of this article, you can find IP address in Ubuntu without any errors but do not hesitate to contact us if you encounter any problems. Our technical support team will try their best to solve your problems.