{"id":64114,"date":"2022-05-04T09:00:41","date_gmt":"2022-05-04T09:00:41","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=64114"},"modified":"2022-05-04T09:00:41","modified_gmt":"2022-05-04T09:00:41","slug":"how-i-manage-my-own-virtual-network-with-zerotier","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=64114","title":{"rendered":"How I manage my own virtual network with ZeroTier"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">How I manage my own virtual network with ZeroTier<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/ksonney\" class=\"username\">Kevin Sonney<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Wed, 05\/04\/2022 &#8211; 03:00<\/span><\/p>\n<div data-drupal-selector=\"rate-node-69994\" class=\"rate-widget-thumbs-up\" title=\"Register or Login to like.\">\n<div class=\"rate-thumbs-up-btn-up vote-pending\"><a href=\"https:\/\/opensource.com\/user\/register\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml\">Login<\/a> to like<\/div>\n<div class=\"rate-score\"><a href=\"https:\/\/opensource.com\/user\/register\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml\">Login<\/a> to like<\/div>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p><em>Automation is a hot topic right now. In my day job as a site reliability engineer (SRE), part of my remit is to automate as many repeating tasks as possible. But how many of us do that in our daily, not-work, lives? This year, I am focused on automating away the toil so that we can focus on the things that are important.<\/em><\/p>\n<p>While automating everything, I ran into some difficulty with remote sites. I&#8217;m not a networking person so I started to look at my options. After researching the various virtual private networks (VPN), hardware endpoints, firewall rules, and everything that goes into supporting multiple remote sites, I was confused, grumpy, and frustrated with the complexity of it all.<\/p>\n<\/p>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">More on automation<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/engage\/automated-enterprise-ebook-20171115?intcmp=701f2000000h4RcAAI\">Download now: The automated enterprise eBook<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/do007-ansible-essentials-simplicity-automation-technical-overview?intcmp=701f2000000h4RcAAI\">Free online course: Ansible essentials<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/ansible-cheat-sheet?intcmp=701f2000000h4RcAAI\">Ansible cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/home-automation-ebook?intcmp=701f2000000h4RcAAI\">eBook: A practical guide to home automation using open source tools<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/ansible-quickstart?intcmp=701f2000000h4RcAAI\">A quickstart guide to Ansible<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/automation?intcmp=701f2000000h4RcAAI\">More articles about open source automation<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<p>Then I found <a href=\"https:\/\/github.com\/zerotier\" target=\"_blank\" rel=\"noopener\">ZeroTier<\/a>. ZeroTier is an encrypted virtual network backbone, allowing multiple machines to communicate as if they were on a single network. The code is all open source, and you can self-host the controller or use the <a href=\"https:\/\/www.zerotier.com\/pricing\" target=\"_blank\" rel=\"noopener\">ZeroTierOne<\/a> service with either free or paid plans. I&#8217;m using their free plan right now, and it is robust, solid, and very consistent.<\/p>\n<p>Because I&#8217;m using the web service, I&#8217;m not going to go into detail about running the controller and root services. ZeroTier has a complete reference on how to do that in their <a href=\"https:\/\/docs.zerotier.com\/\" target=\"_blank\" rel=\"noopener\">documentation<\/a>, and it&#8217;s very good.<\/p>\n<p>After creating my own virtual network in the web user interface, the client installation is almost trivial. ZeroTier has packages for APT, RPM, FreeBSD, and many other platforms, so getting the first node online takes little effort.<\/p>\n<p>Once installed, the client connects to the controller service and generates a unique ID for the node. On Linux, you use the <code>zerotier-cli<\/code> command to join a network, using the <code>zerotier-cli join NETWORKID<\/code> command.<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\">$ <span class=\"kw2\">sudo<\/span> zerotier-cli info<br><span class=\"nu0\">200<\/span> info 469584783a <span class=\"nu0\">1<\/span>.x.x ONLINE<\/div><\/div><\/pre>\n<p>You can also use <code>zerotier-cli<\/code> to get a listing of connected and available nodes, change network settings, and leave networks.<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/05\/SecondDay02-2.png\" width=\"1984\" height=\"268\" alt=\"Image of Setting up a New Node\" loading=\"lazy\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Kevin Sonney, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<p>After joining a network, you do have to approve access for the node, either through the web console or by making a call to the application programming interface (API). Both methods are documented on the ZeroTier site. After you have two nodes connected, connecting to each other \u2014 no matter where you are or what side of any firewalls you may be on \u2014 is exactly what you would expect if you were in the same building on the same network. One of my primary use cases is for <a href=\"https:\/\/opensource.com\/article\/22\/5\/remote-home-assistant\" target=\"_blank\" rel=\"noopener\">remote access to my Home Assistant setup<\/a> without needing to open up firewall ports or expose it to the internet (more on my Home Assistant setup and related services later).<\/p>\n<p>One thing I did set up myself is a <a href=\"https:\/\/github.com\/zerotier\/zeronsd\" target=\"_blank\" rel=\"noopener\">Beta ZeroNDS Service<\/a> for internal DNS. This saved me a lot of complexity for managing my own name service or having to create public records for all my private hosts and IP addresses. I found the instructions to be very straight forward, and was able to have a DNS server for my private network up in about 5 minutes. Each client has to allow Zerotier to set the DNS, which is very simple in the GUI clients. To enable it for use on Linux clients, use:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"bash geshifilter-bash\"><span class=\"co4\">$ <\/span><span class=\"kw2\">sudo<\/span> zerotier-cli setNETWORKID <span class=\"re2\">allowDNS<\/span>=<span class=\"nu0\">1<\/span><\/code><\/span><\/pre>\n<p>No other updates are needed as you add and remove hosts, and it &#8220;just works.&#8221;<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"bash geshifilter-bash\">$ <span class=\"kw2\">sudo<\/span> zerotier-cli info<br><span class=\"nu0\">200<\/span> info 469584845a <span class=\"nu0\">1<\/span>.x.y ONLINE<br>\n$ <span class=\"kw2\">sudo<\/span> zerotier-cli <span class=\"kw2\">join<\/span><br>\n93afae596398153a <span class=\"nu0\">200<\/span> <span class=\"kw2\">join<\/span> OK<br>\n$ <span class=\"kw2\">sudo<\/span> zerotier-cli peers<br><span class=\"nu0\">200<\/span> peers<br><span class=\"sy0\">ztaddr<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">ver<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">role<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">lat<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\"><span class=\"kw2\">link<\/span><span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">TX<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">RX<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">path<span class=\"sy0\">&gt;<\/span><br>\n61d294b9cb - PLANET <span class=\"nu0\">112<\/span> DIRECT <span class=\"nu0\">7946<\/span> <span class=\"nu0\">2812<\/span> 50.7.73.34<span class=\"sy0\">\/<\/span><span class=\"nu0\">9993<\/span><br>\n62f865ae71 - PLANET <span class=\"nu0\">264<\/span> DIRECT <span class=\"nu0\">7946<\/span> <span class=\"nu0\">2681<\/span> 50.7.76.38<span class=\"sy0\">\/<\/span><span class=\"nu0\">9993<\/span><br>\n778cde7190 - PLANET <span class=\"nu0\">61<\/span> DIRECT <span class=\"nu0\">2944<\/span> <span class=\"nu0\">2901<\/span> 103.195.13.66<span class=\"sy0\">\/<\/span><span class=\"nu0\">9993<\/span><br>\n93afae5963 <span class=\"nu0\">1<\/span>.x LEAF <span class=\"nu0\">77<\/span> DIRECT <span class=\"nu0\">2945<\/span> <span class=\"nu0\">2886<\/span> 35.188.31.177<span class=\"sy0\">\/<\/span><span class=\"nu0\">41848<\/span><br>\n992fcf1db7 - PLANET RECT <span class=\"nu0\">79124<\/span> DI47 <span class=\"nu0\">2813<\/span> <span class=\"nu0\">195<\/span>. 181.173.159<span class=\"sy0\">\/<\/span><span class=\"nu0\">9993<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/div><\/div><\/pre>\n<p>I&#8217;ve barely scratched the surface of the features here. ZeroTier also allows for bridging between ZeroTier networks, advanced routing rules, and a whole lot more. They even have a <a href=\"https:\/\/github.com\/zerotier\/terraform-provider-zerotier\" target=\"_blank\" rel=\"noopener\">Terraform provider<\/a> and a listing of <a href=\"https:\/\/github.com\/zerotier\/awesome-zerotier\" target=\"_blank\" rel=\"noopener\">Awesome Zerotier Things<\/a>. As of today, I&#8217;m using ZeroTier to connect machines across four physical sites, three of which are behind NAT firewalls. Zerotier is simple to set up, and almost completely painless to manage.<\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>ZeroTier is an encrypted virtual network backbone, allowing multiple machines to communicate as if they were on a single network.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/05\/coffee_tea_laptop_computer_work_desk.png\" width=\"520\" height=\"292\" alt=\"Person drinking a hat drink at the computer\" title=\"Person drinking a hat drink at the computer\" loading=\"lazy\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p><a href=\"https:\/\/unsplash.com\/@jonasleupe?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noopener\">Jonas Leupe<\/a>\u00a0on\u00a0<a href=\"https:\/\/unsplash.com\/s\/photos\/tea-cup-computer?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" target=\"_blank\" rel=\"noopener\">Unsplash<\/a><\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/networking\" hreflang=\"en\">Networking<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/automation\" hreflang=\"en\">Automation<\/a><\/div>\n<\/p><\/div>\n<div class=\"hidden field field--name-field-listicle-title field--type-string field--label-hidden field__item\">What to read next<\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/05\/cc-by-sa-4-4.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How I manage my own virtual network with ZeroTier Kevin Sonney Wed, 05\/04\/2022 &#8211; 03:00 Register or Login to like Register or Login to like Automation is a hot topic right now. In my day job as a site reliability engineer (SRE), part of my remit is to automate as many repeating tasks as possible. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":64115,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-64114","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/64114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=64114"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/64114\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/64115"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=64114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=64114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=64114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}