WAN IP Address

  • Is it possible to find the WAN IP Address from T-SQL? I have only been able to get internal IP Addresses using WinSock.

    Thanks for any help.

  • This was removed by the editor as SPAM

  • Do you mean the address of an inbound connection? I have never been able to find a way to do that from T-SQL. You can get the mac address, but that won't help. I suspect you could write an extended stored procedure to do so, but haven't run across any pre-written.

    If you mean the IP address of the server you are on, I suspect you can get that (e.g. from an IPCONFIG, or there are probably other ways).

  • At the command prompt run ipconfig /all . find your nic address used and locate the default gateway. The gateway is your out bound connection to the WAN. But some times this is not true. To test this properly run a tracert on i.e. http://www.microsoft.com . On the result you would see the default gateway and then the rest of the hops the IP packet takes to get to microsoft.com . After the hop, your default gateway, the next one should be your public IP address to the Internet or WAN. Please be advised that If you are trying to come from the Internet to your SQL box there will have to be a open port pointing to your SQL boxes IP address and port number. Most companies would not let this into there private network, but may allow the sql box to reside in a DMZ (safe area).

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply