odroid-h3:application_note:wake_on_lan

How To Enable Wake On LAN

  • Operation confirmed with
    • Ubuntu 18.10 with 4.18 kernel.
    • Manjaro 18.0 with 4.19 kernel.
    • Ubuntu 20.04 with 5.4 kernel.
  • Confirmed version of Realtek LAN Driver is
    • H3: r8125 9.009.02

You can make WOL enabled on both two LAN port.

This guide helps you to set WOL on your system.

It is recommended to update your system before following the guides.


target
# Upgrade system packages
$ sudo apt update && sudo apt full-upgrade
 
# Install packages for build a module and working with WOL
$ sudo apt install build-essential libelf-dev ethtool

target
# Upgrade system packages
$ sudo pacman -Syu
 
# Install packages for build a module and working with WOL
# Press "Enter" to install all the packages when it prompts
$ sudo pacman -S base-devel linux419-headers ethtool

Especially in Arch Linux distros, you should check TLP options and have to set WOL_DISABLE option to N.

target
$ sudo vi /etc/default/tlp
...
WOL_DISABLE=N
...

Then reboot your system.

target
$ reboot
  • In H3, you can ignore this procedure because you should install the dedicated driver in advance to use the Internet(☞Install ethernet driver). But later, someday when the integrated r8125 driver is working with H3, you may have to install the Realtek driver then.

Download the latest Realtek LAN driver.
Download LINUX driver for kernel up to 4.15. It isn't downloaded directly on that page, you should enter your email address to get a temporary download page.
The driver described as “for kernel up to 4.15”, but this works on 4.18 or 4.19. Maybe works on the future kernels as well.

Then extract that.

Open a Terminal and go to the extracted directory.
Then enter the commands below.

target
$ sudo ./autorun.sh

Provided script file unloads the current module and build, install, load the new module automatically.


If you use Arch Linux based system, you should uninstall currently exist old module to apply the new r8168 driver.

target
# Remove exist old r8168 module
$ sudo pacman -R linux419-r8168

Then reboot your system.

target
$ reboot

Enable WOL on both network interface.

Generally in H3, the network interfaces are named as enp1s0 and enp2s0.
Check ethernet interfaces of the system.

target
$ ip link
 
# results
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
    link/ether c4:83:4f:27:43:b4 brd ff:ff:ff:ff:ff:ff
3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether c4:83:4f:27:43:b5 brd ff:ff:ff:ff:ff:ff

If it isn't enp, change to yours properly of the commands below.

target
$ sudo ethtool -s enp1s0 wol g
$ sudo ethtool -s enp2s0 wol g

Check it's been enabled.

target
$ sudo ethtool enp2s0 | grep Wake
 
# results
Supports Wake-on: pumbg
Wake-on: g

Check that g character exists which means it wakes up by the magic packet.

Create the file /etc/systemd/system/wol@.service as root with the following content.

target
$ sudo vi /etc/systemd/system/wol@.service
[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
After=network.target
 
[Service]
ExecStart=/bin/sh -c "ethtool -s %i wol g"
Type=oneshot
 
[Install]
WantedBy=multi-user.target

Enable that for the two network interfaces.

target
$ sudo systemctl enable wol@enp1s0
$ sudo systemctl enable wol@enp2s0

Start the services.

target
$ sudo systemctl start wol@enp1s0
$ sudo systemctl start wol@enp2s0

You should know the mac physical address on your internet address.
And then, from the others like the Ubuntu system will send a magic packet to the H3 to see WOL functionality works well.
In the below case, the mac physical address is c4:83:4f:27:43:b5, memorize yours and, power off with command poweroff.

target
odroidh3@odroidh3:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether c4:83:4f:27:43:b4 brd ff:ff:ff:ff:ff:ff
3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether c4:83:4f:27:43:b5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.30.5/24 brd 192.168.30.255 scope global dynamic noprefixroute enp2s0
       valid_lft 85624sec preferred_lft 85624sec
    inet6 fe80::4bb6:1485:1959:5f7d/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
odroidh3@odroidh3:~$ sudo poweroff

In this example, ODROID-C4 Ubuntu sends a magic packet to the H3.
H3 receives it and then will start the booting process.

host
root@odroid:~# apt install wakeonlan etherwake
root@odroid:~# wakeonlan c4:83:4f:27:43:b5 # etherwake command works as well
Sending magic packet to 255.255.255.255:9 with c4:83:4f:27:43:b5
  • odroid-h3/application_note/wake_on_lan.txt
  • Last modified: 2022/10/12 14:36
  • by luke.go