0110.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Easily Connect to Your Home Lab From Anywhere with Tailscale in Docker</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta charset="UTF-8">
  7. <meta name="keywords" content="Home Lab,Home Lab Ideas,Docker Made Easy,Install Guide,Self-Hosted,Free Software,Self-Hosted VPN,VPN Server,Windows,Linux,VPN,VPN Solution,Virtual Private Network,Tailscale,Android,Docker,Home Networking,Network,Docker Simplified,Docker Made Simple,Self-Hosted VPN Server,VPN To Your Home Network,Docker How To,Docker Host,Containers,Containerization,Container,Free VPN,How To,Tutorial,i12bretro">
  8. <meta name="author" content="i12bretro">
  9. <meta name="description" content="Easily Connect to Your Home Lab From Anywhere with Tailscale in Docker">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  11. <meta name="revised" content="12/01/2024 07:13:38 PM" />
  12. <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
  13. <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  14. <script type="text/javascript" src="includes/js/steps.js"></script>
  15. <link href="css/steps.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="gridContainer">
  19. <div class="topMargin"></div>
  20. <div id="listName" class="topMargin">
  21. <h1>Easily Connect to Your Home Lab From Anywhere with Tailscale in Docker</h1>
  22. </div>
  23. <div></div>
  24. <div id="content">
  25. <h2>What is Tailscale?</h2>
  26. <blockquote><em>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. -<a href="https://tailscale.com/kb/1151/what-is-tailscale/" target="_blank">https://tailscale.com/kb/1151/what-is-tailscale/</a></em></blockquote>
  27. <h2>Creating a Tailscale Account</h2>
  28. <ol>
  29. <li>Open a web browser and navigate to <a href="https://login.tailscale.com/" style="font-size: inherit;" target="_blank">https://login.tailscale.com/</a></li>
  30. <li>Log in using one of the available single sign-on methods</li>
  31. <li>Select DNS from the top navigation menu</li>
  32. <li>Click the Add nameserver dropdown &gt; Custom...</li>
  33. <li>Enter the IP address of the DNS server to use for your internal network/LAN &gt; Click Save</li>
  34. <li>Select Settings from the top navigation menu</li>
  35. <li>Select Keys under the Personal Settings heading in the left navigation menu</li>
  36. <li>Click the Generate auth key... button</li>
  37. <li>Check the Reusable box &gt; Generate key</li>
  38. <li>Copy/leave the generated key visible for use later</li>
  39. </ol>
  40. <h2>Installing Docker</h2>
  41. <ol>
  42. <li>Log into the Linux host and run the following commands in a terminal window
  43. <div class="codeBlock"># install prerequisites<br />
  44. sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y<br />
  45. # add docker gpg key<br />
  46. curl -fsSL https://download.docker.com/linux/$(awk -F&#39;=&#39; &#39;/^ID=/{ print $NF }&#39; /etc/os-release)/gpg | sudo apt-key add -<br />
  47. # add docker software repository<br />
  48. sudo add-apt-repository &quot;deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F&#39;=&#39; &#39;/^ID=/{ print $NF }&#39; /etc/os-release) $(lsb_release -cs) stable&quot;<br />
  49. # install docker<br />
  50. sudo apt install docker-ce docker-compose containerd.io -y<br />
  51. # enable and start docker service<br />
  52. sudo systemctl enable docker &amp;&amp; sudo systemctl start docker<br />
  53. # add the current user to the docker group<br />
  54. sudo usermod -aG docker $USER<br />
  55. # reauthenticate for the new group membership to take effect<br />
  56. su - $USER</div>
  57. </li>
  58. </ol>
  59. <h2>Running the Tailscale Container</h2>
  60. <ol>
  61. <li>Continue with the following commands in a terminal window
  62. <div class="codeBlock"># create the tailscale container<br />
  63. # replace the TS_AUTHKEY variable<br />
  64. # and update the TS_ROUTES variable<br />
  65. # to point to your local network subnet<br />
  66. 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=&quot;ctr-gateway&quot; -e TS_AUTHKEY=&lt;%AUTH KEY CREATED EARLIER%&gt; -e TS_ROUTES=192.168.0.0/24 tailscale/tailscale</div>
  67. </li>
  68. <li>Back in the web browser, select Machines from the top navigation menu</li>
  69. <li>The ctr-gateway machine should be listed and connected</li>
  70. <li>Click the Settings button across from the ctr-gateway device &gt; Select Disable key expiry</li>
  71. <li>Click the Settings button across from the ctr-gateway device again &gt; Edit route settings...</li>
  72. <li>Click the Approve all button to enable routing into the local network</li>
  73. </ol>
  74. <h2>Connecting Other Devices</h2>
  75. <ol>
  76. <li>Additional devices can be added to the Tailscale network by installing the Tailscale client <a href="https://tailscale.com/download" target="_blank">Additional reading</a></li>
  77. <li>To connect from a mobile device, install the Tailscale mobile app</li>
  78. <li>Log into Tailscale using the same method used to create the account earlier</li>
  79. <li>Once connected to the network, the mobile device can be used to reach services in your home lab securely from anywhere</li>
  80. </ol>
  81. <p>Source: <span><span class="codeBlock"><a href="https://hub.docker.com/r/tailscale/tailscale" target="_blank">https://hub.docker.com/r/tailscale/tailscale</a><br />
  82. Documentation: <a href="https://tailscale.com/kb/" target="_blank">https://tailscale.com/kb/</a></span></span></p> </div>
  83. </div>
  84. </body>
  85. </html>