Enable Ubuntu 19.04 Server to start over LAN (Wake-on-LAN)


I decided to suspend the file server during the daytime on weekdays to save electricity, so I have to manually cancel the suspend on a public holiday weekday. This itself is unavoidable, but at least, I want to be able to turn on remotely via LAN from the main machine rather than the power button . So I try the fanction called Wake-on-LAN.

Procedure (server side)

Setting UEFI

Reboot to enter the UEFI screen and set the boot over the LAN.

Depending on the motherboard, In my case, I switch Power On By PCI-E/PCI to enabled.

As an aside, there was also an item named Power On By RTC(faint memory). I think I probably need to enable this if I want to shut down and boot instead of suspending in rtcwake.

Install Ethtool

sudo apt install ethtool

Check the LAN used by Wake-on-LAN

$ ls/sys/class/net/
enp3s0 lo wlp4s0

In this case enp3s0 seems to be wired LAN,I use this. wlp4s0 is maybe wifi.

Wake-on-LAN Settings

Enable with the following command:

$ sudo ethtool -s enp3s0 wol g

Check the settings.

$ sudo ethtool enp3s0
Settings for enp3s0:
    Supported ports: [ TP ]
    Supported link modes 10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
    Supported pause frame use: Symmetric
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes: 10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: off (auto)
    Supports Wake-on: pumbg
    Wake-on: g
    Current message level: 0x0000007 (7)
                   drv probe link
    Link detected: yes

Check mac address

Before use Wake-on-LAN, I needs to know the MAC address that is specific ID of device that connecting to the LAN, so let’s check.

$ ip addr
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP>mtu 1500 qdisc mq state UP group default qlen 1000</BROADCAST,MULTICAST,UP,LOWER_UP>
    link/ether 04:92:26:00:00:00 brd ff:ff:ff:ff:ff:ff:ff:ff

In this case 04:92:26:00:00:00:00 will be the target MAC address. (Because the referring source had conceal the MAC address, So follow that, this MAC address is canged from the actual MAC address .)

The server side works is end, so shut down.

Procedure (client side)

From here, I start the main PC side settings to run Wake-on-LAN.

Wake-on-LAN Installation

It’s in the official repository of Ubuntu so you can install it normally with apt install

$ sudo apt install wakeonlan

Running Wake-on-LAN

Execute wakeonlan with MAC address.

$ wakeonlan 04:92:26:00:00:00
Sending magic packet to with 04:92:26:da:61:3c

I was able to confirm the boot safely.

Referred by

Linux から認識されている、すべてのネットワークインターフェイス名だけを取得する

Other translations