PQ
PQ.Hosting

Currency

How to Find the Internal IP Address in Linux: Up-to-date guide for VPS users 2026

Author
PQ
February 24, 2026
5 min read
55 views
How to Find the Internal IP Address in Linux: Up-to-date guide for VPS users 2026

First thing after connecting to a new server — figure out what IP addresses it has and on which interfaces. The external IP is usually visible in the hosting control panel right away, but the internal one — used for communication within the network — needs to be checked directly in the system.

All working methods covered here: from a single fast command to a detailed view of all interfaces.

Internal IP vs External IP — What Is the Difference?

A quick clarification before the commands, to avoid confusion.

External (public) IP — the address by which the server is visible on the internet. This is what any external resource sees when the machine connects to it. On a VPS, it is usually the IP assigned at the time of ordering.

Internal (private) IP — the address of an interface within a local or virtual network. It is used for communication between servers in the same infrastructure, inside containers, between cluster nodes, and so on. This address is not routed over the internet.

Standard private address ranges (RFC 1918):

Range Mask Number of addresses
10.0.0.0 — 10.255.255.255 /8 ~16 million
172.16.0.0 — 172.31.255.255 /12 ~1 million
192.168.0.0 — 192.168.255.255 /16 ~65 thousand

If an address falls within one of these ranges — it is an internal IP. Everything else is public.

Method 1: hostname -I — The Fastest Option

When all that is needed is a plain list of IP addresses:

hostname -I

Prints all IP addresses of the machine on a single line, space-separated — both IPv4 and IPv6. No tables, no formatting. Convenient for quickly copying an address or using in a script.

Method 2: ip addr — Full Interface Information

The main modern tool for networking in Linux. The ifconfig command is outdated and absent by default on most current distributions — ip replaces it entirely.

ip addr

or in short form:

ip a

The output can look intimidating but reads simply. What matters:

  • lo — the loopback interface, address 127.0.0.1. A virtual interface for inter-process communication within the machine itself, not a real network interface.
  • eth0, ens3, enp1s0 and similar — the main network interface. The real IP will be here.
  • inet — IPv4 address of the interface.
  • inet6 — IPv6 address.

Show only IPv4 addresses

ip -4 addr

Show a specific interface only

ip addr show eth0

Extract addresses without surrounding text

ip -4 addr show scope global | grep inet | awk '{print $2}'

This prints only IP addresses in address/mask format for all global (non-loopback) interfaces. Useful in scripts.

💡 The name of the main interface on a VPS depends on the hypervisor and distribution. Usually it is eth0 or ens3. To see all interfaces: ip link show.

Method 3: ip route — Find the IP via the Routing Table

Another approach — check which address outgoing traffic leaves from:

ip route get 1.1.1.1

The output shows which local IP is used for outgoing connections. Useful when there are multiple interfaces and it is not obvious which one is the primary.

ip route

This prints the full routing table. The line with default is the default route; the interface listed there is the main network interface.

Method 4: nmcli — If NetworkManager Is in Use

On servers with Ubuntu Desktop or configurations where NetworkManager is installed, nmcli works well:

nmcli device show

Shows detailed information for each interface: IP address, gateway, DNS, connection status.

For just the essentials:

nmcli -g IP4.ADDRESS device show eth0

On most bare VPS setups NetworkManager is not installed, so ip addr is the more reliable choice.

Method 5: ifconfig — Outdated but Still Around

ifconfig

On modern systems (Ubuntu 20.04+) ifconfig is not installed by default. To install it:

sudo apt install net-tools

After installation, the command shows all interfaces. The inet line is the IPv4 address, inet6 is IPv6. Functionally ifconfig is weaker than ip addr: less information, no support for some modern interface types.

💡 On new servers it is better to get used to ip addrifconfig may eventually be removed from distributions altogether.

How to Check the External IP — for Reference

To confirm what IP the outside world sees:

curl ifconfig.me

or

curl -s https://api.ipify.org

Both commands query an external service and return the public IP — the one the internet sees, after NAT if applicable. This is not the interface address, it is what is visible from outside.

Multiple Interfaces — How to Read Them

On a VPS with multiple NICs, or with VLANs, tunnels, or containers configured — there will be many interfaces. To get only IPv4 addresses of all active interfaces in one command:

ip -4 addr show up | grep inet | awk '{print $NF, $2}'

Output shows interface name and its address side by side. Easy to read.

Quick Reference

Task Command
Quick list of all IPs hostname -I
Full interface information ip addr or ip a
IPv4 only ip -4 addr
Specific interface ip addr show eth0
Default route and interface ip route
Addresses only, no extra text ip -4 addr show scope global | grep inet | awk '{print $2}'
External IP curl ifconfig.me

Summary

For everyday tasks two commands cover everything: hostname -I for a quick address, ip addr for a full picture of all interfaces. ifconfig still works but is better avoided on new systems.

If a server is still needed — the PQ.Hosting catalog has VPS options across a wide range of locations and configurations.

Share this article