To find your local IP address on Linux, open a terminal and run ip addr. For a quick list of IPv4 addresses, use hostname -I; if you need the address Linux will use to reach another network, check the route with ip route get 1.1.1.1.
Quickest Ways to Find the Address
The ip command is the standard starting point on current Linux distributions. Run:
ip addr
Look for an interface such as wlp2s0 (often Wi-Fi), enp3s0 (often wired Ethernet), or eth0. An IPv4 address appears after inet, while an IPv6 address appears after inet6. For example, inet 192.168.1.42/24 means the interface has IPv4 address 192.168.1.42; /24 is the network prefix length, not part of the address.
If you want a compact overview, use:
ip -br addr
This presents interfaces and their addresses in a brief, easier-to-scan format. To show only IPv4 addresses with their interface names and prefix lengths, try:
ip -4 -o addr show
These commands only inspect the computer’s network configuration. They do not change it and do not require administrator privileges on a typical desktop system.
Reading the Output of ip addr
The output can include several interfaces, and not every listed address is the one you want. The loopback interface, usually named lo, has addresses such as 127.0.0.1 for IPv4 and ::1 for IPv6. These refer to the computer itself; other devices on your network cannot use them to contact it.
Look for an interface that is up and connected to the network you care about. A wireless interface commonly starts with w, while wired interfaces often start with en, but names vary. Linux may also list virtual interfaces created by VPN software, containers, virtual machines, bridges, or wireless sharing. Their addresses are real for those network connections, but may not be the address another device on your home network should use.
In the output, state UP indicates an interface is administratively enabled, while flags and carrier information can help show whether it has an active link. An address marked dynamic was generally assigned automatically, often through DHCP. The word scope global means the address is not limited to the host in the way a loopback address is; it does not by itself mean the address is globally reachable over the internet.
Find the Address Used for a Particular Route
A computer can have multiple addresses at once. It might be connected to Wi-Fi and Ethernet, have a VPN, and run containers. In that situation, asking for “the” local address is ambiguous. The most useful answer depends on which destination you want to reach.
To see which interface and source address Linux would select for a typical IPv4 internet destination, run:
ip route get 1.1.1.1
A result might contain dev wlp2s0 src 192.168.1.42. Here, dev identifies the outgoing interface and src is the source address Linux would use for that route. This is a route lookup; it does not send a test request to that address. If you need to know the route to a specific computer or server, replace 1.1.1.1 with that destination’s IP address.
For IPv6, a similar lookup can be made with an IPv6 destination, for example ip -6 route get 2606:4700:4700::1111. The result depends on the system’s routing configuration. A VPN may intentionally change which interface and source address are selected, so check the route while the VPN is in the state relevant to your task.
Other Useful Terminal Commands
hostname -I (capital letter i) is a convenient shortcut when you just want a space-separated list of addresses:
hostname -I
It does not label each address with an interface, and the output can include addresses from more than one network. Do not assume that the first address is always the correct one. For a quick display that includes interface names, ip -br addr is usually clearer.
On systems using NetworkManager, nmcli can show device status and connection details. Start with:
nmcli device status
To inspect a particular active connection, use nmcli connection show to find its name, then run nmcli connection show "connection name". The output includes configured IP settings. This is helpful when diagnosing whether an address was assigned automatically or set manually, though the exact fields depend on the connection and NetworkManager version.
Older guides may recommend ifconfig. It may still be available on some installations, but it belongs to the older net-tools suite and is not installed by default on many modern distributions. Prefer ip for current instructions; there is usually no need to install an older tool just to view an address.
Local, Private, Public, IPv4, and IPv6 Addresses
“Local IP address” usually means an address assigned to one of the computer’s network interfaces, as opposed to the public address seen by internet services. On a typical home IPv4 network, a router assigns devices addresses in private ranges such as 192.168.x.x, 10.x.x.x, or 172.16.x.x through 172.31.x.x. The router commonly translates traffic from those devices to a public IPv4 address.
That common arrangement is not a definition of “local.” A local interface can have an IPv6 address that is globally scoped, and networks may use other address plans. Conversely, a private IPv4 address is not automatically reachable from every device: routing, wireless isolation, firewalls, and VPN settings can all affect connectivity. An address alone does not prove that a service is accessible.
To filter the display by address family, use ip -4 addr for IPv4 or ip -6 addr for IPv6. IPv6 output may show more than one address on an interface, including a link-local address beginning fe80:. Link-local IPv6 addresses are intended for communication on the local link and are not interchangeable with a globally scoped IPv6 address. When using one, the interface may need to be specified as well.
If a website tells you your public IP address, it is reporting the address visible at the internet-facing connection, not necessarily an address configured on your Linux computer. With a router, the public IPv4 address is often assigned to the router. A command such as ip addr will not reveal that router-side address in the usual setup.
Finding the Address in a Desktop Settings App
If you prefer a graphical interface, open your desktop’s network settings and select the active Wi-Fi or wired connection. Look for a section named Details, IPv4, IPv6, or Network. The exact wording and layout differ between GNOME, KDE Plasma, and other desktop environments, and distributions may customize them.
Check that you have selected the connection currently in use. A saved Wi-Fi network that is disconnected can show configuration information without being the active route. The settings panel is convenient for a one-time check; the terminal commands are more consistent for troubleshooting, remote administration, or copying a precise interface address.
Common Problems and What They Mean
- You see only
127.0.0.1or::1: Those are loopback addresses. Check whether Wi-Fi or Ethernet is connected, then inspect the relevant interface withip addr. If it has no ordinary address, renew or reconnect the network connection. - You see several addresses: Identify the interface connected to the network you mean to use. Use
ip route getwith the intended destination to find the selected route and source address. - The address starts with
169.254: This is an IPv4 link-local address, which Linux may assign when normal configuration such as DHCP does not provide an address. Check the cable or Wi-Fi association, DHCP service, and router or network settings. - A command says “command not found” for
ifconfig: That does not mean networking is broken. Use the built-inip addrcommand instead. - The address changes after reconnecting: That is normal when DHCP assigns addresses dynamically. A reservation on the router or a correctly configured static address can make an address more predictable, but avoid setting a static address that conflicts with another device.
- Another device cannot connect using the address: Confirm both devices are on a network that can route between them, check that you used the correct interface and address family, and inspect the Linux firewall and the application’s listening address. A service listening only on
127.0.0.1accepts local connections but not connections arriving through the LAN interface.
Using the Address Safely
A local address is useful for tasks such as connecting to a development server from another device, sharing files on a trusted network, or checking a machine’s network configuration. For a service to accept connections, it must be running and listening on an address reachable by the client. The firewall must also permit the relevant port, and the network must allow traffic between the devices. Finding an address is only one step in that process.
Do not publish an address or open a service to the internet unless you understand the exposure. Private IPv4 addresses are usually not directly routable from the public internet, but devices on the same network may still reach them. IPv6 may allow direct inbound routing depending on the network and firewall. Keep firewall rules restrictive and share only the address needed for the intended connection.
Frequently Asked Questions
What command shows my IP address on Linux?
Run ip addr to see addresses grouped by interface. For a shorter view, use ip -br addr; use hostname -I for a simple list without interface labels.
How do I show only my IPv4 address?
Run ip -4 addr to display IPv4 information for all interfaces. To focus on non-loopback addresses with interface names, try ip -4 -o addr show scope global, then identify the interface that matches your connection.
Is 192.168.1.42 my public IP address?
Usually not. An address in 192.168.x.x is in a private IPv4 range and is commonly used inside a home or office network. A router often has a separate public-facing address.
Why does Linux show more than one local IP?
A machine can have several interfaces and address families, plus VPN, virtual-machine, or container networks. Each may have its own address. Use the route lookup for the destination you care about to see which source address Linux would select.
Does my local IP address stay the same?
Not necessarily. DHCP can assign a different address after a lease renewal, reconnect, or network change. If you need a stable address, ask the network administrator or configure a DHCP reservation or static address carefully.