Guide

How to find your IP address on Linux (Ubuntu and others)

Find your local and public IP on Linux with ip addr, hostname -I or curl, or in Ubuntu settings — plus your default gateway and DNS servers.

Updated 22 November 2026 · 2 min read

Linux shows two kinds of address: the local IP your computer has on your network, and the public IP your router shares with the internet. Here is how to find both on any modern distribution, including Ubuntu, Debian, Fedora, Mint and Arch.

Local IP address — terminal

The ip command is installed on every current distribution:

ip -brief address

You will see one line per network interface. Ignore lo (the loopback, 127.0.0.1). Your local address is on the active interface — typically eth0/enp… for cable or wlan0/wlp… for Wi-Fi — for example 192.168.1.42/24. The /24 is the subnet size.

For just the addresses, without interface names:

hostname -I

Older guides use ifconfig; it still works where the net-tools package is installed, but ip replaces it.

Local IP address — Ubuntu desktop

Open Settings → Wi-Fi (or Network for a cable), click the ⚙ gear next to the connected network, and read IPv4 Address and IPv6 Address on the Details tab. Other desktops have the same information in their network applet under "Connection information".

Public IP address

Your public IP belongs to your router, so Linux cannot read it locally. Ask a server instead:

curl https://ipclarify.com

This prints just your IP — handy in scripts. For location, provider and ASN as JSON:

curl https://ipclarify.com/json

To force IPv4 or IPv6, add -4 or -6 to the curl command. You can also just open our home page in a browser.

Default gateway (router) IP

ip route show default

The address after via is your router, for example default via 192.168.1.1 dev wlp2s0. Type it into a browser to open the router's admin page — see find your router's IP address.

DNS servers

On distributions that use systemd-resolved (Ubuntu, Fedora and others):

resolvectl status

Look for DNS Servers under your active link. On other systems, cat /etc/resolv.conf shows them.

Troubleshooting

  • The address starts with 169.254. Your computer did not get an address from the router. Reconnect, or run sudo dhclient -r && sudo dhclient (or toggle the connection in NetworkManager).
  • Several addresses on one interface. That is normal with IPv6: you can have a stable address and temporary privacy addresses at the same time.
  • The public IP is not your provider. A VPN or proxy is active. Our VPN check shows whether your real address leaks.

All tools

Look up

Privacy & VPN

Network tools

More