From feb86e678331ae9e1d7a237ef061c6228cb03832 Mon Sep 17 00:00:00 2001 From: Alan Sikora Date: Fri, 24 Apr 2026 12:08:52 -0300 Subject: [PATCH 1/2] Deprioritize iPhone USB tethering below Wi-Fi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plugging an iPhone into USB (even just to charge) loads the ipheth kernel driver, which exposes the phone as a generic USB ethernet device. It then matches /etc/systemd/network/20-ethernet.network (which catches eth*/en*) and gets RouteMetric=100 — beating Wi-Fi at 600 and taking over the default route the moment the phone hands out a DHCP lease. This often breaks connectivity when the phone has no data plan, poor signal, or tethering disabled upstream. Add 15-ipheth.network with [Match] Driver=ipheth and RouteMetric=700. systemd-networkd processes .network files in lexical order and uses the first match, so iPhone interfaces hit this file before the generic ethernet one. Wi-Fi (600) now wins when both are up; if Wi-Fi drops, the tether still takes over automatically. Install on fresh systems via install/config/hardware/network.sh, and migrate existing systems via a new migration that also reloads systemd-networkd. --- default/systemd/network/15-ipheth.network | 27 +++++++++++++++++++++++ install/config/hardware/network.sh | 4 ++++ migrations/1777042493.sh | 4 ++++ 3 files changed, 35 insertions(+) create mode 100644 default/systemd/network/15-ipheth.network create mode 100644 migrations/1777042493.sh 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 From efbf2bc7f92c3a94881b1720cf56adf02662c5a8 Mon Sep 17 00:00:00 2001 From: Alan Sikora Date: Fri, 24 Apr 2026 12:19:13 -0300 Subject: [PATCH 2/2] Create /etc/systemd/network before copying drop-in Copilot review noted cp would fail under set -e on fresh systems where /etc/systemd/network doesn't exist yet. --- install/config/hardware/network.sh | 1 + migrations/1777042493.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/install/config/hardware/network.sh b/install/config/hardware/network.sh index b129f5f6d4..ae7b751da9 100644 --- a/install/config/hardware/network.sh +++ b/install/config/hardware/network.sh @@ -7,4 +7,5 @@ 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 mkdir -p /etc/systemd/network sudo cp ~/.local/share/omarchy/default/systemd/network/15-ipheth.network /etc/systemd/network/ diff --git a/migrations/1777042493.sh b/migrations/1777042493.sh index ca9c6cba94..5fca3251a0 100644 --- a/migrations/1777042493.sh +++ b/migrations/1777042493.sh @@ -1,4 +1,5 @@ echo "Deprioritize iPhone USB tethering below Wi-Fi so plugging in an iPhone to charge does not hijack the default route" +sudo mkdir -p /etc/systemd/network 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