Finding the public IP address of a computer is a simple process. To do this, you need to know the computer’s operating system and its network adapter type. You can also use a program like NetworkManager to find the public IP address of your computer. Once you have these information, you can use a tool like ipconfig to find the public IP address of your computer. ipconfig will show you the computers on your network as well as their public IP addresses.
Being able to access a service to learn your public IP address can be very helpful, but how does the process work? Today’s SuperUser Q&A post has the answer to a curious reader’s question.
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.
Screenshot courtesy of Douglas Porter (Flickr).
The Question
SuperUser reader Harry wants to know what the steps for finding the public IP address of a computer are:
What are the steps to finding the public IP address of a computer?
This is what I already know about creating such a service:
I would set up a web application on the Internet that listens to/for port 80. When a request comes in, I would examine its source IP address and then package that in a nicely formatted HTML response for the user to see.
Is that it, or is there something else involved here as well?
The Answer
SuperUser contributor Scott Chamberlain has the answer for us:
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.
There is, however, one more thing you could do. You could check the X-Forwarded-For header added by some proxies (the kind used for caching) and/or load balancers and report that address instead because the address you get from the source address will be the proxy’s address, not the user’s.
However, that header is user provided, so there is no way to prove that the address listed in X-Forwarded-For is the real source address of the user.