Like all posters here I’ve been struggling to set up wake-on-lan on the Swisscom Internetbox. On powering down a PC the ARP table is lost inside the Internetbox and since the PC is not powered on it no longer has an IP address, so forwarding magic packets on port 7 or 9 basically does not work from the internet. Also, the Internetbox does not allow or isn’t capable of using a broadcast on x.x.x.255, so the only way to have some sort of wake-on-lan functionality is to have at least one device on the local network powered on all the time, capable of waking up the other devices. Since I don’t want my PCs on all the time, the only device that I have available is an Android tablet. Below my solution how to implement wake-on-lan via android.
Device: Rooted Nexus 7
Installed from Google Play Store: SuperSU, BusyBox, SSH Server
This will probably work on any rooted Android device, and UPDATE: also on iOS, see 8.
1. Root, install SuperSU (or Superuser, etc), Busybox Free, SSH Server
2. Change your wifi ip address from a DHCP assigned one to a static one (it needs to be static to be able to forward a port on the Internetbox)
2. Set up SSH server to your liking (I set it up to start on boot, chose a random port to run it on, disabled password login, installed my public key on the device and set SSH server to use it; normal login works ok too of course, but don’t forget this device is going to be on all the time and ssh will therefore be exposed to the internet 24/7, which means you should really only use ssh login via rsa keys if you want to be safe.)
3. Set up Internetbox to forward an outside port to the ssh port on your android device. I never use port 22 on the Internetbox (unless you like hundreds of break-in attempts per day). Choose a random port or one that you can remember. In this example I’ve taken port 41414 on the internet box and forwarded it to the port SSH Server is running on.
4. Try SSH’ing into your Android device from the internet using Putty (windows) or from the terminal in Mac or Linux. (I use JuiceSSH on my Android phone, which works brilliantly) Don’t forget to pick the correct port, and to make sure your private key is installed locally in ~/.ssh As a Linux example: ssh -p 41414 root@your-internetbox-ip-address-or-dynamic-dns. It should work.
5. Now, to wake up any device on your lan, we are going to need ‘ether-wake’ (which should be included in Busybox) and this will only run if you’re root, hence do a ‘su’ At this point you probably will get a pop up on your Android device asking for Superuser rights for SSH Server! Approve this in case that happens.
6. Now to wake up your PC do:
ether-wake -b -i wlan0 AA:AA:AA:AA:AA:AA
(The -b switch does a broadcast, so we don’t need to know the ip address of
the device that needs waking, the -i switch indicates the interface
# (wifi should be wlan0), and the AA:etc is the MAC address of the PC
# that needs waking)
7. Profit.
8. UPDATE 26.08.2015, below instructions to get it working on a jailbroken iOS device
9. Start with jailbroken iOS device with Cydia installed
10. Install BigBoss Recommended Tools (to give you apt-get, nano, vi and whole host of others)
11. Install Open SSH, SBSettings
12. After respringing you can launch SBSettings by swiping the top task bar
13. Look for the SSH toggle inside SBSettings and switch it on
14. Set your IP address to a static one inside the Wifi options (we’ll need that later to forward a port on the router)
15. Now use Putty (Windows) or terminal in Mac/Linux to ssh into your iDevice:
ssh -p 22 root@192.168.1.XXX # (XXX being the static address assigned in 14.)
16. Default SSH password on iOS is ‘alpine’ without the quotes
17. Change the password immediately to something else using
passwd
18. Optional for extra safety, but highly recommended: install your public key into /root/.ssh/authorized_keys, change permissions on.ssh to 700 and change permissions on authorized_keys to 600, try logging in with your private key afterwards, if working then disable password login by modifying /etc/ssh/sshd_config (PermitRootLogin without-password), afterwards reboot
19. Now we need to be able to send a magic packet to wake up our sleeping PC. Only thing I’ve found that works is ‘socat’. Install it with ‘apt-get install socat’
20. Now make sure you’re in /root (cd /root), and generate your magic packet as follows:
MAC=“aabbccddeeff” # (Change aabb,etc to the MAC address of
your sleeping PC, just remove the colons [:])
MAC2=“${MAC}${MAC}${MAC}${MAC}”
MAC3=“FFFFFFFFFFFF${MAC2}${MAC2}${MAC2}${MAC2}”
echo ${MAC3} | xxd -r -p > wakeUpPacketForMyPC
now wakUpPacketForMyPC contains the magic packet that
we need to send via socat as a broadcast on the network:
socat - UDP-DATAGRAM:192.168.1.255:9,broadcast < wakeUpPacketForMyPC
# This assumes of course that your network is 192.168.1.XXX and
# that your sleeping PC accepts WOL packets on port 9. Port 7 could
# also be used, so adapt this line to fit your network.
21. If it all works as expected, then forward a random port on your Internetbox to port 22 on your iDevice
22. Profit! Now also on iOS.