1

I'm connected to my university LAN through their VPN service. Now I want to get the IP of my computer on the local network by its hostname so that I can SSH to it. How can I get the IP address from the hostname? I'm running Ubuntu 13.04 and so is my computer at the uni. Is it even possible, because even while accessing via the hostname, we are actually using the IP address.

Please let me know if you need any more information to answer this.

Thanks!

1

There are at least two ways to do this, that I can think of.

The first way is to run the command arp -a, which will show the names of pcs on the LAN whether they are Windows or *Nix:

      arp -a

You may also use an extremely powerful tool, nmap, which can do an enormous number of things, among which is the one you inquired about:

  sudo apt-get  install nmap
  sudo nmap -sU --script nbstat.nse -p137 192.168.1.0/24

You should adapt the command above to your subnet, instead of 192.168.1.0/24.

This too will return a list of pc-names and addresses, again irrespective of the pc OS. The names will be identified as NetBios Name, and you can sift through the output of the above command by issuing it, instead, in this form:

 sud nmap -sU --script nbstat.nse -p137 192.168.1.0/24 | egrep 'report | NetBIOS'
| improve this answer | |
0

No, its probably not possible to get the IP address from the hostname unless it is defined somewhere - and in this case its not defined anywhere you can get it.

Depending on your Uni, configuration and resources, you might be able to set up dynamic DNS (in conjunction with a dynamic DNS provider) on your laptop which will allow an Internet connected machine to receive updates of the machine name and map it to a domain name.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.