servidor DHCP no Debian 10

1. servidor DHCP no Debian 10

marx cavalcante monteiro
kmmx

(usa Debian)

Enviado em 19/06/2020 - 07:40h

Bom dia, estou tentando usar um netbook antigo com Debian 10, como roteador wifi.
Além do wifi e da porta FastEthernet, tenho uma GigaEthernet-USB que quero usar na rede interna.
Um dos problemas que estou enfrentando no momento é o servidor ISC-DHCP-SERVER, não que iniciar. Dá erro.
Eu tenho um link da vivo fibra.

modem fibra <-> roteador d-link vivo <-> roteador próprio tp-link

Eu quero instalar o netbook entre o roteador vivo e o meu.

Alguém pode me ajudar?



Arquivo dhcpd.conf:

ddns-update-style none;
deny unknown-clients;
log-facility local7;
authoritative;

subnet 192.168.30.0 netmask 255.255.255.0 {
range 192.168.30.110 192.168.30.130;
server-identifier servidorDHCP;
option subnet-mask 255.255.255.0;
option domain-name "kmmx.kmx";
option domain-name-servers 192.168.1.1, 8.8.8.8, 8.8.4.4;
# A lan do roteador vivo é 192.168.1.0/24, a FastEthernet 192.168.30.10/24
option routers 192.168.1.12;
option broadcast-address 192.168.30.255;
default-lease-time 600;
max-lease-time 7200;

host KmmX-DELL {
hardware ethernet B8:CA:3A:xx:xx:xx;
fixed-address 192.168.30.xx
}

host Cxx {
hardware ethernet F4:F5:D8:xx:xx:xx;
fixed-address 192.168.30.xx
}

linha 137 (erro) host Zxx {
hardware ethernet 38:D5:47:xx:xx:xx;
fixed-address 192.168.30.xx
}

linha 142 (erro) host Mxx {
hardware ethernet 20:A6:0C:xx:xx:xx;
fixed-address 192.168.30.xx
}

host Txx {
hardware ethernet 00:00:48:xx:xx:xx;
fixed-address 192.168.30.xx
}
linha 151 (erro) }



Arquivo interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp9s0
iface enp9s0 inet dhcp

#auto enp9s0
# iface eth0 inet static
# address 192.168.1.12
# netmask 255.255.255.0
# gateway 192.168.1.1

#auto enx0000ba300849
# iface eth1 inet static
# address 192168.30.100
# netmask 255.255.255.0
# gateway 192.168.30.100



Arquivo /etc/default/isc-dhcp-server:

# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid

# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="enx0000ba300849 wlxf87b8c178de3"
#INTERFACESv6=""



Erro do ISC-DHCP:

root@KmmX-NET:~# service isc-dhcp-server stop
root@KmmX-NET:~# service isc-dhcp-server start
Job for isc-dhcp-server.service failed because the control process exited with error code.
See "systemctl status isc-dhcp-server.service" and "journalctl -xe" for details.
root@KmmX-NET:~# systemctl status isc-dhcp-server.service
&#9679; isc-dhcp-server.service - LSB: DHCP server
Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
Active: failed (Result: exit-code) since Fri 2020-06-19 07:17:49 -03; 15s ago
Docs: man:systemd-sysv-generator(8)
Process: 542 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=1/FAILURE)

jun 19 07:17:49 KmmX-NET dhcpd[549]: ^
jun 19 07:17:49 KmmX-NET dhcpd[549]: Configuration file errors encountered -- exiting
jun 19 07:17:49 KmmX-NET dhcpd[549]:
jun 19 07:17:49 KmmX-NET dhcpd[549]: If you think you have received this message due to a bug rather
jun 19 07:17:49 KmmX-NET dhcpd[549]: than a configuration issue please read the section on submitting
jun 19 07:17:49 KmmX-NET dhcpd[549]: bugs on either our web page at www.isc.org or in the README file
jun 19 07:17:49 KmmX-NET dhcpd[549]: before submitting a bug. These pages explain the proper
jun 19 07:17:49 KmmX-NET dhcpd[549]: process and the information we find helpful for debugging.
jun 19 07:17:49 KmmX-NET dhcpd[549]:
jun 19 07:17:49 KmmX-NET dhcpd[549]: exiting.
root@KmmX-NET:~# journalctl -xe
jun 19 07:17:49 KmmX-NET isc-dhcp-server[542]: ^
jun 19 07:17:49 KmmX-NET isc-dhcp-server[542]: Configuration file errors encountered -- exiting
jun 19 07:17:49 KmmX-NET isc-dhcp-server[542]: If you think you have received this message due to a bug rather
jun 19 07:17:49 KmmX-NET isc-dhcp-server[542]: than a configuration issue please read the section on submitting
jun 19 07:17:49 KmmX-NET isc-dhcp-server[542]: bugs on either our web page at www.isc.org or in the README file
jun 19 07:17:49 KmmX-NET isc-dhcp-server[542]: before submitting a bug. These pages explain the proper
jun 19 07:17:49 KmmX-NET isc-dhcp-server[542]: process and the information we find helpful for debugging.
jun 19 07:17:49 KmmX-NET isc-dhcp-server[542]: exiting.
jun 19 07:17:49 KmmX-NET dhcpd[549]: ^
jun 19 07:17:49 KmmX-NET systemd[1]: isc-dhcp-server.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStart= process belonging to unit isc-dhcp-server.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
jun 19 07:17:49 KmmX-NET dhcpd[549]: /etc/dhcp/dhcpd.conf line 137: host declarations not allowed here.
jun 19 07:17:49 KmmX-NET systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit isc-dhcp-server.service has entered the 'failed' state with result 'exit-code'.
jun 19 07:17:49 KmmX-NET dhcpd[549]: host
jun 19 07:17:49 KmmX-NET systemd[1]: Failed to start LSB: DHCP server.
-- Subject: A unidade isc-dhcp-server.service falhou
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- A unidade isc-dhcp-server.service falhou.
--
-- O resultado é failed.
jun 19 07:17:49 KmmX-NET dhcpd[549]: ^
jun 19 07:17:49 KmmX-NET dhcpd[549]: /etc/dhcp/dhcpd.conf line 142: host declarations not allowed here.
jun 19 07:17:49 KmmX-NET dhcpd[549]: host
jun 19 07:17:49 KmmX-NET dhcpd[549]: ^
jun 19 07:17:49 KmmX-NET dhcpd[549]: /etc/dhcp/dhcpd.conf line 147: host declarations not allowed here.
jun 19 07:17:49 KmmX-NET dhcpd[549]: host
jun 19 07:17:49 KmmX-NET dhcpd[549]: ^
jun 19 07:17:49 KmmX-NET dhcpd[549]: /etc/dhcp/dhcpd.conf line 151: unexpected end of file
jun 19 07:17:49 KmmX-NET dhcpd[549]: }
jun 19 07:17:49 KmmX-NET dhcpd[549]: ^
jun 19 07:17:49 KmmX-NET dhcpd[549]: Configuration file errors encountered -- exiting
jun 19 07:17:49 KmmX-NET dhcpd[549]:
jun 19 07:17:49 KmmX-NET dhcpd[549]: If you think you have received this message due to a bug rather
jun 19 07:17:49 KmmX-NET dhcpd[549]: than a configuration issue please read the section on submitting
jun 19 07:17:49 KmmX-NET dhcpd[549]: bugs on either our web page at www.isc.org or in the README file
jun 19 07:17:49 KmmX-NET dhcpd[549]: before submitting a bug. These pages explain the proper
jun 19 07:17:49 KmmX-NET dhcpd[549]: process and the information we find helpful for debugging.
jun 19 07:17:49 KmmX-NET dhcpd[549]:
jun 19 07:17:49 KmmX-NET dhcpd[549]: exiting.



Obrigado pela atenção!


  


2. Re: servidor DHCP no Debian 10

Paulo Bonfanti
pbonfanti

(usa Debian)

Enviado em 30/09/2020 - 08:14h

/etc/dhcp/dhcpd.conf line 137: host declarations not allowed here.

Você precisa mover suas declarações de host para outra parte do arquivo, aparentemente é só isso.
Existem as declarações globais, de range, etc, e normalmente declaraçoes de host eu deixo mais para o final.
Agora olhando melhor pro seu arquivo:

subnet 192.168.30.0 netmask 255.255.255.0 {

Você abriu a chave da declaração da subnet, mas não fechou ela com outra chave ...
Normalmente dhcp falha por erro de digitação,mesmo.






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts