大网数据广告活动
服务器运维问答

AWS CLI Elastic IP, IPv6

· 52CE 我爱测

I have two AWS instances working in high availability. (I'm using keepalived) I have an Elastic IP associated, everything was a fine. I used this script so to change the instance IP in case o failover: #!/bin/bash EIP=52.212.151.…

问题原文

原帖链接 · Thiago Souza · CC BY-SA 3.0

I have two AWS instances working in high availability. (I'm using keepalived)

I have an Elastic IP associated, everything was a fine.

I used this script so to change the instance IP in case o failover:

#!/bin/bash

EIP=52.212.151.17
INSTANCE_ID=i-0bdd8a68eb573fd1a

/usr/bin/aws ec2 disassociate-address --public-ip $EIP
/usr/bin/aws ec2 associate-address --public-ip $EIP --instance-id  $INSTANCE_ID

But now my server has an ipv4 and ipv6. And i cannot do the same for ipv6. Only ipv4.

How can i do the same for ipv6? Since there is no Elastic ipv6?

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 3.0

IPv6 addressing is different than IPv4 is usually managed. IPv6 is managed by subnet, not by individual address as in IPv4 today.

So in Amazon AWS, you need to first assign an IPv6 CIDR block to your VPC. Then you can assign individual IPv6 addresses to your instances. See Amazon's guides for getting started with IPv6 and understanding IP addressing.

By default your instances will obtain IPv6 addresses automatically. If you don't want this, you can assign a specific IPv6 address to it. But unlike IPv4, with IPv6 you assign addresses to the network interface of the instance, not to the instance.

Use aws ec2 assign-ipv6-addresses to assign IPv6 addresses to your instances' network interfaces.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-03-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。