Tailscale: reach your networks from anywhere, and use the firewall as an exit node
Tailscale connects your phones, laptops and servers in a private network, a tailnet, wherever they are, with no ports to forward. With the Tailscale add-in, the firewall joins your tailnet too:
- as a subnet router: devices in the tailnet reach the networks behind the firewall (printers, NAS, cameras, servers) without Tailscale on each of them;
- as an exit node: a laptop in a hotel or a phone on mobile data sends its internet traffic through the firewall's internet connection, under its filtering;
- as a client: the firewall reaches other sites' subnet routers, or sends its own internet traffic through another exit node.
It works with Tailscale's service and with Headscale, the open-source coordination server you run yourself.
Tailnet devices are a zone of their own on the firewall. The firewall's rules decide what they reach, as for any network: nothing at all until you add rules. Tailscale never changes the firewall's rules.
The example:
| Firewall | fw-main |
| LAN | zone LAN, 192.168.1.1/24 and fd00:2::1/64 |
| IoT network | zone IOT, 10.20.0.1/24 |
| Tailnet | example.com on Tailscale, with an admin account |
| Goal | phones and laptops reach the LAN (not the IoT network), and can use the firewall as exit node |
Before you start
- A Tailscale account (tailscale.com) or a Headscale server reachable over HTTPS. You need to be an admin of the tailnet to approve routes.
- Not in FIPS mode. Tailscale uses WireGuard, which is not FIPS-validated, so the add-in is not available in FIPS mode. Use IPsec there.
- Optional: an auth key, to sign the firewall in without a browser. In the Tailscale admin console, open Settings › Keys › Generate auth key:
- tick Reusable if you will reinstall or replace the firewall;
- tick Pre-approved if your tailnet requires device approval;
- add a tag such as
tag:firewall, so the firewall is not tied to your personal account and its key does not expire. The tag must exist in your tailnet policy (tagOwners).
Set it up
Open VPN › Tailscale.
- Networks for the tailnet: the firewall's internal networks are listed with their zones, all ticked at first. Untick the ones tailnet devices should not reach. In the example: keep
192.168.1.0/24andfd00:2::/64(the LAN), untick10.20.0.0/24(IoT).- Keep both families of a network. When only one is ticked, the page warns (IPv6 parity) and offers Advertise for the other.
- To offer only part of a network, type it under the list (for example
192.168.1.0/25) and press Add.
- Exit node and routes from others: tick Offer the firewall as an exit node if devices should be able to use its internet connection.
- Settings:
- Name in the tailnet: the firewall's name,
fw-mainby default; - Tailnet devices belong to zone:
tailnetby default. The zone is created when you save, if it does not exist; - Auth key: paste the key from Before you start, or leave it empty to sign in with the browser;
- Coordination server: leave empty for Tailscale. For Headscale, enter its address, such as
https://headscale.example.com; - Tags: for example
tag:firewall; - UDP port and Open the port for direct connections in: keep 41641 and the internet zone. Other devices then connect directly instead of through Tailscale's relays;
- Send tailscaled's logs to Tailscale: off by default. Turn it on only if Tailscale's support asks for logs.
- Name in the tailnet: the firewall's name,
- Press Save to pending changes, review, and commit.
- Sign in. Under Status:
- with an auth key, the firewall signs in by itself within seconds. If it says needs sign-in, press Sign in to Tailscale;
- without a key, press Sign in to Tailscale. The Tailscale sign-in page opens in a new tab: sign in with an account of your tailnet. If no tab opens (a pop-up blocker), use the link under Status.
Status then shows connected, the tailnet name and the firewall's Tailscale addresses (100.x.y.z and fd7a:115c:a1e0:…).
Approve the routes and the exit node
A subnet router's networks, and an exit node, work only after an admin approves them. Until then the page shows waiting for approval next to each network.
- Tailscale: the page links the admin console (open the Tailscale admin console). Open Machines, then the firewall's ⋯ › Edit route settings. Tick the networks, and Use as exit node if offered.
- With
autoApproversin your tailnet policy fortag:firewall, routes are approved automatically.
- With
- Headscale: on the Headscale server, run
headscale nodes list-routes, thenheadscale nodes approve-routes --identifier <id> --routes 192.168.1.0/24,fd00:2::/64. Add0.0.0.0/0,::/0for the exit node.
Within a minute, the networks show approved.
Allow the tailnet in the firewall's rules
The zone tailnet has no rules yet, so nothing from the tailnet passes the firewall. Open Firewall › Rules and add, for example:
| From | To | Service | Action | Why |
|---|---|---|---|---|
| tailnet | LAN | any | Allow | phones and laptops reach the LAN |
| tailnet | WAN | any | Allow | only if the firewall is an exit node: internet through the firewall |
Commit. The rules apply to IPv4 and IPv6. Tailnet devices keep their own addresses (100.64.0.0/10 and fd7a:115c:a1e0::/48) through the firewall, so a rule can also allow only some of them: make an address object with their Tailscale addresses.
- Exit node traffic leaves through the firewall's outbound NAT, like the LAN's. If your source NAT lists only some sources, add 100.64.0.0/10 (and fd7a:115c:a1e0::/48 for IPv6).
- Web filtering, IPS and the other security add-ins apply to tailnet traffic when they cover the zone
tailnet.
Use it
- On a phone or laptop in the tailnet, open a LAN address, such as the NAS at 192.168.1.20. Phones with Tailscale's app use the subnet routes automatically. On Linux, run
tailscale up --accept-routes. - Exit node: in the Tailscale app, choose Exit node › fw-main. The device's internet traffic now goes through the firewall.
- Tailnet devices on the page lists every device:
- online, or when it was last seen;
- direct (with the address it connects from) or through a relay;
- the networks it offers, transfer, and when its key expires.
- Check relays measures the latency to Tailscale's relay regions, and shows whether UDP works (without UDP, every connection goes through a relay).
Optional: the firewall as a client
- Use networks other nodes advertise: the firewall reaches another site's subnet router. These routes take precedence over the firewall's own, so make sure no other node advertises one of the firewall's networks. Allow the traffic with rules from your zones to
tailnet. - Send the firewall's internet traffic through an exit node: choose a node that offers itself as exit node. Everything the firewall and the networks behind it send to the internet then goes through that node, which is useful for a branch that must leave through the head office. The firewall's own networks stay reachable.
The firewall cannot offer itself as an exit node and use another one at the same time.
Change or stop
- Disconnect for a while: untick Connected under Settings, save and commit. The firewall stays signed in and reconnects when you tick it again.
- Sign out: press Sign out under Status. The firewall leaves the tailnet; remove it under Machines in the admin console, or let its key expire.
- Turn the add-in off: with the switch at the top of the page, then commit. tailscaled stops. The firewall stays known to the tailnet, and turning the add-in on again reconnects without a new sign-in.
- Shields up: refuses every connection from the tailnet to the firewall and to the networks behind it, while the firewall can still reach out.
Good to know
- Tailscale never touches the firewall's rules. tailscaled runs with its own firewall handling off and is built without iptables. It cannot change the firewall's DNS settings, system files or kernel settings. Its routes for the tailnet live in a routing table of their own.
- Changes apply without dropping connections, except a new UDP port, the log setting, or a new auth key: those restart tailscaled for a few seconds.
- Failover pair: each firewall of a pair is its own tailnet node. Both can advertise the same networks, and Tailscale uses one at a time. To run Tailscale only on the active box, add
tailscaleto the add-ins held off on the standby. - Backups and new hardware: the configuration holds the settings and the auth key (as a secret), but not the firewall's node key. A firewall restored on new hardware signs in again, with the auth key or with Sign in to Tailscale, as a new node.
- Not in FIPS mode: the page says so, and commits are refused.
Troubleshooting
| What you see | What to do |
|---|---|
| needs sign-in stays after a commit with an auth key | The key may be used up (single use), expired, or for another tailnet. Make a new one, paste it, save and commit. |
| waiting for approval | Approve the networks in the admin console (or on Headscale). |
| A phone cannot reach the LAN | Is the network approved? Is there a rule tailnet → LAN? Does the phone accept routes (Linux: --accept-routes)? |
| Everything goes through a relay | Check relays: if UDP blocked, the internet connection blocks UDP. Keep the UDP port open in the internet zone. Behind another router, a port forward for UDP 41641 to the firewall helps. |
| tailscaled not running | See Monitoring › Logs & audit for tailscaled. Check that the zone exists and that nothing else uses the UDP port. |
| The exit node gives no internet | A rule tailnet → WAN is needed, and the outbound NAT must cover 100.64.0.0/10. |