Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm setting up a cluster and can wake up individual machines with the command

wakeonlan -i [MAC Address]

I'd like to be able to do this by hostname instead of MAC, but the config file for wakeonlan only seems to offer IP <-> MAC mapping. How can I do it by hostname?

If it helps, I'm running DHCP3 + BIND and have entered all the machines MAC addresses in the dhcpd.conf file so that they get sent the correct hostname when PXEbooting.

Perhaps there is some command like 'host' that would give me a MAC from a hostname?


share|improve this question
I've done that, i.e. extended the wakeonlan perl script with a new option to search that dhcpd.conf for a hostname-mac conversion. Do you want it? – ott-- Apr 26 '13 at 18:20
up vote 5 down vote accepted

See man 5 ethers; basically, put MAC / hostname pairs in your /etc/ethers. Then etherwake will be able to wake them.

share|improve this answer
Fantastic! Worked great. Out of interest, is it possible to get dhcpd to use this ethers file too, instead of my having to also write the MACs into the config (so they are sent correct hostname)? Sorry can't vote up your answer. Seems I don't have sufficient reputation. – Pengin Aug 6 '10 at 9:21
That's merely setting up aliases, pretty much the way a hosts file works. The same result can be achieved through a simple script and lookup file, which makes it OS independent. – John Gardeniers Aug 6 '10 at 10:33
@John Indeed, I use a script that looks up values from a FOG database, or search the dnsmasq leases. – Andrew Aug 6 '10 at 11:34
@Pengin dnsmasq will and can also act as a lightweight DNS server. – Andrew Aug 6 '10 at 11:36
  • No. MAC addresses do not correspond to hostnames. MAC Adddresses are lower level and specific to the technology used (ethernet).
  • WakeOnLan works with MAC addresses, ONLY.

Ergo - sorry - no hostname.

share|improve this answer

You can do it by Hostname, but before you have to configure the config file of ether-wake (if you use Linux) like this:

MAC_adress: name_of_machine
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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