Score:1

Permanently disable network interface in Ubuntu 22.04

bl flag

I'm running Ubuntu 22.04, and want to disable the Wifi interface on my machine. I can use

ip link set wlx0007324d4d34 down

to take it down from the CLI, but that doesn't survive a reboot. How do I make this change permanent, using netplan or something similar?

nobody avatar
gh flag
You can make it over udev at least I would try it this way.
chili555 avatar
cn flag
The interface name wlx indicates that it is WireLess eXternal; i.e. a USB wireless device. Why not simply unplug it?
Jeff avatar
bl flag
No, it's not a USB wireless device. Not sure why the naming is coming up like that, but it's an AtomicPI and there's nothing to unplug.
chili555 avatar
cn flag
Let's blacklist the driver. It will appear in `lsmod` As the output will be lengthy, paste it here and give us the link: http://paste.ubuntu.com
Jeff avatar
bl flag
Here's the lsmod output. https://paste.ubuntu.com/p/Sxs2MSGXhj/ I believe the Wifi device is an rt5572.
nobody avatar
gh flag
Can you add `lspci -nnk | grep -i net -A2` please? And `udevadm info /sys/class/net/wlx0007324d4d34 --attribute-walk`
Score:3
tn flag

In Ubuntu 22.04, the network configuration files are by default located at /etc/netplan/*.yaml instead of /etc/network/interfaces.

Open the /etc/netplan/*.yaml file and in that, the interface you are interesting in disabling, under the 'set' keyword - you can add the 'down' keyword and set it to

network:
    version: 2
    ethernets:
        interface:
            activation-mode: off

Save the file and then apply the changes using

sudo netplan apply

You can reboot to check if it still appears in the ifconfig.

Jeff avatar
bl flag
Hmm. This errors out with a few issues. It "netplan try" doesn't recognize the keys "name" or "down".
Score:1
tf flag

Edit the /etc/network/interfaces file and add:

iface <interface_name> inet manual

After that, restart service using:

sudo service network-manager restart
Jeff avatar
bl flag
This machine does not have network-manager installed. I can install it, but that seems like overkill just to disable a device!
chili555 avatar
cn flag
The /etc/network/interfaces mechanism has been deprecated since Ubuntu 17.10.
Score:0
cn flag

The driver for your device is rt2800usb. You may disable the device by unloading and blacklisting its driver:

sudo -i
modprobe -r rt2800usb
echo "blacklist rt2800usb" >>  /etc/modprobe.d/blacklist.conf
exit

Reboot.

Jeff avatar
bl flag
This seems to disable all network connections, not just the wireless.
chili555 avatar
cn flag
Didn't r8169 load after reboot? `lsmod | grep r8169`
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.