本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 RFP 文件使用的語言,或引用第三方產品的語言,因此本文件中可能會出現例外狀況。深入瞭解思科如何使用包容性用語。
思科已使用電腦和人工技術翻譯本文件,讓全世界的使用者能夠以自己的語言理解支援內容。請注意,即使是最佳機器翻譯,也不如專業譯者翻譯的內容準確。Cisco Systems, Inc. 對這些翻譯的準確度概不負責,並建議一律查看原始英文文件(提供連結)。
本文說明如何疑難排解 Cisco Catalyst 交換器網路中動態主機設定通訊協定 (DHCP) 的幾個常見問題。
本文件沒有特定先決條件。
本文件所述內容不限於特定軟體和硬體版本。
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
如需文件慣例的詳細資訊,請參閱思科技術提示慣例。
附註:只有已註冊的思科使用者端才能存取內部錯誤報告。
DHCP提供了一種機制,通過該機制,使用傳輸控制協定/網際網路協定(TCP/IP)的電腦可以通過網路自動獲取協定配置引數。DHCP是由Internet工程任務組(IETF)的動態主機配置工作組(Dynamic Host Configuration-Working Group,DHC-WG)開發的一種開放式標準。
DHCP基於客戶端 — 伺服器模式,其中DHCP客戶端(例如台式電腦)與DHCP伺服器聯絡以獲取配置引數。DHCP伺服器通常位於中心位置,由網路管理員操作。由於伺服器由網路管理員運行,因此DHCP客戶端可以可靠、動態地配置適合當前網路體系結構的引數。
大多數企業網路都包含多個子網,這些子網劃分為稱為虛擬LAN(VLAN)的子網路,在這些子網之間由路由器路由。由於預設情況下路由器不會傳遞廣播,因此每個子網都需要一台DHCP伺服器,除非路由器配置為使用DHCP中繼代理功能轉發DHCP廣播。
以下是DHCP的幾個關鍵概念:
DHCP客戶端最初沒有配置IP地址,因此必須傳送廣播請求以從DHCP伺服器獲取IP地址。
預設情況下,路由器不會轉發廣播。如果DHCP伺服器位於另一個廣播域(第3層(L3)網路)上,則需要滿足客戶端DHCP廣播請求。 這是使用DHCP中繼代理執行的。
DHCP中繼的Cisco路由器實施通過介面級ip helper命令提供
案例 1:DHCP使用者端和伺服器網路之間的Cisco路由器路由
如圖中所配置,介面Ethernet1通過介面Ethernet1將客戶端廣播的DHCPDISCOVER轉發到192.168.2.2。DHCP伺服器通過單播完成請求。本範例無需對路由器進行進一步的設定。
案例 2:採用L3模組在DHCP使用者端和伺服器網路之間路由的Cisco Catalyst交換器
如圖中所配置,介面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,因為客戶端沒有配置的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伺服器將租借儲存在其資料庫中,並用客戶端識別符號或機箱以及相關的IP地址唯一地標識租約。客戶端和伺服器都使用此識別符號組合來引用租用。客戶端識別符號是裝置的MAC地址加上介質型別。
在DHCP客戶端開始使用新地址之前,DHCP客戶端必須計算與租用地址關聯的時間引數,即租用時間(LT)、續訂時間(T1)和重新繫結時間(T2)。 典型的預設LT是72小時。如果需要,您可以使用更短的租用時間來節省地址。
如果選定的伺服器無法滿足DHCPREQUEST消息,則DHCP伺服器會使用DHCPNAK消息進行響應。當客戶端收到DHCPNAK消息或者沒有收到對DHCPREQUEST消息的響應時,客戶端在進入請求狀態時重新啟動配置進程。客戶端在60秒內至少重新傳輸DHCPREQUEST四次,然後才會重新啟動初始化狀態。
客戶端接收DHCPACK,並且可以選擇對引數執行最終檢查。當客戶端向DHCPACK中提供的IP地址傳送地址解析協定(ARP)請求時,將執行此過程。如果客戶端在接收到對ARP請求的回覆時檢測到該地址已在使用中,則客戶端向伺服器傳送DHCPDECLINE消息,並在請求狀態下重新啟動配置過程。
如果客戶端已通過某種其他方式獲得網路地址或具有手動配置的IP地址,客戶端工作站可以使用DHCPINFORM請求消息獲取其他本地配置引數,如域名和域名伺服器(DNS)。 當DHCP伺服器收到DHCPINFORM消息時,會使用適用於沒有新IP地址的客戶端的任何本地配置引數來構建DHCPACK消息。此DHCPACK以單播方式傳送到客戶端。
當DHCP客戶端向DHCP伺服器傳送DHCPRELEASE消息時,可以選擇放棄其對網路地址的租用。客戶端使用DHCPRELEASE消息中的client identifierfield和網路地址標識要釋放的租用。如果需要擴展當前DHCP地址池範圍,請刪除當前地址池,然後在DHCP地址池下指定新的IP地址範圍。要刪除特定IP地址或要位於DHCP池中的地址範圍,請使用命令ip dhcp excluded-address。
附註:如果裝置使用BOOTP,路由器的DHCP繫結中顯示無限長度的租約。
由於IP地址僅從伺服器租用,因此必須不時續租。租期過半時(T1=0.5 x LT),客戶端會嘗試續訂租期。客戶端進入Renewing狀態並向持有當前租約的伺服器傳送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。然後,客戶端將進入Initializing狀態並傳送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地址) | 網關IP地址,由DHCP/BootP中繼代理填寫。 |
chaddr | 16 | 客戶端MAC地址 | DHCP客戶端MAC地址。 |
sname | 64 | 伺服器名稱 | 可選的伺服器主機名。 |
檔案 | 128 | 啟動檔名 | 啟動檔名。 |
選項 | 變數 | 選項引數 | DHCP伺服器可以提供的可選引數。RFC 2132提供所有可能的選項。 |
封包說明 | 源MAC地址 | 目標MAC地址 | 來源IP位址 | 目標IP地址 |
---|---|---|---|---|
DHCPDISCOVER | 用戶端 | 廣播 | 0.0.0.0 | 255.255.255.255 |
DHCPOFFER | DHCP伺服器 | 廣播 | DHCP伺服器 | 255.255.255.255 |
DHCPREQUEST | 用戶端 | 廣播 | 0.0.0.0 | 255.255.255.255 |
DHCPACK | DHCP伺服器 | 廣播 | DHCP伺服器 | 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中繼代理還使用從客戶端接收DHCP消息的介面的IP地址填充Gateway IP address欄位。DHCP伺服器使用Gateway IP address欄位確定DHCPDISCOVER、DHCPREQUEST或DHCPINFORM消息源自的子網。
配置Cisco路由器轉發BootP或DHCP請求的過程非常簡單。您只需配置一個指向DHCP/BootP伺服器或伺服器所在網路的子網廣播地址的IP幫助地址。
網路範例:
要從客戶端向DHCP伺服器轉發BootP/DHCP請求,請使用ip helper-address interface 命令。可以將IP helper-address配置為根據UDP埠號轉發任何UDP廣播。預設情況下,IP幫助地址轉發以下UDP廣播:
簡單式檔案傳輸通訊協定(TFTP)(連線埠69)
DNS(埠53)、時間服務(埠37)
NetBIOS名稱伺服器(埠137)
NetBIOS資料包伺服器(埠138)
啟動協定(DHCP/BootP)客戶端和伺服器資料包(埠67和68)
終端存取控制存取控制系統(TACACS)服務(連線埠49)
IEN-116名稱服務(埠42)
IP helper-address可以將UDP廣播定向到單播或廣播IP地址。但是,由於可能發生大量廣播泛洪,請勿使用IP helper-address將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流量,因為DHCPDISCOVER、DHCPOFFER和DHCPREQUEST/DHCPDCDENY消息是在每對DHCP客戶端和伺服器之間交換的。
設定手動繫結有兩種方法:一個用於Windows主機,另一個用於非Windows主機。有兩個不同的命令可用於配置;一個用於Microsoft DHCP客戶端,另一個用於非Microsoft DHCP客戶端:DHCPclient-identifier (手動繫結 — Microsoft DHCP客戶端)和DHCPhardware-address (手動繫結 — 非Microsoft DHCP客戶端)。 使用兩個不同命令的原因是,運行Windows的PC會修改其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請求時,它會使用介面上配置的主IP的源地址將其轉發到DHCP伺服器(配置IP幫助地址時),以讓DHCP伺服器知道它必須在DHCP應答資料包中使用哪個IP池(用於客戶端)。
路由器無法知道DHCP廣播請求是否來自介面上配置的輔助IP網路上的裝置。作為解決方法,可以配置子介面配置(前提是連線到路由器的裝置支援dot1q標籤)來分隔兩個子網,以便這兩個子網都能正確獲得其對應的IP地址。
如果次要地址是首選方式,則還有另一種解決方法,即啟用全域性配置命令ip dhcp smart-relay。這有一個限制,即在連續三次請求主地址池後,如果DHCP伺服器沒有響應,則它僅使用輔助IP中繼DHCP請求。
另一種解決方法是將輔助子網移到需要遠端伺服器處理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地址填寫「網關IP地址」欄位,將源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地址填寫「網關IP地址」欄位,將源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)功能時,思科路由器可以捨棄來源位址為0.0.0.0且目的地位址為255.255.255的動態主機設定通訊協定(DHCP)和開機載入通訊協定(BOOTP)封包。路由器也可以捨棄介面上具有多點傳送IP目的地的所有IP封包。此問題已記錄在Cisco錯誤ID CSCdw31925
注意只有已註冊的思科客戶才能存取錯誤報告。
未使用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交換器上的連線埠進入errdisabled狀態。如需詳細資訊,請參閱Cisco IOS平台上的錯誤停用連線埠狀態復原,其中說明錯誤停用狀態、說明如何從中復原,並提供從此狀態復原的範例。
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 disabled和trunking/channel auto(如果適用)。若是2900XL/3500XL/2950/3550交換器,則STP portfast是唯一必需的組態。這些配置更改可解決初次安裝Catalyst交換機時最常見的DHCP客戶端問題。
如需更多有關在連線到Catalyst交換機時DHCP正常運行所需的交換機埠配置要求的文檔,請參閱使用Portfast和其他命令修復工作站啟動連線延遲。
在審閱該文檔後,您可以繼續排除這些問題。
如果Catalyst交換機配置正確,則可能導致導致DHCP問題的Catalyst交換機或DHCP客戶端NIC上存在軟體相容性問題。下一個故障排除步驟是複查疑難排解Cisco Catalyst交換器與NIC的相容性問題,並排除導致問題的Catalyst交換器或NIC的任何軟體問題。
需要瞭解DHCP客戶端作業系統以及特定NIC資訊(如製造商、型號和驅動程式版本),才能正確排除任何相容性問題。
當客戶端與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
不會顯示在配置中,而是預設配置命令。如果未啟用服務dhcp,客戶端將不會從DHCP伺服器接收IP地址。
附註:在執行舊版Cisco IOS的路由器中, ip bootp server 命令會處理DHCP中繼代理功能,而不是service dhcp 命令。因此,如果將ip helper-address 命令配置為轉發DHCP UDP廣播並正確充當代表DHCP客戶端的DHCP中繼代理,則需要在這些路由器中啟用ip bootp server 命令。
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 |
DHCP中繼代理資訊(選項82)功能使DHCP中繼代理(Catalyst交換機)能夠在DHCP客戶端向DHCP伺服器轉發DHCP請求時包含有關自身和所連線的客戶端的資訊。
DHCP伺服器可以使用此資訊為服務提供商網路的每個使用者分配IP地址、執行訪問控制、設定服務品質(QoS)和安全策略(或其他引數分配策略)。當在交換機上啟用DHCP監聽時,它將自動啟用選項82。如果未將DHCP伺服器配置為使用選項82處理資料包,則它將停止為該請求分配地址。為了解決此問題,請使用全域性配置命令no ip dhcp relay information option禁用交換機(中繼代理)中的使用者標識選項(82)。
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
當連線到Cisco IP電話的switchport禁用了Cisco Discovery Protocol(CDP)時,DHCP伺服器不能為電話分配適當的IP地址。DHCP伺服器傾向於分配屬於交換機埠的資料VLAN/子網的IP地址。如果啟用CDP,交換機可以檢測到Cisco IP電話請求DHCP,並且可以提供正確的子網資訊。然後DHCP伺服器可以從語音VLAN/子網池分配IP地址。將dhcp服務繫結到語音vlan不需要任何明確步驟。
在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中被丟棄。
當DHCP客戶端在DHCP資料包中設定廣播位時,DHCP伺服器和中繼代理會將DHCP消息傳送到具有全一廣播地址(255.255.255.255)的客戶端。 如果已將ip broadcast-address 命令配置為傳送網路廣播,則DHCP傳送的全一廣播將被覆蓋。要解決此問題,請使用ip dhcp limited-broadcast-address 命令確保已配置的網路廣播不會覆蓋預設的DHCP行為。
有些DHCP客戶端只能接受全一廣播,並且無法獲取DHCP地址,除非在與客戶端連線的路由器介面上配置了此命令。
使用debug命令檢驗路由器是否收到DHCP請求
在支援處理DHCP資料包的軟體的路由器上,您可以驗證路由器是否收到來自客戶端的DHCP請求。如果路由器沒有收到來自客戶端的請求,則DHCP進程將失敗。在此步驟中,配置訪問清單以調試輸出。此存取清單僅用於偵錯命令,對路由器沒有干擾作用。
在全域性配置模式下,輸入以下訪問清單:
access-list 100 permit ip host 0.0.0.0 host 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處理進行推斷。在exec模式下,輸入以下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)中可能會顯示以十六進位制表示的整個封包。 複查Verify Router Receives DHCP Request with debug Commands 和Verify Router Receives DHCP Request and Forwards to DHCP Server with debug Commands 部分,以及新增到訪問清單的dump關鍵字,可以獲得相同的調試資訊,但資料包詳細資訊以十六進位制表示。要確定資料包的內容,需要轉換資料包。附錄A中給出了一個示例。
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 |
初始版本 |