0

I was wondering if anyone knew how to get the actual public IP Address of someone who was connected to a VPN, for example, let's say that my real IP address is 109.174.134.423 (made up), but I am connected to a VPN who's IP address is 32.59.102.302 (made up), how would I get the first IP Address instead of the second one. Right now my method is

string IP = new WebClient().DownloadString("https://api.ipify.org/");

but this returns the second IP, the IP of the VPN Server.

Any solutions would be greatly appreciated, thanks.

  • A VPN is usually exposed as a virtual NIC that replaces your router as the gateway for some or all Internet-bound traffic. This would be done by updating your routing table. The only way I see that you could get the real IP address is if you could add a route to `api.ipify.org`'s own IP that uses the physical NIC's default gateway. – ProgrammingLlama Mar 22 '21 at 03:07
  • Take a look at [this question](https://stackoverflow.com/a/49579578/3181933). – ProgrammingLlama Mar 22 '21 at 03:08
  • Sorry, I'm not really familiar with the route.exe, can you explain the command in a bit more detail? – Alexander Mylnikov Mar 22 '21 at 03:35
  • Microsoft has docs [here](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/route_ws2008) for it. Essentially it's the for administering and viewing the routing table for your computer, which is partly how your computer knows where to send network traffic. – ProgrammingLlama Mar 22 '21 at 03:39

0 Answers0