This is a step by step guide to install Tailscale VPN and setup Subnet router on Ubuntu OS. The guide will allow installation on both physical hardware, KVM virtual machine, as well as unprivileged LXC containers.
Ignore the following part if not using LXC containers. Edit the LXC container config file from the host machine. In this example, lets say the LXC container ID is 102.
Add at the bottom of the config file:
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
This step onward is applicable for all.
Run the following in the machine you are installing Tailscale on to setup the subnets:
echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
sudo sysctl -p /etc/sysctl.d/99-tailscale.conf
Then install tailscale with the following command:
curl -fsSL https://tailscale.com/install.sh | sh
Bring up the tailscale with the subnet:
sudo tailscale up --advertise-routes=10.0.0.0/24,192.168.1.0/24
Copy the url provided into your browser to login and edit the device to approve the subnet router request.