我有一个带有无线和有线networking端口的Cent0S 7 miniPC。 无线端口(wlp3s0)作为DHCP客户端与192.168.10.X寻址连接,并具有DNSparsing。
我正在尝试将有线端口(enp2s0)设置为具有192.168.100.X寻址的私有子网的DHCP服务器。 miniPC将连接到一个networking交换机,它将连接其他客户端设备进行testing。
我按照RedHat的指示在这里开球。
我的/etc/systemd/system/dhcpd.service如下:
[Unit] Description=DHCPv4 Server Daemon Documentation=man:dhcpd(8) man:dhcpd.conf(5) Wants=network-online.target After=network-online.target After=time-sync.target [Service] Type=notify ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid enp2s0 [Install] WantedBy=multi-user.target
而我的/etc/dhcp/dhcpd.conf如下:
default-lease-time 600; max-lease-time 7200; authoritative; subnet 192.168.100.0 netmask 255.255.255.0 { option routers 192.168.100.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.100.255; range 192.168.100.10 192.168.100.100; }
当我去configuration和启动服务:
sudo systemctl --system daemon-reload sudo systemctl restart dhcpd.service
我得到这在/var/log/messages :
localhost systemd: Starting DHCPv4 Server Daemon... localhost dhcpd: Internet Systems Consortium DHCP Server 4.2.5 localhost dhcpd: Copyright 2004-2013 Internet Systems Consortium. localhost dhcpd: All rights reserved. localhost dhcpd: For info, please visit https://www.isc.org/software/dhcp/ localhost dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file localhost dhcpd: Wrote 0 leases to leases file. localhost dhcpd: localhost dhcpd: No subnet declaration for enp2s0 (no IPv4 addresses). localhost dhcpd: ** Ignoring requests on enp2s0. If this is not what localhost dhcpd: you want, please write a subnet declaration localhost dhcpd: in your dhcpd.conf file for the network segment localhost dhcpd: to which interface enp2s0 is attached. ** localhost dhcpd: localhost dhcpd: localhost dhcpd: Not configured to listen on any interfaces! localhost dhcpd: localhost dhcpd: This version of ISC DHCP is based on the release available localhost dhcpd: on ftp.isc.org. Features have been added and other changes localhost dhcpd: have been made to the base software release in order to make localhost dhcpd: it work better with this distribution. localhost dhcpd: localhost dhcpd: Please report for this software via the CentOS Bugs Database: localhost dhcpd: http://bugs.centos.org/ localhost dhcpd: localhost dhcpd: exiting. localhost systemd: dhcpd.service: main process exited, code=exited, status=1/FAILURE localhost systemd: Failed to start DHCPv4 Server Daemon. localhost systemd: Unit dhcpd.service entered failed state. localhost systemd: dhcpd.service failed.
任何想法这里怎么了?
谢谢。
您的第二个接口(enp2s0)没有IP地址。 设置他的地址从定义的networking – ip addr add 192.168.100.1/24 dev enp2s0 ,然后再次运行DHCP服务。 该接口的IP地址必须是静态的。
在/ etc / sysconfig / network-scripts / ifcfg-enp2s0中将静态IP地址192.168.100.1configuration为enp2s0接口。