Why Doesn’t My Machine’s IP Address Match What I’m Told on the Internet?

IP addresses versus IP addresses.

Ever wonder why your computer shows one IP address, but websites see something totally different? They're both right. I'll describe how your router juggles two addresses behind the scenes and how that protects you every time you go online.
a computer and router on a desk with a symbolic connection from the computer to the router, and from the router to the cloud representing the internet
(Image: Gemini)
Question: Using tools on my machine, I can see that my IP address is one thing (in my case, 192.168.1.100). But when I go to an internet site that shows me my IP, it shows me something completely different. Which is right?

They both are.

Your machine has one IP address, but it isn’t necessarily the IP address that is used to connect to the internet.

The IP address that appears depends on who’s looking and from where.

TL;DR:

Two IP addresses

When you check your computer’s IP address, you’ll see a local number, like 192.168.1.100. But websites see your router’s address. Your router acts as a middleman, swapping addresses back and forth using a process called NAT. Both addresses are real and correct!

Your computer’s IP address

Windows doesn’t come with any great utilities to make finding your computer’s IP address easy. (Before you object, I’m talking about the IP address of your computer. As we’ll see in a moment, that’s not something you’ll get from a website.)

The simplest way to find the IP address of your computer is by running a Windows Command Prompt. In the Command Prompt window, type ipconfig followed by Enter.

Command Prompt showing IP address

I’ve highlighted the IP address assigned to the computer’s network adapter. This is the computer’s IP address.

Your computer’s internet IP address

Calling something an internet IP address feels redundant, as IP stands for Internet Protocol. As the Internet Protocol is often used even when not directly connected to the internet, it’s not really that silly to talk about an IP address on the internet, or its internet Internet Protocol address.

There are several sites on the web you can visit to learn your internet IP address. For example, here’s mine, via whatismyipaddress.com.

My IP Address
My IP address. Click for larger image. (Screenshot: askleo.com)

So why is your internet IP address different than your computer’s IP address?

How IP addresses are born

Let’s back up and look at how IP addresses are assigned.

In most cases, internet addresses are assigned dynamically.

May I Have an IP Address?
Your computer asking your ISP for an IP address. Click for larger image. (Image: askleo.com)

In this example, your computer uses a protocol called DHCP (for Dynamic Host Configuration Protocol) to connect to its ISP or network provider. It asks for an IP address, and the ISP assigns one. From here, that IP address identifies that computer on the internet. The IP address may change: each time the computer connects, it may be given a different IP address. That’s why it’s called a dynamic IP address.

A static IP address is, well, static; unchanging. Your computer doesn’t ask your ISP for an IP address. Both the computer and the ISP are pre-configured manually to “know” the IP address from the start and the computer that it refers to:

Static IP address.
How a static IP address works. Click for larger image. (Image: askleo.com)

Most of the rest of this article applies equally well to static and dynamic assignment, except in the details of how the IP addresses are actually assigned. Dynamic is most common and is almost certainly what you’re using.

Let’s insert a router into the mix. It sits between the computer and the internet. When you turn it on or attach it to your ISP’s provided connection, one of the first things it does is ask for an IP address.

Your router asking for an IP address.
Your router asking for an IP address. Click for larger image. (Image: askleo.com)

Note that the router asked and received an IP address. That address identifies it — the router — on the internet.

At some point, you turn on your computer, which is connected to the router. It must also ask for an IP address.

PC getting IP address from router.
A PC getting an IP address from its router. Click for larger image. (Image: askleo.com)

The computer makes its request of the router this time and receives an IP address back from the router. Note that the “192.168.” address is special. You’ll never see IP addresses beginning with 192.168. (or 10., or 172.16. through 172.31.) on the internet. Those are reserved specifically for use by local networks.

If you connect a second computer to your router, you are building a local area network, or LAN.

Two computers connecting to a router.
Two computers connecting to a router. Click for larger image. (Image: askleo.com)

Note that the two computers each get a unique IP address assigned by the router.

And the router has its own IP address that connects it to the internet.

Network Address Translation (NAT) at work

Now, what happens when one of those computers makes a request that accesses something on the internet? The computers get to the internet through the router, so the first step looks like this.

Fetching a web page, step 1.
Fetching a web page, step 1. Click for larger image. (Image: askleo.com)

The router then passes that request to the internet via your ISP.

Fetching a web page, step 2.
Fetching a web page, step 2. Click for larger image. (Screenshot: askleo.com)

To the internet, it looks like the router is making the request. Remember, the internet cannot see your internal IP address, so the router translates from the internal address (192.168.1.100) to the external (1.2.3.4 in this example). When the response arrives, the same translation happens in reverse.

Fetching a web page, the return path.
Returning a web page. Click for larger image. (Image: askleo.com)

The router keeps track of which computer on the Local Area Network (LAN) side the request belongs to and routes the response appropriately.

That’s what’s called NAT (Network Address Translation). The router manages the IP addresses on a LAN, or Local Area Network, and then translates to the appropriate IP address as connections are made across it to the internet.

Why NAT?

There are two major reasons why NAT is used even when only one computer is connected to a router.

  • All of the devices behind the router appear to use exactly one IP address on the internet. You may have heard that the internet is “running out” of IP addresses, and this technique was initially developed as a way around that. It’s a way to connect a large number of computers to the internet while using only a single internet IP address.
  • Connections can only be initiated outbound. This turns your router into a powerful firewall. The computer behind the router can make a connection to a server on the internet, like perhaps https://askleo.com. Once established, that connection can then transfer data in either direction, but it had to be initiated by your computer. A computer out on the internet cannot initiate a connection to your machine. There’s no protocol to traverse the router in the reverse direction. Your router prevents outside computers from randomly connecting to yours.

Even if the first issue weren’t an issue, I’d still recommend using a NAT router as a firewall. It’s that simple and good.

Do this

Your computer can appear to have two IP addresses:

  1. The local IP address assigned to it by your router.
  2. The internet IP address of your router. This is the IP address visible to the connections you make to sites and services on the internet.

They both have important roles to play.

Subscribe to Confident Computing! Less frustration and more confidence, solutions, answers, and tips in your inbox every week.

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.