{"id":5553,"date":"2019-06-05T19:07:06","date_gmt":"2019-06-05T19:07:06","guid":{"rendered":"https:\/\/really.zonky.org\/?p=5553"},"modified":"2019-06-05T19:07:10","modified_gmt":"2019-06-05T19:07:10","slug":"linux-containers-configuring-network-address-part-636","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=5553","title":{"rendered":"Linux Containers: Configuring Network Address (part 636)"},"content":{"rendered":"\n<p>On previous occasions (yes that does mean more than once) I have messed around with the network configuration of containers to get :-<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>A consistent behaviour.<\/li><li>A fixed IPv4 address with no DHCP configuration (this one is easy).<\/li><li>A fixed IPv6 address with no autoconfigured global addresses (this one has been tricky)<\/li><li><\/li><\/ol>\n\n\n\n<p>This turns out to be <em>relatively<\/em> easy providing that you configure the addresses within the container rather than within the container configuration. At least it looks good to go so far (I&#8217;ve been mistaken in the past).<\/p>\n\n\n\n<p>The container configuration is quite simple :-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lxc.net.0.type = veth\nlxc.net.0.flags = down\nlxc.net.0.link = br0<\/code><\/pre>\n\n\n\n<p>Note that the bridge interface (<em>br0<\/em>) may be different. Also note that there is no <em>lxc.net.0.ipv4.address<\/em>, <em>lxc.net.0.ipv4.gateway<\/em>, <em>lxc.net.0.ipv6.address<\/em>, or <em>lxc.net.0.ipv6.gateway<\/em>.<\/p>\n\n\n\n<p>The configuration within the container is dependent on what userland you are running, but for Debian (and Ubuntu if you&#8217;re not using Netplan) :-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>auto lo\niface lo inet loopback\n\nauto eth0\niface eth0 inet static\n    address 10.0.0.34\/16\n    gateway 10.0.0.1\n\niface eth0 inet6 static\n    address 2001:0db8:cafe:dead:0000:0000:0000:3eb\/64\n    scope global\n    gateway 2001:0db8:cafe:dead:0000:0000:0000:0001\n    privext 0\n    accept_ra 0\n    autoconf 0<\/code><\/pre>\n\n\n\n<p>Not sure quite which options are required but having all of &#8220;privext 0&#8221;, &#8220;accept_ra 0&#8221; and &#8220;autoconf 0&#8221; does mean no additional autoconfigured IPv6 addresses.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"463\" src=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/dam-ip6.jpeg?resize=695%2C463&#038;ssl=1\" alt=\"\" class=\"wp-image-4294\" srcset=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/dam-ip6.jpeg?w=792&amp;ssl=1 792w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/dam-ip6.jpeg?resize=300%2C200&amp;ssl=1 300w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/dam-ip6.jpeg?resize=768%2C512&amp;ssl=1 768w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/figure>\n\n\n\n<p>(And no the part number of this post isn&#8217;t anything more than a joke)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On previous occasions (yes that does mean more than once) I have messed around with the network configuration of containers to get :- A consistent behaviour. A fixed IPv4 address with no DHCP configuration (this one is easy). A fixed IPv6 address with no autoconfigured global addresses (this one has been tricky) This turns out <a href='https:\/\/really.zonky.org\/?p=5553' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[4,209,226],"tags":[163,1006,43,918],"class_list":["post-5553","post","type-post","status-publish","format-standard","hentry","category-it","category-linux-it","category-working-notes","tag-containers","tag-ipv6","tag-linux","tag-lxc","category-4-id","category-209-id","category-226-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-1rz","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5553"}],"version-history":[{"count":2,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5553\/revisions"}],"predecessor-version":[{"id":5555,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5553\/revisions\/5555"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}