ubuntu/xenial64 Vagrant box 的网络设置失败

tec*_*raf 15 networking vagrant 16.04

使用官方 Ubuntu 16.04 LTS (Xenial Xerus) Vagrant box 映像(在 VirtualBox 上)我在基本网络设置方面遇到问题:

我的Vagrantfile

Vagrant.configure(2) do |config|

  config.vm.box = 'ubuntu/xenial64'

  config.vm.define "xenial" do |server|
    server.vm.network "private_network", ip: "192.168.10.10"
  end
end
Run Code Online (Sandbox Code Playgroud)

vagrant up 结果:

==> xenial: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/sbin/ifdown eth1 2> /dev/null

Stdout from the command:



Stderr from the command:

sudo: unable to resolve host ubuntu-xenial
mesg: ttyname failed: Inappropriate ioctl for device
Run Code Online (Sandbox Code Playgroud)

将配置留给 DHCP 也不起作用:

server.vm.network "private_network", type: "dhcp"
Run Code Online (Sandbox Code Playgroud)

与此同时,上述配置工作,为ubuntu/trusty64ubuntu/wily64和非官方的gbarbieru/xenial

尝试该命令/sbin/ifdown eth1 2> /dev/null没有结果,因为界面具有不同的命名方案(主要是enp0s3)。

我在这里遗漏了什么明显的东西还是盒子刚刚坏了?

小智 15

这个问题似乎在 vagrant 的下一个版本中得到解决:https : //github.com/mitchellh/vagrant/issues/7155

我尝试了 Jeff Geerling https://twitter.com/geerlingguy/status/723571293174427648?lang=fr 的另一个盒子,它对我来说效果很好。Jeff 在 Vagrant/Ansible 上做了很多很棒的工作,所以我想这是下一个版本的 Vagrant 发布之前最好的解决方案