HOW-TO:Set up Wake-on-LAN for Ubuntu: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>MacUsers
No edit summary
>MacUsers
No edit summary
Line 53: Line 53:
         ;;
         ;;
esac</source>
esac</source>
 
===Configure WOL service to start upon boot===
"sysv-rc-conf" is Run-level configuration for SysV like init script links. sysv-rc-conf is not installed by default
<source lang="bash">
sudo apt-get install sysv-rc-conf
</source>


[[category:How To|Linux]]
[[category:How To|Linux]]

Revision as of 19:05, 28 May 2010

Template:XBMC wiki toc Inline


Before you start

First off, the motherboard should support the WOL (Wake On LAN) and it should be enabled in the BIOS. Different BIOS/motherboard do it differently; on ASUS (P5N7A-VM), it's under Power > APM Configuration and in there "Resume On PCIE Wake" and "Resume On LAN(MAC)" should be enabled.

Enable WOL in the OS

Even though WOL works in network layer 2, OS support is still one of the important things to make it work. Even if you see the light on the Ethernet port is on after the halt/shutdown, the OS shuts off the Ethernet internally. One must tell Ethernet controller to WOL when boots up and tell "halt" script not to bring down controller during shut-down.

Install ethtool

I found "ethtool" is one of the easiest to use to enable WOL; install it first if it's not there yet.

sudo apt-get ethtool

Create an init.d script

Next, create a file, say "walk-on-lan" in the "/etc/init.d" to automatically start WOL at the boot time.

#!/bin/bash
#
### BEGIN INIT INFO
# Provides:		walk-on-lan
# Required-Start:	$local_fs      
# Required-Stop:        $local_fs
# Default-Start:	3 4 5	
# Default-Stop:         0 6
# Short-Description:	Enable Wake-On-Lan 
### END INIT INFO
#
. /lib/lsb/init-functions

do_start() {
    ethtool -s eth0 wol g
    exit
} 

do_stop() {
    ethtool -s eth0 wol d
    exit
}

case "$1" in
  start)
        do_start
        ;;
  restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
  stop)
        do_stop
        ;;
  *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac

Configure WOL service to start upon boot

"sysv-rc-conf" is Run-level configuration for SysV like init script links. sysv-rc-conf is not installed by default

sudo apt-get install sysv-rc-conf