LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux > 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
 
Thread Tools
Old 07-05-2008, 05:47 PM   #1
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247
Thanked: 40
Getting the hostname from a Linux computer on a LAN


[Log in to get rid of this advertisement]
Background: If I go into my router's setup, I can see which computers are currently using the LAN, and it also gives their hostnames.

So if I am a computer on the LAN, how can I get the hostnames of other computers on the LAN? For Windows machines, I know that I can usually use a NetBIOS query to their computer to get the hostname, unless they have taken specific measures to disable it. For a Linux machine, is there a similar way to ask it for its hostname from another computer on the LAN? And if so, how would I disable it?

And in case someone knows, for the specific case of using the WLAN with my router, when my computer first connects to the router and gives the router my computer's hostname, would someone who is sniffing packets "promiscuously" be able to get that information even if I'm using WPA/WPA2? In other words, does my computer give that information to the router before or after the encryption begins?

Thanks for any help or insight.
CJS is offline     Reply With Quote
Old 07-05-2008, 06:29 PM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,511
Thanked: 4
There are no native broadcast discovery services in traditional *nix networking. Names are discovered by doing IP->hostname lookups, either in /etc/hosts, or via DNS.

With Samba, one can emulate Windows networking, and thereby gain its discovery services.

I do not believe sensitive information is sent into the ether before the encrypted handshake is complete. A host name is hardly sensitive in any case.
Mr. C. is offline     Reply With Quote
Old 07-05-2008, 06:53 PM   #3
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247
Thanked: 40

Original Poster
Quote:
Originally Posted by Mr. C. View Post
There are no native broadcast discovery services in traditional *nix networking. Names are discovered by doing IP->hostname lookups, either in /etc/hosts, or via DNS.

With Samba, one can emulate Windows networking, and thereby gain its discovery services.

I do not believe sensitive information is sent into the ether before the encrypted handshake is complete. A host name is hardly sensitive in any case.
Yes, I totally agree that "a host name is hardly sensitive in any case", I mainly wanted to know this for my own information. Often people name their computers in ways that obviously identify them, so it's a step in the right direction if you can keep that information hidden from would-be hackers on a LAN; that way they have a harder time figuring out which LAN IP actually corresponds to which computer. Thanks for the info!
CJS is offline     Reply With Quote
Old 07-05-2008, 09:22 PM   #4
Matir
Moderator
 
Registered: Nov 2004
Location: Atlanta, GA
Distribution: Ubuntu
Posts: 8,347
Thanked: 13
It's not usually easy to enumerate all of the hosts and hostnames on a network unless they are registered in DNS. Your router has this information because, most likely, it is acting as a DHCP server, and systems send their hostname in their DHCP requests.

To answer the second part of your question: WPA/WEP encryption is applied to each packet that is sent. Only a hardware handshake is performed before the encryption. Hostname information is in the DHCP request, which is in a standard data packet.
Matir is offline     Reply With Quote
Old 07-09-2008, 09:36 PM   #5
CJS
Member
 
Registered: May 2008
Location: California, USA
Distribution: Ubuntu 8.10
Posts: 247
Thanked: 40

Original Poster
Matir, thanks for the info about the host name being given with a DHCP request; I tested it with my router--I connected to my router with a static IP and sure enough, no longer was my host name listed in the router config (whereas the router lists my computer's name when I use DHCP). I'm starting to understand it all better now, thanks for the help.
CJS is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
one computer affects DHCP for other computer on same LAN? discomurder Linux - Networking 1 12-12-2006 04:15 AM
Ping a computer in LAN using hostname seven Linux - Networking 3 07-05-2003 11:42 PM
Hostname/computer name Brad3d Linux - General 1 01-12-2003 03:02 PM
Hostname of computer Kaiser_Sose Linux - Networking 2 02-04-2002 06:45 PM
Hostname of computer Kaiser_Sose Linux - Software 3 01-26-2002 09:22 PM


All times are GMT -5. The time now is 07:48 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration