本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
本文說明如何疑難排解 Cisco Catalyst 交換器網路中動態主機設定通訊協定 (DHCP) 的幾個常見問題。
本文件沒有特定先決條件。
本文件所述內容不限於特定軟體和硬體版本。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
注意:只有已註冊的思科客戶端才能訪問內部錯誤報告。
DHCP提供了一種機制,使用傳輸控制協定/網際網路協定(TCP/IP)的電腦可透過該機制自動透過網路獲取協定配置引數。DHCP是由網際網路工程任務組(IETF)的動態主機配置工作組(DHC-WG)開發的開放標準。
DHCP基於客戶端-伺服器模式,其中DHCP客戶端(例如台式電腦)與DHCP伺服器聯絡以獲取配置引數。DHCP伺服器通常位於中心位置,由網路管理員管理。由於伺服器由網路管理員運行,因此DHCP客戶端可以可靠、動態地配置適合當前網路體系結構的引數。
大多數企業網路由多個子網組成,這些子網劃分成稱為虛擬LAN (VLAN)的子網,路由器在這些子網之間路由。由於預設情況下路由器不會傳遞廣播,因此每個子網都需要一台DHCP伺服器,除非路由器配置為使用DHCP中繼代理功能轉發DHCP廣播。
以下是DHCP的幾個關鍵概念:
DHCP客戶端最初沒有配置IP地址,因此必須傳送廣播請求以從DHCP伺服器獲取IP地址。
預設情況下,路由器不會轉發廣播。如果DHCP伺服器位於另一個廣播域(第3層(L3)網路)上,則需要滿足客戶端DHCP廣播請求。使用DHCP中繼代理來執行此操作。
Cisco路由器實施DHCP中繼需由介面級的ip helper 命令來執行
場景1:Cisco路由器在DHCP客戶端網路與伺服器網路之間進行路由
如圖所示,介面Ethernet1透過介面Ethernet1將客戶端廣播的DHCPDISCOVER轉發到192.168.2.2。DHCP伺服器透過單播完成請求。本示例中不需要對路由器進行進一步配置。
方案2:帶有L3模組的Cisco Catalyst交換機在DHCP客戶端網路與DHCP伺服器網路之間路由
如圖所示,介面VLAN20透過介面VLAN10將客戶端廣播的DHCPDISCOVER轉發到192.168.2.2。DHCP伺服器透過單播完成請求。本示例中不需要對路由器進行進一步配置。交換器連線埠需要設定為主機連線埠,並啟用跨距樹狀目錄通訊協定(STP) portfast,以及停用中繼和通道。
DHCP最初在請求註解(RFC) 1531 中進行了定義,但該定義已經過時,最新的定義可在RFC 2131 中找到。 DHCP基於RFC 951中定義的引導協定(BootP)。
工作站(主機)使用DHCP獲取初始配置資訊,如IP地址、子網掩碼和啟動時的預設網關。使用DHCP時,您無需手動為每台主機配置IP地址。此外,如果主機移至不同的IP子網,它必須使用與以前所用地址不同的IP地址。DHCP會自動處理這個問題。它允許主機選擇正確IP子網中的IP地址。
RFC 2131:DHCP
RFC 2132:DHCP選項與BootP廠商擴充
RFC 1534:DHCP與BootP之間的互通性
RFC 1542:BootP的說明和延伸
RFC 2241:Novell目錄服務的DHCP選項
RFC 2242:Netware/IP網域名稱與資訊
RFC 2489:定義新DHCP選項的程式
DHCP使用客戶端-伺服器模型,其中一個或多個伺服器(DHCP伺服器)在客戶端啟動時將IP地址和其他可選配置引數分配給客戶端(主機)。伺服器將這些配置引數租給客戶端一段指定的時間。當主機啟動時,主機中的TCP/IP堆疊會傳輸廣播(DHCPDISCOVER)消息,以獲取IP地址和子網掩碼以及其他配置引數。這將啟動DHCP伺服器和主機之間的交換。在此交換過程中,客戶端會經歷以下明確定義的狀態:
正在初始化
選取
請求
繫結
續約
重新繫結
要在這些狀態之間移動,客戶端和伺服器可以交換DHCP消息表中列出的消息型別。
參考 | 訊息 | 說明 |
---|---|---|
0x01 | DHCPDISCOVER | 使用者端會尋找可用的DHCP伺服器。 |
0x02 | DHCPOFFER | 伺服器對客戶端DHCPDISCOVER的響應。 |
0x03 | DHCPREQUEST | 客戶端向伺服器廣播,請求從一台伺服器提供引數,具體如資料包中所定義。 |
0x04 | DHCPDECLINE | 客戶端到伺服器的通訊,表示網路地址已在使用中。 |
0x05 | DHCPACK | 伺服器到客戶端的通訊,帶有配置引數以及承諾的網路地址。 |
0x06 | DHCPNAK | 伺服器到客戶端通訊拒絕配置引數請求。 |
0x07 | DHCPRELEASE | 客戶端到伺服器的通訊,會交出網路地址並取消剩餘租期。 |
0x08 | DHCPINFORM | 客戶端到伺服器的通訊僅要求客戶端已外部配置為地址的本地配置引數。 |
當客戶端首次啟動時,它被稱為處於初始化狀態,並透過使用者資料包協定(UDP)埠67 (BootP伺服器)在其本地物理子網中傳輸DHCPDISCOVER消息。由於客戶端無法知道其所屬的子網,因此DHCPDISCOVER是全子網廣播(目的IP地址為255.255.255.255),源IP地址為0.0.0.0。源IP地址是0.0.0.0,因為客戶端沒有配置的IP地址。如果DHCP伺服器存在於此本地子網上,並且已正確配置並正常運行,則DHCP伺服器會聽到廣播並以DHCPOFFER消息做出響應。如果本地子網中沒有DHCP伺服器,則此本地子網中必須有DHCP/BootP中繼代理,才能將DHCPDISCOVER消息轉發到包含DHCP伺服器的子網。
此中繼代理可以是專用主機(例如,Microsoft Windows Server)或路由器(例如,配置了介面級IP幫助語句的Cisco路由器)。
接收DHCPDISCOVER消息的DHCP伺服器可以在UDP埠68(BootP客戶端)上使用DHCPOFFER消息進行響應。客戶端收到DHCPOFFER並進入Selecting狀態。此DHCPOFFER消息包含客戶端的初始配置資訊。例如,DHCP伺服器使用請求的IP地址填充DHCPOFFER消息的yiaddr欄位。子網掩碼和預設網關分別在選項欄位、子網掩碼和路由器選項中指定。DHCPOFFER消息中的其他常見選項包括IP地址租用時間、續訂時間、域名伺服器和NetBIOS名稱伺服器(WINS)。DHCP伺服器將DHCPOFFER傳送到廣播地址,但將客戶端硬體地址包括在提供的主機地址欄位中,以便客戶端知道它是預期目的地。如果DHCP伺服器不在本地子網上,則DHCP伺服器會在UDP埠67上將DHCPOFFER作為單播資料包傳送回DHCPDISCOVER所來自的DHCP/BootP中繼代理。然後,DHCP/BootP中繼代理在UDP埠68的本地子網上廣播或單播DHCPOFFER,這取決於Bootp客戶端設定的廣播標誌。
在客戶端收到DHCPOFFER後,它會以DHCPREQUEST消息作出響應,並表明它打算接受DHCPOFFER中的引數,然後進入請求狀態。客戶端可以接收多個DHCPOFFER消息,從接收原始DHCPDISCOVER消息的每個DHCP伺服器接收一個。客戶端選擇一個DHCPOFFER並僅響應該DHCP伺服器,並隱式拒絕所有其他DHCPOFFER消息。客戶端使用DHCP伺服器IP地址填充Server Identifier選項欄位後,標識所選伺服器。DHCPREQUEST也是廣播,因此所有傳送DHCPOFFER的DHCP伺服器都可以看到DHCPREQUEST,並且每台伺服器都知道其DHCPOFFER是被接受還是被拒絕。客戶端需要的任何其他配置選項都包含在DHCPREQUEST消息的選項欄位中。即使已為客戶端提供IP地址,它也會傳送源IP地址為0.0.0.0的DHCPREQUEST消息。此時,客戶端尚未收到可以使用IP地址的驗證。
當DHCP伺服器收到DHCPREQUEST後,它會使用DHCPACK消息確認請求,然後完成初始化過程。DHCPACK消息具有DHCP伺服器的源IP地址,並且目標地址再次是廣播,並且包含客戶端在DHCPREQUEST消息中請求的所有引數。當客戶端收到DHCPACK時,它將進入繫結狀態,現在可自由使用IP地址在網路上通訊。同時,DHCP伺服器將租期儲存在其資料庫中,並用客戶端ID或Chaddr以及相關的IP地址唯一地標識租期。客戶端和伺服器都使用識別符號的此組合來引用租用。客戶端識別符號是裝置的MAC地址加上介質型別。
在DHCP客戶端開始使用新地址之前,DHCP客戶端必須計算與租用地址關聯的時間引數,即租用時間(LT)、續訂時間(T1)和重新繫結時間(T2)。典型的預設LT為72小時。如果需要,您可以使用更短的租用時間來節省地址。
如果所選伺服器無法滿足DHCPREQUEST消息,則DHCP伺服器將以DHCPNAK消息作出響應。當客戶端收到DHCPNAK消息或者沒有收到對DHCPREQUEST消息的響應時,客戶端會在進入請求狀態時重新啟動配置過程。客戶端在60秒內至少重新傳輸DHCPREQUEST四次,然後才會重新啟動初始化狀態。
客戶端收到DHCPACK,並且可以選擇對引數執行最終檢查。客戶端在傳送地址解析協定(ARP)請求以獲取DHCPACK中提供的IP地址時執行此過程。如果客戶端在收到對ARP請求的回覆時檢測到該地址已在使用中,則客戶端將向伺服器傳送DHCPDECLINE消息,並在請求狀態下重新啟動配置過程。
如果客戶端透過其他方式獲得網路地址或具有手動配置的IP地址,客戶端工作站可以使用DHCPINFORM請求消息獲取其他本地配置引數,如域名和域名伺服器(DNS)。當DHCP伺服器收到DHCPINFORM消息時,將構建包含適用於沒有新IP地址的客戶端的任何本地配置引數的DHCPACK消息。此DHCPACK單播傳送到客戶端。
當DHCP客戶端向DHCP伺服器傳送DHCPRELEASE消息時,可以選擇放棄其對網路地址的租用。客戶端在DHCPRELEASE消息中使用client identifierfield和網路地址來標識要釋放的租期。如果需要擴展當前DHCP池範圍,請刪除當前的地址池,然後在DHCP池下指定新的IP地址範圍。若要刪除您想放置在DHCP池中的特定IP地址或特定IP地址範圍,請使用ip dhcp excluded-address命令。
注意:如果裝置使用BOOTP,路由器的DHCP繫結中顯示無限長度的租用。
由於IP地址僅從伺服器租用,因此必須不時更新租用。當租用時間的一半已過期(T1=0.5 x LT)時,客戶端會嘗試續訂租期。客戶端進入續訂狀態並向伺服器傳送DHCPREQUEST消息,伺服器保留當前租期。如果伺服器同意更新租期,則伺服器將以DHCPACK消息回覆更新請求。DHCPACK消息包含新的租用和任何新的配置引數,如果在上一個租用期間對伺服器進行任何更改。如果客戶端由於某種原因在保留租用時無法訪問伺服器,則當原始DHCP伺服器在T2時間內未響應續訂請求後,客戶端會嘗試從任何DHCP伺服器續訂地址。T2的預設值為( 7/8 x LT)。這表示T1 < T2< LT。
如果客戶端以前分配了DHCP IP地址並且重新啟動,則客戶端會特別在DHCPREQUEST資料包中請求以前租用的IP地址。此DHCPREQUEST的源IP地址仍為0.0.0.0,目標地址仍為IP廣播地址255.255.255.255。
當客戶端在重新啟動過程中傳送DHCPREQUEST時,它不能填寫伺服器識別符號欄位,而必須填寫請求的IP地址選項欄位。只有RFC相容的客戶端使用請求的地址填充ciaddr欄位,而不是DHCP選項欄位。DHCP伺服器接受其中一種方法。DHCP伺服器的行為取決於許多因素,例如Windows NT DHCP伺服器的情況、所使用的系統版本,以及其他因素,例如超級複製。如果DHCP伺服器確定客戶端仍然可以使用請求的IP地址,則伺服器會保持靜默或為DHCPREQUEST傳送DHCPACK。如果伺服器確定客戶端無法使用所請求的IP地址,它會將DHCPNACK傳送回客戶端。然後,客戶端進入「正在初始化」狀態,並傳送DHCPDISCOVER消息。
注意:DHCP伺服器將IP地址池中的底部IP地址分配給DHCP客戶端。當底部地址的租用到期時,如果請求該地址,則將其分配給另一個客戶端。不能對DHCP地址的分配順序進行任何更改。
DHCP消息的長度可變,由DHCP資料包表中列出的欄位組成。
注意:此資料包是原始BootP資料包的修改版本。
欄位 | 位元組 | 名稱 | 說明 |
---|---|---|---|
op | 1 | 作業代碼 | 將資料包標識為請求或應答:1=BOOTREQUEST,2=BOOTREPLY |
htype | 1 | 硬體型別 | 指定網路硬體位址型別。 |
hlen | 1 | 硬體長度 | 指定硬體地址長度的長度。 |
躍點 | 1 | 躍點 | 客戶端將值設定為零,如果請求透過路由器轉發,該值將遞增。 |
xid | 4 | 交易ID | 使用者端選擇的隨機數。為給定DHCP事務交換的所有DHCP消息都使用ID (xid)。 |
秒 | 2 | 秒 | 指定自DHCP進程啟動以來的秒數。 |
旗標 | 2 | 旗標 | 指示消息是廣播還是單播。 |
ciaddr | 4 | 客戶端IP地址 | 僅當客戶端知道其IP地址時(如Bound、Renew或Rebinding狀態)使用。 |
yiaddr | 4 | 您的IP地址 | 如果客戶端IP地址是0.0.0.0,則DHCP伺服器將提供的客戶端IP地址放在此欄位中。 |
siaddr | 4 | 伺服器IP位址 | 如果客戶端知道DHCP伺服器的IP地址,則此欄位將填入DHCP伺服器地址。否則,在DHCP伺服器的DHCPOFFER和DHCPACK中使用它。 |
giaddr | 4 | 路由器IP地址(GI地址) | 由DHCP/BootP中繼代理填充的網關IP地址。 |
查德爾 | 16 | 客戶端MAC地址 | DHCP客戶端MAC地址。 |
sname | 64 | 伺服器名稱 | 可選伺服器主機名。 |
檔案 | 128 | 開機檔案名稱 | 啟動檔案名稱。 |
選項 | 變數 | 選項引數 | DHCP伺服器可以提供的可選引數。RFC 2132提供所有可能的選項。 |
封包說明 | 源MAC地址 | 目的MAC地址 | 源IP地址 | 目標IP地址 |
---|---|---|---|---|
DHCPDISCOVER | 使用者端 | 廣播 | 0.0.0.0 | 255.255.255.255 |
DHCPOFFER | DHCPS伺服器 | 廣播 | DHCPS伺服器 | 255.255.255.255 |
DHCPREQUEST | 使用者端 | 廣播 | 0.0.0.0 | 255.255.255.255 |
DHCPACK | DHCPS伺服器 | 廣播 | DHCPS伺服器 | 255.255.255.255 |
預設情況下,路由器不會轉發廣播資料包。由於DHCP客戶端消息使用目的IP地址255.255.255.255(所有網路廣播),因此DHCP客戶端無法向另一個子網上的DHCP伺服器傳送請求,除非路由器上配置了DHCP/BootP中繼代理。DHCP/BootP中繼代理代表DHCP客戶端將DHCP請求轉發到DHCP伺服器。DHCP/BootP中繼代理將自己的IP地址附加到進入DHCP伺服器的DHCP幀的源IP地址。這允許DHCP伺服器透過單播響應DHCP/BootP中繼代理。DHCP/BootP Relay Agent還會使用從客戶端接收DHCP消息的介面的IP地址填充Gateway IP address欄位。DHCP伺服器使用網關IP地址欄位確定DHCPDISCOVER、DHCPREQUEST或DHCPINFORM消息的源子網。
配置Cisco路由器以轉發BootP或DHCP請求的過程很簡單。您只需要配置一個指向DHCP/BootP伺服器或伺服器所在網路的子網廣播地址的IP幫助地址。
網路範例:
要將BootP/DHCP請求從客戶端轉發到DHCP伺服器,可使用ip helper-address interface 命令。可以將IP幫助程式地址配置為根據UDP埠號轉發任何UDP廣播。預設情況下,IP幫助地址轉發以下UDP廣播:
簡單式檔案傳輸通訊協定(TFTP)(連線埠69)
DNS(埠53)、時間服務(埠37)
NetBIOS名稱伺服器(連線埠137)
NetBIOS資料包伺服器(連線埠138)
引導協定(DHCP/BootP)客戶端和伺服器資料包(埠67和68)
終端存取控制存取控制系統(TACACS)服務(連線埠49)
IEN-116名稱服務(埠42)
IP幫助地址可以將UDP廣播定向到單播或廣播IP地址。但是,由於可能發生大量廣播泛洪,請勿使用IP幫助地址將UDP廣播從一個子網轉發到另一個子網的廣播地址。還支援單個介面上的多個IP幫助程式地址條目:
version 12.0 service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname router ! ! ! interface Ethernet0 ip address 192.168.2.1 255.255.255.0 no ip directed-broadcast ! interface Ethernet1 ip address 192.168.1.1 255.255.255.0 ip helper-address 192.168.2.2 ip helper-address 192.168.2.3 !--- IP helper-address pointing to DHCP server no ip directed-broadcast ! ! ! line con 0 exec-timeout 0 0 transport input none line aux 0 line vty 0 4 login ! end |
Cisco路由器不支援配置為DHCP中繼代理的DHCP伺服器的負載均衡。Cisco路由器將DHCPDISCOVER消息轉發給該介面提及的所有幫助地址。使用兩台或多台DHCP伺服器為一個子網提供服務,只會增加DHCP流量,因為每對DHCP客戶端和伺服器之間會交換DHCPDISCOVER、DHCPOFFER和DHCPREQUEST / DHCPDRCATE消息。
設定手動繫結的方式有兩種:一種用於Windows主機,另一種用於非Windows主機。有兩個不同的命令可用於配置;一個用於Microsoft DHCP客戶端,另一個用於非Microsoft DHCP客戶端:DHCPclient-identifier(手動繫結- Microsoft DHCP客戶端)和DHCPhardware-address(手動繫結-非Microsoft DHCP客戶端)。採用兩種不同的命令是因為運行Windows的電腦會修改本機的MAC地址,即在地址的起始處加上01。以下是配置示例:
以下是Microsoft DHCP客戶端的配置:
configure terminal ip dhcp pool new_pool host ip_address subnet_mask client-identifier 01XXXXXXXXXXXX
!--- xxxxxx represents 48 bit MAC address prepended with 01
以下是非Microsoft DHCP客戶端的配置:
configure terminal ip dhcp pool new_pool host ip_address subnet_mask hardware-address XXXXXXXXXXXX
!--- xxxxxx represents 48 bit MAC address
預設情況下,DHCP有一個限制,即僅當從配置了主IP地址的介面收到請求時,才會傳送應答資料包。DHCP流量使用廣播地址。路由器介面收到DHCP請求後,會將其轉發到DHCP伺服器(配置IP helper-address時),該伺服器會在介面上配置主IP的源地址,以使DHCP伺服器知道它必須在DHCP應答資料包中使用哪個IP池(用於客戶端)。
路由器無法知道DHCP廣播請求是否來自介面上配置的輔助IP網路上的裝置。解決方法是,可以配置子介面配置(如果連線到路由器的裝置支援dot1q標籤)來分隔兩個子網,以便這兩個子網都能正確獲得其對應的IP地址。
如果想要首選備用地址,還有另一個應急方案,就是啟用全局配置命令ip dhcp smart-relay。這有一個限制,即在三個連續請求主地址池後沒有來自DHCP伺服器的響應時,它僅使用輔助IP來中繼DHCP請求。
下表說明DHCP客戶端從DHCP伺服器獲取IP地址的流程。此表是根據前面的「配置DHCP/BootP中繼代理功能」網路圖建模的。圖中的每個數值都表示下表中所描述的資料包。使用下表瞭解DHCP客戶端-伺服器會話的資料包流。它還可以幫助您確定問題發生的位置。
封包 | 客戶端IP地址 | 伺服器IP位址 | GI地址 | 資料包源MAC地址 | 資料包源IP地址 | 資料包目的MAC地址 | 資料包目的IP地址 |
---|---|---|---|---|---|---|---|
1. 從客戶端傳送DHCPDISCOVER。 | 0.0.0.0 | 0.0.0.0 | 0.0.0.0 | 0005.DCC9.C640 | 0.0.0.0 | ffff.ffff.fffff(廣播) | 255.255.255.255 |
2. 路由器在E1介面上接收DHCPDISCOVER。路由器辨識出此資料包是DHCP UDP廣播。路由器現在充當DHCP/BootP中繼代理並使用傳入介面IP地址填寫Gateway IP address欄位,將源IP地址更改為傳入介面IP地址,然後將請求直接轉發到DHCP伺服器。 | 0.0.0.0 | 0.0.0.0 | 192.168.1.1 | 介面E2 MAC地址 | 192.168.1.1 | DHCP伺服器的MAC地址 | 192.168.2.2 |
3. DHCP伺服器已收到DHCPDISCOVER並將DHCPOFFER傳送到DHCP中繼代理。 | 192.168.1.2 | 192.168.2.2 | 192.168.1.1 | DHCP伺服器的MAC地址 | 192.168.2.2 | 介面E2 MAC地址 | 192.168.1.1 |
4. DHCP中繼代理接收DHCPOFFER並在本地LAN上轉發DHCPOFFER廣播。 | 192.168.1.2 | 192.168.2.2 | 192.168.1.1 | 介面E1 MAC地址 | 192.168.1.1 | ffff.ffff.ffff (廣播) | 255.255.255.255 |
5. 客戶端傳送的DHCPREQUEST。 | 0.0.0.0 | 0.0.0.0 | 0.0.0.0 | 0005.DCC9.C640 | 0.0.0.0 | ffff.ffff.fffff(廣播) | 255.255.255.255 |
6. 路由器在E1介面上接收DHCPREQUEST。路由器辨識出此資料包是DHCP UDP廣播。路由器現在充當DHCP中繼代理,使用傳送的介面IP地址填寫Gateway IP address欄位,將源IP地址更改為傳入介面IP地址,然後將請求直接轉發到DHCP伺服器。 | 0.0.0.0 | 0.0.0.0 | 192.168.1.1 | 介面E2 MAC地址 | 192.168.1.1 | DHCP伺服器的MAC地址 | 192.168.2.2 |
7. DHCP伺服器已收到DHCPREQUEST並將DHCPACK傳送到DHCP/BootP中繼代理。 | 192.168.1.2 | 192.168.2.2 | 192.168.1.1 | DHCP伺服器的MAC地址 | 192.168.2.2 | 介面E2 MAC地址 | 192.168.1.1 |
8. DHCP/BootP中繼代理接收DHCPACK並在本地LAN上轉發DHCPACK廣播。客戶端接受ACK並使用客戶端IP地址。 | 192.168.1.2 | 192.168.2.2 | 192.168.1.1 | 介面E1 MAC地址 | 192.168.1.1 | ffff.ffff.ffff (廣播) | 255.255.255.255 |
預先執行環境(PXE)可讓工作站先從網路上的伺服器開機,再從本機硬碟啟動系統。網路管理員無需親自訪問特定工作站並手動將其啟動。作業系統和其他軟體(如診斷程式)可以透過網路從伺服器載入到裝置上。PXE環境使用DHCP配置其IP地址。
如果DHCP伺服器位於網路的另一個路由網段上,則必須在路由器上完成DHCP/BootP中繼代理配置。必須配置本地路由器介面上的ip helper-address命令。有關配置資訊,請參閱本文檔的在Cisco IOS路由器上配置DHCP/BootP中繼代理功能部分。
監聽器追蹤範例由六個訊框組成。這六個架構說明了DHCP客戶端和伺服器位於同一物理或邏輯網段的情況。請使用下一個代碼示例排除DHCP故障。將您的監聽器追蹤與此範例中的追蹤配對是很重要的。與下一個圖示的蹤跡相比,可能存在一些差異,但一般資料包流必須完全相同。資料包跟蹤跟蹤之前有關DHCP工作方式的討論。
- - - - - - - - - - - - - - - - - - - - Frame 1 - DHCPDISCOVER - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 1[0.0.0.0] [255.255.255.255] 618 0:01:26.810 0.575.244 05/07/2001 11:52:03 AM DHCP: Request, Message type: DHCP Discover DLC: ----- DLC Header ----- DLC: DLC: Frame 1arrived at 11:52:03.8106; frame size is 618 (026A hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 0005DCC9C640 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 604 bytes IP: Identification = 9 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = B988 (correct) IP: Source address = [0.0.0.0] IP: Destination address = [255.255.255.255] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 68 (BootPc/DHCP) UDP: Destination port = 67 (BootPs/DHCP) UDP: Length = 584 UDP: No checksum UDP: [576 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 1 (Request) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 00000882 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [0.0.0.0] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [0.0.0.0] DHCP: Client hardware address = 0005DCC9C640 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 1 (DHCP Discover) DHCP: Maximum message size = 1152 DHCP: Client identifier = 00636973636F2D303030352E646363392E633634302D564C31 DHCP: Parameter Request List: 7 entries DHCP: 1 = Client's subnet mask DHCP: 66 = TFTP Option DHCP: 6 = Domain name server DHCP: 3 = Routers on the client's subnet DHCP: 67 = Boot File Option DHCP: 12 = Host name server DHCP: 150 = Unknown Option DHCP: Class identifier = 646F63736973312E30 DHCP: Option overload =3 (File and Sname fields hold options) DHCP: - - - - - - - - - - - - - - - - - - - - Frame 2 - DHCPOFFER - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 2[192.168.1.1] [255.255.255.255] 331 0:01:26.825 0.015.172 05/07/2001 11:52:03 AM DHCP: Reply, Message type: DHCP Offer DLC: ----- DLC Header ----- DLC: DLC: Frame 2 arrived at 11:52:03.8258; frame size is 331 (014B hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 0005DCC42484 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 317 bytes IP: Identification = 5 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = F901 (correct) IP: Source address = [192.168.1.1] IP: Destination address = [255.255.255.255] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 67 (BootPs/DHCP) UDP: Destination port = 68 (BootPc/DHCP) UDP: Length = 297 UDP: No checksum UDP: [289 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 2 (Reply) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 00000882 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [192.168.1.2] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [0.0.0.0] DHCP: Client hardware address = 0005DCC9C640 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 2 (DHCP Offer) DHCP: Server IP address = [192.168.1.1] DHCP: Request IP address lease time = 85535 (seconds) DHCP: Address Renewal interval = 42767 (seconds) DHCP: Address Rebinding interval = 74843 (seconds) DHCP: Subnet mask = [255.255.255.0] DHCP: Domain Name Server address = [192.168.1.3] DHCP: Domain Name Server address = [192.168.1.4] DHCP: Gateway address = [192.168.1.1] DHCP: - - - - - - - - - - - - - - - - - - - - Frame 3 - DHCPREQUEST - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 3[0.0.0.0] [255.255.255.255] 618 0:01:26.829 0.003.586 05/07/2001 11:52:03 AM DHCP: Request, Message type: DHCP Request DLC: ----- DLC Header ----- DLC: DLC: Frame 56 arrived at 11:52:03.8294; frame size is 618 (026A hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 0005DCC9C640 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 604 bytes IP: Identification = 10 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = B987 (correct) IP: Source address = [0.0.0.0] IP: Destination address = [255.255.255.255] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 68 (BootPc/DHCP) UDP: Destination port = 67 (BootPs/DHCP) UDP: Length = 584 UDP: No checksum UDP: [576 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 1 (Request) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 00000882 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [0.0.0.0] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [0.0.0.0] DHCP: Client hardware address = 0005DCC9C640 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 3 (DHCP Request) DHCP: Maximum message size = 1152 DHCP: Client identifier = 00636973636F2D303030352E646363392E633634302D564C31 DHCP: Server IP address = [192.168.1.1] DHCP: Request specific IP address = [192.168.1.2] DHCP: Request IP address lease time = 85535 (seconds) DHCP: Parameter Request List: 7 entries DHCP: 1 = Client's subnet mask DHCP: 66 = TFTP Option DHCP: 6 = Domain name server DHCP: 3 = Routers on the client's subnet DHCP: 67 = Boot File Option DHCP: 12 = Host name server DHCP: 150 = Unknown Option DHCP: Class identifier = 646F63736973312E30 DHCP: Option overload =3 (File and Sname fields hold options) DHCP: - - - - - - - - - - - - - - - - - - - - Frame 4 - DHCPACK - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 4[192.168.1.1] [255.255.255.255] 331 0:01:26.844 0.014.658 05/07/2001 11:52:03 AM DHCP: Reply, Message type: DHCP Ack DLC: ----- DLC Header ----- DLC: DLC: Frame 57 arrived at 11:52:03.8440; frame size is 331 (014B hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 0005DCC42484 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 317 bytes IP: Identification = 6 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = F900 (correct) IP: Source address = [192.168.1.1] IP: Destination address = [255.255.255.255] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 67 (BootPs/DHCP) UDP: Destination port = 68 (BootPc/DHCP) UDP: Length = 297 UDP: No checksum UDP: [289 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 2 (Reply) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 00000882 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [192.168.1.2] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [0.0.0.0] DHCP: Client hardware address = 0005DCC9C640 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 5 (DHCP Ack) DHCP: Server IP address = [192.168.1.1] DHCP: Request IP address lease time = 86400 (seconds) DHCP: Address Renewal interval = 43200 (seconds) DHCP: Address Rebinding interval = 75600 (seconds) DHCP: Subnet mask = [255.255.255.0] DHCP: Domain Name Server address = [192.168.1.3] DHCP: Domain Name Server address = [192.168.1.4] DHCP: Gateway address = [192.168.1.1] DHCP: - - - - - - - - - - - - - - - - - - - - Frame 5 - ARP - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 5 0005DCC9C640 Broadcast 60 0:01:26.846 0.002.954 05/07/2001 11:52:03 AM ARP: R PA=[192.168.1.2] HA=0005DCC9C640 PRO=IP DLC: ----- DLC Header ----- DLC: DLC: Frame 58 arrived at 11:52:03.8470; frame size is 60 (003C hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 0005DCC9C640 DLC: Ethertype = 0806 (ARP) DLC: ARP: ----- ARP/RARP frame ----- ARP: ARP: Hardware type = 1 (10Mb Ethernet) ARP: Protocol type = 0800 (IP) ARP: Length of hardware address = 6 bytes ARP: Length of protocol address = 4 bytes ARP: Opcode 2 (ARP reply) ARP: Sender's hardware address = 0005DCC9C640 ARP: Sender's protocol address = [192.168.1.2] ARP: Target hardware address = FFFFFFFFFFFF ARP: Target protocol address = [192.168.1.2] ARP: ARP: 18 bytes frame padding ARP: - - - - - - - - - - - - - - - - - - - - Frame 6 - ARP - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 6 0005DCC9C640 Broadcast 60 0:01:27.355 0.508.778 05/07/2001 11:52:04 AM ARP: R PA=[192.168.1.2] HA=0005DCC9C640 PRO=IP DLC: ----- DLC Header ----- DLC: DLC: Frame 59 arrived at 11:52:04.3557; frame size is 60 (003C hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 0005DCC9C640 DLC: Ethertype = 0806 (ARP) DLC: ARP: ----- ARP/RARP frame ----- ARP: ARP: Hardware type = 1 (10Mb Ethernet) ARP: Protocol type = 0800 (IP) ARP: Length of hardware address = 6 bytes ARP: Length of protocol address = 4 bytes ARP: Opcode 2 (ARP reply) ARP: Sender's hardware address = 0005DCC9C640 ARP: Sender's protocol address = [192.168.1.2] ARP: Target hardware address = FFFFFFFFFFFF ARP: Target protocol address = [192.168.1.2] ARP: ARP: 18 bytes frame padding ARP:
- - - - - - - - - - - - - - - - - - - - Frame 1 - DHCPDISCOVER - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 1 [0.0.0.0] [255.255.255.255] 618 0:02:05.759 0.025.369 05/31/2001 06:53:04 AM DHCP: Request, Message type: DHCP Discover DLC: ----- DLC Header ----- DLC: DLC: Frame 124 arrived at 06:53:04.2043; frame size is 618 (026A hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 0005DCF2C441 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 604 bytes IP: Identification = 183 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = B8DA (correct) IP: Source address = [0.0.0.0] IP: Destination address = [255.255.255.255] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 68 (BootPc/DHCP) UDP: Destination port = 67 (BootPs/DHCP) UDP: Length = 584 UDP: No checksum UDP: [576 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 1 (Request) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 00001425 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [0.0.0.0] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [0.0.0.0] DHCP: Client hardware address = 0005DCF2C441 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 1 (DHCP Discover) DHCP: Maximum message size = 1152 DHCP: Client identifier = 00636973636F2D303065302E316566322E633434312D4574302F30 DHCP: Parameter Request List: 7 entries DHCP: 1 = Client's subnet mask DHCP: 6 = Domain name server DHCP: 15 = Domain name DHCP: 44 = NetBIOS over TCP/IP name server DHCP: 3 = Routers on the client's subnet DHCP: 33 = Static route DHCP: 150 = Unknown Option DHCP: Class identifier = 646F63736973312E30 DHCP: Option overload =3 (File and Sname fields hold options) DHCP: - - - - - - - - - - - - - - - - - - - - Frame 2 - DHCPOFFER - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summaryr 125 [192.168.1.1] [255.255.255.255] 347 0:02:05.772 0.012.764 05/31/2001 06:53:04 AM DHCP: Reply, Message type: DHCP Offer DLC: ----- DLC Header ----- DLC: DLC: Frame 125 arrived at 06:53:04.2171; frame size is 347 (015B hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 003094248F71 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 333 bytes IP: Identification = 45 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = F8C9 (correct) IP: Source address = [192.168.1.1] IP: Destination address = [255.255.255.255] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 67 (BootPs/DHCP) UDP: Destination port = 68 (BootPc/DHCP) UDP: Length = 313 UDP: Checksum = 8517 (correct) UDP: [305 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 2 (Reply) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 00001425 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [192.168.1.2] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [192.168.1.1] DHCP: Client hardware address = 0005DCF2C441 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 2 (DHCP Offer) DHCP: Server IP address = [192.168.2.2] DHCP: Request IP address lease time = 99471 (seconds) DHCP: Address Renewal interval = 49735 (seconds) DHCP: Address Rebinding interval = 87037 (seconds) DHCP: Subnet mask = [255.255.255.0] DHCP: Domain Name Server address = [192.168.10.1] DHCP: Domain Name Server address = [192.168.10.2] DHCP: NetBIOS Server address = [192.168.10.1] DHCP: NetBIOS Server address = [192.168.10.3] DHCP: Domain name = "cisco.com" DHCP: - - - - - - - - - - - - - - - - - - - - Frame 3 - DHCPREQUEST - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 3 [0.0.0.0] [255.255.255.255] 618 0:02:05.774 0.002.185 05/31/2001 06:53:04 AM DHCP: Request, Message type: DHCP Request DLC: ----- DLC Header ----- DLC: DLC: Frame 126 arrived at 06:53:04.2193; frame size is 618 (026A hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station Cisc14F2C441 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 604 bytes IP: Identification = 184 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = B8D9 (correct) IP: Source address = [0.0.0.0] IP: Destination address = [255.255.255.255] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 68 (BootPc/DHCP) UDP: Destination port = 67 (BootPs/DHCP) UDP: Length = 584 UDP: No checksum UDP: [576 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 1 (Request) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 00001425 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [0.0.0.0] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [0.0.0.0] DHCP: Client hardware address = 0005DCF2C441 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 3 (DHCP Request) DHCP: Maximum message size = 1152 DHCP: Client identifier = 00636973636F2D303065302E316566322E633434312D4574302F30 DHCP: Server IP address = [192.168.2.2] DHCP: Request specific IP address = [192.168.1.2] DHCP: Request IP address lease time = 99471 (seconds) DHCP: Parameter Request List: 7 entries DHCP: 1 = Client's subnet mask DHCP: 6 = Domain name server DHCP: 15 = Domain name DHCP: 44 = NetBIOS over TCP/IP name server DHCP: 3 = Routers on the client's subnet DHCP: 33 = Static route DHCP: 150 = Unknown Option DHCP: Class identifier = 646F63736973312E30 DHCP: Option overload =3 (File and Sname fields hold options) DHCP: - - - - - - - - - - - - - - - - - - - - Frame 4 - DHCPACK - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 4 [192.168.1.1] [255.255.255.255] 347 0:02:05.787 0.012.875 05/31/2001 06:53:04 AM DHCP: Reply, Message type: DHCP Ack DLC: ----- DLC Header ----- DLC: DLC: Frame 127 arrived at 06:53:04.2321; frame size is 347 (015B hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station 003094248F71 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 333 bytes IP: Identification = 47 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = F8C7 (correct) IP: Source address = [192.168.1.1] IP: Destination address = [255.255.255.255] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 67 (BootPs/DHCP) UDP: Destination port = 68 (BootPc/DHCP) UDP: Length = 313 UDP: Checksum = 326F (correct) UDP: [305 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 2 (Reply) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 00001425 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [192.168.1.2] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [192.168.1.1] DHCP: Client hardware address = 0005DCF2C441 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 5 (DHCP Ack) DHCP: Server IP address = [192.168.2.2] DHCP: Request IP address lease time = 172800 (seconds) DHCP: Address Renewal interval = 86400 (seconds) DHCP: Address Rebinding interval = 151200 (seconds) DHCP: Subnet mask = [255.255.255.0] DHCP: Domain Name Server address = [192.168.10.1] DHCP: Domain Name Server address = [192.168.10.2] DHCP: NetBIOS Server address = [192.168.10.1] DHCP: NetBIOS Server address = [192.168.10.3] DHCP: Domain name = "cisco.com" DHCP: - - - - - - - - - - - - - - - - - - - - Frame 5 - ARP - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 5 Cisc14F2C441 Broadcast 60 0:02:05.798 0.011.763 05/31/2001 06:53:04 AM ARP: R PA=[192.168.1.2] HA=Cisc14F2C441 PRO=IP DLC: ----- DLC Header ----- DLC: DLC: Frame 128 arrived at 06:53:04.2439; frame size is 60 (003C hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station Cisc14F2C441 DLC: Ethertype = 0806 (ARP) DLC: ARP: ----- ARP/RARP frame ----- ARP: ARP: Hardware type = 1 (10Mb Ethernet) ARP: Protocol type = 0800 (IP) ARP: Length of hardware address = 6 bytes ARP: Length of protocol address = 4 bytes ARP: Opcode 2 (ARP reply) ARP: Sender's hardware address = 00E01EF2C441 ARP: Sender's protocol address = [192.168.1.2] ARP: Target hardware address = FFFFFFFFFFFF ARP: Target protocol address = [192.168.1.2] ARP: ARP: 18 bytes frame padding ARP: - - - - - - - - - - - - - - - - - - - - Frame 6 - ARP - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 5 Cisc14F2C441 Broadcast 60 0:02:05.798 0.011.763 05/31/2001 06:53:04 AM ARP: R PA=[192.168.1.2] HA=Cisc14F2C441 PRO=IP DLC: ----- DLC Header ----- DLC: DLC: Frame 128 arrived at 06:53:04.2439; frame size is 60 (003C hex) bytes. DLC: Destination = BROADCAST FFFFFFFFFFFF, Broadcast DLC: Source = Station Cisc14F2C441 DLC: Ethertype = 0806 (ARP) DLC: ARP: ----- ARP/RARP frame ----- ARP: ARP: Hardware type = 1 (10Mb Ethernet) ARP: Protocol type = 0800 (IP) ARP: Length of hardware address = 6 bytes ARP: Length of protocol address = 4 bytes ARP: Opcode 2 (ARP reply) ARP: Sender's hardware address = 00E01EF2C441 ARP: Sender's protocol address = [192.168.1.2] ARP: Target hardware address = FFFFFFFFFFFF ARP: Target protocol address = [192.168.1.2] ARP: ARP: 18 bytes frame padding ARP:
- - - - - - - - - - - - - - - - - - - - Frame 1 - DHCPDISCOVER - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 118 [192.168.1.1] [192.168.2.2] 618 0:00:51.212 0.489.912 05/31/2001 07:02:54 AM DHCP: Request, Message type: DHCP Discover DLC: ----- DLC Header ----- DLC: DLC: Frame 118 arrived at 07:02:54.7463; frame size is 618 (026A hex) bytes. DLC: Destination = Station 0005DC0BF2F4 DLC: Source = Station 003094248F72 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 604 bytes IP: Identification = 52 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = 3509 (correct) IP: Source address = [192.168.1.1] IP: Destination address = [192.168.2.2] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 67 (BootPs/DHCP) UDP: Destination port = 67 (BootPs/DHCP) UDP: Length = 584 UDP: Checksum = 0A19 (correct) UDP: [576 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 1 (Request) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 1 DHCP: Transaction id = 000005F4 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [0.0.0.0] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [192.168.1.1] DHCP: Client hardware address = 0005DCF2C441 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 1 (DHCP Discover) DHCP: Maximum message size = 1152 DHCP: Client identifier = 00636973636F2D303065302E316566322E633434312D4574302F30 DHCP: Parameter Request List: 7 entries DHCP: 1 = Client's subnet mask DHCP: 6 = Domain name server DHCP: 15 = Domain name DHCP: 44 = NetBIOS over TCP/IP name server DHCP: 3 = Routers on the client's subnet DHCP: 33 = Static route DHCP: 150 = Unknown Option DHCP: Class identifier = 646F63736973312E30 DHCP: Option overload =3 (File and Sname fields hold options) DHCP: - - - - - - - - - - - - - - - - - - - - Frame 2 - DHCPOFFER - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 2 [192.168.2.2] [192.168.1.1] 347 0:00:51.214 0.002.133 05/31/2001 07:02:54 AM DHCP: Request, Message type: DHCP Offer DLC: ----- DLC Header ----- DLC: DLC: Frame 119 arrived at 07:02:54.7485; frame size is 347 (015B hex) bytes. DLC: Destination = Station 003094248F72 DLC: Source = Station 0005DC0BF2F4 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 333 bytes IP: Identification = 41 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = 3623 (correct) IP: Source address = [192.168.2.2] IP: Destination address = [192.168.1.1] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 67 (BootPs/DHCP) UDP: Destination port = 67 (BootPs/DHCP) UDP: Length = 313 UDP: Checksum = A1F8 (correct) UDP: [305 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 2 (Request) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 000005F4 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [192.168.1.2] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [192.168.1.1] DHCP: Client hardware address = 0005DCF2C441 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 2 (DHCP Offer) DHCP: Server IP address = [192.168.2.2] DHCP: Request IP address lease time = 172571 (seconds) DHCP: Address Renewal interval = 86285 (seconds) DHCP: Address Rebinding interval = 150999 (seconds) DHCP: Subnet mask = [255.255.255.0] DHCP: Domain Name Server address = [192.168.10.1] DHCP: Domain Name Server address = [192.168.10.2] DHCP: NetBIOS Server address = [192.168.10.1] DHCP: NetBIOS Server address = [192.168.10.3] DHCP: Domain name = "cisco.com" DHCP: - - - - - - - - - - - - - - - - - - - - Frame 3 - DHCPREQUEST - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 3 [192.168.1.1] [192.168.2.2] 618 0:00:51.240 0.025.974 05/31/2001 07:02:54 AM DHCP: Request, Message type: DHCP Request DLC: ----- DLC Header ----- DLC: DLC: Frame 120 arrived at 07:02:54.7745; frame size is 618 (026A hex) bytes. DLC: Destination = Station 0005DC0BF2F4 DLC: Source = Station 003094248F72 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 604 bytes IP: Identification = 54 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = 3507 (correct) IP: Source address = [192.168.1.1] IP: Destination address = [192.168.2.2] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 67 (BootPs/DHCP) UDP: Destination port = 67 (BootPs/DHCP) UDP: Length = 584 UDP: Checksum = 4699 (correct) UDP: [576 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 1 (Request) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 1 DHCP: Transaction id = 000005F4 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [0.0.0.0] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [192.168.1.1] DHCP: Client hardware address = 0005DCF2C441 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 3 (DHCP Request) DHCP: Maximum message size = 1152 DHCP: Client identifier = 00636973636F2D303065302E316566322E633434312D4574302F30 DHCP: Server IP address = [192.168.2.2] DHCP: Request specific IP address = [192.168.1.2] DHCP: Request IP address lease time = 172571 (seconds) DHCP: Parameter Request List: 7 entries DHCP: 1 = Client's subnet mask DHCP: 6 = Domain name server DHCP: 15 = Domain name DHCP: 44 = NetBIOS over TCP/IP name server DHCP: 3 = Routers on the client's subnet DHCP: 33 = Static route DHCP: 150 = Unknown Option DHCP: Class identifier = 646F63736973312E30 DHCP: Option overload =3 (File and Sname fields hold options) DHCP: - - - - - - - - - - - - - - - - - - - - Frame 4 - DHCPACK - - - - - - - - - - - - - - - - - - - - Frame Status Source Address Dest. Address Size Rel. Time Delta Time Abs. Time Summary 4 [192.168.2.2] [192.168.1.1] 347 0:00:51.240 0.000.153 05/31/2001 07:02:54 AM DHCP: Request, Message type: DHCP Ack DLC: ----- DLC Header ----- DLC: DLC: Frame 121 arrived at 07:02:54.7746; frame size is 347 (015B hex) bytes. DLC: Destination = Station 003094248F72 DLC: Source = Station 0005DC0BF2F4 DLC: Ethertype = 0800 (IP) DLC: IP: ----- IP Header ----- IP: IP: Version = 4, header length = 20 bytes IP: Type of service = 00 IP: 000. .... = routine IP: ...0 .... = normal delay IP: .... 0... = normal throughput IP: .... .0.. = normal reliability IP: .... ..0. = ECT bit - transport protocol will ignore the CE bit IP: .... ...0 = CE bit - no congestion IP: Total length = 333 bytes IP: Identification = 42 IP: Flags = 0X IP: .0.. .... = may fragment IP: ..0. .... = last fragment IP: Fragment offset = 0 bytes IP: Time to live = 255 seconds/hops IP: Protocol = 17 (UDP) IP: Header checksum = 3622 (correct) IP: Source address = [192.168.2.2] IP: Destination address = [192.168.1.1] IP: No options IP: UDP: ----- UDP Header ----- UDP: UDP: Source port = 67 (BootPs/DHCP) UDP: Destination port = 67 (BootPs/DHCP) UDP: Length = 313 UDP: Checksum = 7DF6 (correct) UDP: [305 byte(s) of data] UDP: DHCP: ----- DHCP Header ----- DHCP: DHCP: Boot record type = 2 (Request) DHCP: Hardware address type = 1 (10Mb Ethernet) DHCP: Hardware address length = 6 bytes DHCP: DHCP: Hops = 0 DHCP: Transaction id = 000005F4 DHCP: Elapsed boot time = 0 seconds DHCP: Flags = 8000 DHCP: 1... .... .... .... = Broadcast IP datagrams DHCP: Client self-assigned IP address = [0.0.0.0] DHCP: Client IP address = [192.168.1.2] DHCP: Next Server to use in bootstrap = [0.0.0.0] DHCP: Relay Agent = [192.168.1.1] DHCP: Client hardware address = 0005DCF2C441 DHCP: DHCP: Host name = "" DHCP: Boot file name = "" DHCP: DHCP: Vendor Information tag = 63825363 DHCP: Message Type = 5 (DHCP Ack) DHCP: Server IP address = [192.168.2.2] DHCP: Request IP address lease time = 172800 (seconds) DHCP: Address Renewal interval = 86400 (seconds) DHCP: Address Rebinding interval = 151200 (seconds) DHCP: Subnet mask = [255.255.255.0] DHCP: Domain Name Server address = [192.168.10.1] DHCP: Domain Name Server address = [192.168.10.2] DHCP: NetBIOS Server address = [192.168.10.1] DHCP: NetBIOS Server address = [192.168.10.3] DHCP: Domain name = "cisco.com" DHCP:
當DHCP伺服器和客戶端位於同一個LAN網段或VLAN中,並且客戶端無法從DHCP伺服器獲取IP地址時。但是,本地路由器不太可能導致DHCP問題。此問題與連線DHCP伺服器和DHCP客戶端的裝置有關。但是,問題可能出在DHCP伺服器或客戶端本身。這些模組有助於排除故障並確定導致問題的裝置。
注意:要基於每個VLAN配置DHCP伺服器,請為向客戶端提供DHCP地址的每個VLAN定義不同的DHCP池。
當DHCP伺服器和客戶端位於不同的LAN網段或VLAN上時,路由器將充當DHCP/BootP中繼代理,負責將DHCPREQUEST轉發到DHCP伺服器。排除DHCP/BootP中繼代理以及DHCP伺服器和客戶端故障需要執行其他步驟。如果跟蹤這些模組,則可以確定導致問題的裝置。
某些地址可能仍由客戶端持有,即使它們已從池中釋放。這可以透過show ip dhcp conflict命令的輸出進行驗證。當兩台主機使用同一個IP地址時,會發生地址衝突。在地址分配時,DHCP使用ping和無償ARP檢查衝突。
如果檢測到衝突,地址將從池中刪除。地址被分配,直到管理員解決衝突。配置no ip dhcp conflict logging以解決此問題。
DHCP問題可能由多種原因引起。最常見的原因是配置問題。但是,許多DHCP問題可能是由系統、網路介面卡(NIC)驅動程式或路由器上執行的DHCP/BootP中繼代理軟體缺陷所造成。由於可能存在問題的區域數量眾多,因此需要採用系統化的方法進行故障排除。
Catalyst交換機預設配置
DHCP/BootP中繼代理配置
NIC相容性問題或DHCP功能問題
NIC故障或NIC驅動程式安裝不正確
由於頻繁生成樹計算而導致的間歇性網路中斷
作業系統行為或軟體缺陷
DHCP伺服器作用域配置或軟體缺陷
Cisco Catalyst交換機或Cisco IOS DHCP/BootP中繼代理軟體缺陷
單播反向路徑轉發(uRPF)檢查失敗,因為收到DHCP提供的介面與預期介面不同。在介面上啟用反向路徑轉送(RPF)功能時,Cisco路由器可能會捨棄來源位址為0.0.0.0且目的地位址為255.255.255.255的動態主機設定通訊協定(DHCP)和啟動分段通訊協定(BOOTP)封包。路由器也可以丟棄在介面上具有組播IP目標的所有IP資料包。Cisco Bug ID CSCdw中說明了此問題31925
注意只有已註冊的思科客戶端可以訪問錯誤報告。
未使用DHCP資料庫代理,但DHCP衝突日誌記錄未停用
此程式適用於所有案例研究。
首先,檢驗DHCP客戶端和伺服器的物理連線。如果連線到Catalyst交換機,請驗證DHCP客戶端和伺服器是否都具有物理連線。 對於基於Cisco IOS的交換機(如Catalyst 2900XL/3500XL/2950/3550),與show port status等效的命令是show interface <interface>。 如果介面的狀態不是<interface>為up,線路協定為up,則埠不會傳輸資料流,甚至不會傳輸DHCP客戶端請求。命令的輸出:
Switch#show interface fastEthernet 0/1 FastEthernet0/1 is up, line protocol is up Hardware is Fast Ethernet, address is 0030.94dc.acc1 (bia 0030.94dc.acc1)
如果驗證了物理連線,證實Catalyst交換機和DHCP客戶端之間沒有鏈路,則使用排除Cisco Catalyst交換機的NIC相容性問題部分就有關物理層連線的問題進行故障排除。
過多的資料鏈路錯誤導致某些Catalyst交換機上的埠進入anerrdisabledstate。有關詳細資訊,請參閱Cisco IOS平台上的Errdisable埠狀態恢復,其中描述了errdisable狀態、說明了如何從此狀態恢復,並且提供了從此狀態恢復的示例。
B.配置客戶端工作站和靜態IP以測試網路連線
此程式適用於所有案例研究。
排除任何DHCP故障時,必須在客戶端工作站上配置靜態IP地址以驗證網路連線。如果工作站具有靜態配置的IP地址,卻無法訪問網路資源,則問題的根本原因不是DHCP。此時,您需要排除網路連線故障。
此程式適用於所有案例研究。
如果DHCP客戶端無法在啟動時從DHCP伺服器獲取IP地址,您可以手動強制客戶端傳送DHCP請求。執行後續步驟,手動從所列作業系統的DHCP伺服器獲取IP地址。
Microsoft Windows 95/98/ME:
Microsoft Windows NT/2000:
如果PC完成啟動過程後,DHCP客戶端能夠透過手動更新IP地址來獲取IP地址,則問題很可能是DHCP啟動問題。如果DHCP客戶端連線到Cisco Catalyst交換機,則問題很可能是由涉及STP portfast和/或通道和中繼的配置問題引起的。其他可能性包括NIC卡問題和交換器連線埠啟動問題。檢視步驟D和E以排除交換機埠配置和NIC卡問題是DHCP問題的根本原因。
如果交換器是Catalyst 2900/4000/5000/6000,請確認連線埠是否已啟用STP portfast且已停用中繼/通道功能。預設配置是STP portfast停用和中繼/通道自動(如果適用)。對於2900XL/3500XL/2950/3550交換機,STP portfast是唯一必需的配置。這些配置更改可解決Catalyst交換機的初始安裝過程中最常見的DHCP客戶端問題。
有關在連線到Catalyst交換機時DHCP正常運行所需的交換機埠配置要求的更多文檔,請參閱使用Portfast和其他命令解決工作站啟動連線延遲問題。
檢閱檔案後,您可以繼續排除這些問題。
如果Catalyst交換機配置正確,則可能導致DHCP問題的Catalyst交換機或DHCP客戶端NIC上存在軟體相容性問題。排除故障的下一個步驟是檢視排除Cisco Catalyst交換機的NIC相容性問題,並排除Catalyst交換機或NIC上導致問題的任何軟體問題。
需要瞭解DHCP客戶端作業系統以及特定網絡卡資訊(例如製造商、型號和驅動程式版本),才能正確排除任何相容性問題。
當客戶端與DHCP伺服器位於同一子網或VLAN時,必須區分DHCP是否正常工作。如果DHCP在與DHCP伺服器相同的子網或VLAN上正常工作,則DHCP問題主要由DHCP/BootP中繼代理引起。如果即使在與DHCP伺服器相同的子網或VLAN上測試DHCP時問題仍然存在,則問題可能出在DHCP伺服器。
驗證設定:
在路由器上配置DHCP中繼時,請驗證ip helper-address 命令是否位於正確的介面上。ip helper-address 命令必須位於DHCP客戶端工作站的入站介面上,並且必須定向到正確的DHCP伺服器。
驗證是否存在全局配置命令no service dhcp。此配置引數停用路由器上的所有DHCP伺服器和中繼功能。預設配置service dhcp不會出現在配置中,而是預設配置命令。如果未啟用eservice dhcp,則客戶端無法從DHCP伺服器獲得IP地址。
注意:在運行較早Cisco IOS版本的路由器中,處理DHCP中繼代理功能的是ip bootp server 命令而非service dhcp 命令。因此,如果將ip helper-address命令配置為轉發DHCP UDP廣播並作為代表DHCP客戶端的DHCP中繼代理,則需在路由器中啟用ip bootp server命令。
- 使用ip helper-address命令將UDP廣播轉發到子網廣播地址時,請驗證UDP廣播資料包需要穿過的任何出站介面上是否未配置
no ip directed-broadcast。no ip directed-broadcast用於阻止定向廣播到物理廣播的任何轉換。此介面配置是軟體版本12.0及更高版本中的預設配置。
-
當DHCP廣播轉發到DHCP伺服器子網廣播地址時,會出現軟體問題。當您排除DHCP故障時,嘗試將DHCP UDP廣播轉發到DHCP伺服器IP地址:
version 12.0
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
no service dhcp
!--- This configuration command will disable all DHCP server and relay functionality on the router.
hostname router
!
!
!
interface Ethernet0
ip address 192.168.2.1 255.255.255.0
no ip directed-broadcast
!--- This configuration will prevent translation of a directed broadcast to a physical broadcast.
interface Ethernet1
!--- DHCP client workstations reside of this interface.
ip address 192.168.1.1 255.255.255.0
ip helper-address 192.168.2.255
!--- IP helper-address pointing to DHCP server's subnet.
no ip directed-broadcast
!
!
!
line con 0
exec-timeout 0 0
transport input none
line aux 0
line vty 0 4
login
!
end
H.打開使用者標識(82)選項
DHCP中繼代理資訊(選項82)功能使DHCP中繼代理(Catalyst交換機)在從DHCP客戶端向DHCP伺服器轉發DHCP請求時,可以包含有關自身和所連線客戶端的資訊。
DHCP伺服器可以使用此資訊為服務提供商網路的每個使用者分配IP地址、執行訪問控制、設定服務品質(QoS)和安全策略(或其他引數分配策略)。在交換機上啟用DHCP監聽時,會自動啟用選項82。 如果DHCP伺服器未配置為使用選項82處理資料包,則它不再為該請求分配地址。 要解決此問題,請用全局配置命令no ip dhcp relay information option在交換機(中繼代理)中停用使用者標識選項(82)。
I. DHCP資料庫代理和DHCP衝突日誌記錄
DHCP資料庫代理是儲存DHCP繫結資料庫的任何主機,例如FTP、TFTP或RCP伺服器。您可以配置多個DHCP資料庫代理,並且可以配置每個代理的資料庫更新和傳輸之間的間隔。使用ip dhcp database命令配置資料庫代理和資料庫代理引數。
如果選擇不配置DHCP資料庫代理,請停用DHCP伺服器上記錄DHCP地址衝突。執行noip dhcp conflict logging命令以停用DHCP地址衝突日誌記錄。使用clear ip dhcp conflict清除已記錄的衝突。
如果這無法停用衝突日誌記錄,則會出現以下錯誤消息:
%DHCPD-4-DECLINE_CONFLICT: DHCP address conflict: client
J.檢查CDP以驗證IP電話連線情況
當連線到Cisco IP電話的交換機埠停用了Cisco Discovery Protocol (CDP)時,DHCP伺服器無法為電話分配適當的IP地址。DHCP伺服器傾向於分配屬於交換機埠的資料VLAN/子網的IP地址。如果啟用CDP,交換機可以檢測到Cisco IP電話請求DHCP並且可以提供正確的子網資訊。然後DHCP伺服器就可以從語音VLAN/子網池分配IP地址。將dhcp服務繫結到語音vlan不需要任何明確步驟。
K.刪除SVI會干擾DHCP監聽操作
在Cisco Catalyst 6500系列交換機上,在將DHCP配置為監聽特定VLAN後,會自動建立SVI(處於關閉狀態)。此SVI的存在直接影響DHCP監聽的正確操作。
運行本地Cisco IOS的Cisco Catalyst 6500系列交換機上的DHCP監聽主要在路由處理器(RP或MSFC)上實現,而不是在交換機處理器(SP或Supervisor)上實現。Cisco Catalyst 6500系列使用向RP訂閱的本地目標邏輯(LTL)提供資料包的VACL在硬體中攔截資料包。幀進入RP後,首先需要與L3介面(SVI) IDB關聯,然後才能傳送到監聽部分。如果沒有SVI,則此IDB不存在,並且資料包在RP中被丟棄。
L.有限的廣播地址
當DHCP客戶端在DHCP資料包中設定廣播位時,DHCP伺服器和中繼代理將DHCP消息傳送到具有全1廣播地址(255.255.255.255)的客戶端。如果ip broadcast-address命令已配置為傳送網路廣播,則會覆蓋DHCP傳送的全1廣播。要解決此問題,請使用ip dhcp limited-broadcast-address命令來確保配置的網路廣播不會覆蓋預設DHCP行為。
某些DHCP客戶端只能接受全1廣播,並且無法獲取DHCP地址,除非在與客戶端連線的路由器介面上配置此命令。
M.使用路由器Debug命令調試DHCP
使用debug命令驗證路由器是否收到DHCP請求
在支援處理DHCP資料包的軟體的路由器上,您可以驗證路由器是否收到來自客戶端的DHCP請求。如果路由器沒有收到來自客戶端的請求,則DHCP進程將失敗。在此步驟中,將存取清單設定為偵錯輸出。此訪問清單僅用於調試命令,不干擾路由器。
在全局配置模式下,輸入以下訪問清單:
access-list 100 permit ip host 0.0.0.0 host 255.255.255.255
在執行模式下,輸入以下debug命令:
debug ip packet detail 100
示例輸出
Router#debug ip packet detail 100
IP packet debugging is on (detailed) for access list 100
Router#
00:16:46: IP: s=0.0.0.0 (Ethernet4/0), d=255.255.255.255, len 604, rcvd 2
00:16:46: UDP src=68, dst=67
00:16:46: IP: s=0.0.0.0 (Ethernet4/0), d=255.255.255.255, len 604, rcvd 2
00:16:46: UDP src=68, dst=67
從該輸出示例可以清楚地看到,路由器主動接收來自客戶端的DHCP請求。此輸出只顯示封包的摘要,而不是封包本身。因此,無法確定資料包是否正確。但是,路由器確實收到了廣播資料包,其中源IP埠和目的IP埠以及UDP埠對DHCP而言是正確的。
使用debug ip udp命令驗證路由器是否接收和轉發DHCP請求
debug ip udp 命令可以透過路由器跟蹤DHCP請求的路徑。但是,由於所有處理的交換UDP資料包都會顯示到控制檯,因此該調試在生產環境中會中斷。此debug命令不得用於生產中。
警告: debug ip udp命令會干擾,可能會導致中央處理器(CPU)使用率高。
在執行模式下,輸入以下debug命令:debug ip udp
示例輸出
Router#debug ip udp
UDP packet debugging is on
Router#
00:18:48: UDP: rcvd src=0.0.0.0(68), dst=255.255.255.255(67), length=584
!--- Router receiving DHCPDISCOVER from DHCP client.
00:18:48: UDP: sent src=192.168.1.1(67), dst=192.168.2.2(67), length=604
!--- Router forwarding DHCPDISCOVER unicast to DHCP server using DHCP/BootP Relay Agent source IP address.
00:18:48: UDP: rcvd src=192.168.2.2(67), dst=192.168.1.1(67), length=313
!--- Router receiving DHCPOFFER from DHCP server directed to DHCP/BootP Relay Agent IP address.
00:18:48: UDP: sent src=0.0.0.0(67), dst=255.255.255.255(68), length=333
!--- Router forwarding DHCPOFFER from DHCP server to DHCP client via DHCP/BootP Relay Agent.
00:18:48: UDP: rcvd src=0.0.0.0(68), dst=255.255.255.255(67), length=584
!--- Router receiving DHCPREQUEST from DHCP client.
00:18:48: UDP: sent src=192.168.1.1(67), dst=192.168.2.2(67), length=604
!--- Router forwarding DHCPDISCOVER unicast to DHCP server using DHCP/BootP Relay Agent source IP address.
00:18:48: UDP: rcvd src=192.168.2.2(67), dst=192.168.1.1(67), length=313
!--- Router receiving DHCPACK (or DHCPNAK) from DHCP directed to DHCP/BootP Relay Agent IP address.
00:18:48: UDP: sent src=0.0.0.0(67), dst=255.255.255.255(68), length=333
!--- Router forwarding DHCPACK (or DHCPNAK) to DHCP client via DHCP/BootP Relay Agent.
00:18:48: UDP: rcvd src=192.168.1.2(520), dst=255.255.255.255(520), length=32
!--- DHCP client verifying IP address not in use by sending ARP request for its own IP address.
00:18:50: UDP: rcvd src=192.168.1.2(520), dst=255.255.255.255(520), length=32
!--- DHCP client verifying IP address not in use by sending ARP request for its own IP address.
使用debug ip dhcp server packet命令驗證路由器是否接收和轉發DHCP請求
如果路由器Cisco IOS是12.0.x.T或12.1並支援Cisco IOS DHCP伺服器功能,您可以使用debug ip dhcp server packet命令。此調試旨在與Cisco IOS DHCP伺服器功能一起使用,並用於排除DHCP/BootP中繼代理功能的故障。與之前步驟一樣,路由器調試不能提供問題的確切確定,因為無法檢視實際的資料包。但是,調試允許對DHCP處理進行推斷。 在執行模式下,輸入以下debug命令:
debug ip dhcp server packet
Router#debug ip dhcp server packet
00:20:54: DHCPD: setting giaddr to 192.168.1.1.
!--- Router received DHCPDISCOVER/REQUEST/INRORM and setting Gateway IP address to 192.168.1.1 for forwarding.
00:20:54: DHCPD: BOOTREQUEST from 0063.6973.636f.2d30.3065.302e.3165.6632.2e63..
!--- BOOTREQUEST includes DHCPDISCOVER, DHCPREQUEST, and DHCPINFORM.
!--- 0063.6973.636f.2d30.3065.302e.3165.6632.2e63 indicates client identifier.
00:20:54: DHCPD: forwarding BOOTREPLY to client 00e0.1ef2.c441.
!--- BOOTREPLY includes DHCPOFFER and DHCPNAK.
!--- Client's MAC address is 00e0.1ef2.c441.
00:20:54: DHCPD: broadcasting BOOTREPLY to client 00e0.1ef2.c441.
!--- Router is forwarding DHCPOFFER or DHCPNAK broadcast on local LAN interface.
00:20:54: DHCPD: setting giaddr to 192.168.1.1.
!--- Router received DHCPDISCOVER/REQUEST/INFORM and set Gateway IP address to 192.168.1.1 for forwarding.
00:20:54: DHCPD: BOOTREQUEST from 0063.6973.636f.2d30.3065.302e.3165.6632.2e63..
!--- BOOTREQUEST includes DHCPDISCOVER, DHCPREQUEST, and DHCPINFORM.
!--- 0063.6973.636f.2d30.3065.302e.3165.6632.2e63 indicates client identifier.
00:20:54: DHCPD: forwarding BOOTREPLY to client 00e0.1ef2.c441.
!--- BOOTREPLY includes DHCPOFFER and DHCPNAK.
!--- Client's MAC address is 00e0.1ef2.c441.
00:20:54: DHCPD: broadcasting BOOTREPLY to client 00e0.1ef2.c441.
!--- Router is forwarding DHCPOFFER or DHCPNAK broadcast on local LAN interface.
同時執行多個偵錯
當同時運行多個調試時,可以發現有關DHCP/BootP中繼代理和伺服器運行的大量資訊。如果使用前面的大綱進行故障排除,則可以推斷出DHCP/BootP中繼代理功能無法正常運行的位置。
IP: s=0.0.0.0 (Ethernet0), d=255.255.255.255, len 604, rcvd 2
UDP src=68, dst=67
UDP: rcvd src=0.0.0.0(68), dst=255.255.255.255(67), length=584
DHCPD: setting giaddr to 192.168.1.1.
UDP: sent src=192.168.1.1(67), dst=192.168.2.2(67), length=604
IP: s=192.168.1.1 (local), d=192.168.2.2 (Ethernet1), len 604, sending
UDP src=67, dst=67
DHCPD: BOOTREQUEST from 0063.6973.636f.2d30.3030.302e.3030.3030.2e30.3030.312d.4574.30 forwarded to 192.168.2.2.
IP: s=192.168.2.2 (Ethernet1), d=192.168.1.1, len 328, rcvd 4
UDP src=67, dst=67
UDP: rcvd src=192.168.2.2(67), dst=192.168.1.1(67), length=308
DHCPD: forwarding BOOTREPLY to client 0000.0000.0001.
DHCPD: broadcasting BOOTREPLY to client 0000.0000.0001.
UDP: sent src=0.0.0.0(67), dst=255.255.255.255(68), length=328
IP: s=0.0.0.0 (Ethernet0), d=255.255.255.255, len 604, rcvd 2
UDP src=68, dst=67
UDP: rcvd src=0.0.0.0(68), dst=255.255.255.255(67), length=584
DHCPD: setting giaddr to 192.168.1.1.
UDP: sent src=192.168.1.1(67), dst=192.168.2.2(67), length=604
IP: s=192.168.1.1 (local), d=192.168.2.2 (Ethernet1), len 604, sending
UDP src=67, dst=67
DHCPD: BOOTREQUEST from 0063.6973.636f.2d30.3030.302e.3030.3030.2e30.3030.312d.4574.30 forwarded to 192.168.2.2.
IP: s=192.168.2.2 (Ethernet1), d=192.168.1.1, len 328, rcvd 4
UDP src=67, dst=67
UDP: rcvd src=192.168.2.2(67), dst=192.168.1.1(67), length=308
DHCPD: forwarding BOOTREPLY to client 0000.0000.0001.
DHCPD: broadcasting BOOTREPLY to client 0000.0000.0001.
UDP: sent src=0.0.0.0(67), dst=255.255.255.255(68), length=328.
獲取嗅探器蹤跡並確定DHCP問題的根本原因
檢視解碼同一LAN段上的DHCP客戶端和伺服器的嗅探器蹤跡和解碼由配置為DHCP中繼代理的路由器分隔的DHCP客戶端和伺服器的嗅探器蹤跡部分
解密DHCP資料包跟蹤。
有關如何使用Catalyst交換機上的交換埠分析器(SPAN)功能獲取嗅探器蹤跡的資訊,請參閱配置Catalyst交換埠分析器(SPAN)配置示例。
路由器上使用調試進行資料包解碼的備選方法
透過在思科路由器上使用debug ip packet detail dump <acl>命令,可以在系統日誌或命令列介面(CLI)中以十六進位制形式顯示完整的資料包。複習上述使用debug命令驗證路由器是否接收DHCP請求和使用debug命令驗證路由器接收DHCP請求並將請求轉發到DHCP伺服器部分以及增加到訪問清單中的dump關鍵字可獲取相同的調試資訊,但資料包的詳細資訊是以十六進位制格式顯示的。要確定資料包的內容,需要轉換該資料包。附錄A給出了一個示例。
附錄A:Cisco IOS DHCP示例配置
DHCP伺服器資料庫以樹的形式組織。樹根是自然網路的地址池,分支是子網地址池,而枝葉是到客戶端的手動繫結。子網繼承網路引數,客戶端繼承子網引數。因此,通用引數(例如域名)必須在樹的最高(網路或子網)級別配置。
有關如何配置DHCP及與其關聯的命令的詳細資訊,請參閱DHCP配置任務清單。
version 12.1 ! service timestamps debug uptime service timestamps log uptime no service password-encryption ! hostname Router ! enable password cisco ip subnet-zero no ip domain-lookup ip dhcp excluded-address 10.10.1.1 10.10.1.199 !--- Address range excluded from DHCP pools. ip dhcp pool test_dhcp !--- DHCP pool (scope) name is test_dhcp. network 10.10.1.0 255.255.255.0 !--- DHCP pool (address will be assigned in this range) for associated Gateway IP address. default-router 10.10.1.1 !--- DHCP option for default gateway. dns-server 10.30.1.1 !--- DHCP option for DNS server(s). netbios-name-server 10.40.1.1 !--- DHCP option for NetBIOS name server(s) (WINS). lease 0 0 1 !--- Lease time. interface Ethernet0 description DHCP Client Network ip address 10.10.1.1 255.255.255.0 no ip directed-broadcast ! interface Ethernet1 description Server Network ip address 10.10.2.1 255.255.255.0 no ip directed-broadcast ! line con 0 transport input none line aux 0 transport input all line vty 0 4 login ! end |
註:請注意,命令subnet prefix-length對DHCP池的正常運行不是必需的。此命令的使用重點針對需要子網分配池的情況,有關此命令的詳細資訊,請參閱配置DHCP伺服器按需地址池管理器文檔中的子網分配伺服器操作部分。
相關資訊
修訂 | 發佈日期 | 意見 |
---|---|---|
2.0 |
22-Sep-2023 |
重新認證 |
1.0 |
07-Feb-2014 |
初始版本 |