0

In CentOS 7.3 I had the following in /etc/sysconfig/network-scripts/ifcfg-eth0:

IPV6INIT=yes
IPV6ADDR=[address]/64
IPV6_DEFAULTGW=[gateway address]

This worked fine. However, now that 7.4 uses cloud-init this gets reset on boot.

I can add the IPV6INIT=yes line by following the answer here:

How do I enable IPv6 in RHEL 7.4 on Amazon EC2

# /etc/cloud/cloud.cfg.d/99-custom-networking.cfg
network:
  version: 1
  config:
  - type: physical
    name: eth0
    subnets:
      - type: dhcp6

This seems to work and enable IPV6 but it only works with DHCP. (Though I am not sure this is really being used as it doesn't seem to have any effect).

I also tried:

network:
  version: 1
  config:
    - type: physical
      name: eth0
      subnets
        - type: dhcp
        - type: static6
          address: [address]/64
          gateway: [gateway]

Though it doesn't make any changes in /etc/sysconfig/network-scripts/ifcfg-eth0

How do I set the equivalent of IPV6ADDR and IPV6_DEFAULTGW using cloud-init?

Tom B
  • 175
  • 1
  • 1
  • 6

1 Answers1

0

After a bit of trial and error with various examples, the following works:

network:
    version: 2
    ethernets:
        eth0:
            dhcp: true
            dhcp6: false
            match:
              name: eth0
            addresses:
              - "[address]"
            gateway6: "[gateway address]"

Tom B
  • 175
  • 1
  • 1
  • 6