Disable the Wi-Fi adapter on RaspberryPi

Using a RaspberryPi in your home can greatly reduce costs and allow you to tinker around with new and interesting projects, commonly many people use their RaspberryPi wirelessly. But how do you disable the adapter when it is no longer needed?

Temporary Disable (Until Reboot)

Use the following command to disable Wi-Fi temporarily:

sudo ifconfig wlan0 down

To re-enable it:

sudo ifconfig wlan0 up

This first method is only temporary, the WiFi adapter will reenable once a reboot has happened. For you to keep the Wi-Fi adapter disabled follow the below guide:

Using rfkill

You can block Wi-Fi with the following command:

sudo rfkill block wifi

To unblock it later:

sudo rfkill unblock wifi

If you want this change to persist across reboots, create a systemd service:

  1. Create the service file:

    sudo nano /etc/systemd/system/disable-wifi.service
  2. Add the following content:

    ini

    [Unit]
    Description=Disable Wi-Fi
    After=multi-user.target

    [Service]
    Type=oneshot
    ExecStart=/usr/sbin/rfkill block wifi

    [Install]
    WantedBy=multi-user.target
  3. Save and exit the file (Ctrl+O, then Ctrl+X).
  4. Enable the service:
    sudo systemctl enable disable-wifi

Be sure to check out our other Tutorial posts for more information:

Tutorial Posts

Feel free to also try something else, such as setting up your own ad blocker using PiHole!

PiHole Install Guide

https://pi-hole.net/

Leave a Reply

Your email address will not be published. Required fields are marked *