KVM: starting the ‘default’ network

本文解决了KVM环境下启动虚拟机时遇到的网络错误问题,包括“Network 'default' is not active”及dnsmasq启动失败等。通过分析日志和查阅资料,找到了合适的配置方法来规避这一冲突。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最初的错误:


Error starting domain: internal error Network 'default' is not active.


这个一看就是 kvm自己建的网络没了,ifconfig 后果然没了virbr0

然后尝试 virsh net-start default,又得到dnsmasq的错误:


error: Failed to start network default
error: internal error Child process (dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file= --except-interface lo --listen-address 192.168.122.1 --dhcp-range 192.168.122.2,192.168.122.254 --dhcp-lease-max=253 --dhcp-no-override) exited with status 2.


去syslog 看下仔细的日志 vi /var/log/sys


Aug 28 19:27:16 ezzze dnsmasq[4357]: failed to create listening socket for 192.168.122.1: Address already in use
Aug 28 19:27:16 ezzze dnsmasq[4357]: FAILED to start up


google了下 发现你要是单独安装dnsmasq和libvirt就会出现这个鸟问题....

具体的扯皮在https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/231060

两边的人都不愿意改....但是提供了解决方案:


Following advice in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=505522
We could for example have:

/etc/dnsmasq.d/libvirt
bind-interfaces
except-interface=<virtual bridge>

and libvirt would start its dnsmasq using --interface=<virtual-bridge>



顺便这个bug的状态一直是in-progress..........
[root@localhost initramfs]# sudo virt-install --name rhel-vm --ram=2048 --vcpus=2 --disk path=/shared_storage/rhel-vm.qcow2,size=20,format=qcow2 --os-type linux --os-variant=debian10 --network bridge=virbr0 --graphics none --console pty,target_type=serial --cdrom /root/iso/velinux-1.4-hwe-amd64-DVD-1.iso WARNING KVM acceleration not available, using 'qemu' WARNING /root/iso/velinux-1.4-hwe-amd64-DVD-1.iso may not be accessible by the hypervisor. You will need to grant the 'qemu' user search permissions for the following directories: ['/root'] WARNING /root/iso/velinux-1.4-hwe-amd64-DVD-1.iso may not be accessible by the hypervisor. You will need to grant the 'qemu' user search permissions for the following directories: ['/root'] WARNING CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location. See the man page for examples of using --location with CDROM media Starting install... ERROR internal error: process exited while connecting to monitor: 2025-03-15T05:34:39.246728Z qemu-kvm: -blockdev {"driver":"file","filename":"/root/iso/velinux-1.4-hwe-amd64-DVD-1.iso","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}: Could not open '/root/iso/velinux-1.4-hwe-amd64-DVD-1.iso': Permission denied Domain installation does not appear to have been successful. If it was, you can restart your domain by running: virsh --connect qemu:///system start rhel-vm otherwise, please restart your installation. 怎么解决?
最新发布
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值