<div dir="ltr">Tomasz<div><br></div><div>After experimenting with TINC, OpenVPN & others I found and have used PeerVPN to do this:</div><div><br></div><div><a href="https://peervpn.net/">https://peervpn.net/</a><br></div><div><br></div><div>PeerVPN is a full-mesh VPN and is auto-learning..<br></div><div><ul style="color:rgb(0,0,0);font-family:verdana,arial"><li>Ethernet tunneling support using TAP devices.</li><li>IPv6 support.</li><li>Full mesh network topology.</li><li>Automatically builds tunnels through firewalls and NATs without any further setup (for example, port forwarding).</li><li>Shared key encryption and authentication support.<br></li></ul><div><span style="color:rgb(0,0,0);font-family:verdana,arial">At the time <i>I found PeerVPN much simpler to configure that TINC !</i></span></div><div><span style="color:rgb(0,0,0);font-family:verdana,arial"><br></span></div><div><span style="color:rgb(0,0,0);font-family:verdana,arial">A PeerVPN mesh is extremely easy to configure as you only have to install PeerVPN on each host server and edit its config file on that server.</span><br></div></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">The brief tutorial page (<a href="https://peervpn.net/tutorial/">https://peervpn.net/tutorial/</a>) shows that config for a basic PeerVPN only requires about 7 lines on each of your servers.</font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">In <a href="https://bmullan.wordpress.com/2015/05/12/proof-of-concept-using-mesh-vpn-to-interconnect-lxc-containers-on-multiple-hosts-on-multiple-clouds/">Apr 2015 I documented a proof-of-concept test setup</a> I'd done to interconnect LXC containers on AWS, DIgital Ocean and here locally (so much like you want to do I think). </font></div><div><br></div><div><font color="#000000" face="verdana, arial"><b>NOTE:  </b> that documentation <u>was before</u> my use of LXD !   </font></div><div><font color="#000000" face="verdana, arial"><br></font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font color="#000000" face="verdana, arial"><i>The reason I mention this is that with the advent of LXD the entire container IP addressing setup using PeerVPN becomes even easier ! </i>   </font><span style="color:rgb(0,0,0);font-family:verdana,arial">This is because when I did those tests I never took the time to create a single DHCP source for all lxc containers on all hosts.   In my 2015 proof-of-concept test of PeerVPN I just a quick & dirty config using the assumption that no 2 containers (for my test purposes) would get assigned the same 10.0.3.x IP address by their local Server/Host.</span></blockquote><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">Today, LXD <i><u>during installation</u></i> allows you much more control over each Server/Host's LXDBR0 bridge IP and the 10.x.x.x IP address range that is used for that Host's lxc containers.</font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial"><i>So if you were to use PeerVPN,  during LXD installation on each server just reserve a portion of the 10.x.x.x IP address range for each Server/Host to avoid any possibility of any 2 containers on any 2 Hosts getting assigned the same IP.</i></font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">The last config step on each Server/Host is to connect the PeerVPN mesh Tunnel End Point (TEP to the local LXDBR0 bridge to enable all the containers attached to that bridge to pass data over the VPN tunnel to the other servers since my documentation set up a Layer 2 VPN (note PeerVPN supports a Layer 3 tunnel as well I believe).</font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">Since the PeerVPN TEP "interface" ... called "peervpn0" in my tutorial example is just like any other Linux ethernet interface you only have to use the "ip link" command to connect "peervpn0" to the LXD "lxdbr0" bridge. </font></div><div><p style="line-height:19px;margin:15px 15px 2px;font-stretch:normal;font-size:11px;font-family:"lucida sans unicode","trebuchet ms",verdana,monospace;color:rgb(0,0,0);padding-left:30px"><em><strong>$ sudo ip link set dev peervpn0 master lxdbr0</strong></em></p></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">After you've done that on all 3 hosts your containers on all the hosts should be able to reach each other since they would all be on what logically is the same "ethernet" via the VPN & the fact that you setup all of the LXD installs with the same same 10.x.x.x network.</font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">Also, the containers on each Server/Host still get external Internet access (if you permit it) via their local Host.</font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">Anyway, I thought I'd send this info in case it is helpful as this should work with servers locally or remotely using LXD.</font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial">Brian</font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial"><br></font></div><div><font color="#000000" face="verdana, arial"><br></font></div></div>