Assign ip address to my vm

2,835 views
Skip to first unread message

Akshay

unread,
Sep 9, 2013, 3:39:44 PM9/9/13
to vagra...@googlegroups.com
Hi,

I am trying to assign static ip to my vm machine like this:

machine_ip="192.168.1.2"
config.vm.network :private_network, ip: "#{machine_ip}"

Somehow vagrant does not seem to like this replacement and show the following error:
[Machine1] Setting the name of the VM...
[Machine1] Clearing any previously set forwarded ports...
[Machine1] Creating shared folders metadata...
[Machine1] Clearing any previously set network interfaces...
The specified host network collides with a non-hostonly network!
This will cause your specified IP to be inaccessible. Please change
the IP or name of your host only network to not match that of
a bridged or non-hostonly network.

Any suggestions ??

Thanks
Akshay

Mark Kremer

unread,
Sep 12, 2013, 1:20:43 PM9/12/13
to vagra...@googlegroups.com
It looks like you are trying to assign a private network (that only
exists within your're computer) that is clashing with the address space
of a real network
> --
> You received this message because you are subscribed to the Google
> Groups "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to vagrant-up+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

bala

unread,
Sep 22, 2013, 6:43:23 AM9/22/13
to vagra...@googlegroups.com
You realize this will create a second network connection on the guest, and not set the ipaddr of the primary eth0 network which must be NAT.  If you're trying to create a private network for multiple VMs to communicate with each other just choose an unused network  - I use 10.10.10.x for mine.

If on the other hand you want external machines to access services running on your VM, your best bet is to map ports from your host to the guest like this:

  # access for mysql  on guest
  config.vm.network :forwarded_port, guest: 3306, host: 3306

Reply all
Reply to author
Forward
0 new messages