# NBNS Broadcast (instead of DNS) for IP Address [SOLVED]

## John Klug

Is it possible in my home network for Gentoo Linux to use NBNS broadcasts for the local domain only in place of DNS?

My Actiontec Router/DNS/DHCP server appears to only have one possible lookup success with stuff it should know about, and that is its own name and address.  It responds negatively to all other local requests, even though it is the DHCP server (DNS requests that it passes off to the ISP's DNS work just fine).  The ideal fix would be for Actiontec to fix local DNS/DHCP. 

So apparently the way my network has been working is by doing NBNS broadcasts for local addresses.  This works with everything but Linux.  I assume I could install Samba, and the Windows machines could see Linux, but does the other way around work?  In other words, can Linux be configured to do the NBNS broadcasts to get the IP addresses of the local machines?  One possibility would be for the local DNS requests (my domain) to be routed to a local (on the Linux machine) DNS server, which then translates them to NBNS, and does the broadcast, populating a DNS cache.  Does it exist?Last edited by John Klug on Sun Jan 20, 2008 6:28 pm; edited 1 time in total

----------

## John Klug

NBNS allows one to have a small ad-hoc network with no need for a DNS or maintaining a /etc/host file.  This eliminates the need to add an extra box with power on all the time to be a DNS, or to maintain a host file across multiple systems, assuming one has a DHCP/router running with no local DNS.

First you need to emerge samba with the flag winbind.  This creates a library in /usr/lib/libnss_wins.so.  This is used for NBNS name resolution.

You need to add wins resolution for host names to the /etc/nsswitch.conf file:

hosts:       files dns wins

Now the /etc/smb.conf file needs touching up:

[global]

   workgroup = WORKGROUP  # Your workgroup

   lm announce = auto

   lm interval = 120

   name resolve order = bcast

   dns proxy = no

Now start samba from /etc/init.d, and add it to your startup with /etc/rc-update if you haven't used Samba before:

rc-update add samba default

This is what happens when I ping my print server now  (Every IP address starts with 192.168):

ARP broadcast from Linux 0.22 to get the DNS server address (the DNS forwarding gateway)  Who has 0.1?

ARP message from DNS server address 0.1 to Linux  0.1 is at  MAC ab:cd:ef:01:23:34

DNS request for printer.domain.actdsltmp to 0.1 (my DHCP puts domain.actdsltmp in my resolve.conf)

Four seconds elapse  (awful!)

DNS replies with Server failure

Same DNS request is then sent to the ISP DNS server, which was probably already queried by the local DNS

ISP DNS server is much faster, and reponds within .04 seconds that there is no such address

Now we get to the good part:

0.3 second pause

NBNS Broadcast from Linux 0.22 to 0.255 requesting NB Name Query for name PRINTER

ARP Broadcast from 0.23 (PRINTER) Who has 0.22 tell 0.23

ARP Message from 0.22 (Linux) 0.23 (Printer) is at MAC ab:cd:ef:01:23:35

NBNS message from 0.1 (Router/DHCP/Gateway)  to 0.22 (Linux)  NB resonse 192.168.0.23

Now we know the printer IP address

This was instigated by ping, and took 4.7 seconds, most of which was wasted by the DSL Modem/Router DNS query.

----------

