What is the 'correct' way to disable WIFI on Raspberry 3B+ running Openhabian

Hi All, I have my RPi3 running Openhabian. Recently I (succesfully) enabled my WIFI thinking this would be a nice ‘back-up’ when I wanted to try something on the Pi and I could easily remove it from the garage where it normally lives to play with it in the livingroom.

When I connect both the LAN and the WIFI the WIFI seems to have priority. Since I want my LAN to have priority (stable connection) I would like to disable the WIFI again. I’m not using it anyhow.

However, I can’t seem to remove the credentials with ‘’‘openhabian-config’’’.

What is the correct way to disable WIFI again?

There is a lot of bad info out there. I just tried this as an experiment for you since I too use wired.

As root

systemctl disable hciuart

Using a text editor, edit /boot.config.txt. At the end, add
# Disable Wi-Fi
dtoverlay=pi3-disable-wifi

Reboot

wlan0 should be gone.

Should it be possible to have both interfaces?

I suspect so if they connect to different subnets. Otherwise routing could get more complex.

What is your ultimate goal here?

My ultimate goal is a stable system when running in operational mode (thus LAN) but with the flexibility to pick up my Pi and take it to an other location when I’m testing something with my Gpio (thus wifi).

-Initially I only worked with LAN, no problems
-Then I entered my wifi credentials and I could work with wifi. However due to poor signal strength in my default location this sometimes causes problems.
-Currently when I plug in my network cable I still connect via wifi, hence the idea to disable wifi.

Since the system is Debian-based like Ubuntu, This is worth a try.

It seems like I somehow cometely removed eth0 from my interfaces file.

# 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

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Let’s see if I can find out what happened and how to get it back

I’ve changed my interfaces file now.

# 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 lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
    metric 50

allow-hotplug wlan0
iface wlan0 inet manual
    metric 100
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Now I can ssh to both my wlan and eth0 connections.
Still strange, I use system items to show my IP address and that shows the WLAN IP.

It looks like you are manually setting your WLAN address? Is it in your /etc/hosts file?

This is my etc/hosts file

127.0.0.1	localhost
::1		localhost ip6-localhost ip6-loopback
ff02::1		ip6-allnodes
ff02::2		ip6-allrouters

127.0.1.1 openHABianPi
``

This line is why I thought you were setting your WLAN ip address manually.

Marijn, I had the same problem where the wlan0 interface had priority. I found three default routes, one for wlan0 with metric 0, one for eth0 with metric 202, and another one for wlan0 with metric 303. There are a number of posts referencing these three routes but so far I have not figured out where the metric 0 route comes from. I added the following line to rc.local and the wired connection now has precedence. I tested unplugging the eth0 cable - its default route disappeared and traffic switched over to wlan0. When I plugged in the eth0 cable, the eth0 default route reappeared. At least in this situation, the metric 0 default route for wlna0 was not recreated.

route del -net 0.0.0.0 netmask 0.0.0.0 metric 0 dev wlan0

1 Like

@nh905 nh905, same here…I have a wlan0 with metrich 0 and a eth0 with metric 0.

What exactly does your line do?

@Marijn_Oudijk, because of the low metric, wlan0 becomes the preferred route for external traffic. My route table also includes specific routes for my local subnet referencing eth0 (metric 202) and wlan0 (metric 303). Even with the third default route, local traffic to other devices on my LAN were using eth0, with external traffic using wlan0.

The right answer is to figure out what adds the second default route referencing wlan0 but deleting it has proven to be an expedient solution.

Regards, Norbert

@Bruce_Osborne
Hi, can I disable WiFi as you recommended?