我有一个多vm迷走片文件设置与3 vms。两个vm的NAT网络接口被禁用,并且只在内部接口上使用静态ip。
副作用是我再也不能运行vagrant ssh foo来连接到vm了。
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#config.vm.box = "PuppetlabsCent64"
#config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box"
config.vm.box = "Debian-7-2"
config.vm.box_url= "https://dl.dropboxusercontent.com/u/197673519/debian-7.2.0.box"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network :private_network, ip: "192.168.45.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network :public_network
config.vm.synced_folder ".", "/vagrant_data"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
end
config.vm.define "r", primary: true do |router|
router.vm.box = "Debian-7-2"
router.vm.network :private_network, ip: "192.168.45.11"
end
config.vm.define "r1" do |roomate1|
roomate1.vm.box = "Debian-7-2"
roomate1.vm.network :private_network, ip: "192.168.45.12"
end
config.vm.define "r2" do |roomate2|
roomate2.vm.box = "Debian-7-2"
roomate2.vm.network :private_network, ip: "192.168.45.13"
end
config.vm.provider :virtualbox do |vb|
vb.customize "post-boot",["controlvm", :id, "setlinkstate1", "off"]
end
end我在没有运气的情况下试过下面的每一种
config.vm.define "r", primary: true do |router|
router.vm.box = "Debian-7-2"
router.vm.network :private_network, ip: "192.168.45.11"
#config.ssh.host "192.168.45.11"
#router.vm.network :forwarded_port, host: "192.168.45.11"
#router.vm.box_url = "192.168.45.11"
#router.vm.boot_timeout = 200
#router.vagrant.host = "192.168.45.11"
#router.ssh.host = "192.168.45.11"
end
#non working
sowen@pv-sowen-nb:~/Code/flatmate-firewall$ vagrant ssh-config r
Host r
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/sowen/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL运行vagrant up会在引导过程中部分挂起,导致我不得不等待300秒才能启动每个vm。
错误信息
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period. This can
mean a number of things.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.是否有一种方法将vagrant ssh配置为使用正确的ip和端口,使其不超时?
来源:https://github.com/spuder/flatmate-firewall/blob/master/Vagrantfile
发布于 2014-01-14 13:50:44
我可以在您的Vagrantfile文件中看到您的问题,但是我用两台机器向您展示了我的示例。
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
config.vm.define 'app' do |app_config|
app_config.vm.box = 'ubuntu_app'
app_config.vm.host_name = 'app'
app_config.vm.network "private_network", ip: "192.168.33.33"
end
config.vm.define 'web' do |web_config|
web_config.vm.box = 'ubuntu_app'
web_config.vm.host_name = 'web'
web_config.vm.network "private_network", ip: "192.168.33.34"
end
end然后,我用标准ssh对齐连接到"web“机器。
roberto@rcisla-pc:~/Desktop/vagrant$ ssh vagrant@web -p 22
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)
* Documentation: https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Sun Jan 12 13:18:18 2014 from 192.168.33.1
vagrant@web:~$等同于“应用程序机器”
roberto@rcisla-pc:~/Desktop/vagrant$ ssh vagrant@app -p 22
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)
* Documentation: https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Sun Jan 12 13:18:18 2014 from 192.168.33.1
vagrant@app:~$我希望这能帮上忙。
https://stackoverflow.com/questions/20941224
复制相似问题