[Samba] Mapping between domain NetBIOS name and DNS name ?

Jon Gerdes GERDESJ at whl.co.uk
Fri Aug 8 08:44:12 GMT 2003


Not sure why you'd want to because nearly everyone makes them the same thus either way should work.  DNS does have the added wrinkle of not being a flat list though, so you have to keep an eye out for the DNS domain.

Now this assumes that you are using WINS and let's face it if you are on a network large enough to worry about NetBIOS to DNS mappings then you will have a WINS server running.

nmblookup -R -U < address of wins server> < name to lookup>

This gives you the IP address of the device.  Finally finish off by doing a reverse lookup in DNS on the address.  Eg:

Here I am using a WINS server called voyager to look up my PC's IP address 
[root at voyager /root]# nmblookup -R -S -U voyager noddy
querying noddy on noddy<00>
Looking up status of
        NODDY           <00> -         P <ACTIVE>
        WGROUP1         <00> - <GROUP> P <ACTIVE>
        NODDY           <20> -         P <ACTIVE>
        NODDY           <03> -         P <ACTIVE>
        WGROUP1         <1e> - <GROUP> P <ACTIVE>
        GERDESJ         <03> -         P <ACTIVE>

So noddy has an address of, (the -S gives the other stuff as well) which I now look up in the DNS:

[root at voyager /root]# nslookup -sil

Non-authoritative answer:       name = noddy.gkn-whl.co.uk.

... and it's DNS and NetBIOS names match. 

However all this assumes that the DNS is setup correctly and is accurate!  Seeing that I look after all this stuff I am pretty confident.  We use DHCP with dynamic DNS and the WINS server's address is handed out with the lease so it really ought to work.

To perform a reverse NetBIOS lookup:

[root at voyager /root]# nmblookup -R -A -U voyager
Looking up status of
        NODDY           <00> -         P <ACTIVE>
        WGROUP1         <00> - <GROUP> P <ACTIVE>
        NODDY           <20> -         P <ACTIVE>
        NODDY           <03> -         P <ACTIVE>
        WGROUP1         <1e> - <GROUP> P <ACTIVE>
        GERDESJ         <03> -         P <ACTIVE>

And for completeness:

[root at voyager /root]# nslookup -sil noddy

Non-authoritative answer:
Name:   noddy.gkn-whl.co.uk

(the -sil stops the later versions of nslookup from whittering on about deprecation).  You could use "dig" but like many I prefer nslookup and here's why:

[root at voyager /root]# dig @silicon noddy.gkn-whl.co.uk ANY

; <<>> DiG 9.1.1 <<>> @silicon noddy.gkn-whl.co.uk ANY
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 895
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 5

;noddy.gkn-whl.co.uk.           IN      ANY

noddy.gkn-whl.co.uk.    86400   IN      A

gkn-whl.co.uk.          86400   IN      NS      silicon-eng.gkn-whl.co.uk.
gkn-whl.co.uk.          86400   IN      NS      iridium.gkn-whl.co.uk.
gkn-whl.co.uk.          86400   IN      NS      nickel.gkn-whl.co.uk.
gkn-whl.co.uk.          86400   IN      NS      copper.gkn-whl.co.uk.

silicon-eng.gkn-whl.co.uk. 86400 IN     A
iridium.gkn-whl.co.uk.  86400   IN      A
nickel.gkn-whl.co.uk.   86400   IN      A
copper.gkn-whl.co.uk.   86400   IN      A

;; Query time: 3 msec
;; WHEN: Fri Aug  8 09:39:17 2003
;; MSG SIZE  rcvd: 258

What a mess!! Check out the man pages for dig, nmblookup and nslookup for the full meaning of the options used.

Jon Gerdes

>>> Yuquan Jiang <jiangy at cs.unc.edu> 08/08/2003 07:35:33 >>>

Does anyone know how to lookup a domain's DNS name with its NetBIOS name ?
And how to do the reverse?

Thanks a lot.


To unsubscribe from this list go to the following URL and read the
instructions:  http://lists.samba.org/mailman/listinfo/samba

More information about the samba mailing list