An IP address is used to identify a computer in a network. There are mainly two types of IP addresses:
- Local Network (LAN) IP address or Local IP address or Private IP address or Internal IP address.
- The Public IP address or External IP address
The private IP is the one that is used within a local area network. This IP is used to identify the computer within the LAN. This private IP can’t be accessed directly from the Internet.
Also, read about how to check the mac address of your computer or any remote computer in the network.
Public or External IP address is the one provided by your Internet Service Provider (ISP). Multiple computers can have a single public IP if a network is set up using a technique called NAT (Network Address Translation). Since public IP is normally not provided free of cost, people use a mixture of private IP addresses that connect to a single public IP address to run the Internet on every network computer in a private network.
Please note that a single computer can have multiple LAN and public IP addresses. Let’s find out how we can find the private and public IP addresses in Windows using command-line options.
Table of Contents
Find my IP Address (Local Area Network)
If you want to know about the network information of your computer, you can get it from multiple locations. Let’s list down some of the locations and then we’ll go through the command-line option.
- Windows Settings –> Network & Internet
- Control Panel –> Network and Sharing Center
- Task Manager –> Performance tab
Now let’s see how you can get all the network-related information using Command Prompt:
- Open command prompt by going to Run –> cmd.
- Run the following command for IP address lookup:
ipconfig
This will show you the summary of all the connected network interfaces including their assigned IP addresses.
If you want complete information of all the network interfaces on your computer, you can run the following command:
ipconfig /all
Get your public IP address using command-line
Sometimes we need to verify what our external IP address is. Let’s see how we can get the public IP information using command-line in Windows. Please note that you need to be connected to the Internet to use the below-mentioned commands and services.
If you have a home network, you can run these commands on one device even if multiple devices are connected to the Internet. They should all have the same public IP.
Find your public IP address using Command Prompt
You can get public IP information using the command nslookup and the OpenDNS service. Just run the following command on your command prompt and you will get your external IP address.
The following command will get you the public IP address of your computer:
nslookup myip.opendns.com resolver1.opendns.com
Find public IP address of your computer using PowerShell
You can also use PowerShell to get the external/public IP without using any third-party IP lookup tool.
Open PowerShell by going to Run –> powershell. Run the following command to get the public IP address of your computer:
(Invoke-WebRequest ifconfig.me/ip).Content.Trim()
Get your computer public IP address using third-party services
There are a few services on the Internet which can show you the public IP by simply opening a webpage. The benefit of some of these services is that they will show you a host of other related things like IP location, ISP name, Internet protocol (ipv4 and ipv6 address) etc. Here is the list of these third-party services:
- Google.com – Search for “my ip” and Google will show you the public IP of your device.
- Whatismyip.com – Shows a wealth of information about the network including the external IP. What is my IP command line is also available through their API service.
- Myexternalip.com – Simply outputs the public IP in plain text.
- Icanhazip.com – Outputs public IP in text format.
- ifconfig.me – Displays a wealth of information including public IP, user agent, port used, language, etc.
When in doubt, you can always go to your router, which displays the exact information about the public IP and other network info assigned from your ISP. I hope this has been informative for you. Please let us know in the comments section below if any information is missing.
6 comments
timeless.tavern
Public IP can be found via CMD by “curl ifconfig.me”
Have a wonderful day!
Larry
From Windows 10, Linux, or OSX command line:
curl ifconfig.me
curl ifconfig.me/all
curl ifconfig.me/all.json
John Machacek
This is gold, thank you Larry!
Alan
Thank you, Usman. This was very helpful in a recent on-call pinch I was in.
-Alan
John Veldhuis
In some cases it is necessary to use
(Invoke-WebRequest -UseBasicParsing ifconfig.me/ip).Content.Trim()
Win10Geek
If you want to check and log public IP address changes on your computer, you can use Public IP Logger. I’m using Public IP Logger and loving the tool :)
https://github.com/ingram1987/Public-IP-Logger