I’m unable to set the IP for a VM using the standard centos/7 box. I’m following the instructions at Public Networks - Networking | Vagrant by HashiCorp and my Vagrant version is 2.2.19.
If I add:
config.vm.network "public_network", ip: "192.168.0.33"
to Vagrantfile, then if I run vagrant up, the result is:
...
11: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/builtin/synced_folders.rb:87:in `call'
10: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
9: from /root/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.9.0/lib/vagrant-libvirt/action/prepare_nfs_settings.rb:21:in `call'
8: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
7: from /root/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.9.0/lib/vagrant-libvirt/action/share_folders.rb:22:in `call'
6: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
5: from /root/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.9.0/lib/vagrant-libvirt/action/set_boot_order.rb:80:in `call'
4: from /opt/vagrant/embedded/gems/2.2.19/gems/vagrant-2.2.19/lib/vagrant/action/warden.rb:48:in `call'
3: from /root/.vagrant.d/gems/2.7.6/gems/vagrant-libvirt-0.9.0/lib/vagrant-libvirt/action/start_domain.rb:439:in `call'
2: from /root/.vagrant.d/gems/2.7.6/gems/fog-libvirt-0.9.0/lib/fog/libvirt/models/compute/server.rb:76:in `start'
1: from /root/.vagrant.d/gems/2.7.6/gems/fog-libvirt-0.9.0/lib/fog/libvirt/requests/compute/vm_action.rb:7:in `vm_action'
/root/.vagrant.d/gems/2.7.6/gems/fog-libvirt-0.9.0/lib/fog/libvirt/requests/compute/vm_action.rb:7:in `create': Call to virDomainCreateWithFlags failed: Unable to get index for interface eth0: No such device (Libvirt::Error)
If I allow the machine to come up with DHCP, then eth0 is used. But using DHCP is not an option for me.