## When you go back in, look /etc/network/interfaces.d/50-cloud-init.cfg
## and verify it has an ipv6 address and a dhclient6 running.
$ grep -v "^[#]." /etc/network/interfaces.d/50-cloud-init.cfg | grep .
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp
$ ip address show dev eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP group default qlen 1000
link/ether 06:20:c9:69:43:c3 brd ff:ff:ff:ff:ff:ff
inet 172.31.30.202/20 brd 172.31.31.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 2600:1f16:aeb:b20b:7b8c:976e:5010:f218/128 scope global
valid_lft forever preferred_lft forever
inet6 fe80::420:c9ff:fe69:43c3/64 scope link
valid_lft forever preferred_lft forever
ami-6b6f4b0e ubuntu/ images- testing- dev/hvm- ssd/ubuntu- xenial- 16.04-testing- amd64-server- 20170307 images- testing/ hvm-ssd/ ubuntu- yakkety- daily-amd64- server- 20170307
ami-6a6f4b0f ubuntu/
I launched an instance in an EC2 region (us-east-2) into a subnet with configured ipv6.
$ rel=$(lsb_release -sc) sources. list) sources. list.d/ proposed. list g1c795b9- 0ubuntu1~ 16.10.1
$ line=$(awk '$1 == "deb" && $2 ~ /ubuntu.com/ { printf("%s %s %s-proposed main universe\n", $1, $2, rel); exit(0) }; ' "rel=$rel" /etc/apt/
$ echo "$line" | sudo tee /etc/apt/
$ sudo apt-get update -q && sudo apt-get install cloud-init -qy </dev/null
$ dpkg-query --show cloud-init
cloud-init 0.7.9-48-
## just show the network info to show the ipv6 section. utils.get_ instance_ metadata( )["network" ])' c9:69:43: c3': {'public-ipv4s': '52.14.184.32', 'vpc-ipv6- cidr-blocks' : '2600:1f16: aeb:b200: :/56', 'subnet-id': 'subnet-20b8565b', 'interface-id': 'eni-8388dff8', 'owner-id': '950047163771', 'subnet- ipv4-cidr- block': '172.31.16.0/20', 'subnet- ipv6-cidr- blocks' : '2600:1f16: aeb:b20b: :/64', 'security-groups': 'wide-open', 'security- group-ids' : 'sg-5a61d333', 'local-hostname': 'ip-172- 31-30-202. us-east- 2.compute. internal' , 'ipv4-associati ons': {'52.14.184.32': '172.31.30.202'}, 'vpc-ipv4- cidr-blocks' : '172.31.0.0/16', 'vpc-ipv4- cidr-block' : '172.31.0.0/16', 'ipv6s': '2600:1f16: aeb:b20b: 7b8c:976e: 5010:f218' , 'vpc-id': 'vpc-87e72bee', 'mac': '06:20: c9:69:43: c3', 'public-hostname': 'ec2-52- 14-184- 32.us-east- 2.compute. amazonaws. com', 'local-ipv4s': '172.31.30.202', 'device-number': '0'}}}}
$ python3 -c 'from cloudinit import ec2_utils; print(ec2_
{'interfaces': {'macs': {'06:20:
I then set default networking for cloud-init to attempt both ipv4 and ipv6.
$ ADDR=$(cat /sys/class/ net/eth0/ address) cloud.cfg. d/99-network- config. cfg <<EOF
$ sudo tee /etc/cloud/
network:
version: 1
config:
- type: physical
name: eth0
mac_address: $ADDR
subnets:
- type: dhcp
- type: dhcp6
EOF
Then, clean the instance, and reboot.
$ sudo rm -Rf /var/log/cloud-init /var/lib/cloud
$ sudo reboot
## When you go back in, look /etc/network/ interfaces. d/50-cloud- init.cfg interfaces. d/50-cloud- init.cfg | grep .
## and verify it has an ipv6 address and a dhclient6 running.
$ grep -v "^[#]." /etc/network/
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
iface eth0 inet6 dhcp
$ grep INFO.*network /var/log/ cloud-init. log | head -n 1 c9:69:43: c3', 'subnets': [{'type': 'dhcp'}, {'type': 'dhcp6'}]}]}
2017-03-08 20:44:20,861 - stages.py[INFO]: Applying network configuration from system_cfg bringup=False: {'version': 1, 'config': [{'name': 'eth0', 'type': 'physical', 'mac_address': '06:20:
$ ip address show dev eth0 MULTICAST, UP,LOWER_ UP> mtu 9001 qdisc pfifo_fast state UP group default qlen 1000 aeb:b20b: 7b8c:976e: 5010:f218/ 128 scope global c9ff:fe69: 43c3/64 scope link
2: eth0: <BROADCAST,
link/ether 06:20:c9:69:43:c3 brd ff:ff:ff:ff:ff:ff
inet 172.31.30.202/20 brd 172.31.31.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 2600:1f16:
valid_lft forever preferred_lft forever
inet6 fe80::420:
valid_lft forever preferred_lft forever
$ ps axw | grep [d]hclient eth0.pid -lf /var/lib/ dhcp/dhclient. eth0.leases -I -df /var/lib/ dhcp/dhclient6. eth0.leases eth0 eth0.pid -lf /var/lib/ dhcp/dhclient6. eth0.leases -I -df /var/lib/ dhcp/dhclient. eth0.leases eth0
777 ? Ss 0:00 /sbin/dhclient -1 -v -pf /run/dhclient.
1050 ? Ss 0:00 /sbin/dhclient -1 -6 -pf /run/dhclient6.