Cloud-config networking configuration with both IPv4 and IPv6

Hi,

On both http://docs.rancher.com/os/cloud-config/ and http://docs.rancher.com/os/configuration/networking/ I’ve found how to do basic IPv4 network configuration in cloud-config, instead of defaulting to DHCP.

I can’t seem to find how to set multiple IPv4 addresses on an interface, or both an IPv4 and an IPv6 address. Is this possible using cloud-config? If not, is it possible to somehow create a script which adds this IPv6 address to eth0, before any (user) Docker containers are started?

Thanks!
Robbert

You can use addresses (vs the single address) to set up multiple IP addresses on an interface, like this:

#cloud-config
rancher:
  network:
    interfaces:
      eth1:
        addresses:
        - 192.168.0.102/24
        - 10.0.2.15/24
        gateway: 10.0.2.2

You can also use gateway_ipv6 key to set IPv6 gateway to the interface.

Great, thanks a lot!

About this:

  • Can the addresses list also take IPv6 addresses?
  • Does gateway_ipv6 require square brackets around the gateway address or a prefix-length?

Thanks again!

To answer my own questions: I was having some problems getting this working with one of the previous versions of RancherOS, but I’ve just gave it another shot on v0.4.4, and I can confirm this is working:

#cloud-config
rancher:
  network:
    interfaces:
      eth*:
        dhcp: false
      eth0:
        addresses:
          - 192.168.0.8/24
          - fd00:dead:beef::8/48
        gateway: 192.168.0.1
        gateway_ipv6: fd00:dead:beef::1