I am trying to set up a Raspberian Stretch install to act as DHCP server on the ethernet port (eth0), to share the network coming from wlan0, but when I restart dnsmasq
it fails and in the logs I see: unknown interface eth0
. I have looked around at various docs, but I am still not working out what's going wrong?
ifconfig output:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether b8:27:eb:41:7e:e5 txqueuelen 1000 (Ethernet)
RX packets 147 bytes 49152 (48.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 455 bytes 86402 (84.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 4 bytes 156 (156.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 156 (156.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.89 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::5c84:d395:9208:b2 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:16:2b:b0 txqueuelen 1000 (Ethernet)
RX packets 4603 bytes 1034004 (1009.7 KiB)
RX errors 0 dropped 2 overruns 0 frame 0
TX packets 1356 bytes 304820 (297.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Contents of the /etc/dnsmasq.conf
:
dhcp-range=eth0,192.168.8.8,192.168.8.250,255.255.255.0,12h
Notable changes in /etc/sysctl.conf
:
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1
Notable changes in /etc/dhcpcd.conf
:
interface eth0
static ip_address=192.168.8.1/24
Running sudo systemctl restart dnsmasq
, gives me:
Job for dnsmasq.service failed because the control process exited with error code.
See "systemctl status dnsmasq.service" and "journalctl -xe" for details.
Checking journalctl -xe
gives me:
Sep 14 22:08:23 pibridge NetworkManager[376]: <info> [1568495303.0907] dhcp4 (eth0): canceled DHCP transaction, DHCP client pid 3408
Sep 14 22:08:23 pibridge NetworkManager[376]: <info> [1568495303.0908] dhcp4 (eth0): state changed timeout -> done
Sep 14 22:08:23 pibridge NetworkManager[376]: <info> [1568495303.0925] device (eth0): state change: ip-config -> failed (reason 'ip-config-unavailable') [70 120 5]
Sep 14 22:08:23 pibridge NetworkManager[376]: <info> [1568495303.0940] policy: disabling autoconnect for connection 'Wired connection 1'.
Sep 14 22:08:23 pibridge NetworkManager[376]: <warn> [1568495303.0955] device (eth0): Activation: failed for connection 'Wired connection 1'
Sep 14 22:08:23 pibridge NetworkManager[376]: <info> [1568495303.0997] device (eth0): state change: failed -> disconnected (reason 'none') [120 30 0]
Sep 14 22:08:23 pibridge avahi-daemon[374]: Withdrawing address record for fe80::bfb3:994d:2b02:2adb on eth0.
Sep 14 22:08:23 pibridge avahi-daemon[374]: Leaving mDNS multicast group on interface eth0.IPv6 with address fe80::bfb3:994d:2b02:2adb.
Sep 14 22:08:23 pibridge avahi-daemon[374]: Interface eth0.IPv6 no longer relevant for mDNS.
Sep 14 22:08:36 pibridge sudo[3666]: pi : TTY=pts/0 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/systemctl restart dnsmasq
Sep 14 22:08:36 pibridge sudo[3666]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Sep 14 22:08:36 pibridge systemd[1]: Stopping dnsmasq - A lightweight DHCP and caching DNS server...
-- Subject: Unit dnsmasq.service has begun shutting down
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit dnsmasq.service has begun shutting down.
Sep 14 22:08:37 pibridge dnsmasq[3672]: Too few arguments.
Sep 14 22:08:37 pibridge dnsmasq[3567]: exiting on receipt of SIGTERM
Sep 14 22:08:37 pibridge systemd[1]: Stopped dnsmasq - A lightweight DHCP and caching DNS server.
-- Subject: Unit dnsmasq.service has finished shutting down
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit dnsmasq.service has finished shutting down.
Sep 14 22:08:37 pibridge systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
-- Subject: Unit dnsmasq.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit dnsmasq.service has begun starting up.
Sep 14 22:08:37 pibridge dnsmasq[3723]: dnsmasq: syntax check OK.
Sep 14 22:08:37 pibridge dnsmasq[3725]: dnsmasq: unknown interface eth0
Sep 14 22:08:37 pibridge dnsmasq[3725]: unknown interface eth0
Sep 14 22:08:37 pibridge dnsmasq[3725]: FAILED to start up
Sep 14 22:08:37 pibridge systemd[1]: dnsmasq.service: Control process exited, code=exited status=2
Sep 14 22:08:37 pibridge systemd[1]: Failed to start dnsmasq - A lightweight DHCP and caching DNS server.
-- Subject: Unit dnsmasq.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit dnsmasq.service has failed.
--
-- The result is failed.
Sep 14 22:08:37 pibridge systemd[1]: dnsmasq.service: Unit entered failed state.
Sep 14 22:08:37 pibridge systemd[1]: dnsmasq.service: Failed with result 'exit-code'.
Sep 14 22:08:37 pibridge sudo[3666]: pam_unix(sudo:session): session closed for user root
Note once or twice it did seem to restart without complaint, but then I did not see any IPv4 address assigned to the eth0 interface. I would have assumed 192.168.8.1, per the above config?
I have also avoided touching /etc/network/interface
since most recent sources suggest this should not be touched in Raspian Stretch.
Environment details:
Model: Raspberry Pi 3 Model B Rev 1.2
uname -a: Linux pibridge 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux