Link to home
Start Free TrialLog in
Avatar of airplays
airplays

asked on

How to enable netbios for NBNS name resolution?

How can I enable netbios (NBNS) name resolution on Linux?

I have a windows 2000 pc and a Linux pc (knoppix) running Samba.

I determined (via sniffer) that the Win2k pc finds my Linux pc by machine name, by sending a NBNS broadcast query (after getting no results from a DNS query).

However the Linux pc only does a DNS query, not a NBNS query, so it can't find the windows pc.
Avatar of harbor235
harbor235
Flag of United States of America image

You can set up Samba as a WINS server by setting two global options in the configuration file, as shown below:

[global]
      wins support = yes
      name resolve order = wins lmhosts hosts bcast


harbor235 ;}
Avatar of airplays
airplays

ASKER

I set those options in /etc/samba/smb.conf,  and did a /etc/init.d/samba stop, then /etc/init.d/samba start...

But there was no change... my sniffer (ethereal) showed that when pinging my win2k box, only a DNS query was sent, not an NBNS query.

ASKER CERTIFIED SOLUTION
Avatar of jar3817
jar3817

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi airplays,

Try:

nmblookup <netbios_name>

Steve :)
harbor234: My understanding is that there is already a WINS server running on the win2k box - how would a WINS server running on Linux help me find the win2k from Linux?

jar3817:  I made the change to the file, but still no NBNS query when pinging.  Do I have to restart a service for that to take effect?

sda100:  that function successfully returned the IP of my win2k box (which is useful, thanks!)  however how do I enable NBNS queries when pinging?
Ah, yes...

With help from another source... you need to edit /etc/nsswitch.conf

Add the wins parameter to the "hosts:" line, for example:

       hosts:      files dns wins

Then you should just be able to ping by netbios host name.

Steve :)
Sorry jar3817, I've just read your answer - I was a little late there.
Like I mentioned, I edited /etc/nsswitch.conf to contain "hosts:      files dns wins"

Still no NBNS query when pinging (only DNS).  Do I have to restart a service for that to take effect?  I'm on Debian (knoppix)
Is it able to query but just can't find the name, or are you getting an error when you try?

For the Windows machine, does it have a firewall  (if so, turn off for testing)

On the Windows machine, does the output of this command match the name you're trying to ping?

     nbtstat -n | find "<00>  U"

(there's 2 spaces before the U)

Steve :)
Yes on windows that command is the machine name I ping.  

But really it shouldn't make a difference if the name is correct or not.  Because I determined with the sniffer that when I ping from Debian knoppix, it only attempts a DNS query, whereas pinging from windows attempts a DNS then a NBNS query.

So I just want to enable the Debian knoppix box to also perform an NBNS query, which won't matter whether the target name exists or not.
Ok, that makes more sense.  On my test system (Fedora Core #3), all I had to do was edit nsswitch.  If, on Debian, you have to also restart networking, then Google says:

     /etc/init.d/networking restart

Failing that, can you post the [global] section of your smb.conf?
Or just try rebooting the server.

This might not be the answer you're looking for, but why don't you just set up a dns server? You can do it on the linux machine. Netbios is an old dead protocol. Starting with windows 2000 they switched the default name resolution from netbios to dns. As long as you have the right dns suffix set in all the computers you'll be able to do \\computername\share and have it work.
"/etc/init.d/networking restart" did not change the behavior, still no NBNS query.
My [global] smb.conf section follows:

[global]
   panic action = /usr/share/samba/panic-action %d
   printing = cups
   printcap name = cups
   load printers = yes
   guest account = nobody
   invalid users = root
   security = user
   workgroup = WORKGROUP
   server string = %h server (Samba %v)
   syslog only = no
   syslog = 0;
   socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=4096 SO_RCVBUF=4096
   encrypt passwords = true
   passdb backend = smbpasswd guest
   wins support = no
   include = /etc/samba/dhcp.conf
   name resolve order = lmhosts host wins bcast
   dns proxy = no
   preserve case = yes
   short preserve case = yes
   unix password sync = false
   passwd program = /usr/bin/passwd %u
   max log size = 1000
   obey pam restrictions = yes
   unix charset = iso-8859-15
   display charset = iso-8859-15
   dos charset = 850
jar3817:  As for your suggestion for me to setup a network server, here is my response:  In my network, I will be connecting various laptop computers to various router ports at various times... so the IP address of each computer will change.  Will a DNS server be useful in this case?  Because I thought a DNS server is only an ideal solution for static IPs.  It seems to me like NBNS is an ideal solution for locating windows & linux boxes when the IPs are dynamic... I may be totally misinformed, so correct me if I'm wrong.

Also I think you deserve the points for this question since your suggestion on /etc/nsswitch.conf seems to be the solution... although I haven't gotten it to work, but it may be an OS issue having to do with Linux/Knoppix.  
Sorry you haven't gotten it to work, I tried it on my servers and it works fine.

You're right and wrong about the DNS only being useful for static hosts. In it's simplest form, yes that is true. But if you want to get more complicated you could set up dynamic dns that would change as your hosts get addresses from the dhcp server. That sounds like overkill for you though...

Looking at your [global] section of smb.conf above, you don't have a netbios name specified. Add a line like this to the [global] section of that file:

netbios name = svrname

Then restart smbd and nmbd.  Maybe that'll fix it.