MacBook Tunnel Setup
VPN tunnel configuration for MacBook • Topic Documentation
MacBook Reverse SSH Tunnel Setup
This guide sets up a persistent reverse SSH tunnel from the MacBook to orcus.lan, allowing orcus.lan (and Cursor running on it) to SSH back to the MacBook for testing.
Quick Manual Start (Temporary)
Run this command on the MacBook:
autossh -M 0 -f -N -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -R 2222:localhost:22 jd@192.168.1.24Password: jd
This creates a reverse tunnel where:
orcus.lancan SSH tolocalhost:2222- Which forwards to MacBook's SSH port 22
autosshmonitors and reconnects if it drops
Permanent Setup (Survives Reboots)
Step 1: Install autossh
brew install autosshStep 2: Set up SSH key for passwordless auth (recommended)
On MacBook:
# Generate key if you don't have one
ssh-keygen -t ed25519 -f ~/.ssh/id_orcus_tunnelCopy public key to orcus.lan
ssh-copy-id -i ~/.ssh/id_orcus_tunnel.pub jd@192.168.1.24Test passwordless connection
ssh -i ~/.ssh/id_orcus_tunnel jd@192.168.1.24 whoamiStep 3: Create launchd service (macOS)
sudo cp /var/www/zap/infra/launchd/com.getzap.reverse-tunnel.plist /Library/LaunchDaemons/
``Edit the plist to use your SSH key (if you set one up):
`bash
sudo nano /Library/LaunchDaemons/com.getzap.reverse-tunnel.plist
`
Add after the autossh arguments:
`xml
-i
/Users/juliandarley/.ssh/id_orcus_tunnel
`Set permissions:
`bash
sudo chown root:wheel /Library/LaunchDaemons/com.getzap.reverse-tunnel.plist
sudo chmod 644 /Library/LaunchDaemons/com.getzap.reverse-tunnel.plist
`Load and start:
`bash
sudo launchctl load /Library/LaunchDaemons/com.getzap.reverse-tunnel.plist
sudo launchctl start com.getzap.reverse-tunnel
`Step 4: Verify
On
orcus.lan:bash
Test connection
ssh -p 2222 juliandarley@localhost whoamiWith password
sshpass -p '0788' ssh -p 2222 juliandarley@localhost whoami
Managing the Service
bash
Check status
sudo launchctl list | grep reverse-tunnelCheck logs
tail -f /tmp/reverse-tunnel.log tail -f /tmp/reverse-tunnel.errStop
sudo launchctl stop com.getzap.reverse-tunnelUnload (disable)
sudo launchctl unload /Library/LaunchDaemons/com.getzap.reverse-tunnel.plist
Troubleshooting
Tunnel keeps dropping
Check network stability and increase retry intervals:
bash
Edit the plist and increase ServerAliveInterval to 120
sudo nano /Library/LaunchDaemons/com.getzap.reverse-tunnel.plist sudo launchctl unload /Library/LaunchDaemons/com.getzap.reverse-tunnel.plist sudo launchctl load /Library/LaunchDaemons/com.getzap.reverse-tunnel.plist
Port already in use
bash
On orcus.lan, check what's using port 2222
sudo lsof -i :2222Kill the existing tunnel if needed
sudo pkill -f "ssh.*2222"MacBook (192.168.68.55) │ │ autossh -R 2222:localhost:22 │ ▼ orcus.lan (192.168.1.24) │ │ ssh -p 2222 juliandarley@localhost │ ▼ MacBook SSH (port 22) ``orcus.lanAuthentication fails
Ensure SSH key is set up correctly (see Step 2) Or ensure password authentication is enabled on /var/log/auth.logCheck onorcus.lanfor SSH errorsArchitecture
This allows: