There are a lot of things to take into consideration here.
You're not specifying where does that "Magic packet received successfully" comes from, but I assume you're using some WoL listener to verify that the packet has arrived successfully when the computer is ON.
These are the things you must look into:
On the Computer to turn on
- If the network card is not embebed into the motherboard, you must find a setting in your mobo to allow PCI cards to wake up the system. Then you'll have to check your card and motherboard to see which energy states are compatible with WoL.
- If the network card is embebed into the motherboard, it will usually have some Wake On Lan option into the BIOS settings that will enable everything for you
- If the network card is not embebed into the motherboard, you'll have to configure it from your OS to allow WoL (and optionally magic packets). Linux has ethtools, in Windows you have to go to your network card properties, click configuration to open the adapter configurtation window, and go to energy tab. The layout depends on yout network card, but modern Intel cards provide separate sections for WoL and energy saving, just enable everything for WoL if you don't know very well what you're doing.
- Some computers (even on servers) will provide unpredictable behaviour when there's a power loss while the system is off and will never notify the switch of their presence until they're booted again, making WoL impossible. The "last state" on power recovery usually fix this, however, I recommend you to test it before, as you may find that you need to use the "power on" to be absolutly sure.
Router / switch
- If PC2 has direct l2 access to the PC to turn on, there are usually no problems with WoL
- If you have to perform WoL from the Internet or from a diferent network, there are many solutions. The simplest one is to map some port to the broadcast IP and WoL port, however, not all routers will allow to do so. OpenWRT DOES SUPPORT this kind of setting.
- If you are not capable of configuring WoL through different networks, consider placing a WoL server into your computer networks and connect to it via ssh / http to display a menu that will execute commands locally. I preffer a ssh menu, however,
in php it is as simple as:
Code sample for php dummy WoL server:
$response= shell_exec("/usr/bin/wakeonlan $mac -p $port");