I have a Cent0S 7 miniPC with a wireless and wired network ports. The wireless port (wlp3s0) is connected as a DHCP client with 192.168.10.X addressing and has DNS resolution.
I'm trying to setup the wired port (enp2s0) as a DHCP server for a private subnet with 192.168.100.X addressing. The miniPC will be attached to a network switch which will have other client devices connected for testing.
I followed the directions from RedHat here to a tee.
My /etc/systemd/system/dhcpd.service
is as follows:
[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
And my /etc/dhcp/dhcpd.conf
is as follows:
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;
}
When I go to configure and start the service:
sudo systemctl --system daemon-reload
sudo systemctl restart dhcpd.service
I get this in /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.
Any idea what's going wrong here?
Thanks.
Your second interface (enp2s0) has no IP address. Set him up with address from defined network -
ip addr add 192.168.100.1/24 dev enp2s0
and then run dhcp service again. IP address of that interface have to be static.Configure enp2s0 interface with static ip address 192.168.100.1 in /etc/sysconfig/network-scripts/ifcfg-enp2s0 .
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Using_the_Command_Line_Interface.html