Putting a home server to sleep when idle
Summary
Daniel Gross combines idle detection, unicast Wake-on-LAN and an ARP stand-in for a sleeping home server. The solution requires an always-on Linux device on the same network. The ARP stand-in comprises about 50 lines of Ruby code.
Ideas
- A cron job uses logged-in users and active backup connections as idle criteria.
- Unicast packets can wake suitable network cards from suspend-to-RAM.
- Sleeping servers do not answer ARP requests once other machines' caches expire.
- A Raspberry Pi answers on the server's behalf with its MAC address.
- Avahi can continue to announce the sleeping machine's services via mDNS.
Insights
- Saving energy on the network requires a stand-in for sleeping control protocols.
- Wake-on-LAN often fails before the wake signal because of name or address resolution.
- Unwanted broadcast traffic can make aggressive power-saving plans unusable.
Facts
- The IPv4 approach described does not support IPv6 neighbour discovery.
Recommendations
- Check your network card's unicast wake support with ethtool.
- Mirror network traffic to find unexpected wake packets outside the sleeping host.
References
Links to the original source and the Web Archive open in a new tab.