一、安装亚马逊网络接口库ec2-net-utils
sudo add-apt-repository ppa:expert360/ppa
sudo apt-get update
sudo apt-get install ec2-net-utils
二、配制eth1网口
sudo env INTERFACE=eth1 ACTION=@H_502_13@add /etc/network/ec2net.hotplug @H_502_13@add
添加两个文件eth1.cfg和dhclient-eth1.conf文件
cat /etc/network/interfaces.d/eth1.cfg
auto eth1
iface eth1 inet dhcp
post-up ip route add default via 172.31.0.1 dev eth1 table 10001
post-up ip route add default via 172.31.0.1 dev eth1 metric 10001
cat /etc/dhcp/dhclient-eth1.conf
supersede dhcp-server-identifier 255.255.255.255;
三、启动eth1
sudo ifup eth1
四、添加私有ip地址
sudo ip addr add 172.x.x.x/20 dev eth0
sudo ifdown eth0
sudo ifup eth0