ホーム AI・IT I looked into what Tailscale Serve is

I looked into what Tailscale Serve is

雨宮 千夏 雨宮 千夏 • 更新: • 公開: • 読了約 37 分
目次

I wanted to safely access the local LLM server running on my home Mac mini from my iPhone or Windows PC while away, so I looked into a feature called "Tailscale Serve." I will organize the basic mechanisms and the points where I stumbled during actual setup and operation so that even those without much knowledge of VPNs can understand.

What is Tailscale Serve?

n00870237e1a5

Tailscale Serve is a feature that allows local web services running within a Tailscale network (tailnet) to be safely accessed by other devices participating in the same network.

  • You can expose a specific local port (e.g., localhost:8080) via HTTPS using the tailscale serve command

  • A TLS certificate is automatically issued, making it accessible via a URL like https://machine-name.tailnet-name.ts.net

  • The default access scope is limited to the tailnet only. Only devices participating in the same network can access it

There is a similar feature called "Funnel," but this is an extended version that can also be exposed outside the tailnet (to the internet). It is easy to distinguish them with the idea: "Use Serve if you only want to show it to people you know, and use Funnel if you want to expose it to the outside."

Regarding certificates, there is no need to manually set up Let's Encrypt and renew it every 90 days; Tailscale handles issuance and renewal automatically in the background. As long as you enable the HTTPS feature in the management console, the certificate acquisition process will run automatically the moment you execute tailscale serve.

What does it mean to "join" a tailnet?

Tailscale is a mechanism for creating a private virtual network (tailnet) based on a technology called WireGuard.

  • Install the Tailscale app on each device and log in with the same account

  • Then, a private IP in the 100.x.x.x format is assigned to that device

  • Regardless of physical location, devices participating in the same tailnet can communicate as if they were on the same LAN

The image is a two-step mechanism: if you log in (establish a VPN connection) with the Tailscale app on your iPhone, you can then simply access https://machine-name.tailnet-name.ts.net from your usual browser to reach the service on your home server. The Tailscale app itself acts like a "connection switch," and you don't need to operate it every time.

Why is it considered "safe"? A deep dive into the mechanism

The reasons why Tailscale Serve is considered safe are easy to understand if you divide them into two layers: the "cannot connect in the first place" layer and the "cannot read the contents even if connected" layer.

  1. Each device generates its own key pair: When you log in to Tailscale, the device itself automatically generates a public/private key pair locally. The point is that the keys are created by the device, not distributed by Tailscale. The private key never leaves the device.

  2. Only the public key is registered with the coordination server: The generated public key is registered with Tailscale's management server (coordination server). Since the private key is not registered, even the Tailscale server cannot decrypt the communication content.

  3. The coordination server distributes a "netmap": A "netmap" containing the public keys and IP address information of all devices in the tailnet is distributed only to devices participating in that tailnet. Devices that are not participating cannot even receive information about who is at which IP. Its role is not as a communication relay, but rather as a "matchmaker."

  4. Directly establish an encrypted tunnel with WireGuard: Actual communication involves devices directly establishing a WireGuard encrypted tunnel based on the netmap. Devices that do not have the correct key pair cannot complete the encrypted handshake, even if they know the IP address (100.x.x.x), so the connection itself is never established.

  5. First of all, the IP address is unreachable from the outside: The 100.x.x.x IP address range used by Tailscale is a special range that is not routed from the regular internet. For devices not participating in the tailnet, a path to that IP simply does not exist.

  6. HTTPS is an additional layer on top of that: While the state of "unreachable by anyone other than participants" is already achieved by this point, the HTTPS (TLS) provided by Serve is a layer that further encrypts the communication content itself. Even within the same tailnet, this serves to prevent eavesdropping or tampering along the path.

To summarize, it is established by combining multiple layers of mechanisms: key generation (on the device side) → registration (public key only) → reachability control (non-routed IP space) → encrypted tunnel (WireGuard) → and finally HTTPS (TLS). I felt that its characteristic is that it is fundamentally blocked at the network path level, rather than relying on ambiguous mechanisms like trying to keep a URL secret. Compared to methods like port forwarding or ngrok that "open a hole to the outside for now," the essential difference is that the paths that could be targets for attack simply do not exist for anyone other than tailnet participants.

What about the cost?

It is basically free for personal use.

  • Personal (Free) Plan: Up to 6 users, unlimited devices. For personal home lab use (such as connecting a home server to a smartphone or PC), this range is sufficient, including features like Serve.

  • Paid Plans: For teams and organizations. With the price revision in April 2026, it has become a per-seat billing system, and it is positioned for when you need SSO integration, advanced access control, audit logs, etc.

Actually setting it up on a Mac mini and iPhone

Now that I understand the theory, I will also summarize the setup procedure to make a server running on a Mac mini (assuming local port 8080) visible from an iPhone.

On the Mac mini side
  1. Install Tailscale: For Homebrew, use 'brew install tailscale'. You can also download the .pkg from the official website.

  2. Log in and join the tailnet: Running 'sudo tailscale up' will open a browser, where you log in (sign up) using your Google account or similar.

  3. Enable the HTTPS feature (first time only, from the admin console): Enable "HTTPS Certificates" in the "DNS" tab of the Tailscale admin console (https://login.tailscale.com/admin/dns). There is no CLI command for this, so operation from the admin console is mandatory. If you don't do this, Serve will not be able to issue a certificate and will result in an error.

  4. Expose the port with Serve: Run something like 'tailscale serve --bg 8080'. Adding '--bg' keeps it running in the background.

  5. Check the public URL: With 'tailscale serve status', a URL like 'https://machine-name.tailnet-name.ts.net' will be displayed. This is the access point from the outside.

Troubleshooting points when installing with Homebrew

If you install the CLI by running 'brew install tailscale' with Homebrew, you might get an error like the following when you run 'sudo tailscale up' directly.

failed to connect to local Tailscale service; is Tailscale running?

This error occurs because the Tailscale core (the 'tailscaled' service that runs in the background) has not started yet. Since the Homebrew version only installs the CLI, you need to perform the task of starting it as a service separately. The solution is to start it using Homebrew's service functionality.

sudo brew services start tailscale

This will start 'tailscaled' in the background. After that, if you run 'sudo tailscale up' again, an authentication URL will be displayed this time. Open the displayed URL (in a format like https://login.tailscale.com/a/xxxxxxxxx) in your browser and log in with an account such as Google or GitHub to complete the authentication. You can check if it is complete with 'tailscale status', and if your Mac mini is displayed with a 100.x.x.x IP, you have successfully joined the tailnet.

Why settings are automatically restored even after a reboot

I noticed that once you enter the Serve settings (such as tailscale serve --bg --https=8440 8000), you don't need to re-enter the command manually even after restarting the Mac mini. This is because two mechanisms are working together.

  1. brew services start also configured automatic startup: Running sudo brew services start tailscale doesn't just start it immediately; it also registers it with macOS's launchd (a startup management mechanism), so tailscaled starts automatically when the Mac boots. In other words, while the process itself disappears when the Mac is powered off, launchd automatically restarts it during the next boot.

  2. Serve settings are persisted to disk: The rules set with tailscale serve (which ports to expose and how) are saved to disk as a persistent state file, not just in tailscaled's memory.

To summarize the flow during a restart: the Mac boots → launchd automatically starts tailscaled → tailscaled reads and restores past settings (including Serve rules) from the disk upon startup. As a result, the original URL becomes usable again without needing to re-enter the command. If you want to stop the automatic startup itself, you can unregister it with sudo brew services stop tailscale.

On the iPhone side
  1. Install the Tailscale app from the App Store.

  2. Log in with the same account as the Mac mini. This joins the iPhone to the same tailnet.

  3. The first time, you will be asked for permission to 'Add VPN Configurations,' so grant it. From then on, it will be constantly connected in the background.

  4. After that, just open the Mac mini's Serve URL in Safari as usual.

You can safely grant permission for 'Add VPN Configurations.' Since Tailscale technically uses a VPN mechanism (a WireGuard-based tunnel) to realize communication within the tailnet, this is displayed as a standard iOS confirmation. This is a message that appears for all apps with VPN functionality and is not specific to Tailscale.

It is also important to note that this is different from general 'VPN apps' where a third-party server relays and views your communication content. Tailscale basically uses this mechanism only to connect devices within the tailnet directly, so it does not affect communication outside the tailnet, such as web searches or social media usage. If you do not grant permission, you cannot join the tailnet at all, and you will not be able to access the Mac mini. It is also reassuring to confirm that the account used for login is the same as the one on the Mac mini side. If you use a different account, it will become a separate tailnet and will not connect. Note that you can revoke permission at any time from 'Settings → VPN'.

Summary of common pitfalls
  • If the Mac mini is sleeping, you cannot access it at all, so sleep prevention (pmset) settings will come into play.

  • If you forget to enable HTTPS Certificates, an error and an activation URL will be displayed when running tailscale serve, so follow those instructions to resolve it.

  • You cannot use the same port number for both Serve and Funnel at the same time (it will be overwritten by the one set later). You don't need to worry about this if you aren't using Funnel.

How to expose multiple web apps at the same time

If you are running different web apps on multiple ports (e.g., 8000 and 8001) on the Mac mini, I also found that Serve can expose multiple ports together on a single device. There are two main ways to do this.

Method of separating paths (simple)

tailscale serve --bg --set-path /app1 http://localhost:8000
tailscale serve --bg --set-path /app2 http://localhost:8001

With this, you can access them like https://machine-name.tailnet-name.ts.net/app1 and /app2.

Method of separating port numbers

tailscale serve --bg --https=8443 http://localhost:8000
tailscale serve --bg --https=8444 http://localhost:8001

In this case, you would access it like https://machine-name.tailnet-name.ts.net:8443 and :8444.

Since the default HTTPS port (port 443, where you don't need to write the port number in the URL) can only be used once per path configuration, if you want both to have clean URLs without port numbers, it seems easier to handle by separating the paths. You can check the currently published settings at any time with tailscale serve status, so it's reassuring to keep track of the situation with this command once you start running multiple apps.

How to stop the service

If you started it with Homebrew's brew services, there are two ways to stop it.

If you only want to temporarily disconnect from the tailnet, sudo tailscale down is sufficient. Communication will be cut off, but tailscaled itself will continue to run in the background. When you want to reconnect, you can bring it back with sudo tailscale up.

If you want to stop the tailscaled process completely (including unregistering it from automatic startup), use Homebrew's service function as follows.

sudo brew services stop tailscale

You can check if it has stopped with brew services list, and if the tailscale line says stopped, you are good to go.

In summary, the difference is that tailscale down only cuts the connection (the process remains alive), while brew services stop tailscale stops the process entirely (and turns off automatic startup). Usually, it is easier to keep the Mac mini running all the time and toggle the connection with tailscale down/up, and a complete stop is only necessary when you won't be using Tailscale for a while.

Summary

  • Tailscale Serve is a feature that allows you to securely publish local web services within your tailnet.

  • The reason it is secure is that each device generates its own key pair, the netmap is only distributed to participants, and it uses multiple layers of WireGuard encrypted tunnels and HTTPS.

  • Certificate issuance and renewal are automatic, but enabling the HTTPS feature for the entire tailnet requires an operation from the admin console.

  • When installed via Homebrew, starting the tailscaled service and registering it for automatic startup with launchd is done via brew services. Serve settings are persisted to disk, so they are automatically restored after a reboot.

  • It is possible to publish multiple web apps on a single device simultaneously by separating them by path or port number.

  • For personal home lab use, the free plan covers it sufficiently.

When it comes to remote access to a home server, I previously considered tunneling tools like ngrok or port forwarding, but I felt that Tailscale is convenient because it allows for HTTPS publishing as an extension of network connectivity.

Reference links

  • Tailscale Official Website

同じカテゴリの記事

雨宮 千夏
デジタルマーケター 雨宮 千夏
プロフィールを見る →

アイドルと音楽シーンの取材を担当。公式サイトの公演情報、リリース告知、公開チャートを照合してから構成しています。

おすすめの関連記事