"Not running dhcpcd because /etc/network/interfaces defines some interfaces that will use a DHCP client or static address"
Question 1.) Sorry, it looks like you've misunderstood a few things.
dhcpcd
is a DHCP client daemon, which is normally started by NetworkManager or ifupdown
, not directly by systemd
. It is what will be handling the IP address assignment for your wlan0
.
You can use dhcpcd
as started by systemd
if you wish, however that will require disabling all the normal network interface configuration logic (i.e. /etc/network/interfaces
must be empty of non-comment lines) of the distribution and replacing it with your own custom scripting wherever necessary. That is for special uses only; if you're not absolutely certain you should do that, you shouldn't.
dhcpcd
will never serve IP addresses to any other hosts. This part you added to dhcpcd.conf
looks like it would belong to the configuration file of ISC DHCP server daemon, dhcpd
(yes it's just one-letter difference) instead:
host Accountant {
hardware ethernet 10:60:4b:68:03:21;
fixed-address 192.168.2.83;
}
host Accountant1 {
hardware ethernet 00:0c:29:35:95:ed;
fixed-address 192.168.2.66;
}
host Accountant3 {
hardware ethernet 30:85:A9:1B:C4:8B;
fixed-address 192.168.2.70;
}
But if you are following the YouTube tutorial you mentioned, you might not even have dhcpd
installed, since dnsmasq
is supposed to do that job.
As far as I can tell, the equivalent syntax for dnsmasq.conf
would be:
dhcp-host=10:60:4b:68:03:21,192.168.2.83,Accountant
dhcp-host=00:0c:29:35:95:ed,192.168.2.66,Accountant1
dhcp-host=30:85:A9:1B:C4:8B,192.168.2.70,Accountant3
Disclaimer: I haven't actually used dnsmasq
, so this is based on just quickly Googling its man page.
Question 2.) In the tutorial you mentioned, dnsmasq
was supposed to act as a DHCP server on eth0
. You did not say anything about it, so I don't know whether it was running or not. If not, the one client that was always getting the same IP might have been simply falling back to a previously-received old DHCP lease that wasn't expired yet. Yes, DHCP clients may store a DHCP lease persistently and keep using it if a network doesn't seem to have a working DHCP server available.
Question 3.): /etc/network/interfaces
is a classic Debian/Ubuntu style network interface configuration file. Use man interfaces
to see documentation for it, or look here.
In Debian, *Ubuntu, Raspbian etc., NetworkManager will have a plug-in that will read /etc/network/interfaces
but won't write to it.
If NetworkManager configuration tools like nmcli
, nmtui
or GUI-based NetworkManager configuration tools of your desktop environment of choice are used, the configuration would be saved to files in /etc/NetworkManager/system-connections/
directory instead.
If NetworkManager is not installed, the /etc/network/interfaces
file is used by the ifupdown
package, which includes the commands ifup
and ifdown
. The package also includes a system start-up script that will run ifup -a
on boot, enabling all network interfaces that have auto <interface name>
in /etc/network/interfaces
. There is also an udev rule which will run ifup <interface name>
if a driver for a new network interface gets auto-loaded and /etc/network/interfaces
has an allow-hotplug <interface name>
line for it.
I found the reason for this "error".
dhcpcd
uses some kind of "noob/newbie protection", which guarantees a safe way for handling the network management, should some "noob/newbie" try to use both dhcpcd
and /etc/interfaces
.
dhcpcd
checks the /etc/interfaces
with the following shell-script /usr/lib/dhcpcd5/dhcpcd
:
#!/bin/sh -e
DHCPCD=/sbin/dhcpcd
INTERFACES=/etc/network/interfaces
if grep -q -E "^[[:space:]]*iface[[:space:]]*.*[[:space:]]*inet[[:space:]]*(dhcp|static)" \
$INTERFACES; then
echo "Not running dhcpcd because $INTERFACES"
echo "defines some interfaces that will use a"
echo "DHCP client or static address"
exit 6
fi
exec $DHCPCD $@
I simply alternated the line
if grep -q -E "^[[:space:]]*iface[[:space:]]*.*[[:space:]]*inet[[:space:]]*(dhcp|static)" \
by removing the |static
argument, to
if grep -q -E "^[[:space:]]*iface[[:space:]]*.*[[:space:]]*inet[[:space:]]*(dhcp)" \
and adjusted the last echo line to:
echo "DHCP client"
PS make sure to add a denyinterfaces "NAME OF YOUR STATIC INTERFACE, WHICH SHALL BE CONTROLLED ONLY BY /etc/interfaces"
, for example denyinterfaces eth0
to your /etc/dhcpcd.conf
.