tomato的远程唤醒

什么是远程唤醒

简单的说就是可以在其它电脑上启动另外一台电脑

tomato的介绍

在tomato路由系统中有一个远程唤醒计算机的功能,但是在外网我们可能不想登陆路由设置界面,会带来一些安全隐患。如果改用ssh登陆路由操作会比较安全一些。我开始在路由系统中找了一番没有找到相关的文件,通过路由web界面看是提交数据到wakeup.cgi文件,但是根本就没有这个文件。没有办法下载tomato的源代码,希望可以从中有些收获。在源代码里根据wake关键字搜索了一下,有个文件ether-wake.c比较醒目,打开一看就是它了。下面是它的一些简单说明:

 

C++代码
  1. /* vi: set sw=4 ts=4: */  
  2. /*  
  3.  * ether-wake.c - Send a magic packet to wake up sleeping machines.  
  4.  *  
  5.  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.  
  6.  *  
  7.  * Author:      Donald Becker, http://www.scyld.com/"; http://www.scyld.com/wakeonlan.html  
  8.  * Busybox port: Christian Volkmann <haveaniceday@online.de>  
  9.  *               Used version of ether-wake.c: v1.09 11/12/2003 Donald Becker, http://www.scyld.com/";  
  10.  */  
  11.   
  12. /* full usage according Donald Becker  
  13.  * usage: ether-wake [-i <ifname>] [-p aa:bb:cc:dd[:ee:ff]] 00:11:22:33:44:55\n"  
  14.  *  
  15.  *  This program generates and transmits a Wake-On-LAN (WOL)\n"  
  16.  *  \"Magic Packet\", used for restarting machines that have been\n"  
  17.  *  soft-powered-down (ACPI D3-warm state).\n"  
  18.  *  It currently generates the standard AMD Magic Packet format, with\n"  
  19.  *  an optional password appended.\n"  
  20.  *  
  21.  *  The single required parameter is the Ethernet MAC (station) address\n"  
  22.  *  of the machine to wake or a host ID with known NSS 'ethers' entry.\n"  
  23.  *  The MAC address may be found with the 'arp' program while the target\n"  
  24.  *  machine is awake.\n"  
  25.  *  
  26.  *  Options:\n"  
  27.  *      -b  Send wake-up packet to the broadcast address.\n"  
  28.  *      -D  Increase the debug level.\n"  
  29.  *      -i ifname   Use interface IFNAME instead of the default 'eth0'.\n"  
  30.  *      -p <pw>     Append the four or six byte password PW to the packet.\n"  
  31.  *                  A password is only required for a few adapter types.\n"  
  32.  *                  The password may be specified in ethernet hex format\n"  
  33.  *                  or dotted decimal (Internet address)\n"  
  34.  *      -p 00:22:44:66:88:aa\n"  
  35.  *      -p 192.168.1.1\n";  
  36.  *  
  37.  *  
  38.  *  This program generates and transmits a Wake-On-LAN (WOL) "Magic Packet",  
  39.  *  used for restarting machines that have been soft-powered-down  
  40.  *  (ACPI D3-warm state).  It currently generates the standard AMD Magic Packet  
  41.  *  format, with an optional password appended.  
  42.  *  
  43.  *  This software may be used and distributed according to the terms  
  44.  *  of the GNU Public License, incorporated herein by reference.  
  45.  *  Contact the author for use under other terms.  
  46.  *  
  47.  *  This source file was originally part of the network tricks package, and  
  48.  *  is now distributed to support the Scyld Beowulf system.  
  49.  *  Copyright 1999-2003 Donald Becker and Scyld Computing Corporation.  
  50.  *  
  51.  *  The author may be reached as becker@scyld, or C/O  
  52.  *   Scyld Computing Corporation  
  53.  *   914 Bay Ridge Road, Suite 220  
  54.  *   Annapolis MD 21403  
  55.  *  
  56.  *   Notes:  
  57.  *   On some systems dropping root capability allows the process to be  
  58.  *   dumped, traced or debugged.  
  59.  *   If someone traces this program, they get control of a raw socket.  
  60.  *   Linux handles this safely, but beware when porting this program.  
  61.  *  
  62.  *   An alternative to needing 'root' is using a UDP broadcast socket, however  
  63.  *   doing so only works with adapters configured for unicast+broadcast Rx  
  64.  *   filter.  That configuration consumes more power.  
  65. */  

 

这个文件的路径在x:\tomato\release\src\router\busybox\networking\ether-wake.c

根据文件看出我们要找的可执行文件名是ether-wake要传的参数是要唤醒机器的mac地址。在系统里执行了一下果然有此文件并执行成功了。

解决了什么问题?
想开机时再开机,随时随地可以控制远程电脑,不会24小时一直开机却什么也不做,也不会因为远程电脑关闭状态很多事做不了了。节能从一点一滴做起。

我的MODT

http://blog.linuxphp.org/?action=show&id=126

Tags: 远程唤醒

上一篇: Tomato固件版本   下一篇: 怎样测家电的耗电功率?

相关文章

你问我答

  1. #1 头像 raychou 2010-04-13 00:52:17
    可以尝试用atom 功耗超低 一天一度电左右
  2. #2 头像 keminar 2010-04-23 18:34:52
    引用 raychou 说过的话:
    可以尝试用atom 功耗超低 一天一度电左右

    最后选了笔记本cpu是因为性能要比atom好.不过atom现在越来越强了,以后会更多人选择.

提交疑问

请先登录 QQ微博登录

回顶部