The Wake-on-LAN works in Windows 10 both after sleep mode and after shutting down but it does not work in Ubuntu 18.04 Kernel 5.4.0-58-generic RTL8111/8168/8411. My ethernet card is RTL8111/8168/8411 and the installed driver is r8169 as you can see in the output of the following commands. This is a laptop, if it matters.
#lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
#uname -r
5.4.0-58-generic
sudo lshw -C network
-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:01:00.0
logical name: enp1s0
version: 15
serial: ***********
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physicatiation
configuration: autonegotiation=on broadcast=yes driver=r8169 duplex=full ncy=0 link=yes multicast=yes port=MII speed=100Mbit/s
resources: irq:16 ioport:3000(size=256) memory:4f804000-4f804fff memory:4
I have noticed that, even though running sudo ethtool -s enp1s0 wol g
changes the value of "Wake-on" variable displayed by ethtool from "d" to "g", making this does not make Wake-on-LAN functionality to work. That means, if I take the laptop to sleep mode right after updating the value of "Wake-on" variable from "d" to "g", the computer does not wake up on LAN.
Moreover, if I reboot the computer right after setting the value "g" on the "Wake-on" variable, this variable gets the value "d" back again after a reboot.
Does anyone have any suggestion to fix this?