Networking error when starting vagrant machine.

706 views
Skip to first unread message

jiminfote...@gmail.com

unread,
Jul 18, 2016, 8:11:27 AM7/18/16
to Vagrant
Hello Folks,

I ran into the following error when I execute "vagrant up" command.

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 so that it no longer matches that of
a bridged or non-hostonly network.

Vagrant file:
Vagrant.configure("2") do |o|
o.vm.box="centos/7"
o.vm.network "private_network", ip: "192.168.1.13"
o.vm.provision "shell", :path=>"setup.sh"
end

setup.sh:
sudo yum -y update
sudo yum -y install vim,git,gedit,nmap
sudo systemctl restart httpd

Nothing is started but I see a machine in Virtual box and I double click and I start as usual. Could assign static IP but no network to outside world. Not sure where the things are going wrong.

Any help would be very much appreciated.

Thanks
Jim

Alvaro Miranda Aguilera

unread,
Jul 18, 2016, 2:38:17 PM7/18/16
to vagra...@googlegroups.com
Hello,

the message is telling you that ip network can be used for private network because there is a network that already exists.

you can use a different network, or try wirth public if what you want is the vm to connect to 192.168.1.x

Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/4bf32117-cc9d-4386-89db-6ab202d73ce8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jiminfote...@gmail.com

unread,
Jul 19, 2016, 11:59:18 AM7/19/16
to Vagrant
Hi Alvaro,

It works with public_network but I don't have access to internet as I see two active interfaces eth0 and eth1. Can we make it working with only one interface ? How to do that?

Cheers
Jim

P.S: Not at all happy with "Vagrant" product. No offence..............

Alvaro Miranda Aguilera

unread,
Jul 19, 2016, 4:07:40 PM7/19/16
to vagra...@googlegroups.com
Hello,

Vagrant does one job and does it very nice. Time by time people want to make vagrant what they would like to do, instead of learning a bit of Vagrant, and that create fustration.

1. Vagrant always will use eth0 for local host/vm communication, and over this network you can use the forwarder ports, and the VM will have access to the network using nat.

2. When you add a private network, you can use this IP (fixed or dhcp) to ssh into the VM, VM->Host, or in a multi machine setup to VM->VM

3. When you use public network, you will get an IP from your home/office network, and by default, its documented, Vagrant wont override the default GW. So if you need to do this, there is an example script in the documentation on how to do this.

IF you could share what you want to do, how your Vagrantfile looks like, there is a lot of people that can have a look and share ideas with you.

Thanks
Alvaro.

jiminfote...@gmail.com

unread,
Jul 20, 2016, 11:30:06 AM7/20/16
to Vagrant
Hi Alvaro,

I have invested days in learning vagrant but somehow not yet in comfort zone. What I find interesting is that I did "vagrant destroy" and then did "vagrant up" and everything seems to be working fine even thought loop back, eth0 and eth1 are all UP.

My Vagrantfile contents was in my original post., anyway posting it again:

Vagrant.configure("2") do |o|
o.vm.box="centos/7"
o.vm.network "public_network", ip: "192.168.1.13"

o.vm.provision "shell", :path=>"setup.sh"
end

setup.sh contents:
sudo su - root
yum -y update
yum -y install vim git gedit nmap
yum -y install httpd
systemctl restart httpd

Not sure why vagrant is not able to install packages??

vagrant up log output is below, I don't think I anything wrong with my Vagrantfile or setup file.
Output of vagrant up:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'centos/7' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
[default] GuestAdditions versions on your host (5.0.26) and guest (5.0.14) do not match.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.colocity.com
 * extras: centos.mirror.crucial.com.au
 * updates: centos.mirror.crucial.com.au
Package kernel-devel-3.10.0-327.22.2.el7.x86_64 already installed and latest version
Package gcc-4.8.5-4.el7.x86_64 already installed and latest version
Package binutils-2.23.52.0.1-55.el7.x86_64 already installed and latest version
Package 1:make-3.82-21.el7.x86_64 already installed and latest version
Package 4:perl-5.16.3-286.el7.x86_64 already installed and latest version
Package bzip2-1.0.6-13.el7.x86_64 already installed and latest version
Nothing to do
Copy iso file C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.0.14 - guest version is 5.0.14
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.14 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.14 of VirtualBox Guest Additions...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module[  OK  ]
Building the shared folder support module[  OK  ]
Building the OpenGL support module[  OK  ]
Doing non-kernel setup of the Guest Additions[  OK  ]
You should restart your guest to make sure the new modules are actually used

Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 5.0.14. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /home/vagrant/sync => C:/Users/ameya_000/VirtualBox VMs/test2
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

P.S: I realized why I have two interfaces as there is two adapters ! My mistake for sure.

Would wait to hear from learned people why package installation is not working.

Regards,
Jim

Alvaro Miranda Aguilera

unread,
Jul 20, 2016, 5:36:44 PM7/20/16
to vagra...@googlegroups.com
Hello the script is not correct.

ITs ok as a series of command that someone need to type, but as soon as sudo su - happens the script should wait for ever, or exit and continue, not sure. But you can skip that line and all the sudo.

Vagrant will run the commands as root (by sudo), so your script should be like this,

setup.sh:

yum -y install vim git gedit nmap
systemctl restart httpd

Do not run yum upgrade, since that will upgrade the kernel and that will cause issues with virtualnbox and other modules.

Options:
a. Create a new base box that is fully updated (fit for use)
b. Update what you require and expclude kernel, ie. yum upgrade -y --exclude kernel*


Thanks
Alvaro

jiminfote...@gmail.com

unread,
Jul 20, 2016, 9:05:30 PM7/20/16
to Vagrant
Hi Alvaro,

Still it doesn't do any installation. I think the two adapters are because of 1. default public network and 2 because I want private network with static IP.

Output from vagrant up is below.
Content of setup.sh
yum -y upgrade  --exclude kernel*

yum -y install vim git gedit nmap
yum -y install httpd
systemctl restart httpd

Alvaro Miranda Aguilera

unread,
Jul 21, 2016, 3:27:52 PM7/21/16
to vagra...@googlegroups.com
hello,

the message is telling you that the box was already provisiones, so it wont run the commands again,

you can run vagrant provision, or vagrant up --provision, or just destroy and create a new one.

In that way you will be forcing a new provision.

Thanks
Alvaro.

jiminfote...@gmail.com

unread,
Jul 21, 2016, 9:45:28 PM7/21/16
to Vagrant
Beauty !! Works like a treat !!

Many thanks Alvaro

Cheers,
Jim

Jim Jim

unread,
Jul 21, 2016, 10:33:04 PM7/21/16
to vagra...@googlegroups.com
Hi Alvaro,

It seems my happiness was for only short while.

I delete the machine by vagrant destroy, deleted the folder and recreated another folder, placed the previous Vagrantfile and now having like here:
https://github.com/mitchellh/vagrant/issues/7610

It's not fixed in Vagrant 1.8.5 I had to chmod into VM and then its working fine.

Cheers,
Jim

You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/z_gBwPdSV5c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/33b17ca9-7720-460d-8ac3-8fb3e3d1b99a%40googlegroups.com.

Alvaro Miranda Aguilera

unread,
Jul 21, 2016, 10:57:01 PM7/21/16
to vagra...@googlegroups.com
thats more related to the guest.

add config.ssh.insert_key=false and try again from vagrant destroy as time permits.

Alvaro.

Reply all
Reply to author
Forward
0 new messages