2011年(51)
分类:
2011-03-03 15:35:04
原文地址:Linux操作系统下实现远程开机 作者:yuansy
实现远程开机的条件,要满足以下两条:首先,这个被远程开机的机器必需是在局域网内,并且你知道这台机器的MAC地址;其次,你的网卡支持网络唤醒功能,当然,现在大部分网卡都是支持网络唤醒的功能。检查你的网卡是否支持网络唤醒功能,只要在被远程开机的机器上执行 ethtool 命令,查看该机器网卡是否支持网络唤醒功能。
# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g [ 提示: g 表示已启动. d 表示禁用 ]
Current message level: 0×00000001 (1)
Link detected: yes
提示:以上命令,需要拥有root权限,否则会有以下错误: $ /sbin/ethtool eth0
Settings for eth0:
Cannot get device settings: Operation not permitted
Cannot get wake-on-lan settings: Operation not permitted
Current message level: 0×000000ff (255)
Cannot get link status: Operation not permitted
如果网络唤醒功能被禁用,则需要用下面的命令启动网络唤醒功能: # ethtool -s eth0 wol g
安装网络唤醒软件: # apt-get install wakeonlan
获取远程机器网卡的物理地址: # ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:k5:64:A9:68 [ Mac地址 ]
inet addr:192.168.6.56 Bcast:192.168.6.255 Mask:255.255.255.0
inet6 addr: fe80::216:17ff:fe6b:289/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3179855 errors:0 dropped:0 overruns:0 frame:0
TX packets:2170162 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3832534893 (3.5 GB) TX bytes:390304845 (372.2 MB)
Interrupt:17
通过以下命令,实现远程开机: # wakeonlan 00:16:k5:64:A9:68