Get public/external IP address?

arbme picture arbme · Jul 15, 2010 · Viewed 160.3k times · Source

I cant seem to get or find information on finding my routers public IP? Is this because it cant be done this way and would have to get it from a website?

Answer

user_v picture user_v · Feb 14, 2014

Using C#, With webclient its a short one.

public static void Main(string[] args)
{
    string externalip = new WebClient().DownloadString("http://icanhazip.com");            
    Console.WriteLine(externalip);
}

Command Line (works on both Linux and Windows)

wget -qO- http://bot.whatismyipaddress.com

OR

curl http://ipinfo.io/ip