My Remote Work Setup (I): Tailscale
Do you have multiple computers at home and work, and want to remotely connect to your powerful workstation in the office? When the connection is lost, do you want to reattach the same session and continue working seamlessly?
If so, this blog is for you.
1 Quick Summary
Pressed for time? Here’s a brief overview of what you’ll find in this blog. I’ll share my journey of setting up a remote connection from my MacBook Pro to my Mac Pro, detailed over several posts. In this first entry, I’ll introduce how to connect all your devices to a virtual local network using Tailscale.
- Tailscale: A free VPN service to connect multiple devices to the same virtual network.
- VSCode: A versatile code editor for remote coding, with the Remote - SSH extension for connecting to remote servers via SSH.
- Radian: An enhanced R console that integrates smoothly with VSCode.
- Tmux: A terminal multiplexer that allows for persistent sessions, letting you reattach a session even after a lost connection.
2 Why Tailscale?
The first crucial step is ensuring both computers can communicate with each other over the same network, even if they are in different locations (e.g., home and office).
2.1 You might be using TeamViewer or Chrome Remote Desktop, but these aren’t the best options.
Software like TeamViewer can be expensive. Although I use the personal version, it frequently flags me for suspected commercial use. Another major drawback for me is the resolution issue — I have a 4K monitor, but TeamViewer doesn’t support that resolution when connecting to my Mac Pro.
Chrome Remote Desktop is free and does offer 4K support, but it’s unstable. I also don’t use Chrome, and I’m not keen on installing it just for remote access.
2.2 Company VPNs can help, but they have limitations.
My university (UCL) provides a free VPN for all faculty and students. However, it routes all traffic through UCL’s network, which can be inconvenient. For instance, I use a NAS at home, and the VPN blocks my connection to it.
2.3 Tailscale is the best solution for me.
After experimenting with various tools, I found that Tailscale is the ideal solution. It’s a “sort of” VPN service that creates a virtual local network, allowing all your devices to connect as if they were on the same local network.
It’s secure. Tailscale uses WireGuard, a highly secure VPN protocol, ensuring point-to-point encryption for all traffic. I’ve been using it for some time, and I’m thoroughly satisfied with the security it provides.
It doesn’t block access to my NAS or home network. Crucially, Tailscale doesn’t interfere with my NAS connection. Even when I’m connected to the Tailscale network, I can still access my NAS from my MacBook Pro. This is because Tailscale only routes traffic between devices on its network, leaving other connections unaffected.
I can use my office computer as an exit node when needed. Occasionally, I need to access resources available only on the UCL network. With Tailscale, I can set my office computer as an exit node, routing all traffic through the UCL network when necessary.
Tailscale is compatible with almost any device. Tailscale supports a wide range of devices, including Mac, Windows, Linux, iOS, and Android. I’ve installed it on my Mac Pro, MacBook Pro, iPhone, NAS, Apple TV, and iPad, all of which are now connected to the same network.
3 Installing Tailscale
The basic idea is to install Tailscale on every device you want to connect to your virtual network, then link them to the same network. You can start by visiting the Tailscale website.
Begin by installing Tailscale on your primary device. I chose my MacBook Pro for this. After clicking “Get Started,” you’ll be prompted to log in using an identity provider like Google, Microsoft, or GitHub, adding an extra layer of security since Tailscale relies on your chosen provider’s credentials.
Once installed on your first device, you can install Tailscale on others. Use the same identity provider for login, and you’ll see all your devices connected to the same network.
Each device is assigned a unique IP address, typically beginning with 100.xxx.xxx.xxx. With this IP, you can connect between devices seamlessly. For example, I can connect to my Mac Pro from my MacBook Pro using the IP assigned by Tailscale.
To test the connection, open the Mac terminal and type:
ssh username@100.xxx.xxx.xxx
where weimiao
is the username of my Mac Pro, and 100.xxx.xxx.xxx
is the IP address assigned by Tailscale.
If it’s your first time using SSH, you’ll be asked whether you trust the connection. Type yes to proceed. Then, enter the password for your Mac Pro (note: your password won’t display as you type). After this, you’ll be connected to your Mac Pro via SSH.
4 Other Benefits of Tailscale
4.1 Access your NAS from anywhere in the world
My NAS supports WebDAV, where I store all my Zotero library PDFs. As I mentioned earlier, Tailscale doesn’t block access to my NAS. With Tailscale, I can access my NAS from my MacBook Pro, no matter where I am — even in a café halfway around the world.
Without Tailscale, my only other option would be to pay my ISP for a static IP, which can be expensive (around £5 extra per month with Hyperoptic, for instance).
4.2 Use your office computer as an exit node
When downloading papers from Google Scholar, the server detects your IP. If I’m connected to the UCL network, I can download papers directly without needing to log into the UCL library service. Tailscale allows me to set my office computer as the exit node, meaning all traffic is routed through UCL, and Google Scholar will think I’m on the UCL network, allowing me to download papers easily.
After all the above steps, now, all my devices are connected to the same virtual network. For example, now you are able to use the mac’s built-in screen sharing feature to control your Mac Pro from your MacBook Pro with native resolution support!
In the next post, I’ll introduce how to use VSCode to code remotely on your Mac Pro from your MacBook Pro.