mistraller
25-08-2007, 00:02
I have a working Wake On Lan Solution on my asus wl500gx using ether-wake, which is included in Oleg firmware.
It's quite simple, and works with the (also builtin) busybox_httpd webserver, without making NAT rules for wake on lan in your modem!
First: Make your asus webserver accessible from the internet. See other HOWTO's how to do that. In my asus httpd runs on port 81, my modem has a NAT rule to translate external port 80 to internal port 81.
If you want to hide your wake-on-lan webpage behind a password protected area (which you probably want, otherwise everyone could turn on your home pc's) you have to include a line to your config file:
/cgi-bin:user:password
In this example, only the active pages will be protected, you can also protect other folders, with one or more useraccounts:
/adm:admin:setup # Require user admin, pwd setup on urls starting with /adm/
/adm:toor:PaSsWd # or user toor, pwd PaSsWd on urls starting with /adm/
Save your configfile under /opt/etc/httpd.conf
Start busybox_httpd with:
busybox-httpd -c /opt/etc/httpd.conf -p 81 -h /opt/share/www
Replace path to configfile, portname and weblocation to your own values of course.
You can place this into /usr/local/sbin/post-boot
Findout if your pc can be woken up by issueing the command:
ether-wake -i br0 00:11:22:33:44:55
Replace with your own mac adress of course. If it's not working, check if your pc or network settings. Your pc has to be a wired connection to the internal network where the asus is connected. Not all routers pass through the magic packet, so best is to keep it simple, and connect the pc directly to the asus. (this howto is not intended for resolving general WOL problems)
If the pc wakes up, you can place the following file into your cgi-bin folder on the shared weblocation, in my case: /opt/share/www/cgi-bin/wol.cgi
#!/bin/sh
ether-wake -i br0 11:22:33:44:55:66
echo "<HTML><HEAD><title>test</title></head><BODY>Magic Packet Sent</Body></html>"
After creating/placing the file, chmod +x it, to give it a execute permissions.
As you see, you can edit this file as you like, or create multiple cgi-bin files, with a central html page with links to all corresponding files, for multiple pc's.
Now, powerdown the pc, go to another pc and go to www.yoursite.com/cgi-bin/wol.cgi
You will see the password protection if installed, after entering your credentials, the pc will wake up!
Because the magic packet was sent by a device from within your lan, it doesn't have to pass your modem, so a NAT rule is not necessary. Also, remembering your mac adress is history ;)
I also tried this with an available php webserver, php-thttpd, but thttpd is more secure. Because of security, thttpd won't start ether-wake with root permissions, and it will end with a "Cannot create raw socket" error. I tried to su ether-wake, but that was no improvement.
Of course, if there's no external disk, or you don't have an /opt/ mountpoint, you can place your files anywhere.
Remember to
flashfs save && flashfs commit && flashfs enable
If you place files on internal storage.
It's quite simple, and works with the (also builtin) busybox_httpd webserver, without making NAT rules for wake on lan in your modem!
First: Make your asus webserver accessible from the internet. See other HOWTO's how to do that. In my asus httpd runs on port 81, my modem has a NAT rule to translate external port 80 to internal port 81.
If you want to hide your wake-on-lan webpage behind a password protected area (which you probably want, otherwise everyone could turn on your home pc's) you have to include a line to your config file:
/cgi-bin:user:password
In this example, only the active pages will be protected, you can also protect other folders, with one or more useraccounts:
/adm:admin:setup # Require user admin, pwd setup on urls starting with /adm/
/adm:toor:PaSsWd # or user toor, pwd PaSsWd on urls starting with /adm/
Save your configfile under /opt/etc/httpd.conf
Start busybox_httpd with:
busybox-httpd -c /opt/etc/httpd.conf -p 81 -h /opt/share/www
Replace path to configfile, portname and weblocation to your own values of course.
You can place this into /usr/local/sbin/post-boot
Findout if your pc can be woken up by issueing the command:
ether-wake -i br0 00:11:22:33:44:55
Replace with your own mac adress of course. If it's not working, check if your pc or network settings. Your pc has to be a wired connection to the internal network where the asus is connected. Not all routers pass through the magic packet, so best is to keep it simple, and connect the pc directly to the asus. (this howto is not intended for resolving general WOL problems)
If the pc wakes up, you can place the following file into your cgi-bin folder on the shared weblocation, in my case: /opt/share/www/cgi-bin/wol.cgi
#!/bin/sh
ether-wake -i br0 11:22:33:44:55:66
echo "<HTML><HEAD><title>test</title></head><BODY>Magic Packet Sent</Body></html>"
After creating/placing the file, chmod +x it, to give it a execute permissions.
As you see, you can edit this file as you like, or create multiple cgi-bin files, with a central html page with links to all corresponding files, for multiple pc's.
Now, powerdown the pc, go to another pc and go to www.yoursite.com/cgi-bin/wol.cgi
You will see the password protection if installed, after entering your credentials, the pc will wake up!
Because the magic packet was sent by a device from within your lan, it doesn't have to pass your modem, so a NAT rule is not necessary. Also, remembering your mac adress is history ;)
I also tried this with an available php webserver, php-thttpd, but thttpd is more secure. Because of security, thttpd won't start ether-wake with root permissions, and it will end with a "Cannot create raw socket" error. I tried to su ether-wake, but that was no improvement.
Of course, if there's no external disk, or you don't have an /opt/ mountpoint, you can place your files anywhere.
Remember to
flashfs save && flashfs commit && flashfs enable
If you place files on internal storage.