title: Vagrant - how to configure vagrant ssh when using private interfaces?
body: <p>I have a multivm vagrantfile setup with 3 vms. 
  Two of the vm's have their NAT network interface disabled, and solely use a static ip on an internal interface.  </p>
  
  <p>The side effect is that I am no longer able to run <code>vagrant ssh foo</code> to connect to the vm's. </p>
  
  <pre><code># -*- 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
  </code></pre>
  
  <p><a href="https://groups.google.com/forum/#!topic/vagrant-up/HwqFegoCXOc" rel="nofollow">This thread</a> in the vagrant user group, gave me the idea to check the <a href="https://github.com/mitchellh/vagrant/blob/master/config/default.rb" rel="nofollow">default vagrant config</a>.</p>
  
  <p>I've tried each of the following with no luck</p>
  
  <pre><code> 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
  </code></pre>
  
  <p>Running <code>vagrant up</code> hangs part way through the boot process, causing me to have to wait 300 seconds for each vm to boot. </p>
  
  <p>The error message  </p>
  
  <pre><code>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.
  </code></pre>
  
  <p>Is there a way to configure <code>vagrant ssh</code> to use the correct ip &amp; port so that it doesn't time out? </p>
  
  <p>Source : <a href="https://github.com/spuder/flatmate-firewall/blob/master/Vagrantfile" rel="nofollow">https://github.com/spuder/flatmate-firewall/blob/master/Vagrantfile</a></p>