Tuesday, October 14, 2008

IP address from NetBIOS name

I will use ping command for knowing the IP address, but for a default *nix system we cannot ping a node using its NetBIOS name. So with a minor edit we can do it all. Here's the process :

  • Edit /etc/nsswitch.conf :
    $ vim /etc/nsswitch.conf
    Or use any other editor of your choice

  • Search for something similar to this :
    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4
    and add wins at the end of the line
    hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 wins
    Save the file and exit

  • Now use ping command :
    $ ping xyz
    You will get a output something like this :
    PING xyz ( 56(84) bytes of data.
    Here is the required IP

There may be different ways but I find this one quite simple.

Source(s) : Samba HOWTO

No comments: