若是咱们的服务器没有部署在本地(一般都会把服务器托管到IDC机房),并且服务器在机房中不止一台,其中一台被关闭时,则咱们能够远程链接一台没有关机的服务器上,而后进行远程开机。linux
用yum命令安装远程开机须要的软件:yum install wol服务器
如何进行远程开机?ide
第一步:首先要肯定你的linux服务器是否支持远程开机?登陆到目标服务器,用ethtool这个命令打印出网卡的信息部署
[root@localhost lhd]# ethtool eth0it
Settings for eth0:io
Supported ports: [ TP MII ]class
Supported link modes: 10baseT/Half 10baseT/Full登录
100baseT/Half 100baseT/Fullsed
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: d
Current message level: 0x00000007 (7)
Link detected: yes
能够看到,ethtool把网卡的信息所有列出,咱们只关心其中的这两项:
Supports Wake-on: pumbg
Wake-on: d
若是 wake-on 一项值为 d,表示禁用wake on lan
值为 g,表示启用 wake on lan
由于此机器禁用了 wake on lan,因此用下面的命令来启用它:
[root@localhost lhd]# ethtool -s eth0 wol g
再用 ethtool命令进行查看,会发现:
Wake-on: g
OK,目标机器的网卡已经支持了远程开机,下面咱们获得它的本地MAC地址:
[root@localhost lhd]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:03:0D:1D:1F:97
inet addr:192.168.6.101 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:34470 errors:0 dropped:0 overruns:0 frame:0
TX packets:35377 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:31559763 (30.0 MiB) TX bytes:5340032 (5.0 MiB)
Interrupt:5 Base address:0x2c00
把HWaddr 00:03:0D:1D:1F:97这一项记录下来便可,如今你能够试着把目标机器关闭。
第二步:开机
如今咱们须要登陆到已安装了wakeonlan软件的机器上,在上面执行开机命令:
wol 00:03:0D:1D:1F:97
稍后就会发现,目标机器已开机能够登陆了。