Install Tailscale on LXC
Quick instructions for installing Tailscale to LXC container
- Create CT
- set Hostname. Leave it to "unprivileged". Set password and ID
- Tamplate tab → choose ubuntu template
- Disk tab → leave it default
- cpu tab → leave it default
- memory tab → leafe it default
- network tab → set IPv4 DHCP or static if you have IP for it
- dns tab → set it default
-
Click Confirm
-
Start the container. Log in (Console)
- to allow remote SSH access edit file /etc / ssh /sshd_config : PermitRootLogin yes
-
apt update && apt upgrade -y
3. Tailscale install docs: https://tailscale.com/kb/1031/install-linux * #apt install curl -y * #curl -fsSL https://tailscale.com/install.sh | sh * (optonal for running exit node) edit file /etc/sysctl.conf - uncomment line #net.ipv4.ip_forward=1 and #net.ipv6.conf.all.forwarding=1 * shutdown container
4. Apply two lines to proxmox https://tailscale.com/kb/1130/lxc-unprivileged
To allow Tailscale container to access proxmox network, ssh to proxmox. Edit file /etc/pve/lxc/150.conf (150 = change it to the ID of your Tailscale container ID)
paste the lines end of the file:
lxc.cgroup2.devices.allow: c 10:200 rwm
lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file
save file and start container again.
5. log in to the tailscale lxc container and start the service with command: tailscale up
(optonal for enabling exit node for access to proxmox network) tailscale up --advertise-routes=10.10.18.0/24 --advertise-exit-node
6. Copy the tailscale link open in browser. Choose the login type and click "Connect"
with command "tailscale status" you can see all the connected devices
7. (optional) enable the access to the proxmox network From the tailscale admin page click the 3 dots from the server → "edit route settings" and enable the subnet route & exit node
to do IP Forwarding from LXC tailscale container to the host Proxmox server run this command in LXC: echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
If firewall is on in the LXC you have to allow forwarding: iptables -A FORWARD -i tailscale0 -o eth0 -j ACCEPT iptables -A FORWARD -i eth0 -o tailscale0 -m state --state RELATED,ESTABLISHED -j ACCEPT