Remote boot under linux system

  
 

First, when do I need to boot remotely?

If our servers are not deployed locally (in fact, this is usually the case, we will host the server to the IDC room),

and the server is more than one in the machine room, one of them When the station is shut down, we can remotely connect to a server that is not powered off,

and then boot remotely.

Second, the software required for remote booting

It needs Wakelan, the software,

Where do you get it?

Its official website is: http://sourceforge.net/projects/wake-on-lan/

If you use the rpm package you can download it from here: http://dag.wieers .com/rpm/packages/wol/

  If you use fedora, you can install it with the yum command:

yum install wol

Third, how to remotely Boot?

Don't rush to shut down your Linux server. First of all, do you want to determine if it supports remote boot?

Step 1: Log in to the target server and use the ethtool command to print out the information of the network card

[root@localhost lhd]# ethtool eth0

Settings for eth0:< Br>

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: d

Current message level: 0x00000007 (7)

Link detected: yes

As you can see, ethtool lists all the information about the network card. We only care about these two items:

Supports Wake-on: pumbg

Wake-on: d

If wake-on The value of d is d, which means that the disable on lan

value is g, which means that wake on lan

is enabled because this machine disables wake on lan, so enable it with the following command: Br>

[root@localhost lhd]# ethtool -s eth0 wol g

If you use the ethtool command to view it, you will find:

Wake-on: g

OK, the target machine's network card already supports remote booting. Below we get its local MAC address:

[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

Put HWaddr 00:03:0D:1D:1F :97 This one can be recorded

Now you can try to shut down the target machine

Step 2: Power on

Now we need to log in to the machine where the wake on lan software is installed and execute the boot command on it:

wol 00:03:0D:1D:1F:97

You will find later that the target machine is powered on and can log in.

IV, learn more:

1, the -s parameter of ethtool is to modify the settings of the specified Ethernet device

2, the value of wol defaults to d, meaning disable

The modified value is g, The meaning is Wake on MagicPacket(tm)

It also has several values, namely:

p Wake on phy activity

u Wake on unicast messages

m Wake on multicast messages

b Wake on broadcast messages

a Wake on ARP

If you are interested, you can check out man ethtool

3, when the machine restarts, eth0 settings will return to Wake-on: d state,

How to solve this problem?

Two methods: the first one, also our inertia thinking;

Attach the /sbin/ethtool -s eth0 wol g command to the /etc/rc.local file. ,

will be executed automatically after the next boot

Second: Edit /etc/sysconfig/network-scripts/ifcfg-eth0

(eth0 NIC configuration file ), add the previous line:

ETHTOOL_OPTS=”wol g”

4, the limitation of network wake-up:

It can only be applied in the LAN, but not through The internet is running, why?

Because the machine is turned off, it is completely waking up the machine by the network card. At this time, the machine is turned off, there is no operating system
run,

can not talk about supporting tcp The /ip protocol, of course, cannot be run over the Internet.

That is to say: if we only have one machine in a LAN, we can't use this feature.

We must Can log in to a machine on the LAN, run wake on lan on this machine to wake up the target machine

The prerequisite is that the target machine and the machine we are logged in are on the same LAN

5, there is one more point: the target machine that is remotely booted must be plugged in, and the machine that is not plugged in can also boot up only in the movie.

The following is a brief introduction to the usage of wakeonlan under Linux: Br>

Suppose the remote computer to wake up IP: 12.34.56.78, Mac address: 01:02:03:04:05:06

$ wakeonlan -i 12.34.56.78 01:02:03: 04:05:06

Copyright © Windows knowledge All Rights Reserved