I have a solution, but it works for fixed IP addresses. I do not know but it might be possible to change a code to fix this for dynamic addresses.
All you need - to send a magic packet to the fixed address of your computer. I created a small utility.
My subnet is 172.17.111.0/24, packets are sent from 172.17.105.0/24
class Program
{
static readonly Tuple<string, byte[]>[] Addr = {
new Tuple<string, byte[]>("**-**-30-9D-98-61", new byte[] { 172, 17, 111, 91 }),
new Tuple<string, byte[]>("**-**-D9-7B-9D-E9", new byte[] { 172, 17, 111, 70 }),
};
static void Main(string[] args)
{
var id = args.Length > 0 ? int.Parse(args[0]) : 0;
WolClass client = new WolClass();
client.Connect(new IPAddress(Addr[id].Item2), 0x9);
client.SetClientToBrodcastMode();
//set sending bites
int counter = 0;
//buffer to be send
byte[] bytes = new byte[1024];
//first 6 bytes should be 0xFF
for (int y = 0; y < 6; y++)
bytes[counter++] = 0xFF;
//now repeate MAC 16 times
for (int y = 0; y < 16; y++)
{
int i = 0;
for (int z = 0; z < 6; z++)
{
bytes[counter++] = byte.Parse(Addr[id].Item1.Substring(i, 2),
NumberStyles.HexNumber);
i += 3;
}
}
//now send wake up packet
client.Send(bytes, 1024);
}
}
public class WolClass : UdpClient
{
//this is needed to send broadcast packet
public void SetClientToBrodcastMode()
{
if (this.Active)
this.Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.Broadcast, 0);
}
}