I have ubuntu 18.04 and as far as I understood, it uses "netplan". I find out on the web a few ideas to switch wifi on/off when cable is off/on, but most of them uses older fashion.
I liked this idea I found (using /etc/network/interfaces), very simple and clear in my opinion (rather than putting a script somewhere you may forgot later).
iface eth0 inet static
address 192.168.1.7
netmask 255.255.255.0
gateway 192.168.1.1
post-up ifconfig wlan0 down
post-down ifconfig wlan0 up
But /etc/network/interfaces seems not used anymore by netplan.
Is there something similar that could be configured in netplan ?
here are more informations:
roger@mini:~$ cat /etc/netplan/*.yaml
cat: '/etc/netplan/*.yaml': Aucun fichier ou dossier de ce type
roger@mini:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
roger@mini:~$ sudo lshw -C network
[sudo] Mot de passe de roger :
*-network
description: Interface réseau sans fil
produit: QCA6174 802.11ac Wireless Network Adapter
fabriquant: Qualcomm Atheros
identifiant matériel: 0
information bus: pci@0000:02:00.0
nom logique: wlp2s0
version: 32
numéro de série: 9c:b6:d0:8b:33:c5
bits: 64 bits
horloge: 33MHz
fonctionnalités: pm msi pciexpress bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=ath10k_pci driverversion=5.3.0-51-generic firmware=WLAN.RM.2.0-00180-QCARMSWPZ-1 latency=0 link=yes multicast=yes wireless=IEEE 802.11
ressources: irq:171 mémoire:dc000000-dc1fffff
*-network
description: Ethernet interface
identifiant matériel: 2
nom logique: enx106530a39639
numéro de série: 10:65:30:a3:96:39
taille: 1Gbit/s
capacité: 1Gbit/s
fonctionnalités: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.09.11 duplex=full ip=192.168.1.15 link=yes multicast=yes port=MII speed=1Gbit/s
roger@mini:~$ cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile
[ifupdown]
managed=false
[device]
wifi.scan-rand-mac-address=no
roger@mini:~$
The tool for triggering additional actions on a network change if using networkd is
networkd-dispatcher
.