# First one has to know the interface of the Ethernet ifconfig # Etc. enp8s0 ---- # Add an interface config file /etc/network/interfaces.d/eth0 # Make sure to change the filename <eth0> to etc. "enp8s0" or similar as from the result above auto eth0 iface eth0 inet dhcp ethernet-wol g # Change it accordingly auto enp8s0 iface enp8s0 inet dhcp ethernet-wol g ---- # ReBoot # and it should be in effect
# Enabling WoL in the NIC # Determining whether the NIC supports WoL # First, determine which NIC will be used, and then check whether it supports the Magic Packet™ using sudo ethtool <NIC> # where <NIC> is the device name of your NIC, e.g. eth0. # This command will output some information about your the capabilities of your NIC. # If this output contains a line similar to the following: Supports Wake-on: <letters> # where <letters> contains the letter g, the NIC should support the WoL Magic Packet™ method # (for the other letters look at man ethtool). # Enabling WoL in the NIC # To check whether WoL is enabled in the NIC, one could use -> sudo ethtool <NIC> # and look for Wake-on: <letters> # If <letters> contains g and not d, then Magic Packet™ is enabled. # However, if <letters> does contain d, WoL needs to be enabled by running the following command: sudo ethtool -s <NIC> wol g ---- # Non-interactive creation of script which will set the "Wake-on" # option to "g" which means "Wake on MagicPacket". For the next step (systemd) to work correctly, # you must have the she-bang line included on the first line of the file. cat >> /root/wol_fix.sh <<EOF #!/bin/bash ethtool -s enp3s0 wol g EOF # Set correct permissions for the fix script. chmod 755 /root/wol_fix.sh -> # Non-interactive creation of script which will run on boot to run the fixing script. cat >> /etc/systemd/system/wol_fix.service <<EOF [Unit] Description=Fix WakeOnLAN being reset to disabled on shutdown [Service] ExecStart=/root/wol_fix.sh Type=oneshot RemainAfterExit=yes [Install] WantedBy=multi-user.target EOF -> # Reload the systemd manager configuration. systemctl daemon-reload # start the wol_fix.service systemctl start wol_fix # Check if it has enabled wake on g sudo ethtool <NIC> # It should now write Wake-on: g # Enable to wol_fix service script. systemctl enable wol_fix.service # NOTE: must reboot for the on-boot script to take effect. # Or you can run the /root/wol_fix.sh script manually this time only before your next shutdown or reboot. reboot ---- # On next reboot make sure the scripts worked # Etc. ethtool <NIC> # And look for g in Wake-On: Wake-on: g
ethtool -s enp4s0 wol g
@papaours Thanks for the idea!I used the solution of darkyere, but instead of creating a system service, I added an Init/Shutdown Scripts (System Settings > Advanced).