Created
July 21, 2023 15:57
-
-
Save Meatballs1/3f6e7b6a02445dc010bb166cadf427c9 to your computer and use it in GitHub Desktop.
networkd-dispatcher wifi/ethernet switchover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
#/etc/networkd-dispatcher/no-carrier.d/50-ifdown-hooks | |
## | |
#!/bin/bash | |
enable_disable_wifi () | |
{ | |
if [ "$IFACE" == "enp0s25" ]; then | |
echo "$(date) - $IFACE down wifi unblocked" | |
rfkill unblock wifi | |
fi | |
} | |
enable_disable_wifi | |
## | |
#/etc/networkd-dispatcher/routable.d/50-ifup-hooks | |
## | |
#!/bin/bash | |
enable_disable_wifi () | |
{ | |
if [ "$IFACE" == "enp0s25" ]; then | |
echo "$(date) - $IFACE up wifi blocked" | |
rfkill block wifi | |
fi | |
} | |
enable_disable_wifi | |
## | |
# /etc/netplan/00-installer-config.yaml | |
# enp0s25 has a static DHCP assignment (192.168.0.110) | |
# wifi manually assigns the same IP | |
## | |
# This is the network config written by 'subiquity' | |
network: | |
ethernets: | |
enp0s25: | |
dhcp4: true | |
optional: true | |
version: 2 | |
wifis: | |
wlp3s0: | |
optional: true | |
access-points: | |
"BSSID": | |
password: "PASSWORD" | |
dhcp4: no | |
addresses: | |
- 192.168.0.110/24 | |
routes: | |
- to: default | |
via: 192.168.0.1 | |
nameservers: | |
addresses: [192.168.0.1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Remember to
netplan apply
andsystemctl enable networkd-dispatcher
andsystemctl restart networkd-dispatcher
to reload the scripts.