get netbios name from ip address?
At the CLI, I want to know how to get a netbios name from an IP address. It seems that every solution that I have found is windows based, or requires me to install something beyond samba. Please tell me that there is a simple "prog-x -somearg 192.168.1.100" or similar to get the netbios name - and that it doesn't require a reconfiguration of my server?
For instance, I would like this to be usable on a desktop system in an ad hoc without having to be run from root. |
Not sure what "beyond Samba" means, but samba should contain the answer. Is this not visible from "smbclient -L a.b.c.d"?
And if you aren't using Samba, why would you possibly care about netbios names? |
Absolutely! That gave me all the info I need! Now why was that so hard for me to find?!?
By beyond I meant in addition to. This will help me diagnose quite a bit in my network, I think. |
nmap might be worth looking into as well.
e.g. nmap --script smb-os-discovery.nse -p445 hostname Dave |
NetBIOS. *shudder*
|
@acid_kewpie: yeah, my roomies like their PC's like they like their, um, NM.
@ilikejam: Yours seems to work better, and is parsable by shell script. Thank you as well. I am still a noob at nmap... |
yeah, nmap FTW. it is so useful it's unreal.
|
If your system runs the avahi daemon, then "getent hosts <ip_address>" may return both the hostname and IP address using zeroconf (mdns). It depends on how your nsswitch.conf and host.conf are configured.
You can also run "getent hosts <hostname>". This will also return IP addresses for hosts on the internet. For avahi, add .local to the hostname. E.G. getent hosts elite.local 192.168.1.106 elite.local I configure my router to map MAC numbers to IP addresses, which allows me to maintain an /etc/hosts file. Entering "getent hosts elite.local" allows me to conveniently look up another hosts IP address before entering it in /etc/hosts. |
It can depend on your lan.
Try this nmblookup -A ip_address |
All times are GMT -5. The time now is 08:16 PM. |