Setting up Wake On Lan on ASROCK Mainboard with Ubuntu

I recently bought an Asrock B550M-HDV mainboard with onboard Realtek RTL8111H ethernet chip.

In order to setup Wake On Lan we need to do two things:

Changes in the UEFI BIOS:

Changes in Ubuntu:

sudo nmcli connection modify OB-Ethernet 802-3-ethernet.wake-on-lan magic

sudo ethtool -s enp3s0 wol g

But sadly, these are not enough despite of all documentation!!!

When I setup everything like this, wake-on-lan doesn’t work. By the way, I tried to run etherwake but it is not sending packets. I succeeded by using wakeonlan tool and checked if I am receiving packets correctly:

From another linux computer, I send :

wakeonlan a8:a1:59:51:75:63

And from the ASrock PC to be waken up, I run:

sudo ngrep '\xff{6}(.{6})\1{15}' -x port 9

When I send it, it receive some hexadecimal bytes, so I am sure that my another linux computer is sending packet to my ASrock PC correctly.

Next, I checked for LINK LED on my mainboard for Ethernet. Sadly, when the system is powered off, I was expecting that LINK LED to stay ON. This turned out to be a misleading conclusion, see next.

I tried my best to find the reason for about 1 hour. And hen I gave up, and send an email to ASrock. As typical, they replied me by giving instructions for Windows ! Even some of their instructions were totally off the target: Their instruction were telling me to enable some setting in the UEFI BIOS which does not exist on P1.90 firmware of B550M-HDV !

So I deep dive more and more, and after 45 minutes of searching, I found this: https://bbs.archlinux.org/viewtopic.php?id=243461

So I decided to give a try:

echo "NETDOWN=no" | sudo tee /etc/default/halt

Then I powered off my PC. And voila ! It worked.

I checked LINK LED when my PC was powered down, and it was OFF still ! But even in that case, when I send the magic packet, system powers ON, and Link LED turns ON after a while.

Quite weird. But thanks to Arch forums, I have been able to solve this issue. I hope this helps to some other people who are experiencing same issue.

Note: Arch wiki and forums suggest using r8168 driver with s5wol=1 as parameter, but my kernel did not had this driver ( either built-in or as a loadable module ); so I couldn’t try that.