How to Find Your IP Address in Linux: Local, Public, and NAT Checks
There are two IP addresses people usually mean when they ask how to find an IP address in Linux.
The first is your local or private IP address, the address your machine uses inside a LAN, VPN, container network, or cloud subnet. The second is your public IP address, the address external services see when your machine reaches the internet.
This guide shows both, explains how to spot NAT, and gives a simple ToolLeap endpoint for scripts and operational runbooks.
Quick answer
For local addresses:
ip addr show
hostname -I
ip route get 1.1.1.1For the public address seen from the internet:
curl https://ip.toolleap.comLocal vs public IP addresses
| Address type | What it means | Common use case |
|---|---|---|
| Local IP | The address assigned to your machine on a local network, VPN, container network, or cloud subnet. | Debugging SSH access, service binding, routing, and internal connectivity. |
| Public IP | The address external services see after NAT, proxying, VPN, or cloud egress. | Firewall allowlists, support diagnostics, incident runbooks, and CI runner checks. |
Commands to find your local IP address
The most complete command is:
ip addr showLook for an address under your active interface, often named eth0, ens3, wlan0, or similar.
For a shorter output:
hostname -ITo see which local address Linux would use for outbound traffic:
ip route get 1.1.1.1This is often the most useful command when a machine has multiple interfaces.
Check the public IP address
For automation, support scripts, and runbooks, a plain-text public IP endpoint is easier than parsing a web page.
curl https://ip.toolleap.comThe response is just the public IP address, so it can be used in shell scripts, CI jobs, diagnostic snippets, and incident notes.
How to tell if you are behind NAT
Compare the local IP address from Linux with the public IP address returned by ToolLeap.
- If the local address is private, such as
192.168.x.x,10.x.x.x, or172.16.x.xthrough172.31.x.x, and the public address is different, you are behind NAT. - If the local address and public address match, the machine may be directly reachable from the internet, depending on firewall and routing rules.
- If the public address changes when a VPN is enabled, the VPN is controlling your egress path.
Use cases for platform and DevOps teams
- Confirm the egress IP of a CI runner before adding it to a firewall allowlist.
- Capture public IP data in a support ticket without asking users to open a browser.
- Verify whether a VPN, proxy, or NAT gateway is being used.
- Add a quick public IP check to incident response runbooks.
- Debug why a cloud service sees a different address than the machine reports locally.
ToolLeap keeps this endpoint intentionally simple because operational tools are most useful when they can be copied into a terminal, a runbook, or a CI step without ceremony.
ToolLeap context
IP Intelligence is one of the lightweight developer tools behind ToolLeap. It supports the same kind of practical platform work we do for AI and infrastructure teams: clear diagnostics, controlled access paths, runbook-friendly utilities, and reliable developer workflows.
If your team is building internal developer platforms, CI runner environments, controlled browser terminals, or AI products that need stronger operational tooling, see ToolLeap AI Platform Engineering.