disable wifi on raspberry pi

7 Ways to Disable Wi-Fi on Raspberry Pi (Lite/Desktop)

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.

1: Crontab

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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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 projects 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):
    blacklist brcmfmac
    blacklist brcmutil

  • 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.

4: Config.txt

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:
    dtoverlay=disable-wifi
    dtoverlay=disable-bt

    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:
dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt

Editing files on a fresh Raspberry Pi OS SD card is a great way to save time for the first boot. You can do many things like this as explained in this other article.

5: Modprobe

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.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

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.

6: RFKill

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

7: Systemctl

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).

Video

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

FAQ

❤️ Love Raspberry Pi & writing?
Combine your passions and get paid. Write for RaspberryTips!

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 “#”).

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.

Conclusion

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:

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: 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.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts

10 Comments

  1. I went with “4 : Config.txt”. It worked like a charm.

    I’m running a headless piHole installation and was looking to conserve RAM by disabling wireless radios and sound. I recovered 32MB of RAM after disabling WIFI, BT, and the bcm2835 sound chip. Here’s a snippet of by /boot/config.txt:

    ******************************************************************************************
    # Additional overlays and parameters are documented /boot/overlays/README
    dtoverlay=disable-wifi
    dtoverlay=disable-bt

    # Enable audio (loads snd_bcm2835)
    dtparam=audio=off

    ******************************************************************************************

    Version: Pi 4 model B, 4GB
    PiHole 5.0

  2. Hi, thanks for the guide! I tried the crontab in my Rpi4 and it didn’t work (subsequently tried the “sudo ifconfig wlan0 down” manually and it did work). After that I tried modifying the config.txt and that did work. I had a question though, when one disables the WiFi in the GUI what command is run? I ask because someday in the future I may stop using my Pi for a few years, then one day plug it back in with the GUI (I’m not using the GUI now) and scratch my head at why the WiFi isn’t working. So if I had to choose a method, I would choose whichever is the one that the GUI also uses, so that it could be undone by the GUI.

  3. Thank you for this. I went with the config.txt approach so that if I need to enable it again without an ethernet connection, I can pull the card and edit the file.

    systemctl disable was not working over a reboot on my Pi 4 Raspbian Buster either.

  4. Thanks for the guide.

    Use my Pi as a light server and everything that is not necessary should be removed. In DietPi there is a way of removing/purging software for wifi and I miss that in you guide.

Comments are closed.