Networking & DNS

How to find your IP address on Linux: public and local

Updated 10/19/2026

On Linux you can find your IP address in seconds, whether you are on a desktop or on a server managed over SSH. As everywhere, there is the public address, seen by the internet, and the local address of your network interface.

Your public IP address

On a desktop, open the What is my IP address page in a browser: you instantly see your public address, the protocol, country and reverse DNS. On a headless server, the cleanest method uses DNS:

dig +short myip.opendns.com @resolver1.opendns.com

The answer is the public address your server uses to reach the internet.

Your local IP with ip addr

The modern command, present on every current distribution:

ip -4 addr show

Look for the inet lines on the active interface (for example eth0, ens3 or wlan0) and ignore 127.0.0.1 on lo, which is just the loopback. For IPv6, run ip -6 addr show.

Want just the addresses, without the rest?

hostname -I

Which interface reaches the internet?

With several interfaces around (Docker, VPNs, private networks), one command tells you where packets leave and with which address:

ip route get 1.1.1.1

On the desktop, from Settings

In GNOME open Settings, Network (or Wi-Fi) and click the gear next to the active connection: the IPv4 and IPv6 addresses, gateway and DNS are all there. KDE and the other desktops have near-identical equivalents.

On a cloud server

A cloud server usually carries its public address directly on the interface, with no NAT, so ip -4 addr show shows the public address itself; you also see it in the console of your account. If the server should be reachable over IPv6 too, see how to configure IPv6, and for checking the connection, network connectivity testing.

The steps for the other systems: how to find your IP address on Windows and on a Mac.

Put this guide into practice on your own VPS

EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.

See pricing

Related tutorials