Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

wakeonlan -i 192.168.1.255 [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?

Thanks

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
add comment

3 Answers

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
add comment
  • 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
add comment

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
add comment

Your Answer

 
discard

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.