I run a Raspberry Pi at our university (Raspbian Stretch). I use it for a project where it has to rely on WiFi. I configured the connection using wpa_supplicant and it worked perfectly well. Now there's a problem with it, so I no longer get onto it using WiFi/ssh. I unplugged the SD card and modified
/etc/network/interfaces file to configure a static network that allows me to acces the Raspi over Ethernet. Here's the file:
source-directory /etc/network/interfaces.d auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf auto eth0 allow-hotplug eth0 iface eth0 inet static address 192.168.66.101 netmask 255.255.255.0 gateway 192.168.66.100
The Ethernet connection works perfectly, so I can acces my Raspi via ssh again. When I do
/etc/init.d/neworking restart, it takes a while, but I don't get a WiFi connection. When i run
sudo systemctl restart dhcpcd.service, it fails.
systemctl status dhcpcd.service says:
Feb 23 09:33:01 pren7 systemd: Starting dhcpcd on all interfaces... Feb 23 09:33:01 pren7 dhcpcd: Not running dhcpcd because /etc/network/interfaces Feb 23 09:33:01 pren7 dhcpcd: defines some interfaces that will use a Feb 23 09:33:01 pren7 dhcpcd: DHCP client or static address Feb 23 09:33:01 pren7 systemd: dhcpcd.service: Control process exited, code=exited status=6 Feb 23 09:33:01 pren7 systemd: Failed to start dhcpcd on all interfaces. Feb 23 09:33:01 pren7 systemd: dhcpcd.service: Unit entered failed state. Feb 23 09:33:01 pren7 systemd: dhcpcd.service: Failed with result 'exit-code'.
So can't I use DHCP for wlan0 when I configure eth0 using a static IP? Is there a workaround? I cannot just deactivate eth0, because if the wlan0 connection fails, I need to modify the config directly on the SD card again.
EDIT: Following your suggestion, I switched from classic networking to dhcpcd. Here's my new
# Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d auto lo iface lo inet loopback iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
And here's my
interface eth0 static ip_address=192.168.66.101/24 static routers=192.168.66.100 static domain_name_servers=220.127.116.11