Wondering what your IP address is? Here are several ways to check IP addresses in Ubuntu and other Linux distributions.
Do you want to know the IP address of your Linux system? You can use the ip command with the a option like this: ip a
The output is extensive and displays all available Internet interfaces, including loopback. Identifying the IP address may seem like a challenge if you’re new to it.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enx747827c86d70: <NO-CARRIER,BROADCAST,MULTICAST,UP> MTU 1500 qdisc pfifo_fast state DOWN group default qlen 1000 link/ether 74:78:27: c8:6d:70 brd ff:ff:ff:ff:ff:ff 3: wlp0s20f3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether dc:41:a9:fb:7a:c0 brd ff:ff:ff:ff:ff:ff inet 192.168.1.53/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp0s20f3 valid_lft 82827sec preferred_lft 82827sec inet6 fe80:: E1D:D71B:C507:5CC8/64 Scope link noprefixroute valid_lft forever preferred_lft forever
It really isn’t, actually
And there are other ways to find the IP address. I will discuss all this in detail. But first, let’s go over the basics.
What is an IP address?
An Internet Protocol address (
commonly known as the IP address) is a numeric label assigned to each device connected to a computer network (using the Internet Protocol). An IP address serves both the identification and location of a machine. The IP address is unique within the network, allowing communication between all connected devices. You should also know that there are two types of IP addresses: public and private. The public IP address is used to communicate over the Internet, in the same way that your physical address is used for postal mail. However, in the context of a local network (such as a home where a router is used), each device is assigned a unique private IP address within this subnet. This is used within this local network without directly exposing the public IP (which the router uses to communicate with the Internet). Another distinction can be made between IPv4 and IPv6 protocols. IPv4 is the classic IP format, which consists of a basic 4-part structure, with four bytes separated by periods (for example, 127.0.0.1). However, with the increasing number of devices, IPv4 will soon not be able to offer enough addresses. That’s why IPv6 was invented, a format that uses 128-bit addresses (compared to 32-bit IPv4).
Checking Your IP Address
in Ubuntu [Terminal Method]
The fastest and easiest way to check your IP address is by using the ip command. You can use this command as follows
Actually, it is short for this:
ip addr show
Both commands show the same output. They will show you
IPv4 and IPv6
You need to identify the correct interface and then look next to inet for IPv4 and inet6 for IPv6.
For example, inet 192.168.1.53
/24 means that the IPv4 address is 192.168.1.53.
Only get the IP address
If you prefer to get minimal details, you can also use the hostname command:hostname
-I It will only give the
of the system. Nothing else.
<img src="https://itsfoss.com/content/images/size/w600/2023/03/ip-addr-show.png" alt="Hostname only shows IP address
other ways to check IP addresses in Linux, but these two commands are more than enough to serve the purpose.
Checking IP Address
in Ubuntu [GUI Method]
If you are not comfortable with the command line, you can also graphically check the IP address.
Open the Ubuntu Applications menu
(Show Applications in the lower left corner of the screen) and find Settings and click on the icon:
This should open the configuration. Go to Network:
next to your connection should open a window with more settings and information about your network link, including your
IP address: <img src="https://itsfoss.com/content/images/2023/03/open-settings-from-activities-overview.png" alt="IP address details in
GUI IP address You can also see the IP address of your router in the screenshot above. It is displayed with “Default route”.
Bonus Tip: Checking
Your Public IP Address (for
Desktops)First, to check your public IP address (used to communicate with servers, etc.) you can use the curl command. Open a terminal and enter the following command:
This should simply return your IP address without additional bulk information. I would recommend being careful when sharing this address, as it is equivalent to giving your personal address.
Another simple way to see your public IP address is by searching for the IP address on Google.
Here is a summary of the commands you learned:
Description command Show IPv4 and IPv6 addresses with the ip ip a or ip addr show command Print IP address only using the hostname hostname -I command To check your public IP address (you need curl installed) curl ifconfig.me Show IP Address with the Network Manager tool nmcli -p device display Use the ifconfig command to display the IP address (You need network tools installed) ifconfig -a
Now that you know your system’s IP address, how about getting the gateway IP?
Boost your Linux networking skills with these essential commands!
In this article, I went over the different ways you can find your IP address in Ubuntu Linux, and gave you a basic overview of what IP addresses are used for and why they are so important to us.
I also discussed IPv4 and IPv6 briefly. By the way, have you ever wondered why there is no IPv5?
I hope you enjoyed this quick guide. Let us know if you found this explanation helpful in the comments section!