Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get public/external IP address?

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?

like image 926
arbme Avatar asked Jul 15 '10 08:07

arbme


People also ask

How do I find my public external IP?

Type "cmd" in the search box in the Start Menu or taskbar and click the Command Prompt icon to open the Windows command prompt. Type "ipconfig" in the command prompt window and take note of the IP address displayed.

How do I find someone's external IP address?

Use an IP lookup tool Starting with the simplest way to find someone's IP address is to use one of the many IP lookup tools available online. Resources such as WhatIsMyIPAddress.com or WhatIsMyIP.com offer tools to enter an IP address and search for its free public registry results.

Is external IP public?

The terms public IP address and external IP address are essentially interchangeable. No matter which phrasing you prefer, the function is the same: a public (or external) IP address helps you connect to the internet from inside your network, to outside your network.


2 Answers

Using C#, With webclient its a short one.

public static void Main(string[] args) {     string externalIpString = new WebClient().DownloadString("http://icanhazip.com").Replace("\\r\\n", "").Replace("\\n", "").Trim();     var externalIp = IPAddress.Parse(externalIpString);      Console.WriteLine(externalIp.ToString()); } 

Command Line (works on both Linux and Windows)

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

OR

curl http://ipinfo.io/ip 
like image 64
user_v Avatar answered Sep 17 '22 20:09

user_v


static void Main(string[] args) {     HTTPGet req = new HTTPGet();     req.Request("http://checkip.dyndns.org");     string[] a = req.ResponseBody.Split(':');     string a2 = a[1].Substring(1);     string[] a3=a2.Split('<');     string a4 = a3[0];     Console.WriteLine(a4);     Console.ReadLine(); } 

Do this small trick with Check IP DNS

Use HTTPGet class i found on Goldb-Httpget C#

like image 37
filippakoc Avatar answered Sep 20 '22 20:09

filippakoc