Get a computer name from IP address in a LAN: command line

Get a computer name from IP address in a LAN: command line

This article will explain how to find the hostname of a computer, connected in a LAN, using an IP address. Depending on the type of IP address - public or private - there are two different procedures. If you want to know how they work, keep reading.

How to find a hostname via public IP address?

In order to find the hostname of a computer with a public IP address, you have to pass the address to the Domain Name System (DNS) server. Here are the steps to follow:

  • Click on the Window Start button.
  • Click on “All Programs”.
  • Click on “Accessories”.
  • Right-click on "Command Prompt".
  • Choose "Run as Administrator".
  • Type “nbtstat -a <ip_address>”. Note that <ip_address> is the IP address of the computer.

How to find a hostname via private IP address?

Finding the hostname of a computer with a private IP address and no local DNS server means you need to query the host itself by using a Windows utility. Here are the steps to follow:

  • Click on the Window Start button.
  • Click on “All Programs”.
  • Click on “Accessories”.
  • A black box opens.
  • Type "nslookup -a <ip_address>". Note that <ip_address> is the IP address of the computer.

Note that it is not necessary to know an IP address in order to find other systems if you have a WiFi LAN connection.

We hope that you find these solutions useful and that your question is answered!

Do you need more help with finding an IP address? Check out our forum!