Forward Wake on LAN packages bewteen networks with socat

If you have two networks and you want to wake a machine in another from network it can be tricky because you can't always set the destination IP address or network. An easy fix is to use socat to forward the UDP wakeonlan packages to the other network or IP:

sudo socat -v UDP4-RECVFROM:9,fork UDP4-SENDTO:

You can leave out the -v for less verbosity. The target network is, you can replace this with a specific IP, which helps with routers not forwarding broadcasts. Usually UDP port 9 is used, but you may change this to port 7 for your setup. You will need to be root because port 9 is generally privileged.