How to disable WiFi interface with netplan?

Solution 1:

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