2

My netplan config at /etc/netplan/wireless.yaml seems to be working well for my WiFi-to-USB adapter, but I seem to still get the native interface to come up. I would prefer to keep that down. Right now, sudo ifconfig wlp0s20f3 down doesn't seem to be persisting across reboots with config:

# See also: https://netplan.io/reference
network:
  version: 2
  renderer: networkd
  wifis:
    wlx7ca7b0babcf7:
      dhcp4: yes
      dhcp6: no
      addresses: [192.168.7.12/24] 
      gateway4: 192.168.7.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
      access-points:
        "my_network":
          password: "my_password"

How can I adjust my netplan config to keep the native WiFi interface down? Is that something that can only be configured to be persistently off elsewhere?

Additional info

$ cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown

Note I have a LAN I connect to:

$ sudo lshw -C network
  *-network                 
       description: Wireless interface
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 14.3
       bus info: pci@0000:00:14.3
       logical name: wlp0s20f3
       version: 00
       serial: 0c:dd:24:1c:52:55
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=5.3.0-7629-generic firmware=48.4fa0041f.0 ip=10.53.189.39 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:16 memory:d3510000-d3513fff
  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0.1
       bus info: pci@0000:26:00.1
       logical name: ethA
       version: 12
       serial: 80:fa:5b:7a:b1:cc
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 firmware=rtl8411-2_0.0.1 07/08/13 latency=0 link=no multicast=yes port=MII
       resources: irq:16 ioport:4000(size=256) memory:d3215000-d3215fff memory:d3210000-d3213fff
  *-network:0
       description: Ethernet interface
       physical id: 1
       logical name: ethA.200
       serial: 80:fa:5b:7a:b1:cc
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=802.1Q VLAN Support driverversion=1.8 firmware=N/A link=no multicast=yes port=MII
  *-network:1
       description: Wireless interface
       physical id: 2
       bus info: usb@1:3
       logical name: wlx7ca7b0babcf7
       serial: 7c:a7:b0:ba:bc:f7
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=rtl88x2bu multicast=yes wireless=unassociated

/etc/netplan/01-network-manager-all.yaml has contents:

# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager

See also

https://unix.stackexchange.com/a/111258/32951

2
  • Your .yaml file is incorrect. You assign static IP, gateway, and nameservers, but you have dhcp4: true. It should be false. Is this a desktop or server installation? Edit your question and show me cat /etc/network/interfaces and sudo lshw -C network.
    – heynnema
    Jun 24, 2020 at 20:18
  • Editing. So wlx7ca7b0babcf7 is what I want up while the other native interface wlp0s20f3 is what I want down.
    – tarabyte
    Jun 24, 2020 at 22:02

2 Answers 2

3

Set your /etc/network/interfaces to this:

# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown
#
auto wlp0s20f3
iface wlp0s20f3 inet manual
     pre-up ifconfig $IFACE down
     pre-down ifconfig $IFACE down
     down ifconfig $IFACE down

Note: you may have to sudo apt install ifupdown


Set your /etc/netplan/wireless.yaml to this:

network:
  version: 2
  renderer: networkd
  wifis:
    wlx7ca7b0babcf7:
      addresses: [192.168.7.12/24]
      gateway4: 192.168.7.1
      nameservers:
        addresses: [8.8.8.8, 8.8.4.4]
      access-points:
        "my_network":
          password: "my_password"

sudo netplan --debug generate

sudo netplan apply

reboot

14
  • /etc/netplan/wireless.yaml:17:7: Error in network definition: wlp0s20f3: No access points defined dhcp4: no
    – tarabyte
    Jun 24, 2020 at 23:18
  • 1
    @tarabyte I've updated my answer. See if it works now. Report back.
    – heynnema
    Jun 24, 2020 at 23:41
  • It unfortunately does not work to intentionally down it in /etc/network/interfaces, either with down ifconfig $IFACE down
    – tarabyte
    Jun 25, 2020 at 0:13
  • @tarabyte Clarification. Is it coming UP at boot and connecting to some network, or just sitting there idle? Did you install ifupdown?
    – heynnema
    Jun 25, 2020 at 0:15
  • Adding a pre-down ifconfig $IFACE down and a pre-up ifconfig $IFACE down did it! Isolating which one actually matters.
    – tarabyte
    Jun 25, 2020 at 0:37
1

Just adding this here in case somebody lands from Google.

I wasn't trying to disable Wifi specifically with Netplan, just disable it in any convenient way in a modern Ubuntu using Netplan.

Turns out the the best way that I found was to configure NetworkManager to ignore the wifi interface. I wasn't able to do it with Netplan only.

I found the information on how to do this here.

Basically add a file /etc/NetworkManager/conf.d/99-unmanaged-devices.conf

With the contents:

[keyfile]
unmanaged-devices=interface-name:ethWifi

(replacing ethWifi with the name of your wifi device.)

And then restart NetworkManager with the command:

systemctl reload NetworkManager

And Wifi interface was down and did not connect again.

1
  • 1
    This solution gives a really odd problem for me on Ubuntu 20.04. The secondary device is disabled however I seem to get two IP address' on the main interface.
    – jamboNum5
    Jun 14, 2022 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .