How to purge all network related config?

I received the raspi 4 two days ago, i have had an odroid c1 running with dietpi since a year or two flawlessly. As the c1 doesn’t have wifi and in my tv there is no ethernet connection, and since i wanted to have a reliable pihole system (the c1 when downloading torrents it gets pretty slow, and critical systems like the dns server of pihole must not suffer any lag or it will be noticeable for the users of the network) i decided to replace it with the raspi 4.

The thing is i have been trying to just have a very usual ethernet+wifi setting, what i want to have, ideally, is a system which stays plugged to ethernet normally, and that when i want to play videos in the tv i just turn it off, unplug it and take it to the tv, and it will connect to wifi, and while it is connected to ethernet, the wifi should not be connected (just as happens in any desktop computer), and lastly (ideally, harder to get, so its optional) i would want to have always the same ip (you know, if you use pihole you must set an ip in the dhcp so the rest of the devices can know where is the dns server, so if i have a different ip in ethernet and in wifi (NOTE: i know it is not possible to have the same ip in two interfaces at the SAME TIME, i know it, i dont want that, as i said my intention is to only be using one interface at the same time, the other one would be unplugged or just disconnected) the dns would not be reachable while im on the tv, for example)

the same ip thing is harder, i could set the same ip as a static ip internally in the raspi, and just pray that the router accepts it, which would probably require a reboot in the router when i want to change interface… but there is also an option which i just discovered, https://wiki.archlinux.org/index.php/Wireless_bonding

but nevermind, im just gonna forget about the same ip requirement and try to fix the other things, it just is very hard to set wifi, its very unreliable, im talking just even without exiting the setup of the first boot, maybe its because using a 5G network fucks up (sorry for the word) some settings, or maybe its that using ethernet and wifi is untested or i dont know but i have just reached a point of setting only 1 SSID and just avoiding at all costs plugging the raspi to ethernet because i know if i do the wifi will stop working. I have had to reflash the iso 3 times now as it gets a point where neither ethernet or wifi works at all, maybe if you try to set a static ip in the wifi it is not programmed properly or something.

This post is more for telling the devs there are problems setting basic network stuff in the dietpi config. But anyway, what i want to know is, if i reach again the point of neither ethernet or wifi works, at all, how do i purge all network related config so i can just reconfigure it?

Hi,

it is possible to use 2 different IP addresses on eth0 as well as wlan0 together with PiHole. You would need to configure your DHCP server that way, that it will populate both IP Address as Primary + Secondary DNS Server. Means, if DNS server is not answering on first IP, your devices will be using second one.

Basically all network related configuration can be done using dietpi-config. If needed you can hack it manually into /etc/network/interfaces

yeah, i know, i have been using dietpi-config for that, i just plug the ethernet, and for wifi i just enable the wifi modules and the inboard wifi, then add ssid and so on, my issues are reported and acknowledged in github, michaing said that as he doesnt use wifi he didnt test that type of combination of interfaces
and i have experienced that when my pihole is down, the other computers doesnt have any access to internet, even when the second and third DNS directions are the google ones… i dont know why but thats what happened to me


but is there a way to purge or delete every network related config set by me from the install?

and the ssid and other wifi related config where is stored or edited manually?

I just tested it on my demo environment

  1. Pihole running + listen on all interfaces
  2. eth0 configured, set STATIC IP1
  3. wlan0 configured, set STATIC IP2
  4. DHCP set to populate IP1 + IP2 as DNS server (dnsmasq dhcp-option=6)
  5. DHCP lease refreshed on a client
  6. check that both IP’s get populates as DNS server
root@DietPiVM2:~# nmap --script broadcast-dhcp-discover -e eth0
Starting Nmap 7.70 ( https://nmap.org ) at 2020-06-19 15:27 CEST
Pre-scan script results:
| broadcast-dhcp-discover:
|   Response 1 of 1:
|     IP Offered: 192.168.0.39
|     DHCP Message Type: DHCPOFFER
|     Server Identifier: 192.168.0.11
|     IP Address Lease Time: 2m00s
|     Renewal Time Value: 1m00s
|     Rebinding Time Value: 1m45s
|     Subnet Mask: 255.255.255.0
|     Broadcast Address: 192.168.0.255
|     Domain Name: lan
|     NTP Servers: 192.168.0.1
|     Router: 192.168.0.1
|_    Domain Name Server: 192.168.0.12, 192.168.0.70
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scanned in 3.81 seconds
root@DietPiVM2:~#
  1. verify DNS server setting on client
root@DietPiVM2:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.0.12
nameserver 192.168.0.70
search lan
root@DietPiVM2:~#
  1. running nslookup to verify DNS resolution > DNS on IP1 was providing the answer
root@DietPiVM2:~# nslookup google.com
Server:         192.168.0.12
Address:        192.168.0.12#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.205.238
Name:   google.com
Address: 2a00:1450:4001:820::200e

root@DietPiVM2:~#
  1. disable eth0 on PiHole system
  2. running nslookup to verify DNS resolution > DNS on IP2 was providing the answer
root@DietPiVM2:~# nslookup google.com
Server:         192.168.0.70
Address:        192.168.0.70#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.205.238
Name:   google.com
Address: 2a00:1450:4001:820::200e

root@DietPiVM2:~#

As already stated above, network config is stored on /etc/network/interfaces. There you have as well wifi configuration done. by default wpa configuration should pointing to /etc/wpa_supplicant/wpa_supplicant.conf

root@DietPi3:~# cat /etc/network/interfaces |grep wpa
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
root@DietPi3:~#

hmm yeah i would have to test it more deeply, it happened to me once and as it wasnt at all my priority to have pihole working i just changed the dns in the dhcp to another public one to keep fixing the raspberry, my real issues are with connectivity

my real issues are with connectivity

What exactly does this mean?

is what i talked about in the opening post

basically, even without leaving the first setup, i can’t tell you exactly what combination of settings bugs my connectivity but having both ethernet and wifi in autoassigned ip can make both interfaces just not connecting at all or having the ethernet connected but internet not working.
I just ended by having only one ssid configured, with autoassigned in both interfaces, and it just works for now, but i have spent 2 days trying to know what the hell was happening as just using very common settings made the connection just not work, not connect at all or showing as connected but no internet connection happening
i suspect it has to do with the way the dietpi network config is designed, as michaing said in github the network of a raspberry is very usually connected only by ethernet, and that is what is more tested and is more easy to program, and the wifi or even more the wifi+ethernet is not as tested
also, maybe having tried to use a 5g wifi maybe have some bug that is the origin of all my issues, is the one ssid i just gave up to configure and now its only configured to connect to a 2.4ghz ssid, now it just works reliability, but im not gonna touch anything or connect it to ethernet as i dont want to spend more hours fixing those basic network problems
maybe you can reproduce this issues testing ethernet+wifi 5g in a raspi 4
i can also say that during the setup sometimes it worked both eth+wlan connection at the same time without problems but maybe after a reboot or after adding the other ssid or something it just stopped working everything or only wifi stopped working

I was playing around with the ifplugd package. After some config attempts, my system is now able to switch between eth0 and wlan0 depending on eth0 status. As soon as a cable is connected, WiFi get deactivated. Removing the cable will activate WiFi. Working as well on boot. This way, only 1 interface is up same time.

okay i have been playing with ifplugd a little bit, i did this:
installed ifplugd, then using http://www.aoakley.com/articles/2013-07-31-raspberry-pi-networking.php i followed the Turning off WiFi when a wired network cable is plugged in, basically edited /etc/ifplugd/action.d/ifupdown and /etc/network/interfaces and the first file was just copypasted, and the second one i edited it with my ips, except i decided to not experiment using the same static ip in both interfaces for now
then i used wpa_cli to replace and have only 1 ssid (a 5G one, if that matters), and rebooted and now the thing is it looks like wpa_supplicant is not the program which is providing the ssid config to the system, because if i enter dietpi-config to monitor the status of the network connectivity, i can see that ethernet is connecting and disconnecting properly, with the ip i set in the interfaces file, but the wlan is not working as expected, it doesnt connect at all but it happens that if i connect ethernet it then connects to the wlan, at the same time (ignoring the ifplugd setting), also if i enter the wlan menu, the ssid is the old one i set yesterday (2.4g) not the one i just set, so i suppose dietpi is not using wpa supplicant, can you guide me from here? i wanna edit manually or at least monitor the config file where it is configured the ssids, and also fix the ifplugd behaviour

edit: if i boot unplugged, it just doesnt connect, it waits the 60 seconds of the ntp daemom, then it waits i think like 2 minutes of postboot script, and then i can log in, also in the welcome print of the terminal, which tells you the cpu temp and dietpi news and so on, it says LAN IP: and the static ip of my ethernet, which has not been plugged in at all during the whole process
Now after all this time and after the time i have been writing all of this, the wlan still has not connected, i can see it in the dietpi config, also if i plug the ethernet right now, i see ethernet connected but still wlan doesnt connect… i expected that after pluggin ethernet then for some reason the wlan will connect, as happened to me before several times

i dont know, if you can guide me from here i will appreciate it a lot, thanks

by the way, now with ethernet plugged in, the boot time is only about 5 seconds, compared to about 30 seconds it took before this changes (with ethernet plugged in, it always took about 30 seconds), so i dont know if all i changed today has been useful at all but this improvement is very noticeable

well the boot time depends on time sync service mainly. Sometime it takes quite long to complete. I’m facing this on all my systems. Sometimes it takes 5 sec to complete, sometimes up to 40 sec. We did not found a cause until now. Anyway this is not our topic :smiley:

Give me some time regarding ifplugd. I’m out this weekend with limited phys access to my RPi. Will try to write something probably during night. Be patient

okay thanks!

edit: im gonna leave here mi current settings.

/etc/wpa_supplicant/wpa_supplicant.conf

# Grant all members of group "netdev" permissions to configure WiFi, e.g. via wpa_cli or wpa_gui
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
# Allow wpa_cli/wpa_gui to overwrite this config file
update_config=1
network={
        ssid="Wifi_5G"
        scan_ssid=1
        key_mgmt=WPA-PSK
        psk="my wifi password"
}

network={
        ssid="Wifi24G"
        scan_ssid=1
        key_mgmt=WPA-PSK
        psk="my wifi password"
}

/etc/network/interfaces

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Local
auto lo
iface lo inet loopback

# Ethernet
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 1.1.1.1 1.0.0.1

# WiFi
auto wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
address 192.168.1.12
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 1.1.1.1 1.0.0.1
wireless-power off

/etc/ifplugd/action.d/ifupdown

  GNU nano 3.2                                                                             /etc/ifplugd/action.d/ifupdown                                                                                         

#!/bin/sh
set -e

case "$2" in
up)
        /sbin/ifup $1
        if [ "$1" == eth0 ]; then /sbin/ifdown wlan0 ; fi
        ;;
down)
        /sbin/ifdown $1
        if [ "$1" == eth0 ]; then /sbin/ifup wlan0 ; fi
        ;;
esac

Hi,

below my settings.

/etc/network/interfaces

  • basically the standard settings if you configure eth0 as well as wlan0 using dietpi-config
  • both interfaces are set to STATIC
  • on eth0, I manually set a # in front of allow-hotplug eth0 to have the feature disabled
  • quite important setting, otherwise wlan0 will not start correctly during reboot if Ethernet cable is unpluged
  • it will block eth0 to start up automatically during reboot. But not a problem as we will give this task to ifplugd to manage eth0
  • Attention: the following will lead to have wlan0 active only until we finished configuration on ifplugd
# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Local
auto lo
iface lo inet loopback

# Ethernet
#allow-hotplug eth0
iface eth0 inet static
address 192.168.0.12
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 9.9.9.9 149.112.112.112

# WiFi
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.70
netmask 255.255.255.0
gateway 192.168.0.1
#dns-nameservers 9.9.9.9
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/ifplugd/ifplugd.action

  • completely different than the default script
  • basically it will deactivate one interface before activating another
#!/bin/sh
set -e
if [ -z "$1" ] || [ -z "$2" ] ; then
       echo "Wrong arguments" > /dev/stderr
       exit 1
fi
if [ "$1" != "eth0" ]; then
       echo "Wrong interface!" > /dev/stderr
       exit 1
fi
if [ "$2" = "up" ] ; then
       echo "bring down WiFi"
       /sbin/ifdown wlan0 --force
       /sbin/ifup eth0 --force
       exit 0
elif [ "$2" = "down" ] ; then
       echo "bring up WiFi"
       /sbin/ifdown eth0 --force
       /sbin/ifup wlan0 --force
       exit 0
fi
exit 1

/etc/default/ifplugd

  • nothing special on this
  • eth0 will be managed
  • switching from eth0 to wlan0 will be delayed by 5 sec
  • switching from wlan0 to eth0 will be done as soon as a cable was plugged in, without any delay
INTERFACES="eth0"
HOTPLUG_INTERFACES="auto"
ARGS="-q -f -u0 -d5 -w -I"
SUSPEND_ACTION="stop"

once done ifplugd service would need to be activated

  • Attention: this will immediately force a switch from wlan0 to eth0 if a cable is plugged in
systemctl enable ifplugd.service
systemctl start ifplugd.service

You can check how it’s working by doing the following

journalctl -u ifplugd.service

hmmm there must be some problem, if i start with the eth unplugged, and then plug it, unplug it and finally plug it, this is the log:

jun 21 10:17:54 DietPi systemd[1]: Starting LSB: Brings up/down network automatically...
jun 21 10:17:54 DietPi ifplugd(eth0)[438]: ifplugd 0.28 initializing.
jun 21 10:17:55 DietPi ifplugd(eth0)[438]: Using interface eth0/DC:A6:32:A9:4B:8D with driver <bcmgenet> (version: v2.0)
jun 21 10:17:55 DietPi ifplugd(eth0)[438]: Using detection mode: SIOCETHTOOL
jun 21 10:17:55 DietPi ifplugd(eth0)[438]: Initialization complete, link beat not detected.
jun 21 10:17:55 DietPi ifplugd[421]: Network Interface Plugging Daemon...start eth0...done.
jun 21 10:17:55 DietPi systemd[1]: Started LSB: Brings up/down network automatically.
jun 21 10:20:26 DietPi ifplugd(eth0)[438]: Link beat detected.
jun 21 10:20:26 DietPi ifplugd(eth0)[438]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.
jun 21 10:20:26 DietPi ifplugd(eth0)[438]: client: bring down WiFi
jun 21 10:20:26 DietPi ifplugd(eth0)[438]: client: RTNETLINK answers: No such process
jun 21 10:20:26 DietPi ifplugd(eth0)[438]: client: RTNETLINK answers: Cannot assign requested address
jun 21 10:20:26 DietPi ifplugd(eth0)[438]: Program executed successfully.
jun 21 10:21:34 DietPi ifplugd(eth0)[438]: Link beat lost.
jun 21 10:21:39 DietPi ifplugd(eth0)[438]: Executing '/etc/ifplugd/ifplugd.action eth0 down'.
jun 21 10:21:39 DietPi ifplugd(eth0)[438]: client: bring up WiFi
jun 21 10:21:39 DietPi ifplugd(eth0)[438]: client: wpa_supplicant: wpa-roam can only be used with the "manual" inet METHOD
jun 21 10:21:39 DietPi ifplugd(eth0)[438]: client: run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
jun 21 10:21:39 DietPi ifplugd(eth0)[438]: client: ifup: failed to bring up wlan0
jun 21 10:21:39 DietPi ifplugd(eth0)[438]: Program execution failed, return value is 1.
jun 21 10:22:33 DietPi ifplugd(eth0)[438]: Link beat detected.
jun 21 10:22:33 DietPi ifplugd(eth0)[438]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.
jun 21 10:22:33 DietPi ifplugd(eth0)[438]: client: bring down WiFi
jun 21 10:22:33 DietPi ifplugd(eth0)[438]: client: RTNETLINK answers: No such process
jun 21 10:22:33 DietPi ifplugd(eth0)[438]: client: RTNETLINK answers: Cannot assign requested address
jun 21 10:22:33 DietPi ifplugd(eth0)[438]: Program executed successfully.

okay so i change wpa-roam in my /etc/network/interfaces to wpa-conf as you have it, and looks working, but it doesnt connect to the ssids, i dont understand why:

-- Logs begin at Thu 2019-02-14 11:11:58 CET, end at Sun 2020-06-21 10:42:53 CEST. --
jun 21 10:25:03 DietPi systemd[1]: Starting LSB: Brings up/down network automatically...
jun 21 10:25:04 DietPi ifplugd(eth0)[438]: ifplugd 0.28 initializing.
jun 21 10:25:04 DietPi ifplugd(eth0)[438]: Using interface eth0/DC:A6:32:A9:4B:8D with driver <bcmgenet> (version: v2.0)
jun 21 10:25:04 DietPi ifplugd(eth0)[438]: Using detection mode: SIOCETHTOOL
jun 21 10:25:04 DietPi ifplugd(eth0)[438]: Initialization complete, link beat not detected.
jun 21 10:25:04 DietPi ifplugd[417]: Network Interface Plugging Daemon...start eth0...done.
jun 21 10:25:04 DietPi systemd[1]: Started LSB: Brings up/down network automatically.
jun 21 10:25:09 DietPi ifplugd(eth0)[438]: Link beat detected.
jun 21 10:25:09 DietPi ifplugd(eth0)[438]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.
jun 21 10:25:09 DietPi ifplugd(eth0)[438]: client: bring down WiFi
jun 21 10:25:09 DietPi ifplugd(eth0)[438]: client: ifdown: waiting for lock on /run/network/ifstate.wlan0
jun 21 10:25:17 DietPi ifplugd(eth0)[438]: Program executed successfully.
jun 21 10:26:42 DietPi ifplugd(eth0)[438]: Link beat lost.
jun 21 10:26:47 DietPi ifplugd(eth0)[438]: Executing '/etc/ifplugd/ifplugd.action eth0 down'.
jun 21 10:26:47 DietPi ifplugd(eth0)[438]: client: bring up WiFi
jun 21 10:26:47 DietPi wpa_supplicant[884]: Successfully initialized wpa_supplicant
jun 21 10:26:50 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 10:26:52 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:26:55 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 10:26:58 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:26:59 DietPi ifplugd(eth0)[438]: Program executed successfully.
jun 21 10:27:01 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'Casita'
jun 21 10:27:04 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:27:06 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'Casita'
jun 21 10:27:09 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:27:12 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 10:27:15 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:27:18 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 10:27:21 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:27:21 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="CasitaAP" auth_failures=1 duration=10 reason=CONN_FAILED
jun 21 10:27:29 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'Casita'
jun 21 10:27:32 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:27:35 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="CasitaAP"
jun 21 10:27:35 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'Casita'
jun 21 10:27:38 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:27:38 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=1 ssid="Casita" auth_failures=1 duration=10 reason=CONN_FAILED
jun 21 10:27:45 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 10:27:48 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:27:48 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="CasitaAP" auth_failures=2 duration=20 reason=CONN_FAILED
jun 21 10:28:01 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-REENABLED id=1 ssid="Casita"
jun 21 10:28:01 DietPi wpa_supplicant[887]: wlan0: Failed to initiate sched scan
jun 21 10:28:08 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="CasitaAP"
jun 21 10:28:08 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 10:28:11 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:28:11 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="CasitaAP" auth_failures=3 duration=30 reason=CONN_FAILED
jun 21 10:28:24 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'Casita'
jun 21 10:28:26 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:28:26 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=1 ssid="Casita" auth_failures=2 duration=20 reason=CONN_FAILED
jun 21 10:28:41 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="CasitaAP"
jun 21 10:28:41 DietPi wpa_supplicant[887]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 10:28:44 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 10:28:44 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="CasitaAP" auth_failures=4 duration=60 reason=CONN_FAILED
jun 21 10:28:56 DietPi wpa_supplicant[887]: wlan0: CTRL-EVENT-SSID-REENABLED id=1 ssid="Casita"
jun 21 10:28:56 DietPi wpa_supplicant[887]: wlan0: Failed to initiate sched scan

i have country=ES in my wpa_supplicant, maybe is because the static ip, but setting it to another one for sure not used by anyone still doesnt work
by the way, i forgot to enable the ifupd daemon as you did, and edit the default file, thats for sure the main reason it didnt work for me before, so for now everything is fixed except the wlan connection :thinking:

edit: okay, so i must use wpa-conf instead of roam if i have preset ssids: https://raspberrypi.stackexchange.com/questions/9257/whats-the-difference-between-wpa-roam-and-wpa-conf-in-the-etc-network-inte

edit: i have just changed the wlan0 to dhcp and it still doesnt connect, im just trying to connect to 2 2.4ghz ssids and the first one the password is 12345678, to discard weird character input, and so the psk is psk=“12345678”

right now i have:
/etc/wpa_supplicant/wpa_supplicant.conf

# Grant all members of group "netdev" permissions to configure WiFi, e.g. via wpa_cli or wpa_gui
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
# Allow wpa_cli/wpa_gui to overwrite this config file
update_config=1
country=ES
network={
        ssid="CasitaAP"
        psk="12345678"
}

network={
        ssid="Casita"
        psk="12345678"
}

/etc/network/interface

# Location: /etc/network/interfaces
# Please modify network settings via: dietpi-config
# Or create your own drop-ins in: /etc/network/interfaces.d/

# Drop-in configs
source interfaces.d/*

# Local
auto lo
iface lo inet loopback

# Ethernet
#allow-hotplug eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 1.1.1.1 1.0.0.1

# WiFi
allow-hotplug wlan0
iface wlan0 inet dhcp
#address 192.168.1.15
#netmask 255.255.255.0
#gateway 192.168.1.1
#dns-nameservers 1.1.1.1 1.0.0.1
wireless-power off
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

journalctl -u ifplugd.service

jun 21 11:09:59 DietPi systemd[1]: Starting LSB: Brings up/down network automatically...
jun 21 11:09:59 DietPi ifplugd(eth0)[439]: ifplugd 0.28 initializing.
jun 21 11:09:59 DietPi ifplugd(eth0)[439]: Using interface eth0/DC:A6:32:A9:4B:8D with driver <bcmgenet> (version: v2.0)
jun 21 11:09:59 DietPi ifplugd(eth0)[439]: Using detection mode: SIOCETHTOOL
jun 21 11:09:59 DietPi ifplugd(eth0)[439]: Initialization complete, link beat not detected.
jun 21 11:09:59 DietPi ifplugd[423]: Network Interface Plugging Daemon...start eth0...done.
jun 21 11:09:59 DietPi systemd[1]: Started LSB: Brings up/down network automatically.
jun 21 11:10:04 DietPi ifplugd(eth0)[439]: Link beat detected.
jun 21 11:10:04 DietPi ifplugd(eth0)[439]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.
jun 21 11:10:04 DietPi ifplugd(eth0)[439]: client: bring down WiFi
jun 21 11:10:04 DietPi ifplugd(eth0)[439]: client: ifdown: waiting for lock on /run/network/ifstate.wlan0
jun 21 11:10:13 DietPi dhclient[556]: Killed old client process
jun 21 11:10:13 DietPi ifplugd(eth0)[439]: client: Killed old client process
jun 21 11:10:14 DietPi dhclient[556]: Internet Systems Consortium DHCP Client 4.4.1
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: Internet Systems Consortium DHCP Client 4.4.1
jun 21 11:10:14 DietPi dhclient[556]: Copyright 2004-2018 Internet Systems Consortium.
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: Copyright 2004-2018 Internet Systems Consortium.
jun 21 11:10:14 DietPi dhclient[556]: All rights reserved.
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: All rights reserved.
jun 21 11:10:14 DietPi dhclient[556]: For info, please visit https://www.isc.org/software/dhcp/
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: For info, please visit https://www.isc.org/software/dhcp/
jun 21 11:10:14 DietPi dhclient[556]: 
jun 21 11:10:14 DietPi dhclient[556]: Listening on LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: Listening on LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:10:14 DietPi dhclient[556]: Sending on   LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: Sending on   LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:10:14 DietPi dhclient[556]: Sending on   Socket/fallback
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: Sending on   Socket/fallback
jun 21 11:10:14 DietPi dhclient[556]: DHCPRELEASE of 192.168.1.130 on wlan0 to 192.168.1.1 port 67
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: DHCPRELEASE of 192.168.1.130 on wlan0 to 192.168.1.1 port 67
jun 21 11:10:14 DietPi dhclient[556]: send_packet: Network is unreachable
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: send_packet: Network is unreachable
jun 21 11:10:14 DietPi dhclient[556]: send_packet: please consult README file regarding broadcast address.
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: send_packet: please consult README file regarding broadcast address.
jun 21 11:10:14 DietPi dhclient[556]: dhclient.c:2878: Failed to send 300 byte long packet over fallback interface.
jun 21 11:10:14 DietPi ifplugd(eth0)[439]: client: dhclient.c:2878: Failed to send 300 byte long packet over fallback interface.
jun 21 11:10:15 DietPi ifplugd(eth0)[439]: Program executed successfully.
jun 21 11:12:13 DietPi ifplugd(eth0)[439]: Link beat lost.
jun 21 11:12:18 DietPi ifplugd(eth0)[439]: Executing '/etc/ifplugd/ifplugd.action eth0 down'.
jun 21 11:12:18 DietPi ifplugd(eth0)[439]: client: bring up WiFi
jun 21 11:12:18 DietPi wpa_supplicant[918]: Successfully initialized wpa_supplicant
jun 21 11:12:19 DietPi dhclient[926]: Internet Systems Consortium DHCP Client 4.4.1
jun 21 11:12:19 DietPi dhclient[926]: Copyright 2004-2018 Internet Systems Consortium.
jun 21 11:12:19 DietPi dhclient[926]: All rights reserved.
jun 21 11:12:19 DietPi dhclient[926]: For info, please visit https://www.isc.org/software/dhcp/
jun 21 11:12:19 DietPi dhclient[926]: 
jun 21 11:12:19 DietPi ifplugd(eth0)[439]: client: Internet Systems Consortium DHCP Client 4.4.1
jun 21 11:12:19 DietPi ifplugd(eth0)[439]: client: Copyright 2004-2018 Internet Systems Consortium.
jun 21 11:12:19 DietPi ifplugd(eth0)[439]: client: All rights reserved.
jun 21 11:12:19 DietPi ifplugd(eth0)[439]: client: For info, please visit https://www.isc.org/software/dhcp/
jun 21 11:12:19 DietPi dhclient[926]: Listening on LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:12:19 DietPi dhclient[926]: Sending on   LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:12:19 DietPi dhclient[926]: Sending on   Socket/fallback
jun 21 11:12:19 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
jun 21 11:12:19 DietPi ifplugd(eth0)[439]: client: Listening on LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:12:19 DietPi ifplugd(eth0)[439]: client: Sending on   LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:12:19 DietPi ifplugd(eth0)[439]: client: Sending on   Socket/fallback
jun 21 11:12:19 DietPi ifplugd(eth0)[439]: client: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
jun 21 11:12:21 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 11:12:22 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
jun 21 11:12:22 DietPi ifplugd(eth0)[439]: client: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
jun 21 11:12:24 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:12:26 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
jun 21 11:12:26 DietPi ifplugd(eth0)[439]: client: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
jun 21 11:12:27 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 11:12:30 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:12:30 DietPi dhclient[926]: No DHCPOFFERS received.
jun 21 11:12:30 DietPi dhclient[926]: Trying recorded lease 192.168.1.107
jun 21 11:12:30 DietPi ifplugd(eth0)[439]: client: No DHCPOFFERS received.
jun 21 11:12:30 DietPi ifplugd(eth0)[439]: client: Trying recorded lease 192.168.1.107
jun 21 11:12:33 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'Casita'
jun 21 11:12:33 DietPi ifplugd(eth0)[439]: client: PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
jun 21 11:12:33 DietPi ifplugd(eth0)[439]: client: --- 192.168.1.1 ping statistics ---
jun 21 11:12:33 DietPi ifplugd(eth0)[439]: client: 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
jun 21 11:12:33 DietPi dhclient[926]: No working leases in persistent database - sleeping.
jun 21 11:12:33 DietPi ifplugd(eth0)[439]: client: No working leases in persistent database - sleeping.
jun 21 11:12:33 DietPi ifplugd(eth0)[439]: Program executed successfully.
jun 21 11:12:35 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
jun 21 11:12:35 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:12:38 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'Casita'
jun 21 11:12:41 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:12:42 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 4
jun 21 11:12:44 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 11:12:46 DietPi dhclient[926]: No DHCPOFFERS received.
jun 21 11:12:46 DietPi dhclient[926]: Trying recorded lease 192.168.1.107
jun 21 11:12:47 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:12:49 DietPi dhclient[926]: No working leases in persistent database - sleeping.
jun 21 11:12:50 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 11:12:52 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
jun 21 11:12:53 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:12:53 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="CasitaAP" auth_failures=1 duration=10 reason=CONN_FAILED
jun 21 11:12:57 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
jun 21 11:13:01 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'Casita'
jun 21 11:13:02 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 1
jun 21 11:13:03 DietPi dhclient[926]: No DHCPOFFERS received.
jun 21 11:13:03 DietPi dhclient[926]: Trying recorded lease 192.168.1.107
jun 21 11:13:03 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:13:07 DietPi dhclient[926]: No working leases in persistent database - sleeping.
jun 21 11:13:07 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-SSID-REENABLED id=0 ssid="CasitaAP"
jun 21 11:13:07 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'Casita'
jun 21 11:13:10 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:13:10 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=1 ssid="Casita" auth_failures=1 duration=10 reason=CONN_FAILED
jun 21 11:13:10 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
jun 21 11:13:17 DietPi wpa_supplicant[921]: wlan0: Trying to associate with SSID 'CasitaAP'
jun 21 11:13:18 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
jun 21 11:13:20 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16
jun 21 11:13:20 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="CasitaAP" auth_failures=2 duration=23 reason=CONN_FAILED
jun 21 11:13:21 DietPi dhclient[926]: No DHCPOFFERS received.
jun 21 11:13:21 DietPi dhclient[926]: Trying recorded lease 192.168.1.107
jun 21 11:13:24 DietPi dhclient[926]: No working leases in persistent database - sleeping.
jun 21 11:13:29 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
jun 21 11:13:33 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-SSID-REENABLED id=1 ssid="Casita"
jun 21 11:13:33 DietPi wpa_supplicant[921]: wlan0: Failed to initiate sched scan
jun 21 11:13:37 DietPi dhclient[926]: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
jun 21 11:13:40 DietPi dhclient[926]: No DHCPOFFERS received.
jun 21 11:13:40 DietPi dhclient[926]: Trying recorded lease 192.168.1.107
jun 21 11:13:40 DietPi ifplugd(eth0)[439]: Link beat detected.
jun 21 11:13:40 DietPi ifplugd(eth0)[439]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.
jun 21 11:13:40 DietPi ifplugd(eth0)[439]: client: bring down WiFi
jun 21 11:13:40 DietPi dhclient[1125]: Killed old client process
jun 21 11:13:40 DietPi ifplugd(eth0)[439]: client: Killed old client process
jun 21 11:13:40 DietPi wpa_supplicant[921]: wlan0: Failed to initiate sched scan
jun 21 11:13:41 DietPi dhclient[1125]: Internet Systems Consortium DHCP Client 4.4.1
jun 21 11:13:41 DietPi dhclient[1125]: Copyright 2004-2018 Internet Systems Consortium.
jun 21 11:13:41 DietPi dhclient[1125]: All rights reserved.
jun 21 11:13:41 DietPi dhclient[1125]: For info, please visit https://www.isc.org/software/dhcp/
jun 21 11:13:41 DietPi dhclient[1125]: 
jun 21 11:13:41 DietPi ifplugd(eth0)[439]: client: Internet Systems Consortium DHCP Client 4.4.1
jun 21 11:13:41 DietPi ifplugd(eth0)[439]: client: Copyright 2004-2018 Internet Systems Consortium.
jun 21 11:13:41 DietPi ifplugd(eth0)[439]: client: All rights reserved.
jun 21 11:13:41 DietPi ifplugd(eth0)[439]: client: For info, please visit https://www.isc.org/software/dhcp/
jun 21 11:13:41 DietPi dhclient[1125]: Listening on LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:13:41 DietPi dhclient[1125]: Sending on   LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:13:41 DietPi dhclient[1125]: Sending on   Socket/fallback
jun 21 11:13:41 DietPi ifplugd(eth0)[439]: client: Listening on LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:13:41 DietPi ifplugd(eth0)[439]: client: Sending on   LPF/wlan0/dc:a6:32:a9:4b:8e
jun 21 11:13:41 DietPi ifplugd(eth0)[439]: client: Sending on   Socket/fallback
jun 21 11:13:41 DietPi dhclient[1125]: DHCPRELEASE of 192.168.1.130 on wlan0 to 192.168.1.1 port 67
jun 21 11:13:41 DietPi ifplugd(eth0)[439]: client: DHCPRELEASE of 192.168.1.130 on wlan0 to 192.168.1.1 port 67
jun 21 11:13:42 DietPi wpa_supplicant[921]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or directory
jun 21 11:13:42 DietPi wpa_supplicant[921]: nl80211: Failed to set IPv4 unicast in multicast filter
jun 21 11:13:42 DietPi wpa_supplicant[921]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlan0/drop_unicast_in_l2_multicast: No such file or directory
jun 21 11:13:42 DietPi wpa_supplicant[921]: nl80211: Failed to set IPv4 unicast in multicast filter
jun 21 11:13:42 DietPi wpa_supplicant[921]: nl80211: deinit ifname=p2p-dev-wlan0 disabled_11b_rates=0
jun 21 11:13:42 DietPi wpa_supplicant[921]: p2p-dev-wlan0: CTRL-EVENT-TERMINATING
jun 21 11:13:42 DietPi wpa_supplicant[921]: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
jun 21 11:13:42 DietPi wpa_supplicant[921]: wlan0: CTRL-EVENT-TERMINATING
jun 21 11:13:42 DietPi ifplugd(eth0)[439]: Program executed successfully.

Hi,

looks like you constantly getting this issue

wlan0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16

Something similar was described in this post
https://www.raspberrypi.org/forums/viewtopic.php?t=198104

can you try using this one single AP (WiFi Network) as well as changing the WiFi Channel on your AP?

its so weird, it didnt connect to any channel from 1 to 5, then 6 connected, and so with channel 6 i reconfigured static ip and still working so its like that post said, something only channel related, i just changed again to channel 1 and still error, so i dont know… im using country=ES in the wpa_supplicant.conf :thinking:

edit: just reinstalled the eeprom firmware just in case, nothing

edit: okay so it all has to do with setting the correct reg domain, i dont know what is going on but i have seen that after a while it randomly appeared at the journalctl -u ifplugd.service two lines:
ctrl-event-regdom-change init=core type=world
CTRL-EVENT-REGDOM-CHANGE init=USER type=COUNTRY alpha2=ES
and so i saw that and tried luck and yeah, it connected in the channel 1, and then i tested a reboot and again bad regdomain

so it seems something is overriding my wpa supplicant’s set country…

in /etc/defaults/crda i have REGDOMAIN=ES

cat /sys/module/cfg80211/parameters/ieee80211_regdom
00

crda:
COUNTRY enviroment variable not set

export COUNTRY=ES; crda
Failed to set regulatory domain: -7

iw reg get:
global
country ES: DFS-ETSI
[…]

can you have a look to dietpi-config and check on network settings which country code is set?

it was in ES, but i have started using dietpi-config again and:
i deleted the old ssids that were set in there, and set the 2.4ghz one that i was using changing the channels from 1 to 6, and it worked, it connected in channel 1. But i tried using the same, only 1 ssid, but the 5ghz one, and it doesnt connect, what could be happening? its the last issue to be fixed

using dietpi-config, it doesnt write country=es in the wpa_supplicant.config, but i tested writing it and it still doesnt connect

edit: what does the auto reconnect option do exactly?

auto reconnect option will try to connect you back to WiFi once the WiFi connection get lost (disconnect from WiFi).

okay but that is the default behaviour of wpa_supplicant right? enabling that option would be the same as the default behaviour?
i have it disabled right now and it tries to connect (failing) continuously

Nope, wpasupplicant has not internal auto-reconnection feature (that I am aware of). The one in dietpi-config starts dietpi-wifi-monitor.service which does that by checking connection state every 10 seconds. However just to be clear it is very simple and does not know about ifplugd or other intentions, hence is not compatible with the ifplugd-based auto-switch on Ethernet connection. It will try to reconnect WiFi until you either stop the service (or dietpi-config option) or physically unplug the adapter :wink:.