Easily Connect to Your Home Lab From Anywhere with Tailscale in Docker
#Tailscale #Docker #Homelab
Full steps can be found at https://i12bretro.github.io/tutorials/0110.html
--------------------------------------------------------------------
What is Tailscale?
--------------------------------------------------------------------
Tailscale is a VPN service that makes the devices and applications you own accessible anywhere in the world, securely and effortlessly. It enables encrypted point-to-point connections using the open source WireGuard protocol, which means only devices on your private network can communicate with each other. - https://tailscale.com/kb/1151/what-is-tailscale/
--------------------------------------------------------------------
Creating a Tailscale Account
--------------------------------------------------------------------
01. Open a web browser and navigate to https://login.tailscale.com/
02. Log in using one of the available single sign-on methods
03. Select DNS from the top navigation menu
04. Click the Add nameserver dropdown ≫ Custom...
05. Enter the IP address of the DNS server to use for your internal network/LAN ≫ Click Save
06. Select Settings from the top navigation menu
07. Select Keys under the Personal Settings heading in the left navigation menu
08. Click the Generate auth key... button
09. Check the Reusable box ≫ Generate key
10. Copy/leave the generated key visible for use later
--------------------------------------------------------------------
Installing Docker
--------------------------------------------------------------------
01. Log into the Linux host and run the following commands in a terminal window
install prerequisites
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
add docker gpg key
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
add docker software repository
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
install docker
sudo apt install docker-ce docker-compose containerd.io -y
enable and start docker service
sudo systemctl enable docker && sudo systemctl start docker
add the current user to the docker group
sudo usermod -aG docker $USER
reauthenticate for the new group membership to take effect
su - $USER
--------------------------------------------------------------------
Running the Tailscale Container
--------------------------------------------------------------------
01. Continue with the following commands in a terminal window
create the tailscale container
replace the TS_AUTHKEY variable
and update the TS_ROUTES variable
to point to your local network subnet
docker run -d --name=tailscale -v /var/lib:/var/lib -v /dev/net/tun:/dev/net/tun -e TS_ACCEPT_DNS=true --network=host --cap-add=NET_ADMIN --cap-add=NET_RAW --restart=unless-stopped --hostname="ctr-gateway" -e TS_AUTHKEY=≪%AUTH KEY CREATED EARLIER%≫ -e TS_ROUTES=192.168.0.0/24 tailscale/tailscale
02. Back in the web browser, select Machines from the top navigation menu
03. The ctr-gateway machine should be listed and connected
04. Click the Settings button across from the ctr-gateway device ≫ Select Disable key expiry
05. Click the Settings button across from the ctr-gateway device again ≫ Edit route settings...
06. Click the Approve all button to enable routing into the local network
--------------------------------------------------------------------
Connecting Other Devices
--------------------------------------------------------------------
01. Additional devices can be added to the Tailscale network by installing the Tailscale client https://tailscale.com/download
02. To connect from a mobile device, install the Tailscale mobile app
03. Log into Tailscale using the same method used to create the account earlier
04. Once connected to the network, the mobile device can be used to reach services in your home lab securely from anywhere
Source: https://hub.docker.com/r/tailscale/tailscale
Documentation: https://tailscale.com/kb/
Connect with me and others ###
★ Discord: https://discord.com/invite/EzenvmSHW8
★ Reddit: https://reddit.com/r/i12bretro
★ Twitter: https://twitter.com/i12bretro