[Samba] Mapping between domain NetBIOS name and DNS name ?
Jon Gerdes
GERDESJ at whl.co.uk
Fri Aug 8 08:44:12 GMT 2003
Yuquan
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 172.16.12.100
172.16.12.12 noddy<00>
Looking up status of 172.16.12.12
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 172.16.12.12, (the -S gives the other stuff as well) which I now look up in the DNS:
[root at voyager /root]# nslookup -sil
> 172.16.12.12
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
12.12.16.172.in-addr.arpa 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 172.16.12.12
Looking up status of 172.16.12.12
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
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: noddy.gkn-whl.co.uk
Address: 172.16.12.12
(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
;; QUESTION SECTION:
;noddy.gkn-whl.co.uk. IN ANY
;; ANSWER SECTION:
noddy.gkn-whl.co.uk. 86400 IN A 172.16.12.12
;; AUTHORITY SECTION:
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.
;; ADDITIONAL SECTION:
silicon-eng.gkn-whl.co.uk. 86400 IN A 172.16.14.1
iridium.gkn-whl.co.uk. 86400 IN A 192.168.40.14
nickel.gkn-whl.co.uk. 86400 IN A 192.168.40.13
copper.gkn-whl.co.uk. 86400 IN A 192.168.40.12
;; Query time: 3 msec
;; SERVER: 192.168.40.11#53(silicon)
;; 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.
Cheers
Jon Gerdes
>>> Yuquan Jiang <jiangy at cs.unc.edu> 08/08/2003 07:35:33 >>>
Hi,
Does anyone know how to lookup a domain's DNS name with its NetBIOS name ?
And how to do the reverse?
Thanks a lot.
Yuquan
--
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