Wake on Lan with Linux and Windows

Linux系统与Windows系统下的网络唤醒

Motivation

问题起因

I have 3 computers. My laptop a Thinkpad X30, another Thinkpad which acts as server and a desktop computer. I have all my main data on my server and use the files on my laptop and desktop by sshfs and NFS.

我有3台计算机。我的笔记本电脑是Thinkpad X30,另一个Thinkpad充当服务器还有台桌面用电脑。我的最主要的数据存储在服务器中,我使用笔记本电脑或桌面用电脑通过sshfs和NFS来访问它们。

The only files I don’t store on my server is media files, such as movies and music – these are stored on my desktop. This was the problem – if I was out I couldn’t access my files since my desktop was turned off when I am not home. I need something to turn on my desktop when I wasn’t home.

媒体文件是我唯一不存储在服务器的文件,诸如电影和音乐——这些都储存在桌面用电脑中。问题是——当我外出时,桌面用电脑处于关闭状态,我是我无法访问所需要的文件的。当我不在家时,我希望能够有某种方式可以远程启动我的桌面用电脑。

Wake on Lan

网络唤醒

Wake on Lan (WOL) is a technology to turn on a computer by sending it a specific network package. When a WOL-enabled computer is turned off the network port will stay active and listen for a certain packages and in if it receives such a package it will boot the computer.

网络唤醒(WOL)是一种技术,通过向一台计算机发送一个特定的网络包来启动它。当一个设置为允许网络唤醒的计算机处于关闭状态时其网络端口将保持活跃并里监听了某些特定的包,如果收到则会启动电脑。

Two things are needed:

两个必需条件:

Enable WOL on my Desktop.

设置计算机为允许网络唤醒。

Installing a program to send the magical network package on my server.

在服务器上安装一个可以用于发送魔术包(使电脑自动开机的数据包)的软件。

BIOS

BIOS设置

Somewhere in the BIOS there will hopefully be some setting to enable WOL. I didn’t find it in the BIOS of my ASUS PW5 DH motherboard, but it works fine. A good indicator is to check whether the lights around the network cable is turned on or not on the back of the computer when the computer has been shutdown.

我希望可以在BIOS中有某些关于WOL的设置。只是在我的华硕PW5 DH主板BIOS中没有找到,但是它确实是运行着的。一个很好的验证方式,就是当你的计算机关机后,且保持网线插入了网卡接口,且在关机前机器可以顺利上网。如果此时网卡上的指示灯亮着表示支持WOL了。

Enabling WOL in Windows

在Windows系统中设置WOL

It always takes more screenshots to explain anything in Windows, but there is not really any way around it. In Windows I need to go to the network setting and choose my network adapter. After selecting “configure” as in the screenshot:

很多时候如果有截图会更好的说明问题,只是有时候却是无法抓取屏幕的。在Windows系统中打开网络设置,然后再弹出属性窗口。在选取“configure”选项后的截图如下:

译者注:所有的设定没有标准的固定的模式,如果你的计算机无法照做,并不说明你的机器无法设置wol,这里只是提供了一种实现而已。译者本人所管理的计算机中有的可以在主板BIOS上设置实现,而有的用的是此种方式。或许还有其他。

I selected the fan called “advanced” where I found to settings I need to turn on:

我选取了“advanced(高级)”选项卡,在这里找到了我需要的选项:

Wake from shutdown(从关机状态下唤醒):

Wake up capabilities(唤醒功能):

That’s it.

很好。

Enabling WOL in Linux

使Linux实现WOL

To enable WOL from Linux the option has to be set before shutting Linux down. First I see what is supported by network driver

WOL需要在未关闭Linux系统时进行设置。首先查看网络驱动支持的内容是什么

root@bohr:/home/tjansson# ethtool eth1

Settings for eth1:

...

Supports Wake-on: pg

Wake-on: d

...

译者机器上显示内容为:

Supports Wake-on: pumbg

Wake-on: g

So it supports

pg which means (from man ethtool):

pg选项的含义(源自ethtool命令的man手册):

p  Wake on phy activity

g  Wake on MagicPacket(tm)

在译者的系统中还有三项设置:

u   Wake on unicast messages

m   Wake on multicast messages

b   Wake on broadcast messages

The

g option is the interesting part. So I set the option on the my network driver:

这个g参数是一个有趣的部分。所有我在网络驱动上设置了这个选项。

root@bohr:~# ethtool -s eth1 wol g

but I don’t want to do this every time I shut down the computer, so I will make a script in

/etc/init.d/ named wol.sh containg the lines:

我并不想在每次关机时都重复此设置,所以我将写一个名为wol.sh的脚本放入到/etc/init.d/文件夹中,其内容如下:

#!/bin/bash

ethtool -s eth1 wol g

and make it executable:

并且使之可执行:

root@bohr:/etc/init.d# chmod +x wol.sh

and finally tell Linux to execute the script on every runlevel, which I quite a overkill, but it doesn’t really mater – it works:

最后通知所有运行级别均自动运行此脚本,我的特别操作并非废话-操作如下:

root@bohr:/etc/init.d# update-rc.d -f wol.sh defaults

Now WOL is enabled under Linux as well.

现在WOL在Linux被允许了。

Sending the magical package from Linux

从Linux系统是发送魔术包

The last thing I need to do is to wake the computer after it has been shut down. I do this from my Linux server on the same local network. The only information needed is the hardware adress of network interface on the desktop machine. I can find this by running ifconfig under Linux or some networkgui on Windows on the desktop machine:

最后我要做的是唤醒已经关闭的计算机。我是在服务器上做这件事情的,它与被唤醒机器处于同一局域网中。唯一所需的信息就是被唤醒机器的网卡硬件地址。可以在Linux执行ifconfig命令或在Windows系统中通过网络设置的图形界面进行查看。(译者注:在Windows中运行ipconfig命令查看)

tjansson@bohr:~$ /sbin/ifconfig

...

eth1      Link encap:Ethernet  HWaddr 00:18:F3:CD:78:A0

...

Now I can start the desktop computer by running wakeonlan from my server:

现在,可以通过在服务器上运行“wakeonlan”命令来唤醒目标机器。

root@nobel:/home/tjansson# wakeonlan 00:18:F3:CD:78:A0

Sending magic packet to 255.255.255.255:9 with 00:18:F3:CD:78:A0

Waking the computer from other OS’s

在其它类型的系统时实现计算机唤醒

In the bottom of the

wikipediaentry on WOL there is a long list of other programs to send the magical network package but I haven’t tried any of these my self.

wikipediaentry on WOL 的底部,有很长的可以发送魔术包的程序列表,只是我没有进行相关的测试。

[翻译完,于2012年04月24日 星期二 09时26分25秒 ]

linux+唤醒windows,Linux系统与Windows系统下的网络唤醒相关推荐

  1. linux 等待进程,Linux 进程等待队列

    Linux内核的等待队列是以双循环链表为基础数据结构,与进程调度机制紧密结合,能够用于实现核心的异步事件通知机制. 在这个链表中,有两种数据结构:等待队列头(wait_queue_head_t)和等待 ...

  2. linux 开机速度 固态,Windows/Linux系统开机OCZ胜出

    SSD评测报告 以下是相关测试项目结果: Windows系统开机效率 作业系统的开机过程,对於硬盘.SSD来说,是相当重要的测试,因为复杂的开机文件读入,是很好的综合性读入评量,也反应最终用户操作计算 ...

  3. linux和windows双系统引导,windows和linux双系统引导问题

    1  将Grub装配到ntloader内 Grub 做出了牺牲,成为了ntloader的附庸,由ntloader对Grub加以引导,只因为Grub没有写进MBR! 通过把hdaX分区内的Grub引导扇 ...

  4. Windows不用虚拟机或双系统,轻松实现linux shell环境:gitforwindows

    windows缺少shell命令支持 用过Linux服务器分析数据的小伙伴,一定对Linux强大Shell命令所折服,经常会感觉windows缺少这些命令而感觉不方便. 还有想学习Linux Shel ...

  5. python使用psutil获取系统(Windows Linux)所有运行进程信息实战:CPU时间、内存使用量、内存占用率、PID、名称、创建时间等;

    python使用psutil获取系统(Windows Linux)所有运行进程信息实战:CPU时间.内存使用量.内存占用率.PID.名称.创建时间等: psutil模块可以跨平台使用,支持Linux/ ...

  6. linux系统启动盘怎么制作工具,windows系统制作linux启动盘工具介绍

    Linux发行版排行榜: http://iso.linuxquestions.org/ http://distrowatch.com/dwres.php?resource=major&lang ...

  7. 创建linux启动盘,linux系统中如何创建windows启动盘的详细介绍

    平时工作中用到linux的操作命令较多,因此为了方便,就给电脑装了双系统,一般工作的时候,都选择进入linux系统.但是今天有件工作之外的事情需要解决下:创建一个windows启动盘.如果按照往常来说 ...

  8. linux语言windows 语言,作业系统一般用什么编码语言程式设计?如:Windows,Linux,是组合语言吗?还是自己开发的程式码?...

    作业系统一般用什么编码语言程式设计?如:Windows,Linux,是组合语言吗?还是自己开发的程式码?以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内 ...

  9. qt creator:一款能够在windows/linux/mac系统上开发c程序的IDE

    qt creator:一款能够在windows/linux/mac系统上开发c程序的IDE 下面是下载地址:http://download.qt.io/official_releases/qtcrea ...

最新文章

  1. python实现单例_Python 实现单例模式
  2. LeetCode 61. 旋转链表
  3. pctfree pctused详解
  4. 结构体:求最高分和最低分
  5. 奇怪的问题,疑惑?不用的 User agent 居然gzip不一样?
  6. android获取未知字符串,android – 未知的URL内容:// downloads / my_dow...
  7. mysql建立修改表存储过程_MySQL数据库创建、表的创建、存储过程、触发器
  8. 【模型压缩】通道剪枝《Pruning Filters For Efficient ConvNets》论文翻译
  9. HDU各种考试题题解
  10. CSDN账号注销问题
  11. apk注册机加密_apk软件添加注册机方法 安卓apk添加授权教程
  12. 一键清理电脑垃圾小程序
  13. 码率和帧率的含义及区别
  14. 类型转化异常 Java Object转 int
  15. Postman使用详解
  16. 挖掘有多深,舞弊就有多大,孙德顺敛财10亿,看图计算如何穿透与识别多层嵌套影子公司!...
  17. 通过搜狐微博API,发带图片的微博
  18. [ 大道至简系列 ] 三分钟理解-1NF,2NF,3NF
  19. 【数据结构】链表相关OJ题 (万字详解)
  20. Codeforces Round #800 (Div. 2) E. Keshi in Search of AmShZ

热门文章

  1. SVD奇异值分解(标题重复率过高)
  2. 平淡生活:生活的五色拼图--轻松和沉重
  3. ubuntu u盘只读 怎么修复
  4. Hyperchain超块链创始人史兴国:“数藏云” 助力实体数字化转型
  5. (一) 模式识别入门
  6. try catch finally 用法 解释
  7. uva 10107 What is the Median?
  8. HttpServletResponse实例化
  9. java大文件存储加密_Java IO--实现文件的加密解密
  10. 语言模型BERT理解