4

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

Pengin
  • 253
  • 4
  • 8
  • 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

3 Answers3

7

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

Andrew
  • 7,772
  • 3
  • 34
  • 43
  • 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 06 '10 at 09: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 06 '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 06 '10 at 11:34
  • @Pengin dnsmasq will and can also act as a lightweight DNS server. – Andrew Aug 06 '10 at 11:36
1
  • 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.

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108
TomTom
  • 50,857
  • 7
  • 52
  • 134
0

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
slm
  • 7,355
  • 16
  • 54
  • 72
rogane
  • 1