我使用Vagrant来定义具有静态IP地址的Fedora机器。
Vagrant.configure("2") do |config|
config.vm.network :public_network, :bridge => 'enp0s25', :dev => 'enp0s25'
config.vm.network "private_network", ip: "192.168.122.1"
config.vm.provision "shell", inline: "ifconfig"
config.vm.define "fedora1" do |fedora1|
fedora1.vm.box = "fedora/23-cloud-base"
end
end
问题是,如果我尝试配置VM,则会引发错误:
调用virDomainCreateWithFlags失败:无法获取索引 interface eth0:没有这样的设备
事实上,我的Fedora 21上没有eth0但是
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.71.85 netmask 255.255.255.0 broadcast 10.1.71.255
inet6 fe80::6af7:28ff:fef3:b97d prefixlen 64 scopeid 0x20<link>
ether 68:f7:28:f3:b9:7d txqueuelen 1000 (Ethernet)
RX packets 1753807 bytes 1271298509 (1.1 GiB)
RX errors 0 dropped 26 overruns 0 frame 0
TX packets 771439 bytes 73736761 (70.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 20 memory 0xe1200000-e1220000
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 1450325 bytes 565140300 (538.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1450325 bytes 565140300 (538.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:5f:e6:70 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.121.1 netmask 255.255.255.0 broadcast 192.168.121.255
ether 52:54:00:fe:98:b5 txqueuelen 0 (Ethernet)
RX packets 3673 bytes 403458 (394.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2367 bytes 381415 (372.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
添加行:
config.vm.network:public_network,:bridge =&gt; &#39; enp0s25&#39;,:dev =&gt; &#39; enp0s25&#39;
没有产生任何影响。有没有解决方案(除了恢复旧的eth0接口)?
答案 0 :(得分:1)
我今天遇到了同样的问题,解决方案就像在对Vagrantfile进行修改后摧毁流浪机一样简单。 vagrant destroy fedora1 && vim Vagrantfile && vagrant up fedora1 --provider libvirt
$ vagrant plugin list
fog-libvirt (0.0.3)
- Version Constraint: 0.0.3
vagrant-libvirt (0.0.32)
$ vagrant version
Installed Version: 1.6.5
希望对你有所帮助。