LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to get another machine's hostname? (https://www.linuxquestions.org/questions/linux-networking-3/how-to-get-another-machines-hostname-42941/)

afpe 01-27-2003 09:25 AM

How to get another machine's hostname?
 
Hi,

I would like to know is there any way to retrieve another machine's hostname by that machine's IP4/IP6 address? For instance, how can a router acting linux machine gets the 'hostname' from any of its client by using that client's IP address?

If you know please help me with any/multi solutions.

Thanx.

- Afpe

niknah 01-27-2003 10:24 AM

if the reverse lookup has been setup on that machine just use "host x.x.x.x"

The results aren't always correct, if the host name changed without the reverse lookup changing then you could have something incorrect and alot of pepole don't bother setting up their reverse lookups. Also anyone can fake a reverse lookup to any hostname they want to.

afpe 01-27-2003 10:33 AM

Thanx for your tips.
Well, you are right about reverse lookup as most of the people do not bother to set those up! Any other idea?

- Afpe

Darin 01-27-2003 10:41 AM

I'd suggest traceroute but that just does a reverse lookup (but at least it works in m$ land where there is no host command.) Another suggestion would be to sniff the network but that's sort of like using a shotgun to hunt a fly. Also in windows land all the computers broadcast their names or register with a wins server but I haven't found a way to get native *nix apps besides samba to use netbios style name resolution yet.

niknah 01-27-2003 07:59 PM

You can get *nix apps to use netbios style name lookups by installing winbindd and adding a line in /etc/nsswitch.conf


All times are GMT -5. The time now is 03:43 PM.