Private Network vs Hostonly / Vagrant 1.2.7 / Ubuntu 12.04

142 views
Skip to first unread message

monosij...@gmail.com

unread,
Sep 6, 2013, 6:29:33 PM9/6/13
to vagra...@googlegroups.com

Hello -

I am trying to setup a VM to be able to reach from Host - using api version 2.
I am using Salt for provisioning.

I tried the configuration as follows:

...
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "precise64"


  config.vm.define :dbms do |dbms|
      dbms.vm.network :private_network, ip: "172.16.1.09"
      dbms.vm.hostname = "dbms"
      config.vm.provision :salt do |salt|
        salt.minion_config = "provision/saltstack/minion"
        salt.run_highstate = true
      end
  end
...

However I cannot reach the VM from host with a ping 172.16.1.09. I tried ping from directory Vagrantfile is in.
Then I tried: dbms.vm.network :hostonly, "172.16.1.09"
This given an error.

It seems from documentation hostonly should work. Just wondering what I may be doing wrong?

Also, I want to be able to ssh into this host VM from any directory, not just where Vagrantfile is in. 
WIl that be possible?

...
And eventually I would ideally like to run as public network.

Vagrant.configure("2") do |config|
  config.vm.network "public_network"
end

I would like to be able to assign it an IP and be able to always access it by that IP. My network router assigns IP by MAC addresses I have set up. 
Will something like that be possible in this configuration so I can get a specific IP?

Meaning I would like to have this DBMS box always have a certain IP so I can access it from another machine on the network. I would prefer not to use port forwarding if I can.

Look forward to your help.

Thank you.

CB

unread,
Sep 7, 2013, 2:51:32 PM9/7/13
to vagra...@googlegroups.com

You can use an SSH tool like PuTTY to connect to the VM.

monosij...@gmail.com

unread,
Sep 7, 2013, 6:53:27 PM9/7/13
to vagra...@googlegroups.com
Hi CB - I am running Ubuntu and I can't ssh into it from any directory. I can only 'vagrant ssh' into it where Vagrantfile is located.

From other directory I tried 'ssh -p 2222 localhost' where 2222 is the port Vagrant forwards ssh into. But it asks for a password there and I tried my host password and even blank to no luck.

Then I ran 'vagrant ssh <ip-addr>' of the box from another directory and got this:
A Vagrant environment is required to run this command. Run `vagrant init` to set one up in this directory, or change to a directory with a Vagrantfile and try again.

And like I said pin <ip-addr> - as set in private network does not work either.

I am trying to see how I can ssh into it from any directory on my host.

Thanks.
Reply all
Reply to author
Forward
0 new messages