错误 RTNETLINK 回答:文件存在

Chr*_*ong 18 virtualbox networking

在 12.04 上,使用两个适配器在 VirtualBox 中作为来宾运行,我收到此错误以响应 ifup eth1

RTNETLINK answers: File exists
Failed to bring up eth1
Run Code Online (Sandbox Code Playgroud)

这是内容 /etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# Host-only interface
auto eth1
iface eth1 inet static
        address         192.168.56.20
        netmask         255.255.255.0
        network         192.168.56.0
        broadcast       192.168.56.255
        gateway         192.168.56.1

# NAT interface
auto eth2
iface eth2 inet dhcp
Run Code Online (Sandbox Code Playgroud)

有关我为何以这种方式配置它的更多信息,请参阅此问题。
在VirtualBox中,如何设置可以上网的host-only虚拟机?

Chr*_*ong 22

问题是设置了两个默认网关,一个是静态的,一个是 dhcp 的。您不能有两个具有相同指标的默认网关。

https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1043244/comments/8

解决方法:从配置中去掉网关线eth1

或者,向 中添加显式metric 100eth1,以赋予eth1网关比eth2网关更低的优先级。