Tuesday, September 19, 2006

ping using netbios name from Linux box

I have a linux box in a LAN with almost other boxen are MS Windows ME/XP. This Linux box acts as a WINS server serving request from LAN for netbios information. I can get the name of pcs in my workgroup using smbclient -L mywinsserver but I didn't know the ip address of each client. I would like to ping the name of a client pc using netbios names. How to overcome this? I got this simple solution from the net. Put wins in /etc/nsswitch.conf like this:

hosts:          files dns wins

This line says, try looking in /etc/hosts files and then dns server and then wins server for the ip address of the name. This is only applicable if there is a WINS server in your network. If not, you're out of luck.

tips : to speed up netbios name resolution, try putting wins in the front like this

hosts:          wins files dns

I don't recommend this unless you access clients on your network frequently. Otherwise, the default should be enough.


4 comments:

Unknown said...

I saw several posts just like yours. They were for ubuntu and stated also that winbind package should be installed. Since I had fedora 9, with winbind already installed, I only edited the nsswitch.conf file as described. However, nothing has ever changed. I even tried to start the winbind service manually(since it isn't running by default), but this didn't help either. I noted in your post that you mentioned that a WINS server should be running on my network, and this doesn't exist in my case. I'm going to try installing samba(server) itself(I only had the client installed) so that it may act as a WINS server on my network and see how the results may be. Thanks for paying my attention to the WINS server tip.

Zamri said...

Yes. You must have a WINS server. Otherwise, where your client will get the IP? Remember that WINS server acts just like DNS server.

Anant Khaitan said...

this is what I was looking for .. Thanks for sharing

Zamri said...

Thanks for reading.. :)