DHCP 客户端未从 DHCP 服务器获取 IPv4 地址

DHCP 客户端未从 DHCP 服务器获取 IPv4 地址

我在 VirtualBox 中的虚拟机上配置了 DHCP 服务器。这台机器有 2 个网络适配器,enp0s3- NAT(我的网络连接来自此)和enp0s8- 内部网络 (intnet)。DHCP 服务器正在监听enp0s8接口。

配置:

    /etc/dhcp/dhcpd.conf   

option domain-name "sth.com";
option domain-name-servers ns1.sth.com, ns2.sth.com;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;

subnet 10.0.3.0 netmask 255.255.255.0 {
range 10.0.3.20 10.0.3.30;
option domain-name-servers ns1.internal.sth.com;
option domain-name "internal.sth.com";
option routers 10.0.3.9;
option broadcast-address 10.0.3.255;
default-lease-time 600;
max-lease-time 7200;
}

/etc/sysconfig/dhcpd
DHCPDARGS=enp0s8

/etc/sysconfig/network-scripts/ifcfg-enp0s8
TYPE=Ethernet
BOOTPRO=static
NETWORK=10.0.3.0
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s8
DEVICE=enp0s8
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.0.3.9
PREFIX=24
IPV6INIT=no

此后,我启动了 DHCP 服务器:

      Active: active (running) since Wed 2016-04-27 15:00:50 EEST; 16min ago
     Docs: man:dhcpd(8)
           man:dhcpd.conf(5)
 Main PID: 863 (dhcpd)
   Status: "Dispatching packets..."
   CGroup: /system.slice/dhcpd.service
           └─863 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid

Apr 27 15:00:50 localhost.localdomain dhcpd[863]: Sending on   LPF/enp0s8/08:00:27:e6:ef:ca/10.0.3.0/24
Apr 27 15:00:50 localhost.localdomain dhcpd[863]: 
Apr 27 15:00:50 localhost.localdomain dhcpd[863]: No subnet declaration for enp0s3 (10.0.2.15).
Apr 27 15:00:50 localhost.localdomain dhcpd[863]: ** Ignoring requests on enp0s3.  If this is not what
Apr 27 15:00:50 localhost.localdomain dhcpd[863]:    you want, please write a subnet declaration
Apr 27 15:00:50 localhost.localdomain dhcpd[863]:    in your dhcpd.conf file for the network segment
Apr 27 15:00:50 localhost.localdomain dhcpd[863]:    to which interface enp0s3 is attached. **
Apr 27 15:00:50 localhost.localdomain dhcpd[863]: 
Apr 27 15:00:50 localhost.localdomain dhcpd[863]: Sending on   Socket/fallback/fallback-net
Apr 27 15:00:50 localhost.localdomain systemd[1]: Started DHCPv4 Server Daemon.

我安装了另一台虚拟机,它将用作 DHCP 客户端。在/etc/sysconfig/network-scripts/ifcfg-enp0s8文件中,我写了以下几行:

DEVICE=enp0s8
BOOTPRO=dhcp
NAME=enp0s8
ONBOOT=yes

之后,我重新启动了客户端机器上的网络:systemctl restart network 但是,客户端机器没有enp0s8从我在中指定的范围中获取接口的 IP dhcpd.conf

有人可以解释一下我,我做错了什么吗?

相关内容