N
N
Ninazu2020-04-22 17:44:07
Computer networks
Ninazu, 2020-04-22 17:44:07

How to set up a DHCP server on Linux Mint?

The server in my case will be a laptop with LinuxMint, which receives the Internet via WiFi. An exotic device that supports DHCP client mode is connected to it via Ethernet.

What I did on the laptop: I

looked at ifconfig to find out the interface that will distribute addresses, in my case it is 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


Delivered isc-dhcp-server
sudo apt-get install isc-dhcp-server

Registered the interface in its config /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"


Next, I replaced the configuration file /etc/dhcp/dhcpd.conf with
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;
}


And restarted the server
/etc/init.d/isc-dhcp-server restart
[ ok ] Restarting isc-dhcp-server (via systemctl): isc-dhcp-server.service.


But that's when I check the service status /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'.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
paran0id, 2020-04-22
@Ninazu

Look at the logs:
journalctl -u isc-dhcp-server
By the way, instead of /etc/init.d/isc-dhcp-server restart you can say systemctl restart isc-dhcp-server , in the same place systemd

D
Drno, 2020-04-22
@Drno

Well, the cant is clearly in the config, most likely.
If the elementary dhcp is necessary - I usually put Dnsmasq. simple, fast

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question