I often need to access my NAS at home from devices outside the local network. Previously, I would access it through the public network, but after moving and changing networks, I no longer have a public network. Fortunately, the network is NAT1, so I can still use Tailscale to create a connection and establish a local network.
Network Topology#
Explanation#
- The network requires a public network, NAT1, and IPV6. If these are not available, using the Tailscale relay server will be very slow, so you will need to set up your own drep.
- Set the side router as the DMZ host, and normal port forwarding should also work.
- All devices in the home LAN are on the same subnet, for example: 192.168.0.0/24
Configuring Tailscale Service on OpenWrt Side Router#
- Download
Tailscale on Openwrt
, - Extract:
tar x -zvC / -f openwrt-tailscale-enabler-<tag>.tgz
- Install required libraries:
opkg update && opkg install libustream-openssl ca-bundle kmod-tun
- Configure startup:
/etc/init.d/tailscale enable
- Start testing:
/etc/init.d/tailscale start
- Log in to the Tailscale service and enable subnet routing:
tailscale up --advertise-routes=192.168.0.0/24 --accept-dns=false
- 192.168.0.0/24: This is the subnet of my LAN.
- After starting, get the login address, register an account, and log in.
- Configure Tailscale service:
- Disable key expiration. By default, it will require a reset every 6 months, but we can disable this.
- Edit route settings of xxx: Enable subnet routing.
- (Optional) Configure exit node:
- If you want all devices in the LAN to use the side router, you can configure this. Note that there are pros and cons to doing this.
- Just add the
--advertise-exit-node
parameter when starting. tailscale up --advertise-routes=192.168.0.0/24 --accept-dns=false --advertise-exit-node
- Open the management page Edit route settings of xxx and check Exit node.
Configure Network Interface#
- Add a new network interface.
- Protocol: Static.
- IPV4 address: The IP address seen on the Tailscale web page, or you can use the command
tailscale ip
to check. - Subnet mask: 255.0.0.0
- Physical settings -> Interface: Select the tailscale0 interface.
- Firewall: lan
- Save and apply, then restart.
- No need to set firewall rules for side router mode.
Usage#
Download the corresponding Tailscale app on other devices and log in with the same account to establish a network. It's very convenient, and devices under the router can be accessed directly using the internal IP address, for example, the router's IP: 192.168.0.1. It's really nice.
Enjoy!#
As we all know, there are no good lines in the telecommunications network except for dedicated lines. But my home broadband is with China Unicom, so why not go home with my phone or other devices first?
References:
Docs · Tailscale Docs
OpenWrt 安装配置 Tailscale – ZhiYunHaiBo 智云海博 (zyh8.com)