Wake on lan over cellular

Discuss My Media Center for Windows 8, Windows RT, iOS, Android, and WP, and ask Ceton for support.
Forum rules
Ceton no longer participate in this forum. There is no official support mechanism for My Media Center.
Post Reply
deihmos

Posts: 200
Joined: Sat Jun 09, 2012 3:33 am
Location:

HTPC Specs: Show details

Wake on lan over cellular

#1

Post by deihmos » Wed Apr 09, 2014 2:50 pm

Is it possible to wake on lan over cellular? I cannot get it to work.

mdavej

Posts: 1477
Joined: Mon Aug 20, 2012 6:52 pm
Location:

HTPC Specs: Show details

#2

Post by mdavej » Wed Apr 09, 2014 2:59 pm

Should work fine with the proper port forwarding. What app are you using on your phone? I use one on iOS called mWOL. I have a couple of local addresses and a WAN address configured for WOL over cellular.

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#3

Post by barnabas1969 » Wed Apr 09, 2014 3:12 pm

Well, it's a little more complicated than simply forwarding a port. A WOL "magic packet" is addressed to a MAC address, and it usually sent on the LAN to the broadcast address. The port number isn't important, but port 7 is usually used on the LAN (but don't forward port 7 on your router, choose a different port that isn't used by any well-known service).

If you forward a specific port to a specific LAN IP address, the WOL packet will be forwarded only if the router/switch still has that IP in its lookup table. When the computer goes to standby, the NIC doesn't have an IP address anymore (because the IP address doesn't exist in the hardware layer), and after some amount of time, the router/switch will delete that entry from the lookup table because no traffic has been sent to that MAC address for a period of time which exceeds the time that the router/switch keeps entries in the table. This can also happen when you reboot/power-cycle the router/switch.

So, simply forwarding a port to a specific IP will sometimes work for WOL, but not always.

To ensure that it always works, you need to forward a port to the broadcast address of the LAN. Most routers do not allow this.

If you have DD-with regard to on your router, you can follow the wiki linked below to setup remote WOL on your router:
http://www.dd-with regard to.com/wiki/index.php/WOL

deihmos

Posts: 200
Joined: Sat Jun 09, 2012 3:33 am
Location:

HTPC Specs: Show details

#4

Post by deihmos » Wed Apr 09, 2014 3:17 pm

I am trying to get it to work using the my media center app but it does not seem to work when I am outside my network.

User avatar
newfiend

Posts: 2503
Joined: Tue Jun 07, 2011 12:10 pm
Location: Earth

HTPC Specs: Show details

#5

Post by newfiend » Wed Apr 09, 2014 4:18 pm

deihmos wrote:I am trying to get it to work using the my media center app but it does not seem to work when I am outside my network.
The MMC App supports WOL (Wake On LAN) or your home network.. Wake on WAN is not supported by the MMC app but others have gotten it to work. On my old Linksys Router I was able to Wake on WAN the MMC app but since switching to the Asus Router I have now it won't work. I have to use another app to wake the HTPC first then connect with the MMC app. I don't know why some routers allow this and other don't.
newfiend~

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#6

Post by barnabas1969 » Wed Apr 09, 2014 4:44 pm

newfiend wrote:I don't know why some routers allow this and other don't.
Because they don't allow a broadcast packet to be forwarded to the LAN. See my post above.

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#7

Post by barnabas1969 » Wed Apr 09, 2014 4:47 pm

deihmos wrote:I am trying to get it to work using the my media center app but it does not seem to work when I am outside my network.
I set My Media Center to use my external address all the time, even when I'm on my home WiFi. I just put my external address in the "Local" address box, and there is a setting in MMC always try the Local address first. This causes MMC to send a WOL packet, even if you are outside the local network. Then, you need to setup your router to forward the WOL packet, which you router may not be able to do without other firmware such as DD-with regard to or Tomato.

deihmos

Posts: 200
Joined: Sat Jun 09, 2012 3:33 am
Location:

HTPC Specs: Show details

#8

Post by deihmos » Wed Apr 09, 2014 4:53 pm

I already have tomato and have port forwarding setup. I tried that before and it didn't work. I will give it another try.

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#9

Post by barnabas1969 » Wed Apr 09, 2014 5:02 pm

It's not only a matter of port forwarding. Please read post #3 again. I did a quick search, and I found this guide to set it up on Tomato. It is written in French, and translated to English via Google Translate. Here's the link:

http://translate.google.com/translate?h ... 6450&twu=1

deihmos

Posts: 200
Joined: Sat Jun 09, 2012 3:33 am
Location:

HTPC Specs: Show details

#10

Post by deihmos » Wed Apr 09, 2014 5:05 pm

barnabas1969 wrote:It's not only a matter of port forwarding. Please read post #3 again. I did a quick search, and I found this guide to set it up on Tomato. It is written in French, and translated to English via Google Translate. Here's the link:

http://translate.google.com/translate?h ... 6450&twu=1
I can wake the PC using other applictions over wan. I can also wake it by logging into the router. The problem is with the ceton app. It isn't working over wan like other applications. You do have to forward ports for it to work. The app on my phone I forward port 9.

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#11

Post by barnabas1969 » Wed Apr 09, 2014 5:17 pm

deihmos wrote:I can wake the PC using other applictions over wan.
OK, so you're saying that you can use an app other than MMC on your phone, and the PC will wake when you are not connected to your WiFi?

In that case, then make sure to setup MMC so that both the local and remote addresses point to your external IP and port. Then, in MMC, go to "Settings" -> "Advanced", and scroll down to the setting that says "Always try internal settings". Make sure it's checked.

Also, make sure "WoL When Connecting" is checked.

deihmos

Posts: 200
Joined: Sat Jun 09, 2012 3:33 am
Location:

HTPC Specs: Show details

#12

Post by deihmos » Wed Apr 09, 2014 5:22 pm

barnabas1969 wrote:
deihmos wrote:I can wake the PC using other applictions over wan.
OK, so you're saying that you can use an app other than MMC on your phone, and the PC will wake when you are not connected to your WiFi?

In that case, then make sure to setup MMC so that both the local and remote addresses point to your external IP and port. Then, in MMC, go to "Settings" -> "Advanced", and scroll down to the setting that says "Always try internal settings". Make sure it's checked.

Also, make sure "WoL When Connecting" is checked.
Did that and it still didn't work. What port is MMC using for WOL?

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#13

Post by barnabas1969 » Wed Apr 09, 2014 5:32 pm

If the above doesn't work, then you could setup a startup script on your router (DD-with regard to supports this, but I don't know if Tomato does).

A script which will work on DD-with regard to is posted below. I don't know if /proc/net/ip_conntrack exists in Tomato. If not, there should be a similar file which tracks recent connections. In DD-with regard to, the ip_conntrack file is erased whenever anything reads the ip_conntrack_flush file. This feature is used in the script so that the script will never trigger more than once on the same line in the ip_conntrack file. So, if you use Tomato, you'll need to figure out what the equivalent filenames are in Tomato vs. DD-with regard to.

Code: Select all

while sleep 4 ; do
  if [ `egrep -c tcp.+SYN_SENT.+dport=5832.+UNREPLIED.+src=192\.168\.1\.123.+sport=5832 /proc/net/ip_conntrack` -gt 0 ] ; then 
    /usr/sbin/wol -i 192.168.1.255 -p 7 01:23:45:67:89:AB
    cat /proc/net/ip_conntrack_flush >/dev/null
  fi
  sleep 1
done >/dev/null &
The IP address above (192\.168\.1\.123) needs to be changed to match the IP of your HTPC. The back-slash (aka escape) before each dot indicates that the dot is to be treated as a literal string instead of a wildcard character.

The "dport=" part is 5832 above. This assumes that your external port number is 5832. Change this to whatever external port number you chose to use.

The "sport=" part is 5832 above also. This assumes that the My Media Center service on your HTPC is setup to listen on 5832. Change this to whatever port number you configured in the My Media Center service on the PC.

The other IP address above (192.168.1.255) should be the broadcast address of your LAN. So, if your LAN is set with a subnet of 192.168.1.x, you can leave it alone. If your subnet is 192.168.0.x, then you need to change this to 192.168.0.255, and so-forth.

The MAC address above (01:23:45:67:89:AB) needs to be changed to match the MAC address on your HTPC.
Last edited by barnabas1969 on Wed Apr 09, 2014 5:40 pm, edited 1 time in total.

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#14

Post by barnabas1969 » Wed Apr 09, 2014 5:37 pm

I corrected a small mistake in my script above. I missed the " ; do" part after the while statement.

BTW, the output redirection and the ampersand at the end of the script are intentional.

Of course, the script relies on the format of the ip_conntrack file in DD-with regard to. If the equivalent file in Tomato has a different format, you'll have to adjust the egrep statement. Login to your router using SSH or telnet, and try each piece of the script manually to see what you get. For example, after a failed attempt to connect to the HTPC with MMC, try the egrep statement all by itself.

Code: Select all

egrep -c tcp.+SYN_SENT.+dport=5832.+UNREPLIED.+src=192\.168\.1\.123.+sport=5832 /proc/net/ip_conntrack
If you don't get a number higher than zero, then it didn't work. From that point, you'd need to look to see if /proc/net/ip_conntrack exists. If not, then look for a similar filename, or search documentation for Tomato to see where it keeps this info.

Then, once you find the correct file, you'll need to look at it with the "more" command to see what format it's in and adjust the search string to find the correct record(s).

Next, you'll want to see if /usr/sbin/wol exists. If not, then find out where the wol command exists in Tomato, and change the path in the script.

grinchy

Posts: 198
Joined: Wed Oct 12, 2011 2:42 am
Location:

HTPC Specs: Show details

#15

Post by grinchy » Fri Apr 25, 2014 7:38 pm

deihmos wrote:Is it possible to wake on lan over cellular? I cannot get it to work.
This is possible and relatively easy, but not through the traditional WOL packet. Enable "Wake on Pattern Match" on your NIC and you'll be able to wake the machine when you're away from home via the app; it won't connect initially (as it is initially asleep) but try again and it'll connect.

I do this w/out any other tweaking required. Some have reported that this can sometimes cause your machine to wake from other devices on your LAN - however I have not had an issue with that.

Post Reply