Ubuntu – Ubuntu 16.04 – Disable internal WIFI while enabling external WIFI adapter

network-manager

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:

  1. Turning it off using Ubntu’s network menu – does not remain OFF after boot.
  2. 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 )screencapture

Problem solved: After applying @pa4080 answer- device not managed screenshot

Best Answer

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 SettingsKeyboardShortcutsCustom 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:

Related Question