In a recent tutorial, I showed you how to use Wi-Fi on your Raspberry Pi (with 5 different solutions). And today, I will show you the opposite. That’s to say, how to disable your Wi-Fi adapter and use the Ethernet cable instead.
Wi-Fi isn’t necessary when your Raspberry Pi is always connected to an Ethernet cable. The easiest way to disable Wi-Fi on your Raspberry Pi is to turn it off manually with sudo ifconfig wlan0 down, but there are many other solutions that you can use instead.
In this post, I will show you 7 ways to disable your Wi-Fi forever (until you reverse your changes). Most of them will work on any operating system, but I only tested on Raspberry Pi OS.
By the way, if you are interested in improving your skills on Raspberry Pi, I highly recommend checking out my e-book here. It’s a 30-day challenge from beginner to master, with step-by-step tutorials and many projects to practice along the way.
In the introduction, I gave you one command to temporarily disable your Wi-Fi interface, but crontab can also be used to disable Wi-Fi automatically at each reboot:
- If you are on Raspberry Pi OS Desktop, start by opening a terminal (or jump to the next solution, easier for you).
- Then open the crontab in edit mode:
sudo crontab -e
Crontab is something like a tool to configure scheduled tasks, you can learn more here about Linux crons.
When you use sudo crontab instead of crontab, you are scheduling the tasks for the root user.
- If it’s the first time you do this, select your favorite text editor.
Press enter to stay with nano:
- In the crontab file, add the following line at the end:
@reboot ifconfig wlan0 down
- Save and exit (CTRL+O and CTRL+X with nano).
If you are new to the Nano text editor on Linux, you can read my guide about it, with all the important commands and shortcuts to use it effectively (click on the link to check).
Your Wi-Fi adapter will now stop directly at each boot, so be sure to use the Ethernet cable all the time.
To bring the Wi-Fi up again (temporarily), use the following:
sudo ifconfig wlan0 up
Or remove the line in the crontab to enable it at each boot.
Note: I tested this recently on the latest Raspberry Pi OS version, and it didn’t work. I had to add some sleep time before disabling the WLAN interface (I guess Raspberry Pi OS is now starting it after the cron).
If you have the same issue, just change the crontab with something like that:
@reboot sleep 10; ifconfig wlan0 down
Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.
2: Raspberry Pi OS Desktop
Most of my solutions here are for Raspberry Pi OS Lite. If you are on Raspberry Pi OS Desktop, there is an easy way to disable the Wi-Fi adapter:
- On the right top bar (near the clock), find the Wi-Fi icon.
- Click on it (left-click).
- A menu like this shows up:
- Click on “Turn Off Wireless LAN” to disable it.
You need to do this after each reboot, but it’s this easy.
I didn’t find a permanent way on Raspberry Pi OS Desktop (at least without losing the SSID configuration).
If you need help getting started on Raspberry Pi, I have an entire course to guide you through your first steps. I’ll help you use the perfect hardware, plug everything in and install your first system. You’ll also do your first project with me, just to make sure you are ready for the next level. Get all the information on this page if you are interested.
3: Raspi blacklist
The third way to disable Wi-Fi on your Raspberry Pi is more extreme. On Debian, as on many other distributions, modprobe is a program that loads kernel modules on boot.
You can choose to disable some modules, like the Wi-Fi drivers for your Raspberry Pi:
- In a terminal, open the following file:
sudo nano /etc/modprobe.d/raspi-blacklist.conf
- Paste these two lines in it (the file is probably empty):
- Save and exit (CTRL+O, CTRL+X).
Then reboot your Raspberry Pi (with an Ethernet cable plugged in), and you won’t see the Wi-Fi adapter on the next boot.
Remove the two lines from the file to reactivate it.
Another method you can try is to edit the Raspberry Pi OS configuration file.
The good news is that you can even do this on a new Raspberry Pi OS SD card in order to disable the Wi-Fi directly.
Here is how to do this:
- You can open a terminal, connect via SSH, or edit the file directly on the SD card from your computer.
- Open the config.txt file with nano:
sudo nano /boot/config.txt
- Find the following line:
# Additional overlays and parameters are documented /boot/overlays/README
- And add these two lines under it:
The second line is for the Bluetooth module (don’t add it if you need Bluetooth and just want to disable Wi-Fi).
- Save and exit (CTRL+O, CTRL+X).
- Reboot your Raspberry Pi to check if everything works as expected.
Note: on older Raspberry Pi OS versions, you may need to add pi3 at the beginning, like this:
Modprobe is similar to the blacklist solution, but it’s a temporary one.
You can use modprobe as a command instead of editing the configuration file.
Here is the command (use this in a terminal if you are on Raspberry Pi OS Desktop):
sudo modprobe -rv brcmfmac
This command will also remove brcmutil and cfg80211 automatically.
To bring back the Wi-Fi adapter, use this one:
sudo modprobe brcmfmac
If the first solution didn’t work for you, you can use this command in crontab to do it automatically on boot.
RFKill is a command line tool to query, enable or disable radio transmitters on a system.
That’s exactly what we want to do, so we can use RFKill to disable our Wi-Fi adapter.
RFKill is available directly on any Raspberry Pi OS version.
Here is how to do this:
- Open a terminal and enter the following commands:
sudo rfkill block wifi
sudo rfkill block bluetooth
- This should disable your Wi-Fi and Bluetooth cards directly.
The block command is persistent after a reboot.
To enable Wi-Fi or Bluetooth, use the
unblock command like this:
sudo rfkill unblock wifi
sudo rfkill unblock bluetooth
Finally, the last solution I want to show you is to use
systemctl to stop the wireless services.
Systemd is the service manager on many Linux distributions, and you can use
systemctl to see and control each service state.
Here are the three commands to do to disable all services:
sudo systemctl disable wpa_supplicant
sudo systemctl disable bluetooth
sudo systemctl disable hciuart
Then reboot your Pi to apply the changes.
Use the “enable” command to use the Wi-Fi again. For example:
sudo systemctl enable wpa_supplicant
Note: This is not working on my Pi 4 with the latest Raspberry Pi OS, but I have seen these commands many times, and I’m sure to have used them in the past, so it’s probably working on other OS or Raspberry Pi models. I give it to you as a last chance if everything else is not working for you.
Tips to improve your network speed
One of the reasons you might be reading this tutorial is if you have network issues, like disconnections or low speed.
Here are a few other things you can try to solve this:
- Use a Raspberry Pi 4: The previous Raspberry Pi models didn’t include a gigabit Ethernet port (even the Raspberry Pi 3B+ is limited to 300 MB max). By using a recent model, you can really improve your network speed for projects where it’s essential.
- Use a better switch: If you have an old router that provides an Internet connection, it may not be the best solution for a fast network between your computer and your Raspberry Pi. Adding a faster switch, with 1 GB Ethernet ports on it, will improve your transfer rates.
- Replace the Ethernet cables: May not be the more efficient solution, but it’s definitely the cheapest one. I’ve been using the same Ethernet cables for years, but new ones are better and better, and if you have a 20-year-old cable that you replace with a new one, it may be enough to improve the network speed (and solve most of the disconnections by the way).
How to forget a saved Wi-Fi network on Raspberry Pi?
On Raspberry Pi, the Wi-Fi network configuration is saved under /etc/wpa_supplicant/wpa_supplicant.conf. Removing the information from this file will delete the wireless configuration, and the Raspberry Pi won’t auto-connect to this SSID anymore.
It’s also possible to comment the paragraph, to disable the auto connection while keeping the password in this file (start each line with “#”).
Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.
That’s it! I think we have seen most of the solutions available.
I hope you found one that works for you, and that this post was helpful.
If you have any other ideas to do the same thing, feel free to leave a comment in the community.
And to conclude, here are a few related tutorials that might be useful next:
- 15 Easy Projects for Raspberry Pi Beginners (With Links)
- Install Webmin and configure your system without any command
- How to Login as Root on Raspberry Pi OS?
Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.
Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.
If you just want to hang out with me and other Raspberry Pi fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.
Need help building something with Python?
Create, understand, and improve any Python script for your Raspberry Pi.
Learn the essentials step-by-step without losing time understanding useless concepts.
Get the e-book now.
You can also find all my recommendations for tools and hardware on this page.