linux 遠程開機
1、主機bios 設置支持lan啓動
2、查看機器是否支持服務器遠程喚醒
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: 32
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000007 (7)
Link detected: yes
Supports Wake-on: pumbg //是否支持wol
Wake-on: g //是否開啓wol以及是何種模式(d 表示禁用,g表示響應magic packet的喚醒)
如果爲d將它改爲g:
ethtool -s eth0 wol g
ether-wake 實行遠程自動開機
下載 ether-wake.c 這個檔案:
gcc -O -Wall -o ether-wake ether-wake.c
此時你的家目錄下應該會有一個名爲 ehter-wake 的檔案,假設客戶端主機的 MAC 爲 11:22:33:44:55:66 好了, 那麼你想要讓這部主機被喚醒,就這樣做吧:
./ether-wake 11:22:33:44:55:66
./ether-wake -u //查看更多用法
一般系統都默認帶有ether-wake 這個東西
只需要直接運行它就可以了
使用ether-wake -p IP地址 就可以喚醒對應ip的機器了