Pxeboot:客户端未从 DHCP 服务器获取 IP 地址

Pxeboot:客户端未从 DHCP 服务器获取 IP 地址

我正在研究 Pxeboot。我有一个 Ubuntu 系统作为 KVM,并在该系统中安装了虚拟机管理器。

我也在虚拟机中安装了Ubuntu。

在启动虚拟机之前,我连接了虚拟网络接口。

Source device: Host device eth0:macvtap
Device model : Hypervisor default
Mac Address  : 00:22:11:01:22:55
Source mode  : private

我在虚拟机中安装了 DHCP 服务器:

# apt-get install isc-dhcp-server

并在文件中配置dhcpd.conf

allow booting;
allow bootp;

filename "pxelinux.0"

subnet 10.5.5.0 netmask 255.255.255.0 {
  range 10.5.5.5 10.5.5.100;
  option domain-name-servers ns1.testworld.local.net;
  option domain-name "testworld.local.net";
  option routers 10.5.5.1;
  option broadcast-address 10.5.5.254;
  default-lease-time 600;
  max-lease-time 7200;
 }

host pxebootserver {
  hardware ethernet 00:22:11:01:22:55      
  fixed-address 10.5.5.1
 }

当我重新启动 isc-dhcp-server 时,我在系统日志中收到以下错误:

Jul  2 20:06:19 ubuntu dhcpd: Wrote 0 leases to leases file.
Jul  2 20:06:19 ubuntu dhcpd: 
Jul  2 20:06:19 ubuntu dhcpd: No subnet declaration for eth0 (no IPv4 addresses).
Jul  2 20:06:19 ubuntu dhcpd: ** Ignoring requests on eth0.  If this is not what
Jul  2 20:06:19 ubuntu dhcpd:    you want, please write a subnet declaration
Jul  2 20:06:19 ubuntu dhcpd:    in your dhcpd.conf file for the network segment
Jul  2 20:06:19 ubuntu dhcpd:    to which interface eth0 is attached. **
Jul  2 20:06:19 ubuntu dhcpd: 
Jul  2 20:06:19 ubuntu dhcpd: 
Jul  2 20:06:19 ubuntu dhcpd: Not configured to listen on any interfaces!
Jul  2 20:10:26 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
Jul  2 20:10:35 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 21
Jul  2 20:10:56 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12
Jul  2 20:11:08 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 17
Jul  2 20:11:25 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 10
Jul  2 20:11:35 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12
Jul  2 20:11:47 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 16
Jul  2 20:12:03 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
Jul  2 20:12:14 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
Jul  2 20:12:23 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 11
Jul  2 20:12:34 ubuntu dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
Jul  2 20:12:37 ubuntu dhclient: No DHCPOFFERS received.
Jul  2 20:12:37 ubuntu dhclient: No working leases in persistent database - sleeping.

即使客户端也无法发现 dhcp 服务器。

我必须在客户端 VM 中启用哪个虚拟网络适配器?

答案1

第一个问题是KVM可能会用来dnsmasq提供地址。地址范围在网络定义中配置。无需安装您自己的 DHCP 服务器。

默认情况下,可能isc-dhcp-server会尝试监听 a 。eth0在 Internet 接口上有一个点对点地址并不罕见(通常eth0)。如果不是,则可能使用192.168.0.0/16路由器提供的地址范围内的地址。

我使用桥接设备上的固定地址配置虚拟机,该设备未连接到任何外部接口。但是,如果您确实有路由器,您可能需要配置您的KVM网桥以包含eth0.

相关内容