← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~yadle/cloud-init:fix-ipv6-configuration into cloud-init:master

 

Raphaël Enrici has proposed merging ~yadle/cloud-init:fix-ipv6-configuration into cloud-init:master.

Commit message:
Nocloud v1 config passes static6 as the type of subnet. This patch replaces static6 by static during interfaces file generation as static6 is not a valid keyword in /etc/network/interfaces

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~yadle/cloud-init/+git/cloud-init/+merge/362005

nocloud v1 network-config looks like this:
version: 1
config:
    - type: physical
      name: eth0
      mac_address: b2:b8:6e:6f:58:47
      subnets:
      - type: static
        address: <ipv4 addr>
        netmask: 255.255.255.224
        gateway: <ipv4 gw addr>
      - type: static6
        address: <ipv6 addr>
        gateway: <ipv6 gw addr>
...
Without the patch this leads to that kind of file:
/etc/network/interfaces.d/50-cloud-init.cfg:
<snip>
auto eth0
iface eth0 inet static
    address <ipv4 addr>
    gateway <ipv4 gw addr>

# control-alias eth0
iface eth0 inet6 static6
    address <ipv6 addr>
    gateway <ipv6 gw addr>
<snip>
Which is not valid, at least in ubuntu xenial. With the patch we get the right entry for ipv6 configuration:
# control-alias eth0
iface eth0 inet6 static  <<<---- 6 removed here
    address <ipv6 addr>
    gateway <ipv6 gw addr>

-- 
Your team cloud-init commiters is requested to review the proposed merge of ~yadle/cloud-init:fix-ipv6-configuration into cloud-init:master.
diff --git a/cloudinit/net/eni.py b/cloudinit/net/eni.py
index 6423632..be6e97e 100644
--- a/cloudinit/net/eni.py
+++ b/cloudinit/net/eni.py
@@ -407,6 +407,8 @@ class Renderer(renderer.Renderer):
                 iface['inet'] = subnet_inet
                 if subnet['type'].startswith('dhcp'):
                     iface['mode'] = 'dhcp'
+                if subnet['type'].startswith('static6'):
+                    iface['mode'] = 'static'
 
                 # do not emit multiple 'auto $IFACE' lines as older (precise)
                 # ifupdown complains

Follow ups