I'm following these instructions to create an Ad-Hoc WiFi network from a Pi Zero W. It works great. Problem is, once I'm done I want to switch the Pi back to DHCP and log on to my house WiFi like normal.
1) Replace the old files: /etc/dhcpcd.conf
and /etc/network/interfaces
to their original states from a backup before the Ad-Hoc instructions were followed
2) I'm trying to restart networking with:
sudo ifdown wlan0
sudo ifup wlan0
... and I've tried all these commands as well following that:
sudo service networking restart
sudo /etc/init.d/networking restart
sudo systemctl daemon-reload
No matter what I try, I can't get the Pi to give up it's static IP and connect normally back to my home WiFi... UNTIL I restart the computer. How else can I force the network to reload /etc/network/interfaces
without powering cycling?
EDIT:
Here's the interfaces file BEFORE adhoc, which is restored AFTER adhoc:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto wlan0
auto lo usb0
iface lo inet loopback
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug usb0
iface usb0 inet manual
during adhoc the wlan0 part is changed to:
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0
...and that's the problem, I can't "clear" that static IP address so the Pi won't connect to my router.
sudo systemctl stop dnsmasq
andsudo systemctl stop hostapd
/etc/network/interfaces
auto wlan0
got the WiFi to connect (visible iniwconfig
) butifconfig
still displays the static IP address, it won't work with my router with that static IP address. I'll try addingdhcp
to `/etc/network/interfaces' nextDHCPDISCOVER
can't get an IP address