Отключить wifi адаптер linux

How to disable built-in Wi-Fi and use only USB Wi-Fi card?

The built-in Wi-Fi card in my laptop (Dell XPS M1330) is crap, pretty much. I have an Asus USB Wi-Fi card, which is significantly better and works fine. What I’d like to do is disable the built-in Wi-Fi card. Is there a way to do this without having to boot into BIOS each time I want to disable/enable the built-in wireless? Here is the lsusb output:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 0b05:179d ASUSTek Computer, Inc. Bus 002 Device 004: ID 05a9:2640 OmniVision Technologies, Inc. OV2640 Webcam Bus 007 Device 002: ID 0483:2016 SGS Thomson Microelectronics Fingerprint Reader 
09:00.0 Ethernet controller [0200]: Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express [14e4:1713] (rev 02) Subsystem: Dell XPS M1330 [1028:0209] Kernel driver in use: tg3 -- 0c:00.0 Network controller [0280]: Broadcom Corporation BCM4312 802.11b/g LP-PHY [14e4:4315] (rev 01) Subsystem: Dell Wireless 1395 WLAN Mini-Card [1028:000b] Kernel driver in use: wl 

13 Answers 13

Add the following line to /etc/network/interfaces :

NetworkManager doesn’t manage interfaces configured in the interfaces file. Replace wlan0 with the interface you want to disable, if it’s not the name of the built-in interface.

Then restart network manager:

sudo service network-manager restart 

@Matt Edit with sudo nano /etc/network/interfaces , add the line, save and exit (Ctrl+O, ENTER, Ctrl+X).

Identifying the logical device name can get confusing. ifconfig is absolutely no help in this. Do a sudo lshw -C network to match the plain english descriptions to logical device name. For example, the builtin on my Dell Lattitude running Mint is wlp3s0 and the external wifi (usb) is wlx9cefd5fcd694 .

After i did this, my CloudPath utility for connecting to eduroam wifi network did not see the USB wifi adapter. The built in adapter is wlp3s0 which is one of two, the USB being wlxd45d649ce597 so I added iface wlp3s0 inet manual` and the sudo service network-manager restart , Here is the CloudPath utility I am using on Ubuntu 18.04: it.ubc.ca/services/email-voice-internet/…

FYI to all, this answer hasnt been updated since 2016. I couldnt find ‘interfaces’ in etc/network/ on Xubuntu 20.04. is it because of slight difference in OS or am i missing something else. Only this answer worked for me: askubuntu.com/a/1320155/327339

I think the easiest way to do this is with ifconfig .
EDIT 2021-03-02: Apparently, if you’re still using ifconfig you’re living in the past, so have a look at Gabriel’s answer below for an ip solution. Read below for the old ifconfig solution.

Читайте также:  Мониторинг температуры видеокарты linux

ifconfig solution:
Run

then look at which adapter you want to turn off, in my case wlan1 is my internal wifi and wlan2 is my usb wifi. Then run

and it will turn off (type ifconfig to check, note that in the network manager the adapter still shows, but it is turned off). To turn it on again:

ifconfig will tell you which adapters are there, most likely the lowest number will be your built-in adapter, but I think you should just try it to be sure.

It seems that sudo lshw -C network give a list of items whose ‘logical name’s are the ones to be used with sudo ifconfig [logical name] up .

For me on 16.04 this causes the interface to disappear from ifconfig for a moment, but then it reappears and reconnects soon.

To blacklist the module of your wireless card:

  1. sudo vi /etc/modprobe.d/blacklist.conf (or create a custom one)
  2. Uncomment the module name that has a # in the beginning of the line:

To remove a module manually without rebooting:

Looses effect after reboot.

If you wanted to blacklist eth1394 woudln’t you uncomment the line or add a new line ? Otherwise this is what I needed thanks!

For me this is the right solution. I’m on MX Linux and was confused, because doing sudo ifconfig wlan0 down sets the interface down only for a few minutes, when checking back with ifconfig the interfaces was up again. So I added blacklist iwlwifi to my /etc/modprobe.d/blacklist.conf and that’s it. Btw. I don’t need wifi at all.

Did this and they still both appear. Btw, does having the default original wifi card connect to the same wifi network as my superfast usb wifi adapter slow down the overall speed?

This answer has been tested and works (at a minimum) on Ubuntu 20.04 with my BrosTrend 1200Mbps Wifi adapter. See my BrosTrendWifiAdapterSoftware repo here. See also my other answer here.

How to enable/disable networking (ethernet or wifi) devices, arbitrarily

How to disable built-in wifi and use only USB wifi card?

  1. Unplug your external USB wifi adapter.
  2. Run iwconfig to see what your built-in adapter looks like. Mine shows wlan0 . So, that is my built-in wifi adapter!
  3. Now plug in your external USB wifi adapter and run iwconfig again to see which device just showed up. This new device showing up in iwconfig is what you just plugged in, so we can know it is the external USB wifi adapter. Mine shows wlan3 .
  4. Run the following to disable the internal wifi adapter, wlan0 :
# recommended (newer cmd) sudo ip link set wlan0 down # alternative (apparently an older cmd) sudo ifconfig wlan0 down 
# recommended (newer cmd) sudo ip link set wlan0 up # alternative (apparently an older cmd) sudo ifconfig wlan0 up 

References:

  1. This ifconfig answer by Gerhard Burger
  2. NOTE: Apparently this ip link set command is intended to replace the older (and apparently/supposedly now-deprecated?) ifconfig cmd! See: https://www.redhat.com/sysadmin/ifconfig-vs-ip —> in the sections «What’s trending?» and «Enable and disable an interface».

See also:

@jcollum, in that case it probably means you have a driver issue and need to install its driver. For example, here are some of my GitHub repos for various WiFi drivers.

Connect the USB Wi-Fi dongle and disable the internal Wi-Fi adapter as below:

    Identify your adapter’s name by:

sudo ip link set wlp2s0 down 

This will ensure that only the USB Wi-Fi adapter is active even though the internal Wi-Fi driver will still be active.

ALTERNATIVELY

Disable the internal Wi-Fi driver module:

This will ensure that only the USB Wi-Fi dongle is active.

sudo modprobe -r iwlmvm worked for me.. but how can I make it persistent after reboot.. please help..

modprobe command is so cool. I was wondering how to identify which driver module my laptop is using for wifi. In my case, I might not have «iwlmvm» as the wifi driver’s name. How to identify the real name?

Most laptops these days have Intel wireless cards, which you can very easily disable using the command:

or disable and blacklist permanently using:

sudo modprobe -r iwlwifi; sudo modprobe -b iwlwifi 

I do this with my laptop to use my high-gain TP-Link adapter instead of the internal Wi-Fi card.

The built in wifi is Broacom’s BCM4312, which uses the proprietary STA driver. So, no need to blacklist anything in your particular case, just deactivate the driver, using the Additional Drivers utility.

I just found out that Trend-tech, who makes the BrosTrend AC1200 2.4GHz/5GHz WiFi adapter which I document in my repo here, recommends the following.

Internal adapters

Normally it should be possible for many wifi adapters to coexist, both internal and external ones. Unfortunately some of our customers have reported that they had connectivity issues that were resolved when they disabled their internal adapter. This may be caused by a bug in the Linux kernel, in wpa_supplicant, in network-manager or elsewhere. It’s probably not caused by our driver, as these problems happen with other USB adapters as well.

To temporarily disable your internal adapter and see if it makes things better, please open a terminal and follow the procedure below. Note that for Raspberry Pi devices, this procedure is recommended instead.

The following command shows the names of the modules (drivers) for your wifi adapters. The module for our adapters is named 8812au , 88x2bu or 8821cu . The module for Intel adapters is named iwlwifi . For Atheros it’s ath9k , etc.

ls -d /sys/module/cfg80211/holders/*/drivers | cut -d/ -f6 # Example output: 88x2bu iwlwifi 

In the following commands, replace iwlwifi with the module that you want to blacklist:

sudo -i echo "blacklist iwlwifi" > /etc/modprobe.d/local.conf update-initramfs -u reboot 

After rebooting, the internal adapter should be disabled. Also, if you have more than one USB wifi adapters, remove the additional ones. Check if things work better that way.

If you ever need to remove the blacklist, use the following commands:

sudo -i rm /etc/modprobe.d/local.conf update-initramfs -u reboot 

In a personal email to me from their Linux support team (who actually does seem to know what they are talking about, which is awesome!), they also said:

The network manager nm-connection-editor dialog (run that from a terminal to see which one I mean) has a «Device» combo box, where you can set a MAC address in order to limit one wifi connection to a specific adapter, or you can leave it empty if you want it to work with any adapter.

So normally there’s no need to disable the internal adapter at all.

That also looks pretty relevant and does seem to work.

See also:

Источник

How to permanently disable a network interface?

I’ve brought down a network interface with ifconfig wlan0 down , but every few hours or so, the wlan0 interface comes back up and I can’t figure out why. I don’t restart the machine, never changed /etc/network/interface . I guess my question is, how would I go about just «permanently» disabling wlan0 . Do I use /etc/network/interface ? I already have ifconfig wlan0 down in my rc.local .

4 Answers 4

Method #1 — from NetworkManager’s Applet

Try disabling the wireless networking under the Network Applet that’s accessible from under the icons in the upper right of your desktop.

ss #!

NOTE: The networking applet’s icon looks like a triangle wedge. The image above is pointing to is as arrow #1. If you click it you should see a menu slide out from where you can disable wireless permanently, arrow #2.

Method #2 — /etc/network/interfaces

From the file /etc/network/interfaces you can specify that NetworkManager shouldn’t control the wlan0 interface. To do so simply add this line to the above mentioned file:

Then restart NetworkManager:

$ sudo service network-manager restart 

References

I had to do something similar to this but wanted the device to not come up at all. We have physically covered up an ethernet port in a linux based device and so it shouldn’t appear at all.

I did this with udev rules.

This udev rule will tell linux to remove the pci device when a network device which has the ID_NET_NAME_ONBOARD of eno2 is added. Add it to e.g. /etc/udev/rules.d/90-disable-eno2.rules .

ACTION=="add", SUBSYSTEM=="net", ENV=="eno2", RUN+="/bin/sh -c 'echo 1 > /sys$DEVPATH/device/remove'" 

The magic environment variables like ID_NET_NAME_ONBOARD are set by udev here. I have copied some examples from the comment in that file below.

PCI Ethernet card with firmware index "1": ID_NET_NAME_ONBOARD=eno1 ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1 PCI Ethernet card in hotplug slot with firmware index number: /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1 ID_NET_NAME_MAC=enx000000000466 ID_NET_NAME_PATH=enp5s0 ID_NET_NAME_SLOT=ens1 PCI Ethernet multi-function card with 2 ports: /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/enp2s0f0 ID_NET_NAME_MAC=enx78e7d1ea46da ID_NET_NAME_PATH=enp2s0f0 /sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.1/net/enp2s0f1 ID_NET_NAME_MAC=enx78e7d1ea46dc ID_NET_NAME_PATH=enp2s0f1 PCI wlan card: /sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlp3s0 ID_NET_NAME_MAC=wlx0024d7e31130 ID_NET_NAME_PATH=wlp3s0 USB built-in 3G modem: /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.6/net/wwp0s29u1u4i6 ID_NET_NAME_MAC=wwx028037ec0200 ID_NET_NAME_PATH=wwp0s29u1u4i6 USB Android phone: /sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.2/2-1.2:1.0/net/enp0s29u1u2 ID_NET_NAME_MAC=enxd626b3450fb5 ID_NET_NAME_PATH=enp0s29u1u2 s390 grouped CCW interface: /sys/devices/css0/0.0.0007/0.0.f5f0/group_device/net/encf5f0 ID_NET_NAME_MAC=enx026d3c00000a ID_NET_NAME_PATH=encf5f0 

When testing your rules you will need to run a command like the following to make sure everything is matching and syntax is correct.

# Find the path marked "P" with this command. udevadm info --path=/sys/class/net/eno2 # Test with this command with the path from above udevadm test --action="add" /devices/pci0000:00/0000:00:1c.4/0000:03:00.0/net/eno2 2>&1 | less 

Источник

Оцените статью
Adblock
detector