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.
The Public or External IP address is the one which is provided by your Internet Service Provider (ISP). Multiple computers can have a single public IP if a network is set up using the 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.
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:
- 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:
Get my external IP address from command-line
Sometimes we need to check out 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 for using 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 all should have the same public IP.
We can get the external 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.
nslookup myip.opendns.com resolver1.opendns.com
You can also use PowerShell command to get the external IP without using any third-party IP lookup tool.
- Open PowerShell by going to Run –> powershell
- Run the following command:
Get my 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 will display the exact information about the public IP and other network info assigned from your ISP. I hope this has been informative for you. Do let us know in the comments below if any information is missing.