WOL OVER IPv4:
You can send WOL magic packet through WAN in IPv4, with a simple port forwarding from your router to your computer´s IP. You just pick a port, forward this port to your computer, then send magic packet to your public IP.
PS: This only works if your ISP is not using CGNAT. You know that you are in CGNAT if your public IP is different than the WAN IP shown in your router setup page. Usually your WAN IP over CGNAT will be 100.xxx.xxx.xxx or 10.xxx.xxx.xxx or 192.xxx.xxx.xxx or 172.xxx.xxx.xxx.
- Your computer OS has to have this functionality, and it has to be enabled (I know Windows 7 and newer do).
- Your Motherboard and BIOS must have this functionality (almost any MB has it)
- Your computer has to be Hybernated or sleeping. If you turn it off, the network card has no power so it is impossible to receive data.
- You need to forward the desired port (usually UDP 7 or 9) from your internet router to your computer. This is done by entering it´s configuration page (usually you just enter your gateway IP in your browser address field)
- Better to give your computer a static IP inside your LAN, so that the packet is forwarded to the right IP.
- You need way to send the UDP packet to your PC. There are many many android apps, some PC freeware and even some websites that do this (example: Depicus Wake On Lan)
You can define the network mask in almost all WOL software/app. If you need to wake up many computers in your LAN, you don´t have to forward ports to every PC. You just set the broadcast address to 0.0.0.0, then the packet will be sent to your entire LAN and every PC will listen. Don´t worry, you will only wake up the PC that matches the MAC address you sent.
WOL OVER IPv6:
Until now I haven´t found any software or app that is able to send an IPv6 packet through WAN sucessfully, so up to now, my guess is that WOL over IPv6 is not possible from WAN, although it works fine from LAN with many apps that support IPv6.
PS: I have been using WOL through IPv4 this to turn on my home computer from anywhere for years.