Dhcp

PXE 引導期間未找到 DHCP 伺服器

  • June 20, 2016

我正在嘗試執行 PXE 伺服器並遇到“PXE-E51:未收到 DHCP 或 proxyDHCP 提供”錯誤,這通常意味著

PXE 客戶端未收到對其 DHCPDISCOVER 消息的回复。此問題的可能原因是:

  1. 沒有 DHCP 或 BOOT 伺服器
  2. DHCP 或 BOOTP 伺服器未執行
  3. DHCP 或 BOOTP 伺服器未配置為為您的 PXE 客戶端提供服務
  4. DHCP 或 BOOTP 伺服器位於不同的子網中,並且沒有 DHCP 或 BOOTP 轉發機制生效

我的設置和配置非常接近ServerFault 上類似問題中指定的設置和配置;不同之處在於,與問題的作者不同,我DHCPDISCOVER在 DHCP 伺服器的日誌中絕對看不到任何內容,並且dhcpdump -i eth0什麼也沒有顯示。

當我嘗試使用另一台機器啟動時,我在日誌中看到DHCPDISCOVERDHCPOFFER條目,並且機器開始查詢 TFTP。當我通過 PXE 引導虛擬機時,也會發生同樣的事情。

我相信這意味著交換機不會阻止 DHCP 流量(另外,DHCP Snooping 已禁用)。這也意味著防火牆配置正確(可以肯定的是,我禁用了主機和 DHCP 伺服器上的防火牆)。

如果我斷開真機與交換機的連接,PXE 引導明確表明連接有問題,因此這不應該是乙太網電纜的問題。

這排除了前三個可能的原因。至於第四個,我不確定我應該檢查什麼。交換機、路由器、主機和 DHCP 伺服器的廣播和網路遮罩值相同。

這看起來很像STP 問題,但交換機上禁用了 STP。

我還需要檢查什麼?


將埠鏡像配置為將 Tx/Rx 鏡像到開發機器使用的埠,dhcpdump顯示如下:

 TIME: 2016-06-08 22:34:12.722
   IP: 0.0.0.0 (0:0:0:0:0:0) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: 01000000
 SECS: 4
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 24) Parameter Request List      1 (Subnet mask)
                         2 (Time offset)
                         3 (Routers)
                         5 (Name server)
                         6 (DNS server)
                        11 (Resource location server)
                        12 (Host name)
                        13 (Boot file size)
                        15 (Domainname)
                        16 (Swap server)
                        17 (Root path)
                        18 (Extensions path)
                        43 (Vendor specific info)
                        54 (Server identifier)
                        60 (Vendor class identifier)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       
OPTION:  57 (  2) Maximum DHCP message size 1260
OPTION:  97 ( 17) UUID/GUID                 0000020003000400 ........
                       0500060007000800 ........
                       09               .
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:34:14.724
   IP: 0.0.0.0 (0:0:0:0:0:0) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: 02000000
 SECS: 6
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 24) Parameter Request List      1 (Subnet mask)
                         2 (Time offset)
                         3 (Routers)
                         5 (Name server)
                         6 (DNS server)
                        11 (Resource location server)
                        12 (Host name)
                        13 (Boot file size)
                        15 (Domainname)
                        16 (Swap server)
                        17 (Root path)
                        18 (Extensions path)
                        43 (Vendor specific info)
                        54 (Server identifier)
                        60 (Vendor class identifier)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       
OPTION:  57 (  2) Maximum DHCP message size 1260
OPTION:  97 ( 17) UUID/GUID                 0000020003000400 ........
                       0500060007000800 ........
                       09               .
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:34:18.729
   IP: 0.0.0.0 (0:0:0:0:0:0) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: 03000000
 SECS: 10
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 24) Parameter Request List      1 (Subnet mask)
                         2 (Time offset)
                         3 (Routers)
                         5 (Name server)
                         6 (DNS server)
                        11 (Resource location server)
                        12 (Host name)
                        13 (Boot file size)
                        15 (Domainname)
                        16 (Swap server)
                        17 (Root path)
                        18 (Extensions path)
                        43 (Vendor specific info)
                        54 (Server identifier)
                        60 (Vendor class identifier)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       
OPTION:  57 (  2) Maximum DHCP message size 1260
OPTION:  97 ( 17) UUID/GUID                 0000020003000400 ........
                       0500060007000800 ........
                       09               .
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:34:26.739
   IP: 0.0.0.0 (0:0:0:0:0:0) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: 04000000
 SECS: 18
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 24) Parameter Request List      1 (Subnet mask)
                         2 (Time offset)
                         3 (Routers)
                         5 (Name server)
                         6 (DNS server)
                        11 (Resource location server)
                        12 (Host name)
                        13 (Boot file size)
                        15 (Domainname)
                        16 (Swap server)
                        17 (Root path)
                        18 (Extensions path)
                        43 (Vendor specific info)
                        54 (Server identifier)
                        60 (Vendor class identifier)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       
OPTION:  57 (  2) Maximum DHCP message size 1260
OPTION:  97 ( 17) UUID/GUID                 0000020003000400 ........
                       0500060007000800 ........
                       09               .
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:34:42.759
   IP: 0.0.0.0 (0:0:0:0:0:0) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: 05000000
 SECS: 34
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 24) Parameter Request List      1 (Subnet mask)
                         2 (Time offset)
                         3 (Routers)
                         5 (Name server)
                         6 (DNS server)
                        11 (Resource location server)
                        12 (Host name)
                        13 (Boot file size)
                        15 (Domainname)
                        16 (Swap server)
                        17 (Root path)
                        18 (Extensions path)
                        43 (Vendor specific info)
                        54 (Server identifier)
                        60 (Vendor class identifier)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       
OPTION:  57 (  2) Maximum DHCP message size 1260
OPTION:  97 ( 17) UUID/GUID                 0000020003000400 ........
                       0500060007000800 ........
                       09               .
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:35:14.817
   IP: 0.0.0.0 (0:0:0:0:0:0) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: 06000000
 SECS: 66
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 24) Parameter Request List      1 (Subnet mask)
                         2 (Time offset)
                         3 (Routers)
                         5 (Name server)
                         6 (DNS server)
                        11 (Resource location server)
                        12 (Host name)
                        13 (Boot file size)
                        15 (Domainname)
                        16 (Swap server)
                        17 (Root path)
                        18 (Extensions path)
                        43 (Vendor specific info)
                        54 (Server identifier)
                        60 (Vendor class identifier)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       
OPTION:  57 (  2) Maximum DHCP message size 1260
OPTION:  97 ( 17) UUID/GUID                 0000020003000400 ........
                       0500060007000800 ........
                       09               .
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:36:18.800
   IP: 0.0.0.0 (0:0:0:0:0:0) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: 07000000
 SECS: 130
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  55 ( 24) Parameter Request List      1 (Subnet mask)
                         2 (Time offset)
                         3 (Routers)
                         5 (Name server)
                         6 (DNS server)
                        11 (Resource location server)
                        12 (Host name)
                        13 (Boot file size)
                        15 (Domainname)
                        16 (Swap server)
                        17 (Root path)
                        18 (Extensions path)
                        43 (Vendor specific info)
                        54 (Server identifier)
                        60 (Vendor class identifier)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       
OPTION:  57 (  2) Maximum DHCP message size 1260
OPTION:  97 ( 17) UUID/GUID                 0000020003000400 ........
                       0500060007000800 ........
                       09               .
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
---------------------------------------------------------------------------

相比之下,以下是虛擬機從 PXE 成功引導時的轉儲:

 TIME: 2016-06-08 22:43:33.301
   IP: 0.0.0.0 (52:54:0:7c:82:35) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: e5cf9a4f
 SECS: 4
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 52:54:00:7c:82:35:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  57 (  2) Maximum DHCP message size 1472
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
OPTION:  77 (  4) User-class Identification 69505845         iPXE
OPTION:  55 ( 21) Parameter Request List      1 (Subnet mask)
                         3 (Routers)
                         6 (DNS server)
                         7 (Log server)
                        12 (Host name)
                        15 (Domainname)
                        17 (Root path)
                        43 (Vendor specific info)
                        60 (Vendor class identifier)
                        66 (TFTP server name)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       175 (???)
                       203 (???)
                       
OPTION: 175 ( 48) ???                       b1050110ec813918 ......9.
                       0101220101190101 ..".....
                       210101100102eb03 !.......
                       0100001301011401 ........
                       0111010117010115 ........
                       0101270101120101 ..'.....                 
OPTION:  61 (  7) Client-identifier         01:52:54:00:7c:82:35
OPTION:  97 ( 17) UUID/GUID                 00b818a0926b2af5 .....k*.
                       e854b1abacc0fd2d .T.....-
                       ba               .
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:43:34.302
   IP: 0.0.0.0 (52:54:0:7c:82:35) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: e5cf9a4f
 SECS: 8
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 52:54:00:7c:82:35:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         1 (DHCPDISCOVER)
OPTION:  57 (  2) Maximum DHCP message size 1472
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
OPTION:  77 (  4) User-class Identification 69505845         iPXE
OPTION:  55 ( 21) Parameter Request List      1 (Subnet mask)
                         3 (Routers)
                         6 (DNS server)
                         7 (Log server)
                        12 (Host name)
                        15 (Domainname)
                        17 (Root path)
                        43 (Vendor specific info)
                        60 (Vendor class identifier)
                        66 (TFTP server name)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       175 (???)
                       203 (???)
                       
OPTION: 175 ( 48) ???                       b1050110ec813918 ......9.
                       0101220101190101 ..".....
                       210101100102eb03 !.......
                       0100001301011401 ........
                       0111010117010115 ........
                       0101270101120101 ..'.....                 
OPTION:  61 (  7) Client-identifier         01:52:54:00:7c:82:35
OPTION:  97 ( 17) UUID/GUID                 00b818a0926b2af5 .....k*.
                       e854b1abacc0fd2d .T.....-
                       ba               .
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:43:34.302
   IP: 192.168.1.40 (52:54:0:ed:3d:b7) > 192.168.1.249 (52:54:0:7c:82:35)
   OP: 2 (BOOTPREPLY)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: e5cf9a4f
 SECS: 4
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 192.168.1.249
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 52:54:00:7c:82:35:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: pxelinux.0.
OPTION:  53 (  1) DHCP message type         2 (DHCPOFFER)
OPTION:  54 (  4) Server identifier         192.168.1.40
OPTION:  51 (  4) IP address leasetime      43200 (12h)
OPTION:   1 (  4) Subnet mask               255.255.254.0
OPTION:   3 (  4) Routers                   192.168.1.1
OPTION:   6 (  8) DNS server                192.168.1.3,192.168.1.4
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:43:36.405
   IP: 0.0.0.0 (52:54:0:7c:82:35) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
   OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: e5cf9a4f
 SECS: 14
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 52:54:00:7c:82:35:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION:  53 (  1) DHCP message type         3 (DHCPREQUEST)
OPTION:  57 (  2) Maximum DHCP message size 1472
OPTION:  93 (  2) Client System             0000             ..
OPTION:  94 (  3) Client NDI                010201           ...
OPTION:  60 ( 32) Vendor class identifier   PXEClient:Arch:00000:UNDI:002001
OPTION:  77 (  4) User-class Identification 69505845         iPXE
OPTION:  55 ( 21) Parameter Request List      1 (Subnet mask)
                         3 (Routers)
                         6 (DNS server)
                         7 (Log server)
                        12 (Host name)
                        15 (Domainname)
                        17 (Root path)
                        43 (Vendor specific info)
                        60 (Vendor class identifier)
                        66 (TFTP server name)
                        67 (Bootfile name)
                       128 (???)
                       129 (???)
                       130 (???)
                       131 (???)
                       132 (???)
                       133 (???)
                       134 (???)
                       135 (???)
                       175 (???)
                       203 (???)
                       
OPTION: 175 ( 48) ???                       b1050110ec813918 ......9.
                       0101220101190101 ..".....
                       210101100102eb03 !.......
                       0100001301011401 ........
                       0111010117010115 ........
                       0101270101120101 ..'.....                 
OPTION:  61 (  7) Client-identifier         01:52:54:00:7c:82:35
OPTION:  97 ( 17) UUID/GUID                 00b818a0926b2af5 .....k*.
                       e854b1abacc0fd2d .T.....-
                       ba               .
OPTION:  54 (  4) Server identifier         192.168.1.40
OPTION:  50 (  4) Request IP address        192.168.1.249
---------------------------------------------------------------------------

 TIME: 2016-06-08 22:43:36.405
   IP: 192.168.1.40 (52:54:0:ed:3d:b7) > 192.168.1.249 (52:54:0:7c:82:35)
   OP: 2 (BOOTPREPLY)
HTYPE: 1 (Ethernet)
 HLEN: 6
 HOPS: 0
  XID: e5cf9a4f
 SECS: 14
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 192.168.1.249
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 52:54:00:7c:82:35:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: pxelinux.0.
OPTION:  53 (  1) DHCP message type         5 (DHCPACK)
OPTION:  54 (  4) Server identifier         192.168.1.40
OPTION:  51 (  4) IP address leasetime      43200 (12h)
OPTION:   1 (  4) Subnet mask               255.255.254.0
OPTION:   3 (  4) Routers                   192.168.1.1
OPTION:   6 (  8) DNS server                192.168.1.3,192.168.1.4
---------------------------------------------------------------------------

中的相關行dhcpdump是:

CHADDR: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

主機板出現故障,導致PXE啟動時缺少MAC地址。反過來,這意味著DHCPDISCOVER來自客戶端電腦的所有請求都是在沒有有效的情況下發送的CHADDR,因此從未到達 DHCP 伺服器,因為我實際上並不理解(我會理解它們是否會到達 DHCP 伺服器,但是伺服器將決定不回复)。

強制寫入MAC地址解決了這個問題。

引用自:https://serverfault.com/questions/782763