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.


 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章