If yes, how does it work? The pc still has no ip, so where should I forward the port?
Does Wake-on-LAN via WAN need port forwarding?
Wake-on-LAN normally uses UDP ports 7 and 9.
The packets are sent to the special broadcast address of the LAN, so it will be received by all network-attached hosts, rather than by a specific host.
The MAC address is used to identify the particular host that should "Wake Up"
If the PC is Wake-on-LAN enabled it will be listening for packets on the above ports.
If the magic packet is coming from the internet (WAN) then any firewall must be set up to allow entry of the Wake-on-LAN signal to a specified port, which can be forwarded to the computer to be woken up
Some routers permit the packet to be broadcast to the entire LAN.
Some routers do not support this as they will not forward broadcast packets.
The MagicPacket: How WoL Works
WoL-enabled computers essentially wait for a “magic packet” to arrive that includes the NIC’s MAC address in it. These magic packets are sent out by professional software made for any platform, but can also be sent by routers and internet-based websites. The typical ports used for WoL magic packets are UDP 7 and 9. Because your computer is actively listening for a packet, some power is feeding your network card which will result in your laptop’s battery draining faster, so road warriors should take care to turn this off when you need to eke out some extra juice.
Magic packets are usually sent over the entirety of a network and contain the subnet information, network broadcast address, and the MAC address of the target computer’s network card, whether Ethernet or wireless. The above image shows the results of a packet sniffer tool used on magic packet.