[英]Cannot access RDS MySQL after assigning secondary private IP address to AWS EC2 instance
The instances are set up on a common VPC as follows: 实例是在通用VPC上设置的,如下所示:
The connection works fine when on the primary private IP address. 在主专用IP地址上时,连接工作正常。
After assigning a secondary private IP address to the EC2 instance, I perform the following: 在为EC2实例分配辅助私有IP地址后,我将执行以下操作:
Add the static IP to the /etc/network/interfaces.d/*.cfg
file: 将静态IP添加到
/etc/network/interfaces.d/*.cfg
文件:
Default file content: 默认文件内容:
auto lo iface lo inet loopback
auto eth0 iface eth0 inet dhcp
Add static IP address: 添加静态IP地址:
auto eth0:0 iface eth0:0 inet static address xx.xx.xx.xx
Run sudo ifup eth0:0
运行
sudo ifup eth0:0
After this, MySQL refuses the connection and returns this error message: 之后,MySQL拒绝连接并返回以下错误消息:
Cannot access the database: No route to host (DNS_OF_RDS)
无法访问数据库:没有到主机的路由(DNS_OF_RDS)
The connection is re-established when I run sudo ifdown eth0:0
. 当我运行
sudo ifdown eth0:0
时,连接重新建立。
What am I missing out on? 我错过了什么?
我可以通过在文件/etc/network/interfaces.d/*.cfg
末尾添加网络掩码地址( netmask 255.255.xx.xx
)来使其工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.