add systemd-networkd client config docs/lxd_container_home_server_networking_for_dummies.md

This commit is contained in:
trent committed 2018-02-18 11:34:31 +00:00
1 parent 27a11c0656
commit 15e26954a8
5 files changed
+72 -22

No files matched your search

+1 -1
View File
@@ -261,5 +261,5 @@
<!--
MkDocs version : 0.17.2
Build Date UTC : 2018-02-13 12:50:47
Build Date UTC : 2018-02-18 11:34:12
-->
@@ -451,6 +451,27 @@ iface eth1 inet static
<p>The configuration for a debian stretch container is the same, except the the file
<code>/etc/network/interfaces</code> will also describe eth0, but you only have to add the
description for eth1.</p>
<h3 id="systemd-networkd">systemd-networkd</h3>
<p>This seems to work.</p>
<pre><code class="conf"># eth0.network
[Match]
Name=eth0
[Network]
DHCP=ipv4
</code></pre>
<pre><code class="conf"># eth1.network
[Match]
Name=eth1
[Network]
DHCP=ipv4
[DHCP]
UseRoutes=false
</code></pre>
<h3 id="the-etchosts-file">the /etc/hosts file</h3>
<p>Once you assign the containers static ip addresses for their <em>eth1</em>
interfaces, you can use the <code>/etc/hosts</code> file on each container to make them
+6 -1
View File
@@ -27,7 +27,7 @@
},
{
"location": "/lxd_container_home_server_networking_for_dummies/",
"text": "LXD Container Home Server Networking For Dummies\n\n\nWhy?\n\n\nIf you're going to operate a fleet of LXD containers for home\nentertainment, you probably want some of them exposed with their\nown ip addresses on your home network, so that you can use them\nas containerized servers for various applications.\n\n\nOthers containers, you might want to be inaccessable from the lan,\nin a natted subnet, where they can solicit connections to the\noutside world from within their natted subnet, but are not addressable\nfrom the outside. A database server that you connect a web app to, for\ninstance, or a web app that you have a reverse proxy in front of.\n\n\nBut these are two separate address spaces, so ideally all of the containers\nwould have a second interface of their own, by which they could connect\nto a third network, that would be a private network that all of the containers\ncan use to talk directly to each other (or the host machine).\n\n\nIt's pretty straightforward, you just have to glue all the pieces together.\n\n\nThree Part Overview.\n\n\n\n\n\n\nDefine and create some bridges. \n\n\n\n\n\n\nDefine profiles that combine the network\ninterfaces in different combinations. In addition to two\nbridges you will have a macvlan with which to expose the containers\nthat you want exposed, but the macvlan doesn't come into\nplay until here in step two when you define profiles. \n\n\n\n\n\n\nAssign each container which profile it should use,\nand then configure the containers to use the included\nnetwork interfaces correctly. \n\n\n\n\n\n\nBuild Sum Moar Bridges\n\n\nThe containers will all have two network interfaces from\ntheir own internal point of view, \neth0\n and \neth1\n. \n\n\nIn this\nscheme we create a bridge for a natted subnet and a bridge for\na non-natted subnet. All of the containers will connect to the\nnon-natted subnet on their second interface, \neth1\n, and some\nof the containers will connect to the natted subnet on their \nfirst interface \neth0\n. The containers that don't connect\nto the natted subnet will instead connect to a macvlan\non their first interface \neth0\n, but that isn't part of this\nstep.\n\n\nbridge for a natted subnet\n\n\nIf you haven't used lxd before, you'll want to run the command \nlxd init\n.\nBy default this creates exactly the bridge we want, called \nlxdbr0\n.\n\n\nOtherwise you would use the following command to create \nlxdbr0\n.\n\n\nlxc network create lxdbr0\n\n\n\n\nTo generate a table of all the existing interfaces.\n\n\nlxd network list\n\n\n\n\nThis bridge is for our natted subnet, so we just want to go with\nthe default configuration.\n\n\nlxc network show lxdbr0\n\n\n\n\nThis cats a yaml file where you can see the randomly\ngenerated network for \nlxdbr0\n.\n\n\nconfig:\n ipv4.address: 10.99.153.1/24\n ipv4.nat: \"true\"\n ipv6.address: fd42:211e:e008:954b::1/64\n ipv6.nat: \"true\"\ndescription: \"\"\nname: lxdbr0\ntype: bridge\nused_by: []\nmanaged: true\n\n\n\n\nbridge for a non-natted subnet\n\n\nCreate \nlxdbr1\n\n\nlxc network create lxdbr1\n\n\n\n\nUse the following commands to remove nat from \nlxdbr1.\n\n\nlxc network set lxdbr1 ipv4.nat false\nlxc network set lxdbr1 ipv6.nat false\n\n\n\n\nOf if you use this next command, your favourite\ntext editor will pop open, preloaded with the complete yaml file\nand you can edit the configuration there.\n\n\nlxc network edit lxdbr1\n\n\n\n\nEither way you're looking for a result such as the following.\nNotice that the randomly generated address space is different\nthat the one for \nlxdbr0\n, and that the *nat keys are set\nto \"false\".\n\n\nconfig:\n ipv4.address: 10.151.18.1/24\n ipv4.nat: \"false\"\n ipv6.address: fd42:89d4:f465:1b20::1/64\n ipv6.nat: \"false\"\ndescription: \"\"\nname: lxdbr1\ntype: bridge\nused_by: []\nmanaged: true\n\n\n\n\nProfiles\n\n\nrecycle the default\n\n\nWhen you first ran \nlxd init\n, that created a default profile.\nConfirm with the following.\n\n\nlxc profile list\n\n\n\n\nTo see what the default profile looks like.\n\n\nlxc profile show default\n\n\n\n\nconfig:\n environment.http_proxy: \"\"\n security.privileged: \"true\"\n user.network_mode: \"\"\ndescription: Default LXD profile\ndevices:\n eth0:\n nictype: bridged\n parent: lxdbr0\n type: nic\n root:\n path: /\n pool: default\n type: disk\nname: default\nused_by: []\n\n\n\n\nprofile the natted\n\n\nThe easiest way to create a new profile is start by copying another one.\n\n\nlxc profile copy default natted\n\n\n\n\nedit the new \nnatted\n profile\n\n\nlxc profile edit natted\n\n\n\n\nAnd add an \neth1\n interface attached to \nlxdbr1\n. \neth0\n and \neth1\n will\nbe the interfaces visible from the container's point of view.\n\n\nconfig:\n environment.http_proxy: \"\"\n security.privileged: \"true\"\n user.network_mode: \"\"\ndescription: Natted LXD profile\ndevices:\n eth0:\n nictype: bridged\n parent: lxdbr0\n type: nic\n eth1:\n nictLine truncated
"text": "LXD Container Home Server Networking For Dummies\n\n\nWhy?\n\n\nIf you're going to operate a fleet of LXD containers for home\nentertainment, you probably want some of them exposed with their\nown ip addresses on your home network, so that you can use them\nas containerized servers for various applications.\n\n\nOthers containers, you might want to be inaccessable from the lan,\nin a natted subnet, where they can solicit connections to the\noutside world from within their natted subnet, but are not addressable\nfrom the outside. A database server that you connect a web app to, for\ninstance, or a web app that you have a reverse proxy in front of.\n\n\nBut these are two separate address spaces, so ideally all of the containers\nwould have a second interface of their own, by which they could connect\nto a third network, that would be a private network that all of the containers\ncan use to talk directly to each other (or the host machine).\n\n\nIt's pretty straightforward, you just have to glue all the pieces together.\n\n\nThree Part Overview.\n\n\n\n\n\n\nDefine and create some bridges. \n\n\n\n\n\n\nDefine profiles that combine the network\ninterfaces in different combinations. In addition to two\nbridges you will have a macvlan with which to expose the containers\nthat you want exposed, but the macvlan doesn't come into\nplay until here in step two when you define profiles. \n\n\n\n\n\n\nAssign each container which profile it should use,\nand then configure the containers to use the included\nnetwork interfaces correctly. \n\n\n\n\n\n\nBuild Sum Moar Bridges\n\n\nThe containers will all have two network interfaces from\ntheir own internal point of view, \neth0\n and \neth1\n. \n\n\nIn this\nscheme we create a bridge for a natted subnet and a bridge for\na non-natted subnet. All of the containers will connect to the\nnon-natted subnet on their second interface, \neth1\n, and some\nof the containers will connect to the natted subnet on their \nfirst interface \neth0\n. The containers that don't connect\nto the natted subnet will instead connect to a macvlan\non their first interface \neth0\n, but that isn't part of this\nstep.\n\n\nbridge for a natted subnet\n\n\nIf you haven't used lxd before, you'll want to run the command \nlxd init\n.\nBy default this creates exactly the bridge we want, called \nlxdbr0\n.\n\n\nOtherwise you would use the following command to create \nlxdbr0\n.\n\n\nlxc network create lxdbr0\n\n\n\n\nTo generate a table of all the existing interfaces.\n\n\nlxd network list\n\n\n\n\nThis bridge is for our natted subnet, so we just want to go with\nthe default configuration.\n\n\nlxc network show lxdbr0\n\n\n\n\nThis cats a yaml file where you can see the randomly\ngenerated network for \nlxdbr0\n.\n\n\nconfig:\n ipv4.address: 10.99.153.1/24\n ipv4.nat: \"true\"\n ipv6.address: fd42:211e:e008:954b::1/64\n ipv6.nat: \"true\"\ndescription: \"\"\nname: lxdbr0\ntype: bridge\nused_by: []\nmanaged: true\n\n\n\n\nbridge for a non-natted subnet\n\n\nCreate \nlxdbr1\n\n\nlxc network create lxdbr1\n\n\n\n\nUse the following commands to remove nat from \nlxdbr1.\n\n\nlxc network set lxdbr1 ipv4.nat false\nlxc network set lxdbr1 ipv6.nat false\n\n\n\n\nOf if you use this next command, your favourite\ntext editor will pop open, preloaded with the complete yaml file\nand you can edit the configuration there.\n\n\nlxc network edit lxdbr1\n\n\n\n\nEither way you're looking for a result such as the following.\nNotice that the randomly generated address space is different\nthat the one for \nlxdbr0\n, and that the *nat keys are set\nto \"false\".\n\n\nconfig:\n ipv4.address: 10.151.18.1/24\n ipv4.nat: \"false\"\n ipv6.address: fd42:89d4:f465:1b20::1/64\n ipv6.nat: \"false\"\ndescription: \"\"\nname: lxdbr1\ntype: bridge\nused_by: []\nmanaged: true\n\n\n\n\nProfiles\n\n\nrecycle the default\n\n\nWhen you first ran \nlxd init\n, that created a default profile.\nConfirm with the following.\n\n\nlxc profile list\n\n\n\n\nTo see what the default profile looks like.\n\n\nlxc profile show default\n\n\n\n\nconfig:\n environment.http_proxy: \"\"\n security.privileged: \"true\"\n user.network_mode: \"\"\ndescription: Default LXD profile\ndevices:\n eth0:\n nictype: bridged\n parent: lxdbr0\n type: nic\n root:\n path: /\n pool: default\n type: disk\nname: default\nused_by: []\n\n\n\n\nprofile the natted\n\n\nThe easiest way to create a new profile is start by copying another one.\n\n\nlxc profile copy default natted\n\n\n\n\nedit the new \nnatted\n profile\n\n\nlxc profile edit natted\n\n\n\n\nAnd add an \neth1\n interface attached to \nlxdbr1\n. \neth0\n and \neth1\n will\nbe the interfaces visible from the container's point of view.\n\n\nconfig:\n environment.http_proxy: \"\"\n security.privileged: \"true\"\n user.network_mode: \"\"\ndescription: Natted LXD profile\ndevices:\n eth0:\n nictype: bridged\n parent: lxdbr0\n type: nic\n eth1:\n nictLine truncated
"title": "LXD Container Home Server Networking For Dummies"
},
{
@@ -95,6 +95,11 @@
"text": "The configuration for a debian stretch container is the same, except the the file /etc/network/interfaces will also describe eth0, but you only have to add the \ndescription for eth1.",
"title": "debian stretch"
},
{
"location": "/lxd_container_home_server_networking_for_dummies/#systemd-networkd",
"text": "This seems to work. # eth0.network\n[Match]\nName=eth0\n\n[Network]\nDHCP=ipv4 # eth1.network\n[Match]\nName=eth1\n\n[Network]\nDHCP=ipv4\n\n[DHCP]\nUseRoutes=false",
"title": "systemd-networkd"
},
{
"location": "/lxd_container_home_server_networking_for_dummies/#the-etchosts-file",
"text": "Once you assign the containers static ip addresses for their eth1 \ninterfaces, you can use the /etc/hosts file on each container to make them\naware of where the other containers and the host machine are. For instance, if you want the container quick-joey to talk directly\nto the host machine, which will be at the ip address of lxdbr1 , start a shell\non the container quick-joey lxc exec quick-joey bash and edit /etc/hosts # /etc/hosts\n10.151.18.1 mothership Or you have a container named fat-cinderella , that needs to be able to talk\ndirectly quick-joey . lxc exec fat-cinderella bash\nvim /etc/hosts # /etc/hosts\n10.151.18.123 quick-joey etcetera",
+19 -19
View File
@@ -4,7 +4,7 @@
<url>
<loc>/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -12,7 +12,7 @@
<url>
<loc>/apt_pinning_artful_aardvark_packages_in_xenial_xerus/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -20,7 +20,7 @@
<url>
<loc>/lxd_container_home_server_networking_for_dummies/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -28,7 +28,7 @@
<url>
<loc>/lxd_container_foo/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -36,7 +36,7 @@
<url>
<loc>/how_to_reassign_a_static_ip_address_with_dnsmasq/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -44,7 +44,7 @@
<url>
<loc>/serve_and_share_apps_from_your_phone_with_fdroid/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -52,7 +52,7 @@
<url>
<loc>/nspawn/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -60,7 +60,7 @@
<url>
<loc>/gentoo_lxd_container/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -68,7 +68,7 @@
<url>
<loc>/mastodon_on_arch/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -76,7 +76,7 @@
<url>
<loc>/debian_nspawn_container_on_arch_for_testing_apache_configurations/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -84,7 +84,7 @@
<url>
<loc>/dynamic_cacheing_nginx_reverse_proxy_for_pacman/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -92,7 +92,7 @@
<url>
<loc>/freebsd_jails_on_freenas/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -100,7 +100,7 @@
<url>
<loc>/arch_redis_nspawn/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -108,7 +108,7 @@
<url>
<loc>/arch_postgresql_nspawn/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -116,7 +116,7 @@
<url>
<loc>/misc_tips_troubleshooting/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -124,7 +124,7 @@
<url>
<loc>/self_signed_certs/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -132,7 +132,7 @@
<url>
<loc>/selfoss_on_centos7/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -140,7 +140,7 @@
<url>
<loc>/stupid_package_manager_tricks/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>
@@ -148,7 +148,7 @@
<url>
<loc>/stupid_kvm_tricks/</loc>
<lastmod>2018-02-13</lastmod>
<lastmod>2018-02-18</lastmod>
<changefreq>daily</changefreq>
</url>