【问题标题】:vagrant up command giving error and eth1 not showing a resolvable ip addressvagrant up 命令给出错误并且 eth1 没有显示可解析的 IP 地址
【发布时间】:2016-09-16 08:53:06
【问题描述】:

我是 VM 新手,但一直在使用 vagrant 在 Ubuntu 14.04 上运行 Centos VM。突然vagrant up 命令给出了这个错误:

root@shanky:~/centos# vagrant  up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'chef/centos-6.5' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) eth0
2) wlan0
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
    default: Which interface should the network bridge to? 1
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 80 => 5444 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

ARPCHECK=no /sbin/ifup eth1 2> /dev/null

Stdout from the command:


Determining IP information for eth1...PING 10.1.34.1 (10.1.34.1) from 10.1.34.183 eth1: 56(84) bytes of data.

--- 10.1.34.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2999ms
pipe 3
PING 10.2.56.1 (10.2.56.1) from 10.2.56.156 eth1: 56(84) bytes of data.

--- 10.2.56.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3000ms
pipe 3
 failed.
Stderr from the command:

我可以 vagrant ssh 到 VM,但 eth1 不再提供可解析的 ip(即它不提供 inet addr 参数。如何解决这个问题?

附: https://unix.stackexchange.com/questions/188413/not-able-to-resolve-ip-address-for-eth1-in-vagrant-vm

我已尝试按照上面链接中的建议对 eth1 进行一些修补,但无济于事。 PLZ帮忙。 谢谢。

【问题讨论】:

    标签: ip vagrant ethernet


    【解决方案1】:

    原来eth2是把Virtual-box直接连接到外网的适配器,所以注释掉

    config.vm.network :public_network
    

    从 VagrantFile 停止加载公共网络接口,从而解决了问题。

    【讨论】:

      【解决方案2】:

      这似乎与启动网络配置有关。

      虽然它无法启动网络接口,但您应该可以通过 ssh 进入该框。要删除持久网络接口,请在 vagrant box 文件夹中执行以下命令。

      vagrant ssh
      sudo rm /etc/udev/rules.d/70-persistent-net.rules
      exit
      vagrant reload
      

      来源:https://github.com/mitchellh/vagrant/issues/921#issuecomment-15789964

      【讨论】:

      • 我的config.vm.network :public_network 行已被注释掉;这个答案对我有用。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-09
      • 1970-01-01
      • 2017-12-13
      • 1970-01-01
      • 2018-03-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多