- How to Find IP Address in Linux
- How to find your IP Address in Linux using ip command
- How to find your IP Address in Linux using hostname command
- How to find your IP Address in Linux using ifconfig command
- How to find your IP Address in Linux using nmcli command
- How to find your IP Address in Linux using GUI method
- How to find your Public IP Address in Linux
- Conclusion
- How to Find or Check Your IP Address in Linux
- Find Your IP Address From the Command Line
- Using the hostname Command
- Using the ip addr Command
- Using the ifconfig Command
- Finding Your IP Address in Linux With a GUI
- How to Find Public IP Address
- What is a Public/Private IP Address?
How to Find IP Address in Linux
Knowing your IP address is essential if you are stuck in any network issue, configuring a firewall, or setting up a new network connection. IP address or the Internet Protocol address comprises a set of numeric digits required for identifying a device and enabling it for communication over the network. Furthermore, an IP address is also used to observe a device’s location.
Don’t know to find out the IP address in Linux? No worries! This post will demonstrate how you can find your IP address using Linux commands and the GUI method. Moreover, the procedure of checking your public IP address will also be provided to you. So, let’s start!
How to find your IP Address in Linux using ip command
In Linux, the “ip” command exists in the net-tools package that can be utilized for conducting various administration tasks. The “Internet Protocol” is abbreviated as “IP“. This command is used to list IP addresses, set up the tunnel over IP, assign, remove, and set up IP addresses and routes, and configure and update default and static routing.
The syntax of the ip command is as follow:
With the “-address” option, you can execute the “ip” command for listing the ip addresses associated with your network devices in this way:
Here, we can find the IP address of our “enpos3” network device, which is “192.168.43.192”:
How to find your IP Address in Linux using hostname command
In a Linux system, the main function of the “hostname” command is to set or show the hostname and Domain Name Service (DNS) of a system. However, you can also utilize it to find the ip address of your Linux system. Before doing so, check out the below-given syntax of the “hostname” command:
Now, to find your IP address in a Linux-based system, write out the “hostname” command with the “-I” option in your terminal:
How to find your IP Address in Linux using ifconfig command
“ifconfig” is a network or system administration tool that permits you to manage, configure, and examine different network interface parameters using configuration scripts and terminals.
To use “ifconfig” command, firstly, you need to install the “net-tools” package on your system:
$ sudo apt install net-tools
Now, execute the “ifconfig” command and find the “ip” address of your network devices in the list:
You can look for the “ip” addresses in the “ifconfig” binary executable file, located “/sbin” directory:
How to find your IP Address in Linux using nmcli command
NetworkManager is controlled by utilizing the “nmcli” command-line utility. In Linux, the nmcli command is used for activating, deactivating, creating, editing, and deleting network connections and displaying network device status.
The basic syntax of the “nmcli” is as follows:
$ nmcli [Option1] [Object] [Option2]
In the “nmcli” command, “-p” and “show” options are used for printing the information related to network devices conveniently:
How to find your IP Address in Linux using GUI method
Some users prefer to utilize the GUI of Linux for performing most of their tasks. In a Linux-based system, you can also use the Graphical User Interface or the GUI for finding your IP address. To do so, open up your system settings by searching it manually in the “Applications”:
In between all categories of the system settings, move to the “Network” and click on the “Gear” button available with your network device:
In the opened window, click on the “Details” tab, and from here, you can check out the “IPv4” and “IPv6” addresses of the selected network connection:
How to find your Public IP Address in Linux
Your Internet Service Provider (ISP) assigns a public IP address to your network router to make it accessible over the network. When you get connected with the internet using your public address, the private address of your network device remains unrevealed.
You can find out your public ip address you can write out “What is my ip” in Google’s search bar:
You can also “dig” command for finding out your public address using the Linux terminal. To do so, you can execute the below-given commands:
$ dig ANY +short @resolver2.opendns.com myip.opendns.com
$ dig ANY +short @ns1-1.akamaitech.net ANY whoami.akamai.net
The “wget” command can also be utilized for the same purpose:
$ wget -O - -q https://icanhazip.com/
By executing the above-mentioned “wget” command, your public address will be printed as an output on the terminal:
Conclusion
Want to try out a solution for any network issue or stuck in the middle of configuring a firewall? Knowing your IP address can assist you in such scenarios. In a Linux-based system, various commands are utilized for finding out the IP address, such as “ip”, “hostname”, and the “ifconfig” commands. This post showed you the method to find out your IP address using different Linux commands and the system GUI. Moreover, the procedure of finding the public IP address is also demonstrated.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY
How to Find or Check Your IP Address in Linux
An IP address is a codename assigned to a computer on a network. It works as a postal address, ensuring that network traffic is sent to the correct computer.
In this tutorial you will learn how to find your IP address using a Linux operating system.
Find Your IP Address From the Command Line
There are a few different commands you can use to check your IP address. To run these commands, start by opening a terminal window/command line.
Using the hostname Command
One way to check your IP address from the command-line is by using the following command:
The system will display your internal IP address.
Using the ip addr Command
Check your ip address with the ip addr command:
The system will scan your hardware, and display the status for each network adapter you have. Look for an entry that says link/ether. Below it, you should see one of the following:
inet6 fe80::a00:27ff:fe76:1e71/64
The entries will include one for a wired (Ethernet) adapter and a wireless (Wi-Fi) adapter. You may also have an entry for a virtual adapter. Generally, only one entry will have an IP address listed – that is the one you will want.
Note: The number after the slash – /24 and /64 – specifies the size of the network, and it helps with scanning and mapping network size.
Using the ifconfig Command
The third method to find your IP address involves using the ifconfig command. In the command line, enter the following:
The system will display all network connections – including connected, disconnected, and virtual. Look for the one labeled UP, BROADCAST, RUNNING, MULTICAST to find your IP address. This lists both IPv4 and IPv6 addresses.
Note: When you check your IP address, you may notice the term loopback. This refers to an IP address that returns traffic to the same computer. Usually, the loopback address is 127.0.0.1 . If you see that address listed, either you are looking at the wrong line, or you are not connected to the network.
Read phoenixNAP’s ultimate Linux IP command tutorial with 31 examples to learn more!
Finding Your IP Address in Linux With a GUI
If you are using a point-and-click interface to run your Linux system, you can check your IP address by following these steps:
1. Go to the Application menu and type Settings into the search bar.
2. Click on the Settings icon that appears among the results, as in the image below:
3. Next, find the Network tab in the Settings Menu and click on the Advanced Wired Settings icon.
4. This opens a new pop-up window with details on wired settings. Here you can find both your IPv4 address and your IPv6 address.
How to Find Public IP Address
To find your public IP address, reach out to an external website.
If you are using a browser, navigate to:
If you are using a command-line or terminal, use a retrieval command like curl or wget to display the external IP address:
wget -O - -q https://checkip.amazonaws.com
Note: Did you know that when you use curl to connect to an insecure website, the output responds with an error? To resolve it, visit our guide on making curl ignore certificates.
What is a Public/Private IP Address?
Each computer in a network is required to have its own IP address. If two systems have the same IP address, it will generate errors on the network. Most modern networks will detect the problem and prompt you to fix it. However, older networks might get confused, trying to route traffic to both computers.
Most systems will have two different IP addresses:
- Private IP address: This is the address used on the network. Also, it is the one you will want to use for configuring routing tools. On smaller networks, the internal IP address typically starts with 192.168.x.x. It is dynamically assigned to your computer whenever you connect.
- Public IP address: This is the IP address that registers on a website when you visit it. When you connect to a small network, your computer connects to a router using an internal IP address. That router, in turn, connects to a bigger network (like an Internet Service Provider), which has its own IP address system.
Note: Learn everything you need to know about public and private IP addresses in our article Public vs. Private IP Address.
Now you know how to find a private and public IP address in Linux using multiple methods.
Each option strikes a balance between speed and complexity. Now you have the flexibility to choose, if you only need your internal IP address, you can use the hostname method. If you need more detailed information, view our article on 31 Linux IP Commands with examples.