LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-01-2010, 05:51 AM   #1
Hailey's_Comet
Member
 
Registered: Jul 2005
Location: USA
Distribution: PCLinuxOS
Posts: 36

Rep: Reputation: 18
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.
 
Old 03-01-2010, 06:52 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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?
 
1 members found this post helpful.
Old 03-01-2010, 08:03 AM   #3
Hailey's_Comet
Member
 
Registered: Jul 2005
Location: USA
Distribution: PCLinuxOS
Posts: 36

Original Poster
Rep: Reputation: 18
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.
 
Old 03-01-2010, 08:08 AM   #4
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
nmap might be worth looking into as well.

e.g.
nmap --script smb-os-discovery.nse -p445 hostname

Dave
 
Old 03-01-2010, 08:08 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
NetBIOS. *shudder*
 
Old 03-01-2010, 08:20 AM   #6
Hailey's_Comet
Member
 
Registered: Jul 2005
Location: USA
Distribution: PCLinuxOS
Posts: 36

Original Poster
Rep: Reputation: 18
@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...
 
Old 03-01-2010, 02:50 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
yeah, nmap FTW. it is so useful it's unreal.
 
Old 03-01-2010, 02:56 PM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.

Last edited by jschiwal; 03-01-2010 at 03:00 PM.
 
Old 03-01-2010, 04:27 PM   #9
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,937

Rep: Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619
It can depend on your lan.

Try this nmblookup -A ip_address
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
netbios behind nat casolorz Linux - Networking 3 08-27-2009 07:52 AM
how to get ip address, broadcast address, mac address of a machine sumeshstar Programming 2 03-12-2005 04:33 AM
NetBios in Linux smallgamevn Linux - Networking 1 11-06-2003 03:05 AM
netbios without samba? hotrodowner Linux - Networking 11 03-21-2003 09:10 PM
netbios gargoyle Linux - General 1 06-23-2001 11:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration