Skip to main content

What is Tailscale?

Tailscale is a zero-config VPN solution that creates a secure network between your devices. It’s perfect for accessing your OpenCode Portal remotely without exposing it to the public internet. Key Benefits:
  • No port forwarding required
  • Encrypted peer-to-peer connections
  • Works behind NAT and firewalls
  • MagicDNS for easy device naming
  • Free for personal use (up to 100 devices)
  • Cross-platform (Linux, macOS, Windows, iOS, Android)

Architecture Overview

Complete Setup Guide

1

Create Tailscale Account

  1. Go to https://tailscale.com
  2. Click “Get Started” or “Sign Up”
  3. Sign in with your preferred provider:
    • GitHub (recommended for developers)
    • Google
    • Microsoft
    • Email
The free personal plan includes up to 100 devices and all essential features.
2

Install Tailscale on Your Server

SSH into your VPS or server:
Install Tailscale using the official installation script:
This script automatically detects your Linux distribution and installs the appropriate package.Manual installation for specific distributions:
3

Connect Server to Tailscale

Start Tailscale and authenticate:
This command will output a URL like:
  1. Copy the URL and open it in your browser
  2. Sign in with the same account you created in Step 1
  3. Authorize the device
  4. Optionally give your device a friendly name
Verify connection:
You should see your device listed with a Tailscale IP (100.x.x.x).Get your server’s Tailscale IP:
4

Install Tailscale on Mobile Device

iOS

  1. Open the App Store
  2. Search for “Tailscale”
  3. Install the official Tailscale app
  4. Open the app
  5. Sign in with the same account
  6. Enable the VPN when prompted

Android

  1. Open Google Play Store
  2. Search for “Tailscale”
  3. Install the official Tailscale app
  4. Open the app
  5. Sign in with the same account
  6. Tap “Connect” to enable VPN
After connecting, you should see all your Tailscale devices in the app, including your server.
5

Enable MagicDNS (Recommended)

MagicDNS lets you access devices by name instead of IP address.
  1. Go to https://login.tailscale.com/admin/dns
  2. Click “Enable MagicDNS”
  3. Optionally add a custom nameserver if needed
Benefits:
  • Access server by name: http://my-server:3000 instead of http://100.x.x.1:3000
  • Names update automatically if IP changes
  • Easier to remember and manage
Test MagicDNS:On your mobile device (with Tailscale connected):
Device names are sanitized: spaces become hyphens, special characters removed. Example: “My VPS Server” becomes “my-vps-server”
6

Configure Firewall (if needed)

If your server has a firewall, you may need to allow Tailscale traffic.UFW (Ubuntu/Debian):
firewalld (CentOS/RHEL):
Tailscale creates a network interface called tailscale0 and manages its own firewall rules, so usually no additional configuration is needed.
7

Start Portal for Remote Access

Start OpenCode Portal bound to all interfaces:
The --hostname 0.0.0.0 flag ensures Portal listens on all network interfaces, including the Tailscale interface.Verify it’s running:
8

Access Portal from Mobile

On your mobile device:
  1. Ensure Tailscale VPN is connected (check the app)
  2. Open your mobile browser
  3. Navigate to one of:
    • With MagicDNS: http://your-server-name:3000
    • With IP: http://100.x.x.1:3000 (use your server’s Tailscale IP)
  4. Bookmark the page for quick access
  5. Optionally add to home screen for app-like experience
You should now see the OpenCode Portal interface and be able to create sessions and chat with the AI.

Advanced Configuration

Subnet Routing

If you want to access other devices on your server’s local network through Tailscale:

Exit Node

Use your server as an exit node to route all internet traffic through it:

Access Controls (ACLs)

Restrict which devices can access specific services:
  1. Go to https://login.tailscale.com/admin/acls
  2. Edit the JSON policy file
  3. Example restricting Portal access:

SSH Over Tailscale

Access your server via SSH through Tailscale:
Enable Tailscale SSH in admin console for managed keys and authentication.

Verification and Testing

Check Tailscale Status

On your server:

Test Portal Access

From your mobile device terminal (using Termius, iSH, or similar):

Performance Testing

Troubleshooting

Check:
  1. Is Tailscale running?
  2. Restart Tailscale:
  3. Check firewall isn’t blocking Tailscale:
  4. Verify you’re using the same Tailscale account on all devices
Solutions:
  1. Verify MagicDNS is enabled in admin console
  2. Restart Tailscale on the device:
  3. Try using the IP address instead: tailscale ip -4
  4. Check device name doesn’t have invalid characters
  5. Wait a few minutes for DNS propagation
Debug steps:
  1. Verify Portal is running:
  2. Check Portal is bound to 0.0.0.0:
  3. Test local access on server:
  4. Test Tailscale access from server itself:
  5. Check firewall rules
  6. Verify you’re using the correct port
Optimization tips:
  1. Check if you’re using direct connection or relay:
  2. Enable UPnP/NAT-PMP on your router for direct connections
  3. Try different exit nodes if using exit node feature
  4. Check server resources:
  5. Run network diagnostics:
iOS fixes:
  • Settings > Tailscale > Allow unlimited background usage
  • Disable “Low Power Mode” which can kill VPN connections
  • Keep Tailscale app updated
Android fixes:
  • Settings > Apps > Tailscale > Battery > Unrestricted
  • Disable battery optimization for Tailscale
  • Settings > Tailscale > Enable “Always-on VPN”

Security Best Practices

While Tailscale is secure by default, follow these practices for maximum security:
  1. Enable Two-Factor Authentication (2FA) on your Tailscale account
  2. Use ACLs to restrict access between devices
  3. Regularly review connected devices in admin console
  4. Remove old devices you no longer use
  5. Keep Tailscale updated on all devices
  6. Use Key Expiry to force periodic re-authentication
  7. Monitor access logs in the admin console
  8. Don’t share your Tailscale account - add users individually if needed

Alternative VPN Solutions

While this guide focuses on Tailscale, you can also use:
  • WireGuard - More control but requires manual configuration
  • ZeroTier - Similar to Tailscale with different feature set
  • Cloudflare Tunnel - Good for HTTP services, different architecture
  • OpenVPN - Traditional VPN, more complex setup
  • Twingate - Enterprise alternative to Tailscale
Tailscale is recommended for ease of use and zero-config setup.

Next Steps