Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Software Hardware

Setting up a System w/ Wake-on-LAN and VNC? 74

andrebsd asks: "I'd like to make myself some sort of webpage where I could startup my system with 'Wake on Lan', and once it is started, use VNC to login. Once I'm done doing what I need the system for I would then like to shut it down again. I'm wondering how one might go about putting something like this together. VNC has various scripts for making that part work, but I haven't seen any scripts that can function as a 'Power on/Power off' button for a webpage. Thanks to anyone with any way of doing this." While there are helpful reference for Wake-on-LAN tools, how would you integrate all of these into a coherent system? How might one keep such a system (relatively) secure?
This discussion has been archived. No new comments can be posted.

Setting up a System w/ Wake-on-LAN and VNC?

Comments Filter:
  • by teridon ( 139550 ) on Tuesday December 16, 2003 @11:49PM (#7742090) Homepage
    It'd be nice if you told us what kind of system you are planning on doing this to. Other hosts on the network that DON'T sleep? info, info, info!
  • WOL isn't very hard. (Score:5, Informative)

    by duffbeer703 ( 177751 ) * on Tuesday December 16, 2003 @11:50PM (#7742095)
    You'll need to lookup the precise specifications for WOL. Basically you simply send the MAC address three times to the target machine over UDP. Then the NIC wakes the computer up.

    It's not very difficult to do this with a perl script or something similar that can be integrated into a web page.

    Another alternative that may interest you if your target computer has access to a phoneline is "Wake on Ring". Some BIOS vendors (Abit was one) allow a modem to power on a PC after a specified number of rings.

  • by Anonymous Coward on Tuesday December 16, 2003 @11:52PM (#7742113)

    Where is your "system"?

    You do realize that Wake on LAN is a layer two protocol, right? I.e. it's an ethernet protocol that has nothing to do with IP, UDP, or TCP.

    The webserver that is hosting this webpage will have to be on the same local area network [layer two] as your "system." So:

    [you at your web browser] -> [THE CLOUD] -> [the webserver] -> [your "system"]
    where the final arrow MUST be on the same local area network.

    The person who administers the webserver [the second to last point in the diagram] must give you sufficient rights to some daemon on that webserver so as to allow you to send out a layer two [ethernet] packet via that daemon. If you yourself are not the administrator of this webserver, the chances of you getting those kind of rights are between slim and none. The standard sandboxes, such as the Java sandbox, don't allow you to get anywhere near sending a layer two packet.

  • Well (Score:3, Informative)

    by SpaFF ( 18764 ) on Tuesday December 16, 2003 @11:54PM (#7742128) Homepage
    You could write a cgi-program that calls Etherwake [scyld.com]. Or you could be even more savvy and write a cgi or php program that just sends out the wake-on-lan "magic packet" by itself. It's just an ethernet packet. Bear in mind thought that the webserver is going to need to be on the same network as the machine that you are trying to wake up or it won't work.

  • Usually webmin would be the best bet, but they don't seem to have a Wake on Lan module [sourceforge.net] yet.

    I suppose you can take one of the hundreds of perl WOL scripts and pretty easily(though not completely pain free Google: "perl wake on lan"), issue a WOL command.
  • Um, too obvious? (Score:5, Interesting)

    by tunah ( 530328 ) <sam&krayup,com> on Wednesday December 17, 2003 @12:04AM (#7742204) Homepage
    What's wrong with something simple? Throw a .htaccess in a directory with this (untested) script.
    <html><body>
    <?php
    $machine="123.123.12 3.123";
    $connect="wakeonlan --wakeup $machine"; // or whatever
    if($_REQUEST['connect']) {
    exec($connect);
    ?>
    Starting up <?=$machine?>.
    <?php
    } elseif(ping($machine)) {
    ?>
    <?=$machine?> is up.
    <?php
    } else {
    ?>
    <?=$machine?> is down. <a href="?connect=1">Start up</a>.
    <?php
    }
    ?>
    </body></html>
    • Oops, I forgot to say, I don't know if WOL allows you to shut down, that's easily added. If not, VNC will do it.
    • $connect="wakeonlan --wakeup $machine"; // or whatever

      Uh, dude, that "or whatever" is more than 50% of the question he was asking. (Unless you are holding out on us with a "wakeonlan" script you have filed away somewhere...)
  • Some simple ideas (Score:5, Informative)

    by Gudlyf ( 544445 ) <<moc.ketsilaer> <ta> <fyldug>> on Wednesday December 17, 2003 @12:05AM (#7742210) Homepage Journal
    I'm pretty sure it's not possible to sent WOL over the internet, since you're accessing the MAC address to turn the system on. It's broadcasting a packet to 255.255.255.255.

    I use WOL to turn my Windows XP PC on by SSH'ing to my Linux server on the same LAN, then running the Linux WOL utility [uminho.pt] to turn the Windows PC on. Then I have the Terminal Services service running on the WinXP system on a non-default port where I can shut it down if I want to (using tsshutdn). It might also be possible to shut the system down remotely from the Linux system with Samba, but I've never tried that.

    • It depends on alot of factors.

      WOL uses UDP to send the "magic packet", usually to port 9, where the packet never goes past layer-2 on the receiving end.

      In a LAN this is a broadcast packet, but you can also direct the UDP to the last known IP address associated with a particular NIC. Sometimes it works, usually it doesn't.
      • I forgot to mention that since WOL over the internet is less than reliable, something like Wake-On-Ring with a modem or something similar is probaly a better idea.
      • Re:Some simple ideas (Score:1, Informative)

        by Anonymous Coward
        It is perfectly ok to send any kind of packet whatsoever, as long as it contains the signature which the network card is looking for (essentially its own MAC address repeated several times, though there are different kinds of WOL packets). The problem is getting the packet to the target network card: If you send it to the last known IP address, the last router on the way will ask (by broadcast) which hardware address is associated with the IP address in the WOL packet (Address Resolution Protocol, ARP). Sin
    • > I have the Terminal Services service running on the WinXP system on a non-default port where I can shut it down if I want to (using tsshutdn).

      Security through obscurity - the golden path to heaven

      you might want to go read these pages [insecure.org]

      particularly this one [insecure.org]

      your non-default port is worth 0 points
    • Re:Some simple ideas (Score:3, Informative)

      by teridon ( 139550 )
      You can wake up a system on a remote subnet by using two methods. One, you mentioned, is by using the remote IP. This probably won't work unless the router on the remote subnet still has the MAC address for that IP in its ARP cache. This isn't likely because if the system is sleeping the ARP cache probably expired already. And when the router for the remote system sends an ARP request (who has IP X), the sleeping system will of course not answer, so the router reports IP X as being down.

      The second meth
      • I've done this before with the directed broadcast. The remote systems are linked via gre tunnels (ipip tunnels didn't work), and the remote routers are cisco 837's. Under current IOS versions you have to enable ip directed broadcast, it used to be on by default but now it's off. Make sure you put appropriate firewall rules in too, directed broadcasts are great for DoS attacks.
    • Why bother running Terminal Services on a non-default port? Why not have the Terminal Services connection tunnel through SSH?

      (I can only assume that your Windows box is behind a firewall, and not directly accessible to the world. If it is, well, this is a moot question.)
    • It seems to be a common misconception that WOL doesn't work across the internet. WOL works across the internet just fine. I've used DSLReport's web based utility here [dslreports.com] and it works perfectly.
  • Why WOL? Why not use a ultra low power unit, set to start VNC or whatever on modem ring. Perhaps set it up to something like a dialup script, where it expects and the phone sends certain tones in order for authentication.
  • What I do. . . (Score:3, Informative)

    by MikeDawg ( 721537 ) on Wednesday December 17, 2003 @01:37AM (#7742673) Homepage Journal

    I have a couple boxes on my network, one of which is a linux box that is "always-on". I have the SSH port (port 22) open to incoming connections from outside the network, and I have a VNC port open able to get to from outside the network, on the windows machine. I just ssh into my linux box, and run a simple perl script (I already recorded the NICs MAC address) to send the magic packet to the windows machine, give it a couple minutes, and then VNC on in to my windows machine. . .

  • by Futurepower(R) ( 558542 ) on Wednesday December 17, 2003 @02:31AM (#7742888) Homepage
    Maybe one piece of the puzzle of making Wake-on-LAN over VNC work would be to have a DSL modem, and some kind of always-on appliance that could be programmed to turn on the computer. The appliance must have an Internet address. This is the idea, but it is too expensive: Internet Power Switch [wti.com]. Maybe this would be better: 1-Port Serial Device Servers [acceed.com], but no price is listed.

    You have a good basic idea. You don't want to leave the computer on all the time, but you would like to VNC the computer when you need it. Actually, I want that too.

    All you need is a low-voltage switch with an Internet address. You can adjust the OS to turn on when the power switch is pressed and hibernate if the power switch is pressed, if the computer is already on. If you need a cold re-boot, you can run the shutdown command from VNC, using a time delay.

    A switch with an Internet address need cost no more than $50. The question is, who sells such a switch?
    • by 3waygeek ( 58990 ) on Wednesday December 17, 2003 @08:23PM (#7749719)
      Another alternative is an APC Masterswitch; it allows you to control multiple devices via web or telnet. It also works with an APC UPS to allow you to control how your systems behave when the power goes out (i.e. shut down non-essential boxen immediately to preserve battery power for the essential ones).

      You can pick up one on eBay [ebay.com] for a few hundred dollars, which works out to less than $50 per switched device.

      I picked up a Masterswitch Plus (basically a switch with a serial port that can signal a computer to do an orderly shutdown) for about $300 on eBay about 6 months ago, and use it to control several computers and my network hardware.
  • Set it up like this

    internet -> Webserver -> priv network -> Machine

    You use the internet to hit the webserver which is a machine that is on both the internet and the private network. The web server has scripts that allow it to run some WOL script to wake the machine and then checks every now and then to see if the machine is started and the vnc server is running, now that you have the machine running be sure it is configured to run the java vnc server so all you have to do is connect to the vnc
  • I do this all the time on my MacOS X systems, with Apple Remote Desktop. It has the ability to wake or sleep CPUs by remote control over the LAN. Right now I'm in bed using my laptop, I left my main CPU in my office downstairs doing a download, I checked its progress remotely just like VNC works, it just finished a few minutes ago, so I issued a remote sleep command. If I want to remotely wake it and start some other task I can do that too. ARD is built in to every Panther system, but the ARD Client softwar
  • Can be done with GSM (Score:2, Interesting)

    by krishnaD ( 514548 )
    If you want to do it with GSM and SMS, you will have less things to worry about and more control. I had something similar to control el. devices using GSM. Take a cheap cellphone, take an Atmel or a philips micro-cont, poll the cell phone using handmade module and connect a live circuit, as soon as predefined sms comes complete the circuit. Depending on the controller you use, you can control up to 8 devices.
  • by WoTG ( 610710 ) on Wednesday December 17, 2003 @05:04AM (#7743380) Homepage Journal
    I see lots of posts for using a local server that is always. I guess this will work for a lot of techie places... but what about everyone else?

    Are there any cheap routers that can send a simple WOL message? Are there any that have been hacked so that someone can add this function?
  • The only catch to all of this is that you need to have another computer on the same LAN that is always switched on.

    Having said that, you may as well have your extra PC always turned on as well, but with power saving enabled.

    If only you could wake up machines straight over the internet...
  • by graf0z ( 464763 ) on Wednesday December 17, 2003 @06:02AM (#7743555)
    At least the "standard AMD Magic Packet format" of WoL is ethernet-type 0x0842, not IP (0x0800). Instead of an IP-packet with dest- and source ip address it just contains repeatedly

    "FF FF FF FF FF FF 00 11 22 33 44 55"

    (if 00:11:22:33:44:55 is the target MAC). So it won't pass any routers, You have to do this in an ethernet-segment. Try

    # ether-wake 00:11:22:33:44:55

    and catch it with Your favorite sniffer.

    It would be senseless to use IP for WoL, as the arp-table of the last router has already forgotten the MAC of the dest ip and cannot resolve via arp-request it as the destination host is sleeping. If You have no machine next to Your target, You're lost.

    graf0z.

    • by graf0z ( 464763 ) on Wednesday December 17, 2003 @06:59AM (#7743698)
      I have to correct myself: You may use ANY packet You want (IP, IPX, whatever), as long as it

      • contains the "magic sequence"
      • is contained in a valid ethernet frame
      • is address to the target's MAC- or a multicast address (including broadcast).

      Because of the handshake You cannot use TCP, but any UDP or ICMP (ping!) packet including the magic would do it. It has to pass the firewall (if any). The dest address could be

      • unicast if the last router has a static arp entry for the dest
      • broadcast if the last router forwards broadcast packets
      • multicast if You have a multicast routing path from You into the last subnet.

      Read AMD whitepaper [amd.com] and a howto [uminho.pt].

      /graf0z.

    • It would be senseless to use IP for WoL, as the arp-table of the last router has already forgotten the MAC of the dest ip and cannot resolve via arp-request it as the destination host is sleeping.

      You're right, but you can use IP if you use the remote subnet's broadcast address (i.e. no ARP request is needed). The perl WOL utility allows you to specify the IP to use.

  • New Wrinkle (Score:3, Funny)

    by cam_macleod ( 59140 ) <c...a...m@@@unb...ca> on Wednesday December 17, 2003 @08:08AM (#7743872) Homepage Journal
    Everybody seems to have great solutions for that question, so let's make it tougher:

    How about when I've got only one system, and it connects using PPPoE to the outside world... can anybody solve *that* one?

    How about if pull out the power plug before I leave for work in the morning?
    • Modify the Ambient Orb [thinkgeek.com] so that the Internet access doesn't change the light, but triggers a robot to plug in your PC (and flick the power switch, or make turn-on automatic after plug-in somehow). Make a startup script that connects PPPoE.
  • by toygeek ( 473120 )
    Get an APC 9210 power switch off Ebay. Then make sure that your system turns on immediatly when power is applied. Login to the power switch, turn on the power to that box, and viola.

    We use these where I work for remote control of systems that have to be cold-booted every so often.
  • by zaqattack911 ( 532040 ) on Wednesday December 17, 2003 @12:50PM (#7745926) Journal
    Not too long ago I was given the "Kiosk project" at my work environment.

    As far as your concerned these are winXP machines. We have 4 on the same lan. I was thinking of having a wake-on-lan system that would force a kiosk to send a "wake-on-lan" request to a neibooring kiosk if it was offline.

    But that doesn't really help me if the kiosk is crashed and online. Is there a similar "reset-on-lan" feature out there?

    • Yes, this capability is available but it requires special hardware.

      There are two solutions that offer what you seek. First you can use server hardware like HP/Compaq with built in Out Of Band(OOB) management cards or Lights Out management cards [hp.com] in them. These cards are IP addressable and connect into the system's BIOS. They allow you to power the system on and off as well as view the boot up screens and even access and change the BIOS settings, all remotely. These are very powerful and indespensible for ma
      • Re:Yes. (Score:1, Troll)

        Thanks! The second option seems fine. anything to prevent me from physically have to approach and reset a kiosk.

        From what I can tell, the only downside is that it'll need its own IP address. (Which we try and conserve at my workplace).
    • Google search: hardware watchdog timer windows [google.com]. That'll be twenty dollars and a four-pack of guinness stout in cans, please.
  • I know the WOL connector on the motherboard provide 5V, but I wonder how much mA one can pull out of it ?

    Think powering an out-of-case device (in my case, a IR receiver).
  • I usually just shut mine down to hibernate with
    shutdown -h 25

    $ shutdown --help
    Usage: shutdown [OPTION]... secs|"now"
    Bring the system down.

    -f, --force Forces the execution.
    -s, --shutdown The system will shutdown and power off (if supported)
    -r, --reboot The system will reboot.
    -h, --hibernate The system will suspend to disk (if supported)
    -p, --suspend The system will suspend to RAM (if supported)
    --help Display this help and exit.
    --version Output version in
  • Use a shell app that sends a WoL packet to the system, executed using the php shell_exec("command") operator.

    That'll turn the system on, then, VNC as necessary.

    To turn off, VNC in and click shutdown or shutdown -k now or w/e.
  • Wake on LAN through a router/firewall [google.com]

    One thing worth noting is that the windows software they used to send magic WOL packets sent them to UDP port 2304. I don't know if this port is standard, so if WOL works through your firewall with their program but not ether-wake or some other software, find out what port your software uses and subsititure that into the firewall forwarding rules.

"Protozoa are small, and bacteria are small, but viruses are smaller than the both put together."

Working...