Ubuntu 16.04 – Disable internal WIFI while enabling external WIFI adapter
I’m using a clean install of Ubuntu 16.04, on an LG laptop which is quite old.
In order to get a faster wifi connection I use an external USB wifi dongle.
Since I do not need both wifis- I wish to turn off on board wifi.
Tries:
- Turning it off using Ubntu’s network menu – does not remain OFF after boot.
- Using Laptop physical wifi’s On/Off button, shuts down BOTH wifis.
Is there a more elegant way making this work, other than running a bash script at boot to disable it using nmcli
?
at can see upper wifi network disabled(on board ) and lower, connected ( via USB adapter )
Problem solved: After applying @pa4080 answer- device not managed
There are at least two possible ways to disable any network adaptor/interface at system startup. First, as @TunanGuo says, use the command ifconfig
to find the name of your interface. When the interface is disabled you can use ifconfig -a
to list all interfaces. Let's assume the interface name is wlx99wifi
.
First method. Edit /etc/rc.local
with root privileges (use sudo nano /etc/rc.local
or sudo -i gedit /etc/rc.local
) and add the following line before the last line in that file, which is exit 0
:
/sbin/ifconfig wlx99wifi down
On the next reboot the device will be disabled.
Second method. This method should be more correct. Edit /etc/network/interfaces
with root privileges (use sudo nano /etc/network/interfaces
or sudo -i gedit ...
) and add the following line to the bottom of this file:
iface wlx99wifi inet manual
On the next reboot the device will be disabled. You can run the next command to restart network-manager
and reload the settings without reboot:
sudo systemctl restart network-manager.service
Create custom shortcuts to up/down the interface. First install gksu
package to get a GUI prompt to enter your password when you need to gain root privileges:
sudo apt install gksu
Then go to System Settings
→ Keyboard
→ Shortcuts
→ Custom Shortcuts
and:
-
Create Interface UP shortcut: Click + to add a new keyboard shortcut.
For Name fill wlx99wifi UP, and for Command fill:
gksu ifconfig wlx99wifi up
Click Apply and then click on the Disabled label to assign shortcut key combination. For example, use the combination Crtl+Shift+↑ Arrow Up
-
Create Interface DOWN shortcut: Click + to add a new keyboard shortcut.
For Name fill wlx99wifi DOWN, and for Command fill:
gksu ifconfig wlx99wifi down
Click Apply and then click on the Disabled label to assign shortcut key combination. For example, use the combination Crtl+Shift+↓ Arrow Down
References and sources:
Remove network interface permanently
How do I set a custom keyboard shortcut to control volume?
How do I add sudo commands to a keyboard shortcut?
Author's notes: Configure WiFi Connections | GnomeDev nmcli
Use ifconfig
to control the interfaces. You can type ifconfig
into terminal.
Both your WiFi cards would pop up as "wlan0" or "wlan1" or other names. Shut down the interface using ifconfig wlan0 down
. If you found that you shut down the wrong one, use ifconfig wlan0 up
to enable it.
You need root privilege to do this, so use sudo ifconfig ...