[lxc-devel] [distrobuilder/master] generators/cloud-init: Add IPv6 to network config

monstermunchkin on Github lxc-bot at linuxcontainers.org
Wed May 20 17:04:43 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 310 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200520/ec6b52dc/attachment.bin>
-------------- next part --------------
From 94af549b660c39b340f4aba2c97d04141442caf0 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Wed, 20 May 2020 19:03:35 +0200
Subject: [PATCH] generators/cloud-init: Add IPv6 to network config

This adds IPv6 to the cloud-init network config.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 generators/cloud-init.go | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/generators/cloud-init.go b/generators/cloud-init.go
index b2bd017..fa543b0 100644
--- a/generators/cloud-init.go
+++ b/generators/cloud-init.go
@@ -124,9 +124,13 @@ local-hostname: {{ container.name }}
 config:
   - type: physical
     name: {% if instance.type == "virtual-machine" %}enp5s0{% else %}eth0{% endif %}
-    subnets:
-      - type: {% if config_get("user.network_mode", "") == "link-local" %}manual{% else %}dhcp{% endif %}
-        control: auto{% else %}{{ config_get("user.network-config", "") }}{% endif %}
+    subnets:{% if config_get("user.network_mode", "") == "link-local" %}
+      - type: manual
+        control: auto{% else %}
+      - type: dhcp
+        control: auto
+      - type: dhcp6
+        control: auto{% endif %}{% else %}{{ config_get("user.network-config", "") }}{% endif %}
 `
 	default:
 		return fmt.Errorf("Unknown cloud-init configuration: %s", defFile.Name)


More information about the lxc-devel mailing list