因此,据我了解,所有 DHCP/BOOTP REQUEST 数据包都应该被广播(255.255.255.255),因为这是与没有 IP 地址的 LAN 上的主机来回通信的唯一方法。我从一个 PCAP 文件(粘贴在下面)中获得了一些信息,我在该文件中断开了一台机器与网络(主机名 debian2)的连接,然后重新连接了它。我使用的防火墙/DHCP 服务器是 pfSense。这一切都发生在仅 Virtualbox 主机的网络中(该虚拟网络关闭了 DHCP - 唯一做 DHCP 的是 pfSense)。
我注意到在 Offer 和 Ack 中,目标 IP 地址都是 pfSense 提供给 debian2 (192.168.1.10) 的地址。如果 debian2 不应该为自己配置提供的 IP 地址,它到底是如何接收该数据包的?为什么 pfSense 不广播(发送到 255.255.255.255),如果目标 IP 地址尚未配置为使用,debian2 如何接收它?pfSense 是否只是使用以太网和客户端的 MAC 地址,所以指定的目标 IP 地址并不重要?
框架摘要:
43 19.808108 0.0.0.0 255.255.255.255 DHCP 344 DHCP Discover - Transaction ID 0x1caf7b43
48 20.810107 192.168.1.1 192.168.1.10 DHCP 344 DHCP Offer - Transaction ID 0x1caf7b43
49 20.810864 0.0.0.0 255.255.255.255 DHCP 344 DHCP Request - Transaction ID 0x1caf7b43
50 20.812807 192.168.1.1 192.168.1.10 DHCP 344 DHCP ACK - Transaction ID 0x1caf7b43
框架细节:
Frame 43: 344 bytes on wire (2752 bits), 344 bytes captured (2752 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Discover)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x1caf7b43
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: PcsCompu_82:09:fa (08:00:27:82:09:fa)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Discover)
Length: 1
DHCP: Discover (1)
Option: (50) Requested IP Address
Length: 4
Requested IP Address: 192.168.1.8
Option: (12) Host Name
Length: 7
Host Name: debian2
Option: (55) Parameter Request List
Length: 13
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (2) Time Offset
Parameter Request List Item: (3) Router
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (119) Domain Search
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (47) NetBIOS over TCP/IP Scope
Parameter Request List Item: (26) Interface MTU
Parameter Request List Item: (121) Classless Static Route
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (255) End
Option End: 255
Padding: 000000000000000000000000000000000000000000000000...
Frame 48: 344 bytes on wire (2752 bits), 344 bytes captured (2752 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 192.168.1.10
User Datagram Protocol, Src Port: 67, Dst Port: 68
Bootstrap Protocol (Offer)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x1caf7b43
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
Client IP address: 0.0.0.0
Your (client) IP address: 192.168.1.10
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: PcsCompu_82:09:fa (08:00:27:82:09:fa)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Offer)
Length: 1
DHCP: Offer (2)
Option: (54) DHCP Server Identifier
Length: 4
DHCP Server Identifier: 192.168.1.1
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (61s) 1 minute, 1 second
Option: (1) Subnet Mask
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 192.168.1.1
Option: (15) Domain Name
Length: 9
Domain Name: me.net
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 192.168.1.1
Option: (255) End
Option End: 255
Padding: 000000000000000000000000000000
Frame 49: 344 bytes on wire (2752 bits), 344 bytes captured (2752 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Request)
Message type: Boot Request (1)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x1caf7b43
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
Client IP address: 0.0.0.0
Your (client) IP address: 0.0.0.0
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: PcsCompu_82:09:fa (08:00:27:82:09:fa)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (Request)
Length: 1
DHCP: Request (3)
Option: (54) DHCP Server Identifier
Length: 4
DHCP Server Identifier: 192.168.1.1
Option: (50) Requested IP Address
Length: 4
Requested IP Address: 192.168.1.10
Option: (12) Host Name
Length: 7
Host Name: debian2
Option: (55) Parameter Request List
Length: 13
Parameter Request List Item: (1) Subnet Mask
Parameter Request List Item: (28) Broadcast Address
Parameter Request List Item: (2) Time Offset
Parameter Request List Item: (3) Router
Parameter Request List Item: (15) Domain Name
Parameter Request List Item: (6) Domain Name Server
Parameter Request List Item: (119) Domain Search
Parameter Request List Item: (12) Host Name
Parameter Request List Item: (44) NetBIOS over TCP/IP Name Server
Parameter Request List Item: (47) NetBIOS over TCP/IP Scope
Parameter Request List Item: (26) Interface MTU
Parameter Request List Item: (121) Classless Static Route
Parameter Request List Item: (42) Network Time Protocol Servers
Option: (255) End
Option End: 255
Padding: 0000000000000000000000000000000000000000
Frame 50: 344 bytes on wire (2752 bits), 344 bytes captured (2752 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 192.168.1.10
User Datagram Protocol, Src Port: 67, Dst Port: 68
Bootstrap Protocol (ACK)
Message type: Boot Reply (2)
Hardware type: Ethernet (0x01)
Hardware address length: 6
Hops: 0
Transaction ID: 0x1caf7b43
Seconds elapsed: 0
Bootp flags: 0x0000 (Unicast)
Client IP address: 0.0.0.0
Your (client) IP address: 192.168.1.10
Next server IP address: 0.0.0.0
Relay agent IP address: 0.0.0.0
Client MAC address: PcsCompu_82:09:fa (08:00:27:82:09:fa)
Client hardware address padding: 00000000000000000000
Server host name not given
Boot file name not given
Magic cookie: DHCP
Option: (53) DHCP Message Type (ACK)
Length: 1
DHCP: ACK (5)
Option: (54) DHCP Server Identifier
Length: 4
DHCP Server Identifier: 192.168.1.1
Option: (51) IP Address Lease Time
Length: 4
IP Address Lease Time: (61s) 1 minute, 1 second
Option: (1) Subnet Mask
Length: 4
Subnet Mask: 255.255.255.0
Option: (3) Router
Length: 4
Router: 192.168.1.1
Option: (15) Domain Name
Length: 9
Domain Name: me.net
Option: (6) Domain Name Server
Length: 4
Domain Name Server: 192.168.1.1
Option: (255) End
Option End: 255
Padding: 000000000000000000000000000000