How do I find out my IP address on Linux?

Three commands to see your Linux machine's IP: list every interface, ask the kernel which source address it really uses, and confirm it sits on the default route.

LinuxifconfigroutingnetworkroutetroubleshootingipLow risk
Run the compact address listing first — it prints every interface with its state and IPv4/IPv6 addresses in one short table, and for most people the answer is the IPv4 address on the interface that shows UP.

What this covers

You need your machine's IP — to let someone SSH in, to open the right subnet in a firewall, or to configure a service to listen on the right address — and the habit of typing ifconfig now just returns command not found on a modern distribution. The right tool is iproute2's ip command. This walks through it in three short moves: see every address on the box, pin down which one your traffic actually uses, and confirm it is the one on the default route, so you can give an answer with confidence instead of guessing between two interfaces.

Symptom

?You have to report or configure this machine's address, but ifconfig is missing, or the own-machine output is a wall of text full of docker0, veth and virbr0 entries, and you cannot tell which of the several 192.168 addresses is the real one.

List every interface with its address in one table

Start here because the answer is not one value — a machine with Docker, VPN or virtual machines has several addresses, and you need to see which one sits on which interface. The compact listing prints one line per interface with its administrative state and its IPv4 and IPv6 addresses, so you can ignore loopback (127.0.0.1), link-local (fe80::…) and the bridge devices named docker0, virbr0 or veth…, and read the IPv4 address off the physical interface that shows UP — eth0, enp3s0, wlan0 or wlp2s0. If the line you need shows no IPv4 address, that interface simply has no address right now and the listing has already told you why nothing else worked.

One command that prints every interface with its state and IPv4/IPv6 addresses in a short table — the modern, memorable replacement for digging through `ifconfig` or the verbose `ip addr` output.

Command
$ ip -br a

Ask the kernel which source address it would actually use

The table gives you candidates; this step gives you the definitive one for talking to the outside world. The kernel performs a real route lookup for whatever destination you name and prints the source address it would stamp on the packet — that value in the src field is the address every other machine on the network sees as you. Put a real off-LAN destination in place of the example address, for instance a public DNS server such as 8.8.8.8; if you look up a host inside your own subnet you only learn which address reaches that subnet, which is the same answer but less convincing. If the lookup reports the route goes out via a device you did not expect (a VPN tunnel like tun0 or wg0), that is your answer for general traffic and you should report that address instead.

See exactly which interface, source address and gateway the kernel picks for a given destination — no guessing from routing tables.

Command
$ ip route get 192.168.1.10

Confirm that interface is the one holding the default route

An address is only useful if traffic actually leaves through the interface that owns it. The routing table shows a default line in the form default via <gateway> dev <interface> — the device named there must be the same interface whose address you read in step one. If it matches, your answer is settled: the address belongs to the NIC that carries all off-LAN traffic, and the gateway printed on that line is a handy sanity check that you are on the network you think you are. If it does not match, the address you found belongs to a secondary card or a bridge, and you should give the address of the interface named on the default line instead.

The routing table is the first thing to check when traffic leaves the wrong interface or the gateway seems dead — and `ip route show` is the quick, modern way to read it.

Command
$ ip route show
!Nothing here modifies the system, so the steps are safe to run as a normal user. Two things to keep in mind: don't paste raw output into public issue trackers, because it exposes your internal addressing and gateway; and the address you find this way is your private LAN address — the public address the outside world sees is translated by your ISP or router and cannot be read locally.

How to confirm it worked

You have a private-range address (192.168.x.x, 10.x.x.x or 172.16–31.x.x) from the address table, the same address appears in the src field of the route lookup toward a public destination, and that interface is the device named on the default route line.

Sources

  • ip(8) — Linux manual page
    man7.org · technical · 2026-09-17
    Evidence: Documents `ip -br addr` as the brief, one-line-per-interface output format of the ip command
  • ip-route(8) — main IPv4/IPv6 routing table management
    Debian manpages · community · 2026-09-17
    Evidence: Page documents the 'get' subcommand ('ip route get' — get a single route) and route attributes like via/dev/src; confirms 'ip route' and 'get' appear in the text.
  • ip-route(8) — Ubuntu man page
    Ubuntu manpages · community · 2026-09-17
    Evidence: Man page contains the 'get' subcommand description showing it performs a route lookup and returns the resolved via/dev/src values.

Last verified: 2026-09-22

Related guides