Eu configurei um servidor DHCP em uma VM no VirtualBox. Esta máquina possui 2 adaptadores de rede, enp0s3
- NAT (de onde tenho minha conexão de rede) e enp0s8
- Rede Interna (intnet). O servidor DHCP está escutando na interface enp0s8
.
Configurações:
/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
Depois disso, iniciei o servidor 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.
Instalei outra VM que será um cliente DHCP. No arquivo /etc/sysconfig/network-scripts/ifcfg-enp0s8
, escrevi estas linhas:
DEVICE=enp0s8
BOOTPRO=dhcp
NAME=enp0s8
ONBOOT=yes
Depois disso, reiniciei a rede na máquina do cliente: systemctl restart network
Mas, a máquina cliente não está obtendo um IP para enp0s8
interface, daquele intervalo que eu especifiquei em dhcpd.conf
.
Alguém pode me explicar, o que estou fazendo de errado aí ???
Tags 64-bit dhcp redhat dhcp-server centos7