Skip to content

ZeroTier-Based Remote Machine Monitoring from iOS using iSH

Source: Notion | Last edited: 2025-03-29 | ID: 1a52d2dc-3ef...


Implementation of a resource-efficient system for monitoring the uptime and connectivity of a machine (172.25.253.142) located behind a corporate firewall using an iOS device running iSH connected via ZeroTier VPN.

  • Target Machine: Company server (172.25.253.142)
  • Monitoring Device: iOS device running iSH
  • VPN Technology: ZeroTier overlay network
  • ZeroTier Network ID: [From your configuration]
  • ZeroTier Gateway: 172.25.0.1
  • ZeroTier Interface: zt* (dynamically named, e.g., ztksetviym)
  • Network Topology: iOS device ↔ ZeroTier Network ↔ Corporate Firewall ↔ Target Machine
  • Terminal Emulator: iSH (Alpine Linux)
  • Package Manager: apk
  • Required Packages: curl, netcat-openbsd, bind-tools, openssh
  1. Interface Verification:
Terminal window
ip addr | grep -o 'zt[a-zA-Z0-9]*'
ip addr show $ZT_IF | grep "inet "
  1. Connectivity Testing:
Terminal window
ping -c 2 -W 2 172.25.253.142
nc -zv -w 3 172.25.253.142 22
curl -I -m 5 <http://172.25.253.142/status>
  1. Advanced Diagnostics:
Terminal window
mtr -n -T 172.25.253.142
traceroute -I 172.25.253.142
#!/bin/sh
# ZeroTier Uptime Monitor for Remote Machine
# Target: 172.25.253.142 behind corporate network
ZT_IP="172.25.253.142"
LOG_FILE="/root/zt-status.log"
# Check ZeroTier interface
ZT_IF=$(ip addr | grep -o 'zt[a-zA-Z0-9]*')
[[ -z "$ZT_IF" ]] && echo "ERROR: No ZeroTier interface detected" >> $LOG_FILE && exit 1
# Verify interface IP assignment
ip addr show $ZT_IF | grep -q "inet " || echo "ERROR: ZeroTier interface has no IP" >> $LOG_FILE
# Connection tests with timeout constraints
ping -c 2 -W 2 $ZT_IP >> $LOG_FILE 2>&1
nc -zv -w 3 $ZT_IP 22 >> $LOG_FILE 2>&1
# Log completion
echo "Test complete $(date)" >> $LOG_FILE
echo "-------------------" >> $LOG_FILE
  • Execute tests at 30-minute intervals: sleep 1800
  • Keep timeouts short: W 2, w 3, m 5
  • Exit early on critical failures
  • Use iSH’s “Keep Alive in Background” feature
  • Optional integration with iOS Shortcuts for WiFi-only execution
  • SSH Server Configuration:
Port 2222
PermitRootLogin yes
PubkeyAuthentication yes
UsePrivilegeSeparation no
  • Remote Development: Connect Cursor IDE to iSH SSH server
  • Port Forwarding: Required if developing from non-local network
  1. iOS background execution limitations
  2. Corporate firewall restrictions on ZeroTier traffic
  3. Battery consumption considerations
  4. ZeroTier connectivity through double-NAT environments
  5. Maintaining persistent connections within iOS limitations
  • Overlay Networks: ZeroTier creates a virtual Layer 2 network
  • NAT Traversal: ZeroTier uses UDP hole punching
  • Software-Defined Networking: Dynamic routing across disparate networks
  • L2 over L3 Tunneling: Ethernet frames over internet protocol
  • Stateful Connection Monitoring: Tracking connection quality over time This implementation provides a lightweight, battery-efficient method for continuous monitoring of remote machine uptime from an iOS device, capable of detecting connectivity issues across corporate network boundaries.