Skip to content

Instantly share code, notes, and snippets.

@cheeseonamonkey
Created December 19, 2025 13:16
Show Gist options
  • Select an option

  • Save cheeseonamonkey/e8d1727d504606b62e27b8eab0130d81 to your computer and use it in GitHub Desktop.

Select an option

Save cheeseonamonkey/e8d1727d504606b62e27b8eab0130d81 to your computer and use it in GitHub Desktop.
easytether doctor script
#!/usr/bin/env zsh
# Quick diagnostics for the EasyTether USB path.
set -u
header() {
printf '\n== %s ==\n' "$1"
}
status() {
# $1 = label, $2 = message
printf '[%s] %s\n' "$1" "$2"
}
need_cmd() {
for c in "$@"; do
command -v "$c" >/dev/null 2>&1 || {
status "MISSING" "install '$c' to run full checks"
return 1
}
done
return 0
}
# Prefer sudo if not root.
run() {
if [[ $EUID -ne 0 ]]; then
sudo "$@"
else
"$@"
fi
}
# 1) Interface presence and state.
header "Interface"
if ip link show tun-easytether >/dev/null 2>&1; then
ip -d link show tun-easytether | sed 's/^/ /'
else
status "FAIL" "tun-easytether not present (is easytether-usb running and the phone connected?)"
fi
# 2) Routes.
header "Routes"
if need_cmd ip; then
run ip route show | sed 's/^/ /'
if ! run ip route show default | grep -q '192.168.117.1'; then
status "WARN" "default via 192.168.117.1 missing; add: sudo ip route replace default via 192.168.117.1 dev tun-easytether metric 50"
fi
fi
# 3) Ping the phone-side gateway.
header "Gateway ping"
if need_cmd ping; then
if run ping -c 3 -w 5 192.168.117.1 >/tmp/easytether_ping.$$ 2>&1; then
status "OK" "gateway 192.168.117.1 reachable"
else
status "FAIL" "cannot reach 192.168.117.1 (check cable/app/adb prompt)"
fi
cat /tmp/easytether_ping.$$ | sed 's/^/ /'
rm -f /tmp/easytether_ping.$$
fi
# 4) DNS config and lookup.
header "DNS"
if [[ -f /etc/resolv.conf ]]; then
status "INFO" "current /etc/resolv.conf:"
sed 's/^/ /' /etc/resolv.conf
if ! grep -q '192\.168\.117\.1' /etc/resolv.conf; then
status "WARN" "phone DNS not configured; echo 'nameserver 192.168.117.1' | sudo tee /etc/resolv.conf"
fi
else
status "FAIL" "/etc/resolv.conf missing"
fi
if need_cmd getent; then
if run getent ahostsv4 example.com >/tmp/easytether_dns.$$ 2>&1; then
status "OK" "example.com resolves (IPv4)"
else
status "FAIL" "example.com does not resolve; try forcing resolv.conf to 192.168.117.1"
fi
cat /tmp/easytether_dns.$$ | sed 's/^/ /'
rm -f /tmp/easytether_dns.$$
fi
# 5) HTTP reachability (real-world traffic; ping may be blocked by carrier).
header "HTTP check"
if need_cmd curl; then
if run curl -4 -I --silent --max-time 6 https://example.com >/tmp/easytether_http.$$ 2>&1; then
status "OK" "HTTPS reachable over IPv4"
else
status "FAIL" "HTTPS failed; inspect output and routes"
fi
cat /tmp/easytether_http.$$ | sed 's/^/ /'
rm -f /tmp/easytether_http.$$
fi
# 6) Journal tail for easytether.
header "Recent easytether logs"
if need_cmd journalctl; then
run journalctl -u 'easytether-usb@*' -n 50 --no-pager 2>/tmp/easytether_journal.$$ && \
cat /tmp/easytether_journal.$$ | sed 's/^/ /'
rm -f /tmp/easytether_journal.$$
else
status "INFO" "journalctl not found; skip logs"
fi
cat <<'HINT'

Notes:

  • If ping to the internet fails but HTTPS works, your carrier is likely blocking ICMP; use curl or a browser to verify real connectivity.
  • If DNS keeps changing, NetworkManager may be overwriting /etc/resolv.conf; you can temporarily freeze it with: sudo chattr +i /etc/resolv.conf (undo with chattr -i).
  • To reassert the default route if it is missing: sudo ip route replace default via 192.168.117.1 dev tun-easytether metric 50
  • To drop conflicting VPN routes, disconnect the VPN or remove its default: sudo ip route del default dev tun0 HINT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment