LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How would I discover hostnames? (https://www.linuxquestions.org/questions/linux-networking-3/how-would-i-discover-hostnames-560971/)

ingrix 06-11-2007 03:26 PM

How would I discover hostnames?
 
This may sound like a simple question to answer, but I've googled my ass off, and I've looked through the man pages, but thus far I haven't been able to find an answer.

My question is this: how would I go about discovering hostnames for other computers on a network? NFS is what I'm worried about here, so suppose I didn't know the hostname or IP address of the NFS server. How would I query a list of computers from the network so as to find it?

Kind of what I am looking for is a smbtree for nfs, if that helps to clarify.

Thank you in advance.

acid_kewpie 06-11-2007 04:07 PM

that's what dns is for, or /etc/hosts

ingrix 06-11-2007 04:35 PM

Thank you acid, I'll look into that, although I'm not entirely sure how that will help me in my current situation. I guess I should have described it better :)

I have a star topology network, with a router at the center going out to the internet from there. Then I have a whole bunch of computers branching off of that, including another router (which my computer is connected to). Is there a way to find out the names of each of the computers on the LAN itself, since I don't have my own personal DNS for it?

EDIT: and this is assuming I don't put anything in the /etc/hosts file, too. Thanks in advance.

Shadow_7 06-11-2007 06:11 PM

arp can give you some information about machines you're directly connected to.

# arp -avn

Although it doesn't do hostnames. Perhaps one step closer anyway. /etc/hosts in the only way to locally apply names to IPs. Unless the connected router is in your /etc/resolv.conf and resolves the ips to names.

whois can resolve IPs to hostnames, but unless you have some sort of interception, it does it at the internet level.

Not that any of this answers your question.

Emerson 06-11-2007 06:24 PM

The only UNIX service which actually broadcasts is CUPS. There is also Bonjour but I'm not familiar with it. You can query NFS servers with rpcinfo. Generally, the idea to advertise every service on the network belongs more to the Windows world.

acid_kewpie 06-12-2007 03:00 AM

as above, but note this is not the way "things are done". you find hostnames via dns entries. that's the point of it.

pwc101 06-12-2007 03:14 AM

Perhaps pinging every address on your network will give you an idea of the active IPs? Of course, this doesn't give you their hostnames.

I'm not sure of the ethics of this... If you're not the sys admin, perhaps there's a reason you don't know the hostnames! ;) Couldn't you just go ask someone?

bathory 06-12-2007 05:29 AM

You can use nmap to scan your network for hosts running specific services. For example:
Code:

nmap -p2049 192.168.0.0/24
will show you the IPs and hostnames of hosts running nfs. For more options take a look at the manpages.

Regards

acid_kewpie 06-12-2007 06:34 AM

people seem to be missing the point. the question was how to find someones hostname, not how to find NFS servers, or ip addresses...

pwc101 06-12-2007 07:30 AM

I was going off this section of the OP:
Quote:

Originally Posted by ingrix
... so suppose I didn't know the hostname or IP address of the NFS server

Which to me implied that either ip or hostname would suffice.


All times are GMT -5. The time now is 02:54 AM.