How to Find Your IP Address on Windows and Linux

To find your local IP address, run ipconfig on Windows or ip addr on Linux. To find your external (public) IP, run curl ifconfig.me or open a service such as ipinfo.io in a browser. Below are all the methods with exact commands and an explanation of which address you actually need in each situation.

Local and public IP: what is the difference

  • Local (private) IP — the address of a device inside your own network (Wi-Fi, LAN). Usually from the 192.168.x.x, 10.x.x.x or 172.16–31.x.x ranges.
  • Public (external) IP — the address the internet sees you under. It is assigned by your provider, and this is the one you need to reach your server from outside.
Address type Where it is visible Example
Local inside the network 192.168.1.42
Public on the internet 203.0.113.17

How to find your IP on Windows

  1. Press Win + R, type cmd, press Enter.
  2. Run the command:
ipconfig

Look for the IPv4 Address line under the active adapter (Ethernet or wireless) — that is your local IP.

For full details, including the MAC address and DNS servers:

ipconfig /all

In PowerShell you can pull just the addresses with a single command:

Get-NetIPAddress -AddressFamily IPv4 | Select-Object IPAddress, InterfaceAlias

How to find your IP on Linux

The modern way is the ip utility from the iproute2 package:

ip addr show

The address follows inet on the interface you need (for example eth0 or ens3). To print only the IP without the extra output:

hostname -I

To filter a specific interface:

ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'

The legacy but still common ifconfig command (net-tools package):

ifconfig eth0

How to find your external (public) IP

Your public IP does not appear in ipconfig/ip addr output when you are behind NAT. You can only learn it by asking an external service.

With curl (Linux, macOS, Windows 10+):

curl ifconfig.me

Alternative echo services in case the first one is unavailable:

curl ifconfig.co
curl https://api.ipify.org
curl https://ipinfo.io/ip

In PowerShell, without curl:

(Invoke-WebRequest -Uri "https://api.ipify.org").Content

In a browser, open any of these sites: ipinfo.io, whatismyip.com, ifconfig.co — they show your public address immediately, and often the country and provider as well.

How to find the IP of a remote server

If you need the IP behind a domain name, use a DNS query:

dig +short example.com
nslookup example.com

How to find your router (gateway) IP

The router IP is your network’s default gateway — all outbound traffic leaves through it. You need it, for example, to open the router web interface or set up port forwarding.

Windows:

ipconfig | findstr "Default Gateway"

Linux:

ip route | grep default

In the output, the address after default via is the gateway — usually 192.168.0.1 or 192.168.1.1.

How to list all network interfaces

A server can have several interfaces: public, private network, loopback, Docker bridge. To see them all in short form:

ip -br addr

The columns are: interface name, state (UP/DOWN) and assigned addresses. The lo interface with address 127.0.0.1 is loopback — it is always local and never visible from outside. The public address usually sits on eth0/ens3, while 10.x/172.x addresses belong to the private network between servers.

Frequently asked questions

Why are my local and public IP different? Because you are behind NAT: your provider’s router translates many internal addresses into one public address. Inside the network you are 192.168.x.x, outside you appear as the provider’s address.

My public IP keeps changing — is that normal? Yes, most home plans use a dynamic IP that changes on reconnection. For a permanent address you need a static IP, usually a paid option from your provider or a VPS.

Why does curl ifconfig.me not work? Either curl is not installed or the service is blocked. Install curl (apt install curl) or use the api.ipify.org alternative.

How do I find my IPv6 address? On Windows it appears in ipconfig as IPv6 Address, on Linux use ip -6 addr show. For the public IPv6: curl -6 ifconfig.co.

Which IP do I use to connect to a server? The server’s public IP. On a VPS it is static and shown in the control panel right after the machine is created.

Need a server with its own static public IP? Deploy a Linux VPS or pick a configuration in the VPS hosting section.

Kristaps Bērziņš