Wake On Lan 远程唤醒(转)

http://www.xiaozhou.net/cooldog/article.asp?id=155

 

 远程唤醒,是现在很多网卡都支持的功能。而远程唤醒的实现,主要是向目标主机发送特殊格式的数据包,是AMD公司制作的Magic Packedt这套软件以生成网络唤醒所需要的特殊数据包,俗称魔术包(Magic Packet)。Magic Packet格式虽然只是AMD公司开发推广的技术,并非世界公认的标准,但是仍然受到很多网卡制造商的支持,因此 许多具有网络唤醒功能的网卡都能与之兼容。
  要实现远程唤醒,还需要硬件的设置:
  主板和网卡必须都支持远程唤醒功能。一般目前的主板都支持这个功能,支持的主板上通常都有一个专门的3芯插座,以便在关机时为网卡供电。但
并非所有的网卡都支持该功能(特别是一些价格较便宜的低档网卡),要判断网卡是否支持远程唤醒功能的方法很简单,支持远程唤醒的网卡上都有一个3针的WOL接口和一条3芯的远程唤醒电缆,通过判断网卡是否带有WOL接口即可(有些较新的网卡可能没有WOL接口也能支持远程唤醒。这是因为现在流行的主板支持PCI2.2标准,而PCI 2.2标准不需要通过专门的WOL接口为网卡供电,允许主板直接通过PCI插槽向网卡提供Standby电源)。

1.硬件连接
    网卡安装完毕后将远程唤醒电缆的一端插入到网卡的WOL接口上,另外一端与主板的3针WOL远程唤醒接口相连(该接口旁通常标有WOL_CON的字样,当然如果主板和网卡都支持PCI2.2标准则无须做这一步)。

2.CMOS设置
    打开CMOS远程唤醒功能很简单,只要将CMOS设置中的“Power Management Setup”的“Wake Up On LAN”项设置为“Enable”即可。

软件的实现方面,其实就是通过socket向目标的机器发送魔术包了,魔术包的格式,包含有连续6个字节的“FF”和连续重复16次的MAC地址。程序中我们可以采用UDP方式广播发送,不需要端口号,只要知道对方机器的MAC地址即可 :)

http://www.gammadyne.com/cmdline.htm#wol

 

WOL.EXE broadcasts a "Wake On LAN" packet to the Network Interface Card (NIC) with the specified MAC address.  The MAC address may optionally be followed by the IP address of the network adapter that should broadcast the packet.

  • The motherboard must support Wake On LAN.
  • The NIC must support Wake On LAN.
  • There must be a wire connecting the motherboard's WOL port to the NIC's WOL port.
  • The Wake On LAN feature must be enabled in the motherboard's BIOS.
  • The "Good Connection" light on the back of the NIC must be lit when the machine is off.
  • Port 12287 (0x2FFF) must be open.
  • Packets cannot be broadcast across the Internet.  That's why they call it Wake On Lan, not Wake On Internet.
  • To find your MAC address, run the MSINFO32.EXE tool that is part of Windows.  Navigate to Components > Network > Adapter.

http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/

 

http://en.wikipedia.org/wiki/Wake-on-LAN

 

Magic Packet

The Magic Packet is a broadcast frame containing anywhere within its payload 6 bytes of ones (resulting in hexadecimal FF FF FF FF FF FF) followed by sixteen repetitions of the target computer's MAC address.

Since the Magic Packet is only scanned for the string above, and not actually parsed by a full protocol stack, it may be sent as a broadcast packet of any network- and transport-layer protocol. It is typically sent as a UDP datagram to port 0, 7 or 9, or, in former times, as an IPX packet.


 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值