2015-03-29 20:32:35 +01:00
|
|
|
---
|
|
|
|
title: Wake-on-LAN
|
|
|
|
layout: default
|
|
|
|
created: 2008-08-13 22:18:28 +0200
|
|
|
|
updated: 2008-08-13 22:18:28 +0200
|
|
|
|
toc: false
|
|
|
|
tags:
|
|
|
|
- know-how
|
|
|
|
- software
|
|
|
|
- linux
|
|
|
|
- networking
|
|
|
|
---
|
|
|
|
Preparing to go asleep
|
|
|
|
======================
|
|
|
|
|
2015-03-29 21:05:46 +01:00
|
|
|
To make Linux not shut down the network interface upon *halt*, edit the file `/etc/init.d/halt`, find the line with the
|
|
|
|
`halt` command and remove the parameter `-i` if there. This parameter does `ifdown` on all networking interfaces. As the
|
2015-03-29 20:32:35 +01:00
|
|
|
manpage for *halt* states, this is unneccessary for newer kernels - also it disables WOL.
|
|
|
|
|
2015-03-29 21:05:46 +01:00
|
|
|
The second step is to make sure, your card supports WOL. To find out, issue the `sudo ethtool eth0` command. You should
|
2015-03-29 20:32:35 +01:00
|
|
|
get something like this:
|
|
|
|
|
2015-03-29 20:38:11 +01:00
|
|
|
~~~
|
2015-03-29 20:32:35 +01:00
|
|
|
Settings for eth0:
|
|
|
|
Supported ports: [ TP MII ]
|
|
|
|
Supported link modes: 10baseT/Half 10baseT/Full
|
|
|
|
100baseT/Half 100baseT/Full
|
|
|
|
Supports auto-negotiation: Yes
|
|
|
|
Advertised link modes: 10baseT/Half 10baseT/Full
|
|
|
|
100baseT/Half 100baseT/Full
|
|
|
|
Advertised auto-negotiation: Yes
|
|
|
|
Speed: 10Mb/s
|
|
|
|
Duplex: Half
|
|
|
|
Port: MII
|
|
|
|
PHYAD: 1
|
|
|
|
Transceiver: internal
|
|
|
|
Auto-negotiation: on
|
|
|
|
Supports Wake-on: g
|
|
|
|
Wake-on: g
|
|
|
|
Current message level: 0x00000007 (7)
|
|
|
|
Link detected: no
|
2015-03-29 20:38:11 +01:00
|
|
|
~~~
|
2015-03-29 20:32:35 +01:00
|
|
|
|
2015-03-29 21:05:46 +01:00
|
|
|
The important lines are the `Supports Wake-on` and `Wake-on` ones. The "`g`" means it is enabled for MagicPacket™.
|
2015-03-29 20:32:35 +01:00
|
|
|
If not, you should manually call the command:
|
|
|
|
|
|
|
|
ethtool -s eth0 wol g
|
|
|
|
|
|
|
|
This should enable WOL for the card. If this works, you have to issue this command after every bootup as the state will
|
|
|
|
be back to disabled then. You might want to create a startup script.
|
|
|
|
|
|
|
|
|
|
|
|
Waking remote PCs
|
|
|
|
=================
|
|
|
|
|
2015-03-29 21:11:15 +01:00
|
|
|
The simple way is to use `wakeonlan` which only supports MagicPacket™.
|
2015-03-29 20:32:35 +01:00
|
|
|
|
|
|
|
For a PC in a Class C network, use a call like this:
|
|
|
|
|
|
|
|
wakeonlan -i 192.168.1.255 de:ad:be:ef:ca:fe
|
|
|
|
|
|
|
|
This would send the packet to the 192.168.1.x subnet and the PC with the specified MAC address should wake up.
|
|
|
|
|
|
|
|
**Note:** Some nVidia chipsets require the MAC address to be specified in reverse order. In the example this would
|
2015-03-29 21:05:46 +01:00
|
|
|
be `fe:ca:ef:be:ad:de`.
|