Vagrant 没有设置私有网络接口

Vagrant 没有设置私有网络接口

我最近在 Ubuntu 12.04 主机上升级到了 Vagrant 1.7.4。我有一个开发虚拟机,过去一年来我每天都在运行它。升级后,vagrant 不再为 Vagrant 文件中定义的私有网络创建网络接口。

我的 Vagrantfile 如下所示:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "devbox-4"

  config.vm.network :forwarded_port, guest: 11211, host: 11211
  config.vm.network :forwarded_port, guest: 5672, host: 5672
  config.vm.network :forwarded_port, guest: 5432, host: 5432

  config.vm.network :private_network, ip: "192.168.255.10"

end

虚拟机内部运行 ifconfig 输出以下内容

eth0      Link encap:Ethernet  HWaddr 08:00:27:83:e7:ad  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe83:e7ad/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:26887 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26397 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1655137 (1.6 MB)  TX bytes:1481978 (1.4 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:14275 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14275 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4278264 (4.2 MB)  TX bytes:4278264 (4.2 MB)

正如您所见,定义的私有网络并不存在。

据我所知,指定网络接口的方式在 Vagrant 1.7.4 中没有改变,所以我遗漏了什么?

我对所涉及的各种程序的版本如下:

Host OS: Ubuntu 12.04
Vagrant: 1.7.4
Virtualbox: 4.2.20
Guest OS: Ubuntu 12.04

此外,当我启动虚拟机时,我在输出中看到以下几行:

default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...

在启动过程继续之前,重试行大约会显示十几次。它以以下内容结尾:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/sbin/ip addr flush dev eth1 2> /dev/null

Stdout from the command:

Stderr from the command:

但是然后我可以使用 vagrant ssh 顺利地 ssh 到 VM。

相关内容