When you create a virtual machine with vagrant on a KVM server, you cannot change the network settings.
The desired environment is to access guests created with vagrant from an external server.
I would like to make it public_network.
My environment is as follows.
Host (KVM server): CentOS Linux release 7.0.1406 (Core)
Guest:CentOS 7
vagrant:2.0.1 version
Network device (id must have vlanid)
Device Type State Connections
brens1f1.id bridge Connected bridge-brens1f1.id
virbr0bridge Connected virbr0
virbr1bridge Connected virbr1
ens1f0ethernet-connected ens1f0
ens1f1.id vlan Connected vlan-ens1f1.id
brctl show
bridge name bridge id STP enabled interfaces
brens1f1.id8000.a44c11deabe5no ens1f1.id
virbr0 8000.52540018f0be yes virbr0-nic
virbr18000.5254005c1399 yes virbr1-nic
#-*-mode:ruby-*-
# vi:set ft=ruby:
Vagrant.configure("2") do | config |
config.vm.box="centos/7"
config.vm.network "public_network"
end
vagrant up --provider=libvirt
Bringing machine 'default' up with 'libvirt' provider...
/root/.vagrant.d/gems/2.4.2/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/document.rb:44:warning:constant::Fixnum is degraded
/root/.vagrant.d/gems/2.4.2/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/document.rb:44:warning:constant::Fixnum is degraded
==>default: Creating image (snapshot of base box volume).
==>default: Creating domain with the following settings...
==>default:--Name:vagrant_default
==>default:--Domain type:kvm
==>default:--Cpus:1
==>default: -- Feature: acpi
== > default: -- Feature: apic
==>default: -- Feature:pae
==>default:--Memory:512M
==>default: -- Management MAC:
==>default: -- Loader:
==>default:--Basebox:centos/7
==>default:--Storage pool:default
==>default: -- Image: /var/lib/libvirt/images/vagrant_default.img (41G)
== > default: -- Volume Cache: default
==>default:--Kernel:
==>default:--Initrd:
==>default:--Graphics Type: vnc
==>default: -- Graphics Port:5900
==>default:--Graphics IP: 127.0.0.1
==>default:--Graphics Password: Not defined
==>default:--Video Type:cirrus
==>default:--Video VRAM:9216
==>default: -- Sound Type:
== > default: -- Keymap: en-us
==>default:--TPM Path:
==>default: -- INPUT: type = mouse, bus = ps2
==>default: Creating shared folders metadata...
/root/.vagrant.d/gems/2.4.2/gems/nokogiri-1.6.8.1/lib/nokogiri/xml/document.rb:44:warning:constant::Fixnum is degraded
==>default: Starting domain.
There was an error talking to Libvirt.The error message is down
below:
Call to virDomainCreateWithFlags failed: Unable to get index for interface eth0: No such device exists
Thank you for your cooperation.
centos vagrant network
In my environment,
config.vm.network "public_network",:dev=>'br0',:type=>'bridge'
It worked well when I had done so.I think it depends on the box.
© 2024 OneMinuteCode. All rights reserved.