We can no longer assign a public IP address to your instance
The auto-assign public IP address feature for this instance is disabled because you specified multiple network interfaces. Public IPs can only be assigned to instances with one network interface. To re-enable the auto-assign public IP address feature, please specify only the eth0 network interface.
ip
MAC=`curl http://169.254.169.254/latest/meta-data/mac`
curl http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC}/local-ipv4s
配置第二块网卡
ip a | grep ^[[:digit:]]
tee -a /etc/network/interfaces.d/50-cloud-init.cfg <<-'EOF'
auto eth1
iface eth1 inet dhcp
EOF
tee -a /etc/dhcp/dhclient-enter-hooks.d/restrict-default-gw <<-'EOF'
case ${interface} in
eth0)
;;
*)
unset new_routers
;;
esac
EOF
systemctl restart networking
访问互联网
必须分配并关联EIP