簡介
本檔案介紹使用Catalyst第3層交換器在VLAN中支援區域網路喚醒(WOL)的組態範例。
必要條件
需求
思科建議您在嘗試此設定之前瞭解以下主題:
採用元件
本文中的資訊係根據以下軟體和硬體版本:
-
運行Cisco IOS®系統軟體版本12.2(25r)SEC的Catalyst 3750系列交換機
-
運行Cisco IOS系統軟體版本12.1(19)EA1a的Catalyst 2950系列交換機
-
運行Microsoft Windows 2000作業系統的電腦
-
SolarWinds提供的免費Wake-On-LAN實用程式。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
慣例
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
背景資訊
LAN喚醒
LAN喚醒(Wake-On-LAN,簡稱WOL)是硬體和軟體技術的組合,用於喚醒睡眠系統。WOL會將特殊編碼的網路封包(稱為魔術封包)傳送到已配備並啟用以回應這些封包的系統。即使使用者關閉了系統電源,管理員也可以使用此附加功能對系統進行維護。WOL功能允許管理員遠端開啟所有休眠電腦的電源,以便它們可以接收更新。WOL的原理是,當PC關閉時,NIC仍然接收電源,並且持續偵聽網路上的幻包到達。此幻方封包可以透過各種無連線通訊協定(UDP、IPX)傳送,但UDP是最為常用的通訊協定。
如果從遠端網路傳送WOL資料包,必須將路由器配置為允許定向廣播。必須這樣做,原因有二:
警告 — 定向廣播
IP定向廣播可用於常見和流行的smurf拒絕服務攻擊,也可用於相關攻擊。
IP定向廣播是傳送到傳送電腦未直接連線的子網的廣播地址的資料包。定向廣播作為單播資料包通過網路路由,直到到達目標子網,在該子網中它被轉換為鏈路層廣播。由於IP編址體系結構的性質,只有鏈中最後一台路由器(直接連線到目標子網的路由器)才能最終識別定向廣播。定向廣播有時用於合法目的,但在金融服務行業之外並不常見。
在smurf攻擊中,攻擊者將ICMP回應請求從偽造的源地址傳送到定向廣播地址。這會導致目標子網上的所有主機向偽造的源主機傳送應答。通過傳送此類請求的連續流,攻擊者可以建立更大的回覆流。這可能會完全淹沒地址被篡改的主機。
如果思科介面配置有 no ip directed-broadcast
命令,則在該介面上分解為鏈路層廣播的定向廣播將被丟棄。這意味著 no ip directed-broadcast
必須在連線到目標子網的每台路由器的每個介面上配置命令。僅配置防火牆路由器是不夠的。其 no ip directed-broadcast
命令是Cisco IOS軟體版本12.0及更高版本的預設命令。在早期版本中,該命令必須應用到每個未知的LAN介面,以轉發合法定向廣播。
設定
本節提供用於設定本文件中所述功能的資訊。
注意:使用命令查詢工具可獲取本節中使用的命令的詳細資訊。只有註冊的思科使用者才能訪問內部思科工具和資訊。
網路圖表
此文件使用以下網路設定:
網路圖表
以下是此網路設定的詳細資訊:
-
PC 1、2和3是需要喚醒的客戶端PC。
-
PC 4是WOL伺服器和DHCP伺服器。
-
PC 4配置了靜態IP地址172.16.3.2/24。
-
客戶端PC配置為從DHCP伺服器獲取IP地址。
-
DHCP伺服器(PC 4)為連線到VLAN 2、3和4的客戶端配置了三個IP範圍。
-
SW-1和SW-2(Catalyst 2950)用作第2層交換機,L3(Catalyst 3750)用作第3層交換機。
-
PC 1和4連線到同一個VLAN(VLAN 3)中。
-
PC 2和PC 3分別連線在VLAN 2和VLAN 4中。
交換機配置
本檔案會使用下列交換器組態:
L3 |
Switch>en
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname L3
L3(config)#ip routing
L3(config)#vtp mode server
Device mode already VTP SERVER.
L3(config)#vtp domain cisco
Changing VTP domain name from NULL to cisco
L3(config)#vlan 2
L3(config-vlan)#vlan 3
L3(config-vlan)#vlan 4
L3(config)#interface gigabitEthernet 2/0/1
L3(config-if)#switchport trunk encapsulation dot1q
L3(config-if)#switchport mode trunk
L3(config-if)#interface gigabitEthernet 2/0/2
L3(config-if)#switchport trunk encapsulation dot1q
L3(config-if)#switchport mode trunk
L3(config-if)#exit
L3(config)#access-list 101 permit udp host 172.16.3.2 any eq 7
!--- This accepts directed broadcasts only from PC 4.
L3(config)#ip forward-protocol udp 7
!--- Specifies the protocol and port to be forwarded. !--- Capture the WOL packet with any network sniffer to determine the UDP port !--- to use in this command. The port number varies with the WOL utility used.
L3(config-if)#interface vlan 2
L3(config-if)#ip address 172.16.2.1 255.255.255.0
L3(config-if)#ip helper-address 172.16.3.2
!--- Enables BOOTP broadcast forwarding to the DHCP server.
L3(config-if)#ip directed-broadcast 101
!--- Enables the translation of a directed broadcast to physical broadcasts.
L3(config-if)#interface vlan 3
L3(config-if)#ip address 172.16.3.1 255.255.255.0
L3(config-if)#ip helper-address 172.16.2.255
L3(config-if)#ip helper-address 172.16.4.255
!-- Enables forwarding of WoL packets to clients. !-- Works in conjunction with the ip forward-protocol command.
L3(config-if)#interface vlan 4
L3(config-if)#ip address 172.16.4.1 255.255.255.0
L3(config-if)#ip helper-address 172.16.3.2
!--- Enables BOOTP broadcast forwarding to the DHCP server.
L3(config-if)#ip directed-broadcast 101
!--- Enables the translation of a directed broadcast to physical broadcasts.
L3(config)#^Z
L3#wr
Building configuration...
[OK]
L3# |
SW-1 |
Switch>en
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW-1
SW-1(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW-1(config)#vtp domain cisco
Changing VTP domain name from NULL to cisco
SW-1(config)#interface fastEthernet 0/1
SW-1(config-if)#spanning-tree portfast
%Warning: portfast must only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/1 but can only
have effect when the interface is in a non-trunking mode.
SW-1(config-if)#switchport mode access
SW-1(config-if)#switchport access vlan 4
SW-1(config-if)#interface fastEthernet 0/2
SW-1(config-if)#spanning-tree portfast
%Warning: portfast must only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/2 but can only
have effect when the interface is in a non-trunking mode.
SW-1(config-if)#switchport mode access
SW-1(config-if)#switchport access vlan 3
SW-1(config-if)#interface gigabitethernet 0/1
SW-1(config-if)#switchport mode trunk
SW-1(config-if)#^Z
SW-1#wr
Building configuration...
[OK]
SW-1# |
SW-2 |
Switch>en
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW-2
SW-2(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW-2(config)#vtp domain cisco
Changing VTP domain name from NULL to cisco
SW-2(config)#interface fastEthernet 0/1
SW-2(config-if)#spanning-tree portfast
%Warning: portfast must only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/1 but can only
have effect when the interface is in a non-trunking mode.
SW-2(config-if)#switchport mode access
SW-2(config-if)#switchport access vlan 3
SW-2(config-if)#interface fastEthernet 0/2
SW-2(config-if)#spanning-tree portfast
%Warning: portfast must only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/2 but can only
have effect when the interface is in a non-trunking mode.
SW-2(config-if)#switchport mode access
SW-2(config-if)#switchport access vlan 2
SW-2(config)#interface gigabitethernet 0/1
SW-2(config-if)#switchport mode trunk
SW-2(config-if)#^Z
SW-2#wr
Building configuration...
[OK]
SW-2# |
客戶端PC配置
目前大多數主機板都擁有內建的NIC並支援WOL功能。某些電腦預設禁用WOL。您必須進入基本輸入輸出系統(BIOS)選項才能啟用WOL。以下是在客戶端PC上啟用WOL的過程:
-
在電腦加電自檢(POST)過程中進入BIOS設定螢幕。
註:通常按下F10或Delete鍵以輸入BIOS設定。
-
在BIOS螢幕中,依次導航至Advanced 設定和Device Options。
-
在此螢幕中,查詢與LAN喚醒相關的設定並啟用它。
-
儲存並退出BIOS設定。
註:BIOS中啟用WOL的確切程式和選項因電腦製造商的不同而不同。有關BIOS設定的詳細資訊,請參閱每台電腦附帶的主機板手冊。
-
檢查網絡卡的進階屬性,以確保已啟用WOL功能。
-
選擇Start > Settings > Network and Dial-up Connections,然後按一下右鍵您的Local Area Connection。
-
按一下「Properties」,然後選擇「Configure」。
-
導覽至Advanced 索引標籤。將Wake Up Capabilities 屬性設定為Both ,將WOL Speed 設定為Auto。
喚醒功能
d.按一下Power Management頁籤,並選中狀態為允許此裝置使電腦從待機狀態的框。
使電腦脫離待機
注意:在Microsoft Windows XP電腦中,還有一個選項:僅允許管理站使電腦脫離待機狀態。只有收到WOL幻方資料包時,最後一個選項才會開啟電腦。如果未選中此選項,則傳送到網路介面卡的任何流量都會開啟PC。
完成以下步驟,客戶端便可以從DHCP伺服器獲取IP地址:
-
選擇Start > Settings > Network and Dial-up Connections,然後按一下右鍵Local Area Connection並選擇Properties。
-
在General 索引標籤下,按一下Internet Protocol(TCP/IP),然後按一下Properties。
-
選擇Obtain an IP address automatically。
自動獲取IP地址
伺服器PC配置
完成以下步驟即可設定WOL伺服器:
-
下載並安裝LAN喚醒實用程式。
-
使用靜態IP地址172.16.3.2/24配置PC。
-
將電腦配置為DHCP伺服器。
-
使用以下詳細資訊嘗試三個作用域:
範圍 |
IP範圍 |
IP排除範圍 |
VLAN 2 |
172.16.2.1 - 172.16.2.254掩碼 — 255.255.255.0 |
172.16.2.1 |
VLAN 3 |
172.16.3.1 - 172.16.3.254掩碼 — 255.255.255.0 |
172.16.3.1和172.16.3.2 |
VLAN 4 |
172.16.4.1 - 172.16.4.254掩碼 — 255.255.255.0 |
172.16.4.1 |
有關DHCP伺服器配置的詳細資訊,請參閱如何在Windows Server 2003的工作組中安裝和配置DHCP伺服器。
驗證
使用本節內容,確認您的組態是否正常運作。
請完成以下步驟:
-
開啟PC的電源,並將它們連線到相應的交換機,如網路圖所示。
-
登入到每台PC並記下MAC地址和IP地址。
註:開啟命令提示符並輸入ipconfig /all命令以確定MAC地址和IP地址。
-
使用Ping檢查PC之間的連通性。
-
驗證連線成功後,關閉所有客戶端PC(PC 1、PC 2和PC 3)。
-
在伺服器PC(PC 4)上啟動WOL實用程式。
-
輸入要「喚醒」的PC的MAC地址和IP地址,如下所示:
PC的IP地址
注意:IP地址可以是客戶端PC所連線到的該VLAN子網範圍內的任何地址(甚至是子網廣播)。僅客戶端PC的MAC地址需要匹配。
-
按一下喚醒PC圖示,向目標PC傳送一系列魔術資料包,嘗試開啟裝置的電源。
到目標PC的魔術資料包
-
當遠端裝置收到喚醒消息並開啟其自身電源時,將顯示以下消息:
喚醒消息和開啟電源
客戶端PC現在已通電。
疑難排解
目前尚無適用於此組態的具體疑難排解資訊。
相關資訊