How to get hostname for ip on a local network?

25,100

To get reverse DNS lookup working your will have to set up your nameserver / DNS-server in a way, that it is authoritative for 192.168.1.* and create zones / zonefiles with the DNS data (ip => hostname). I guess you are under the (false) impression, that a nameserver that knows "hostname => ip" magically knows "ip => hostname" either. You have to setup both ways individually.

Share:
25,100

Related videos on Youtube

George Profenza
Author by

George Profenza

...is interested in Art & Technology and the blend between the two. Works on innovations at disguise. Worked on interesting projects at Hirsch&Mann, sometimes at Technology Will Save Us and advised as a technical tutor at The Bartlett, UCL. Studie(s)d Creative Computing at Goldsmiths College, University of London. Studie(s)d Architectural Computation at The Bartlett, UCL

Updated on September 18, 2022

Comments

  • George Profenza
    George Profenza over 1 year

    I'm trying to get the hostname for a given ip of a computer in a local network.

    The current test setup I have is a few single board computers(odroids) connected via Ethernet and a switch to a laptop which assigns IP addresses (this will get replaced by a server later).

    These single board computers run Ubuntu 15 and have avahi-daemon running. I can ping/ssh these using their hostnames just fine. The issue is I can't seem to get the hostname if I know the IP address.

    So far I've tried host,arp, nslookup, dig but no joy. For example:

    host 192.168.1.11
    Host 11.1.168.192.in-addr.arpa. not found: 3(NXDOMAIN)
    

    As a hacky workaround plan I was thinking of putting a script together that initially pings a list of known hostnames of computers expected to be on the network, creating associations between IPs and hostnames or trying to get the DHCP table from a router to which the computers are connected, but I was wondering if there's a more elegant solution.

    • George Profenza
      George Profenza about 8 years
      how did I automatically get a -1 as soon as I posted ? (What did I do wrong ?)
    • D34DM347
      D34DM347 about 8 years
      This question doesn't belong on Server Fault.
    • George Profenza
      George Profenza about 8 years
      My bad. I'll delete it then. Can you please recommend the correct StackExchange website I should ask this on ? Thank you
    • D34DM347
      D34DM347 about 8 years
      I guess it could fit on SuperUser, but honestly it's pretty obvious that you are out of your depth. I'm not trying to be rude, but it appears that you don't know the first thing about name resolution. You should probably start by doing some reading / research about how DNS works.
    • George Profenza
      George Profenza about 8 years
      Thank you for putting it so politely :) I tried to explain I have no idea what I'm doing in the first line. I'll look into DNS and how that works on local networks.
  • George Profenza
    George Profenza about 8 years
    You're hunch is bang on the buck. Thank you for your contribution(+1). However, I will delete this question as it appears to be off topic