Files
nas-tools/iphone_ssh_tunnel_workaround.md
T

2.2 KiB

SSH Tunnel Workaround for iPhone Proxy

The Problem

Oracle Cloud Security List blocks proxy ports, and you don't have console access right now.

Solution: SSH Tunnel via Your Mac

Since SSH (port 22) is already open, we can use it to tunnel proxy traffic!

Step 1: Create SSH Tunnel on Your Mac

Open Terminal on your Mac and run:

ssh -L 7890:127.0.0.1:7890 -N server2

Or run in background:

ssh -f -N -L 7890:127.0.0.1:7890 server2

This creates a tunnel: Your Mac:7890SSHserver2:7890

Step 2: Configure iPhone to Use Your Mac as Proxy

Option A: If Mac and iPhone on Same Wi-Fi

  1. On your Mac:

    • System Settings → Network → Wi-Fi → Details → TCP/IP
    • Note your Mac's local IP (e.g., 192.168.1.100)
  2. On iPhone:

    • Settings → Wi-Fi → ⓘ (next to your Wi-Fi network)
    • Scroll to HTTP ProxyManual
    • Server: 192.168.1.100 (your Mac's IP)
    • Port: 7890
    • Authentication: Off (SSH tunnel doesn't need it, but Clash does)

Wait - this won't work because Clash needs authentication...

Better Solution: Use SOCKS Proxy Over SSH

Actually, SSH can create a SOCKS proxy directly!

Step 3: Use SSH SOCKS Proxy (Better Method)

On your Mac, run:

ssh -D 1080 -N server2

This creates a SOCKS5 proxy on your Mac at 127.0.0.1:1080

Then on iPhone (same Wi-Fi):

  • Settings → Wi-Fi → ⓘ → HTTP Proxy → Manual
  • Server: 192.168.1.100 (your Mac's IP)
  • Port: 1080
  • Type: SOCKS5 (if option available)

But iOS HTTP Proxy doesn't support SOCKS5...

Best Workaround: Use a Proxy App on Mac

Install a local proxy server on your Mac that:

  1. Connects to server2 via SSH tunnel
  2. Provides HTTP proxy for iPhone

Alternative: Use Tailscale (If Available)

If you can use Tailscale:

  1. Enable Tailscale VPN on iPhone
  2. Configure Shadowrocket to use: 100.70.115.1:7890
  3. This bypasses Oracle Cloud firewall

Simplest Workaround: Keep SSH Tunnel + Use Mac as Bridge

  1. On Mac: Create SSH tunnel to server2's Clash
  2. On Mac: Run a local proxy server that iPhone can connect to
  3. On iPhone: Connect to Mac's proxy

Let me create a script for this...