Getting The IP Address Of A Computer — The Practical Way

I used to spend about twenty minutes chasing down why a remote session wouldn't connect. Most of the time the problem was simple: I had the wrong IP address. Not the private one, not the gateway, but the actual external address the server sees. Here is how I go about finding it now. The method depends on what you actually need. There is a difference between a private IP address that your router assigned locally and a public IP address that the rest of the internet sees. Mixing these up causes more headaches than anything else in this area. I learned that the hard way when I spent an afternoon troubleshooting a port-forwarding rule that kept failing. The router was fine. The ports were open. I had just been looking at the local 192.168.x.x address instead of the public one my ISP had assigned. Once I ran the right command on the actual machine and then checked from an outside source, the issue resolved in about three minutes. On Windows, open a command prompt and type ipconfig. The output will show you the IPv4 address under your active network adapter. If you need the public IP, that command will not help you. You have to go outside the local network. Open a browser and visit whatismyipaddress.com or use the curl command: curl ifconfig.me. That gives you the external IP directly in the terminal without opening a browser. I use the curl approach when I am working headless or on a remote server.

On macOS, the process is almost the same. Open Terminal and run ifconfig to see local addresses, or look under System Settings, Network, and click the active connection for a cleaner view. For the public IP, curl ifconfig.me works identically. On Linux, the commands are the same as macOS. The networking tools vary slightly by distribution, but the concept does not. One thing people miss is that most home networks sit behind a NAT gateway. Your router has one public IP, and every device on your network shares it. The private IP assigned to your machine is only meaningful inside that local subnet. If you are trying to connect to your computer from outside your network, the private IP will not work. You need to set up port forwarding on the router or use a VPN service like Tailscale or ZeroTier. I recommend ZeroTier for most home labs. It takes about five minutes to set up and handles NAT traversal without touching router configuration. Another edge case I run into is dynamic IPs. Most residential ISPs change the public IP address on a regular schedule, sometimes every twenty-four hours, sometimes after a reboot. If you need a stable address, look into a free DynDNS service. ChangeIP or No-IP both offer free tiers. Configure the client on your router, and you get a hostname that always points to whatever IP you currently have. This cuts the time spent checking your address from a manual process to something that updates automatically.

If you are troubleshooting and want to verify what the outside world sees, do not trust a single source. Some websites report the IP of a CDN edge node rather than your actual address. Run the check from two or three different services and compare. If they differ, one of them is lying to you, usually because it sits behind a proxy. I use curl commands to multiple endpoints and note any variation. This takes about thirty seconds and saves you from assuming you have one address when you actually have another. The command-line approach is faster once you know what to run. On Windows, open PowerShell and type Test-NetConnection -ComputerName ifconfig.me. It will resolve the external IP and even test connectivity to that host. On Mac or Linux, the same curl command works. No browser needed. For people who want a GUI, the Network settings panel in any modern OS will show the local IP clearly. Just remember that is not the address you give to someone trying to reach your machine from the internet. There are limitations to all of this. Some corporate networks use CGNAT, meaning your public IP is shared with dozens of other customers. In that case, no amount of checking will give you a unique external address. Port forwarding becomes impossible without asking the network admin. I hit this at a previous job and had to work around it using a jump box with a static public IP instead. If your ISP does this, the workaround is either a static IP add-on or a VPN tunnel to a VPS with a fixed address.

Get the Full Details

How to Find Your Computer IP Address | Windows & Mac
How to Find Your Computer IP Address | Windows & Mac

Another limitation is IPv6. More networks are getting IPv6 prefixes now, and the public IP might be an IPv6 address while you are looking for IPv4. Check both. On Windows, ipconfig shows both types. On macOS and Linux, ifconfig or ip addr will list them. When testing externally, make sure your destination supports the protocol you are trying to use. Mixing them up causes the same kind of confusion as mixing private and public IPv4 addresses. For most people, this process should take less than two minutes. Command line plus an external check, done. If you are setting up remote access regularly, invest ten minutes in a DynDNS client or a mesh VPN. That initial effort pays off every time you need to connect and do not want to spend time figuring out which IP you currently have.