- How do I find my internal ip address?
- 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 Command Line
- Other ways to find the IP address of your system in Linux
- Show IP address with hostname command
- Display IP address with nmcli tool
- What about ifconfig?
- Bonus Tip: Finding the public IP address of your system
How do I find my internal ip address?
I have Ubuntu server 12.04 installed, so I have no GUI. When I do the command ifconfig, I cannot find my internal IP address. It says: inet addr: 127.0.0.1 . Here is the output of ifconfig -a :
eth0 link encap:Ethernet HWaddr 00:06:4f:4a:66:f0 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) eth1 link encap:Ethernet HWaddr 00:16:ec:05:c8:9c BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr 127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:1800 errors:0 dropped:0 overruns:0 frame:0 Tx packets:1800 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:143896 (143.b KB) TX bytes:143896 (143.8 KB)
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp
If someone could edit this for me, the contents of etc/network/interfaces should be on separate lines. The output of host askubuntu.com was:
;; connection timed out; no servers could be reached.
I set up owncloud and webmin a few months ago and was using them for a month with no problems. I think the power went off one day 2 months ago and I never turned the server back on until yesterday. I haven’t done anything that would have affected the internet setup So i’m not sure why it doesn’t work anymore. As far as my network topology goes, I have a pci-e network card for the pc. The ethernet line goes from the network card to a switch, and then to a modem/router from there.
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.
How to Find IP Address in Linux Command Line
How do I find out the IP address of in Linux ? It’s a common question for a number of Linux users. Here are multiple ways to get the IP of host system in Linux.
A Few years back, ifconfig was the favorite way to know IP address in Linux. Unfortunately, ifconfig command has been deprecated. If you try to use this command today, you are most likely to see the following error:
command not found: ifconfig
You may wonder how do I find my IP in Linux then? Let me show you that.
That’s it. That’s how you display the IP address of host system in Linux command line. You can use the same command to get the IP address via bash scripts as well.
Other ways to find the IP address of your system in Linux
There are more ways to check the IP address in Linux. Let me show you them as well.
Show IP address with hostname command
The hostname command usually displays the hostname of your system. It can also be used to display the IP address of the host:
It will simply display the IP address of the host in the terminal.
Display IP address with nmcli tool
Most Linux distributions come with a Network Manager tool. This tool has a command line interface called nmcli. You can use this nmcli tool to view a number of network configurations.
The IP address can be displayed with:
You should see the IP address in the output.
What about ifconfig?
Actually, you can still use ifconfig command. It is present in net-tools package. You can install it using the package manager of your system. However, use of net-tools is not encouraged so I suggest sticking with the ip command.
In Ubuntu-based distributions, you can install net-tools using this command:
sudo apt install net-tools
Now you can use the ifconfig command to display the IP address of your system.
The output will be like this:
lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 14855 bytes 3027297 (3.0 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 14855 bytes 3027297 (3.0 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlp58s0: flags=4163 mtu 1500 inet 192.168.0.106 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::bf14:21e3:4223:e5e4 prefixlen 64 scopeid 0x20 ether 9c:b6:d0:d0:fc:b5 txqueuelen 1000 (Ethernet) RX packets 88413 bytes 61851930 (61.8 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 56505 bytes 11409219 (11.4 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Again, ifconfig has been deprecated and should not be used.
Bonus Tip: Finding the public IP address of your system
What you saw so far was to display the private IP address of your system. What I mean is that if you use a network router, you are most probably behind a NAT.
The IP address of your system is a private one, used only for communicating with the devices on your sub-network. Any device outside your home/work network won’t be able to find you with this IP address. They need to now the IP address of your router. Your router recognizes your device and communicates via the private IP address.
How do you get your public IP address (IP address of your router)? You’ll have to utilize third party tools.
For example, you can use the host command with OpenDNS and get the public IP address:
host myip.opendns.com resolver1.opendns.com
The output should be similar to this:
Using domain server: Name: resolver1.opendns.com Address: 208.67.222.222#53 Aliases: myip.opendns.com has address 202.91.87.117 Host myip.opendns.com not found: 3(NXDOMAIN) Host myip.opendns.com not found: 3(NXDOMAIN)
I hope this quick tip helped you in finding the IP address of your system in Linux command line. You may also read about finding the gateway IP in Linux.
As always, feel free to provide your feedback and suggestion in the comment section below.