I configured a DHCP server on a VM in VirtualBox. This machine has 2 network adapters, enp0s3
- NAT (from where I have my network connection) and enp0s8
- Internal Network (intnet). DHCP server is listening on enp0s8
interface.
Configurations:
/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
Atfer that, I started DHCP server:
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.
I installed another VM that will be a DHCP client. In the /etc/sysconfig/network-scripts/ifcfg-enp0s8
file, I wrote this lines:
DEVICE=enp0s8
BOOTPRO=dhcp
NAME=enp0s8
ONBOOT=yes
After that, I restarted network on client machine: systemctl restart network
But, the client machine is not getting an IP for enp0s8
interface, from that range that I specified in dhcpd.conf
.
Can someone explain me, what I am doing wrong there???
grep -i "dhcp" /var/log/messages
? Also, do atcpdump
(or anything similar aswireshark
) when restarting the client and check if there's any conections between them at all. If so, what type of them? Also, give your client a static IP address and check if they can ping each other.