Diberdayakan oleh Blogger.

Jumat, 04 April 2014

Get Windows Computer Name From Linux

by Joielechong sipayung  |  in Networking at  Jumat, April 04, 2014

As I am using vnc system (with tigervnc and tightvnc) to control a couple of windows machines in my office, I need to know the IP Address of computer I want to control. In windows, we can simply pinging the windows computer name with ping <computer name> command like in picture 1.1 where I ping computer with computer name 'vera'.

picture 1.1 ping computer 'vera'

But in Linux, we can't simply ping the computer name. It won't work (picture 1.2).


There is a simple way to get the computer name IP Address from Linux by using samba command. Use nmblookup command to get the IP Address from Windows Computer.

To get the IP Address just type:
nmblookup <computer_name>
<computer_name> is the Windows Computer Name.

look at the Picture 1.3 for nmblookup action.

Picture 1.3 nmblookup

Likewise, to get the Computer Name from Windows Computer IP Address we can use nmblookup -A <ip_address> like in Picture 1.4.

Picture 1.4 nmblookup with IP Address

We also can get All computer IP Address in our LAN with the nmblookup and simple for loop. With this simple code in terminal:
 for i in {1..200} ; do nmblookup -A 192.168.1.$i; done
Here we enumerate all Computer Name from address 192.168.1.1 to 192.168.1.200 



That is. Simple solution :).



0 comments:

Silahkan tinggalkan komentar anda: