Vagrant up:重启网络(通过systemctl):[FAILED]

时间:2017-07-10 19:00:44

标签: networking vagrant

我的Vagrant文​​件中有以下配置。

Vagrant.configure("2") do |config|
  config.ssh.insert_key = true
  config.vm.box = "boxcutter/centos73"
  config.vm.network :forwarded_port, host: 8000, guest: 8000
  config.vm.network "private_network", ip: "192.168.56.1"
end

这会在vagrant up

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

# Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown 'eth1'
# Move new config into place
mv -f '/tmp/vagrant-network-entry-eth1-1499713004-0' '/etc/sysconfig/network-scripts/ifcfg-eth1'
# attempt to force network manager to reload configurations
nmcli c reload || true

# Restart network
service network restart


Stdout from the command:

Restarting network (via systemctl):  [FAILED]


Stderr from the command:

usage: ifdown <configuration>
Job for network.service failed because the control process exited with error 
code. See "systemctl status network.service" and "journalctl -xe" for 
details.

当我将网络线路切换到config.vm.network "public_network"时,它运行正常,为什么会这样?

1 个答案:

答案 0 :(得分:0)

  • 我希望这会有所帮助... 后 $ vagrant up命令 确保无所事事的VM处于打开状态,而不考虑错误消息。

  • 首先在主机上: $ vagrant ssh

  • 内部游民: $ sudo apt-get install ifupdown

  • 然后: $ sudo ifup eth1

  • 最后从无业游民退出,然后在主机上再次执行$ vagrant up

对我有用!