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
Create Tailscale Account
- Go to https://tailscale.com
- Click “Get Started” or “Sign Up”
- Sign in with your preferred provider:
- GitHub (recommended for developers)
- Microsoft
The free personal plan includes up to 100 devices and all essential features.
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:
Ubuntu/Debian
Ubuntu/Debian
CentOS/RHEL/Fedora
CentOS/RHEL/Fedora
Arch Linux
Arch Linux
Connect Server to Tailscale
Start Tailscale and authenticate:This command will output a URL like:You should see your device listed with a Tailscale IP (100.x.x.x).Get your server’s Tailscale IP:
- Copy the URL and open it in your browser
- Sign in with the same account you created in Step 1
- Authorize the device
- Optionally give your device a friendly name
Install Tailscale on Mobile Device
iOS
- Open the App Store
- Search for “Tailscale”
- Install the official Tailscale app
- Open the app
- Sign in with the same account
- Enable the VPN when prompted
Android
- Open Google Play Store
- Search for “Tailscale”
- Install the official Tailscale app
- Open the app
- Sign in with the same account
- Tap “Connect” to enable VPN
After connecting, you should see all your Tailscale devices in the app, including your server.
Enable MagicDNS (Recommended)
MagicDNS lets you access devices by name instead of IP address.
- Go to https://login.tailscale.com/admin/dns
- Click “Enable MagicDNS”
- Optionally add a custom nameserver if needed
- Access server by name:
http://my-server:3000instead ofhttp://100.x.x.1:3000 - Names update automatically if IP changes
- Easier to remember and manage
Device names are sanitized: spaces become hyphens, special characters removed.
Example: “My VPS Server” becomes “my-vps-server”
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.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:Access Portal from Mobile
On your mobile device:
- Ensure Tailscale VPN is connected (check the app)
- Open your mobile browser
- 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)
- With MagicDNS:
- Bookmark the page for quick access
- 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:- Go to https://login.tailscale.com/admin/acls
- Edit the JSON policy file
- Example restricting Portal access:
SSH Over Tailscale
Access your server via SSH through Tailscale: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
Can't connect to Tailscale network
Can't connect to Tailscale network
Check:
-
Is Tailscale running?
-
Restart Tailscale:
-
Check firewall isn’t blocking Tailscale:
- Verify you’re using the same Tailscale account on all devices
MagicDNS not resolving device names
MagicDNS not resolving device names
Solutions:
- Verify MagicDNS is enabled in admin console
- Restart Tailscale on the device:
- Try using the IP address instead:
tailscale ip -4 - Check device name doesn’t have invalid characters
- Wait a few minutes for DNS propagation
Can't access Portal through Tailscale
Can't access Portal through Tailscale
Debug steps:
-
Verify Portal is running:
-
Check Portal is bound to 0.0.0.0:
-
Test local access on server:
-
Test Tailscale access from server itself:
- Check firewall rules
- Verify you’re using the correct port
High latency or slow performance
High latency or slow performance
Optimization tips:
-
Check if you’re using direct connection or relay:
- Enable UPnP/NAT-PMP on your router for direct connections
- Try different exit nodes if using exit node feature
-
Check server resources:
-
Run network diagnostics:
Tailscale disconnects frequently on mobile
Tailscale disconnects frequently on mobile
iOS fixes:
- Settings > Tailscale > Allow unlimited background usage
- Disable “Low Power Mode” which can kill VPN connections
- Keep Tailscale app updated
- Settings > Apps > Tailscale > Battery > Unrestricted
- Disable battery optimization for Tailscale
- Settings > Tailscale > Enable “Always-on VPN”
Security Best Practices
- Enable Two-Factor Authentication (2FA) on your Tailscale account
- Use ACLs to restrict access between devices
- Regularly review connected devices in admin console
- Remove old devices you no longer use
- Keep Tailscale updated on all devices
- Use Key Expiry to force periodic re-authentication
- Monitor access logs in the admin console
- 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