I need to automatically add mac-addresses to some file and manually add the hostnames assigned to them. A script will then scan my home LAN for those mac-addresses and populate the /etc/hosts file, updating whatever cache. Most importantly I do not want a centralized server that works as DNS server 24/7 and consumes a lot of energy in addition to the energy consumed already by the modem offering its own LAN-dhcp services. i.e. I need a decentralized DNS service.
Has anyone ever heard of such a script?

But I guess that's too much to ask, is some way to automatically read the /etc/hostname file of all computers at the moment they enter my LAN and update name-resolution directly without the need for a /etc/hosts file. Anyone know if that would be possible without altering the dhcp server?


As you're probably going to use IP the MAC addresses won't help you at all. What you want is mDNS to reslove local host names. In Ubuntu, this is activated automatically. You should be able to resolve other computer's IP addresses using their name plus .local as in:

  • many thanks, I didn't know mDNS existed. as for mac, in case you didn't know, mac can be displayed by arp (after the ip has been used) so one can check if that hostname really is what you expect. good for security to know mac of all your local devices.
    – piotr5
    Oct 21 '12 at 13:40
  • But you can change or tell interfaces to use other MAC addresses. Given the nature and purpose of MAC addresses (address resolution via ARP), filtering MAC addresses for security reasons is rather controversial, especially in WiFi networks.
    – LiveWireBT
    Oct 21 '12 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.