IPv6 and Amazon EC2

Back in December, Amazon announced that IPv6 was finally available in the Ohio region (here). On January 25, they announced it had been rolled out worldwide (except China).

If you follow the link in the announcement, you can find all you need to know about enabling IPv6 in your VPC. But the detail that is missing is how to get your EC2 instances to start using IPv6.

That’s what this post is, and it’s insanely simple, but hard to figure out if you’re not already well versed in IPv6 stuff.

So here it is:
In your instance, in /etc/network/interfaces.d, there’s a file called eth0.cfg that looks something like this inside:

# The primary network interface
auto eth0
iface eth0 inet dhcp
  pre-up iptables-restore < /etc/iptables.rules

You need to make it look like this:

# The primary network interface
auto eth0
iface eth0 inet dhcp
  pre-up iptables-restore < /etc/iptables.rules
  
iface eth0 inet6 static
  address <IPv6 Address>
  mask 64

Where the IPv6 address is the address you’ve assigned to the instance in the AWS Console. After modifying this file, reboot the instance. It’ll put that static address on the interface and start picking up route advertisements.

Once that’s done, go into your security group and replicate your IPv4 firewall rules with identical rules using IPv6 source/destinations.

Leave a Reply