Сервером в моём случае будет выступать ноутбук с LinuxMint, который принимает интернет через WiFi. К нему по Ethernet подключается экзотическое устройство которое поддерживает режим DHCP клиента.
Что я делал на ноутбуке:
Посмотрел
ifconfig, чтоб узнать интерфейс который будет раздавать адреса, в моем случае это
enp3s0f1
enp3s0f1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet6 fe80::57eb:1217:90af:ab61 prefixlen 64 scopeid 0x20<link>
ether 80:fa:5b:52:bb:43 txqueuelen 1000 (Ethernet)
RX packets 89748 bytes 14684474 (14.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 73806 bytes 4988432 (4.9 MB)
TX errors 25 dropped 0 overruns 0 carrier 0 collisions 0
Поставил
isc-dhcp-server
sudo apt-get install isc-dhcp-server
Прописал интерфейс в его конфиг
/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=""
#INTERFACESv6=""
INTERFACES="enp3s0f1"
Дальше заменил файл конфигурации
/etc/dhcp/dhcpd.conf на
dns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.116.0;
option routers 192.168.116.254;
option domain-name-servers 8.8.4.4, 8.8.8.8;
subnet 192.168.116.0 netmask 255.255.255.0
{
# Диапазон выдаваемых IP
range 192.168.116.100 192.168.116.200;
}
И перезапустил сервер
/etc/init.d/isc-dhcp-server restart
[ ok ] Restarting isc-dhcp-server (via systemctl): isc-dhcp-server.service.
Но вот когда я проверяю статус сервиса
/etc/init.d/isc-dhcp-server status
● isc-dhcp-server.service - ISC DHCP IPv4 server
Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2020-04-22 17:40:29 EEST; 55s ago
Docs: man:dhcpd(8)
Process: 27053 ExecStart=/bin/sh -ec CONFIG_FILE=/etc/dhcp/dhcpd.conf; if [ -f /etc/ltsp/dhcpd.conf ]; then CONFIG_FILE=/etc/ltsp/dhcpd.conf; fi; [ -e /var/lib/dhcp/dhcpd.leases ] || touch /var/lib/dhcp/dhcpd.leases; chown root:dhcpd /var/lib/dhcp /var/lib/dhcp/dhcpd.leases; chmod 775 /var/lib/dhcp ; chmod 664 /var/lib/dhcp/dhcpd.leases; exec dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf $CONFIG_FILE $INTERFACES (code=exited, status=1/FAILURE)
Main PID: 27053 (code=exited, status=1/FAILURE)
Apr 22 17:40:29 dhcpd[27053]:
Apr 22 17:40:29 dhcpd[27053]: If you think you have received this message due to a bug rather
Apr 22 17:40:29 dhcpd[27053]: than a configuration issue please read the section on submitting
Apr 22 17:40:29 dhcpd[27053]: bugs on either our web page at www.isc.org or in the README file
Apr 22 17:40:29 dhcpd[27053]: before submitting a bug. These pages explain the proper
Apr 22 17:40:29 dhcpd[27053]: process and the information we find helpful for debugging..
Apr 22 17:40:29 dhcpd[27053]:
Apr 22 17:40:29 dhcpd[27053]: exiting.
Apr 22 17:40:29 systemd[1]: isc-dhcp-server.service: Main process exited, code=exited, status=1/FAILURE
Apr 22 17:40:29 systemd[1]: isc-dhcp-server.service: Failed with result 'exit-code'.