设置默认networking接口

我的/etc/network/interfaces如下所示:

 auto lo iface lo inet loopback auto eth1 iface eth1 inet static address 10.0.0.99 netmask 255.255.255.0 gateway 10.0.0.1 auto eth0 iface eth0 inet dhcp 

我重新启动机器后,我得到了

 vagrant@precise64:~$ ip route default via 10.0.2.2 dev eth0 default via 10.0.0.1 dev eth1 metric 100 10.0.0.0/24 dev eth1 proto kernel scope link src 10.0.0.99 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 

我如何修改/etc/network/interfaces使我的stream量默认通过10.0.0.1而不是10.0.2.2? 我可以手动如下,但我不想在每次重新启动时执行此操作:

 vagrant@precise64:~$ sudo ip route del default via 10.0.2.2 dev eth0 vagrant@precise64:~$ ip route default via 10.0.0.1 dev eth1 metric 100 10.0.0.0/24 dev eth1 proto kernel scope link src 10.0.0.99 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 

事实certificate,原因与/etc/network/interfaces无关。 这台机器是一个Vagrant虚拟机,默认情况下在/etc/rc.local有一些额外的东西:

 #!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Make sure eth0 is working. This works around Vagrant issue #391 dhclient eth0 exit 0 

注释dhclient eth0行并重新启动收益率:

 vagrant@precise64:~$ ip r default via 10.0.0.1 dev eth1 metric 100 10.0.0.0/24 dev eth1 proto kernel scope link src 10.0.0.99 10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15