![Vagrant ifup eth1 失败(重复接口)](https://linux22.com/image/593564/Vagrant%20ifup%20eth1%20%E5%A4%B1%E8%B4%A5%EF%BC%88%E9%87%8D%E5%A4%8D%E6%8E%A5%E5%8F%A3%EF%BC%89.png)
我正在尝试从 VirtualBox 机器构建一个 vagrant box。当我给出时vagrant up
,我收到一条错误消息
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifup eth1
如果我尝试手动运行该命令,我会得到
/etc/network/interfaces:17: duplicate interface
ifup: couldn't read interfaces file "/etc/network/interfaces"
vagrantfile中与网络相关的部分是
config.vm.network :hostonly, "192.168.56.11"
(如果我禁用此线路并仅使用 NAT 接口,一切就可以正常工作,但我希望同时使用 NAT 和仅主机网络连接)
的内容/etc/network/interfaces
是
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug eth1
iface eth1 inet dhcp
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto eth1
iface eth1 inet static
address 192.168.56.11
netmask 255.255.255.0
#VAGRANT-END
我尝试在打包机器之前注释掉iface eth1 inet dhcp
,但是没有任何效果(该行在 vagrant box 上没有被注释掉)。
答案1
看看这个:
https://github.com/mitchellh/vagrant/issues/997
删除 /etc/udev/rules.d/70-persistent-net.rules 中除 eth0 之外的条目
并删除 /etc/sysconfig/network/ 中除 eth0 ifcfg-eth 文件之外的所有文件
对我有用。
在 ubuntu 12.1 上运行 virtualbox,vbox 上装有 suse 11 操作系统