diff --git a/default/systemd/network/15-ipheth.network b/default/systemd/network/15-ipheth.network new file mode 100644 index 0000000000..016e06c693 --- /dev/null +++ b/default/systemd/network/15-ipheth.network @@ -0,0 +1,27 @@ +# Deprioritize iPhone USB tethering below Wi-Fi so plugging in an iPhone +# to charge does not hijack the default route. +# +# ipheth is the Linux kernel driver specific to iPhone USB Ethernet. +# Without this drop-in, the iPhone matches /etc/systemd/network/20-ethernet.network +# (which catches eth*/en*) and gets RouteMetric=100 — beating Wi-Fi (600) and +# taking over the default route the moment the phone hands out a DHCP lease. +# +# This file sorts before 20-ethernet.network lexically, so systemd-networkd +# matches it first for any interface whose driver is ipheth. Setting +# RouteMetric=700 keeps Wi-Fi primary when both are up. If Wi-Fi drops, the +# iPhone route automatically takes over. + +[Match] +Driver=ipheth + +[Link] +RequiredForOnline=no + +[Network] +DHCP=yes + +[DHCPv4] +RouteMetric=700 + +[IPv6AcceptRA] +RouteMetric=700 diff --git a/install/config/hardware/network.sh b/install/config/hardware/network.sh index 65f9fdbbe3..b129f5f6d4 100644 --- a/install/config/hardware/network.sh +++ b/install/config/hardware/network.sh @@ -4,3 +4,7 @@ sudo systemctl enable iwd.service # Prevent systemd-networkd-wait-online timeout on boot sudo systemctl disable systemd-networkd-wait-online.service sudo systemctl mask systemd-networkd-wait-online.service + +# Deprioritize iPhone USB tethering below Wi-Fi so plugging in an iPhone +# to charge does not hijack the default route. +sudo cp ~/.local/share/omarchy/default/systemd/network/15-ipheth.network /etc/systemd/network/ diff --git a/migrations/1777042493.sh b/migrations/1777042493.sh new file mode 100644 index 0000000000..ca9c6cba94 --- /dev/null +++ b/migrations/1777042493.sh @@ -0,0 +1,4 @@ +echo "Deprioritize iPhone USB tethering below Wi-Fi so plugging in an iPhone to charge does not hijack the default route" + +sudo cp $OMARCHY_PATH/default/systemd/network/15-ipheth.network /etc/systemd/network/ +sudo networkctl reload 2>/dev/null || sudo systemctl reload systemd-networkd 2>/dev/null || true