为什么会没有网络呢,网桥我也指定了…………
<domain type='kvm'> #类型
<name>openEulerVM</name> #虚拟机名称
<memory unit='GB'>12</memory> #虚拟机内存
<vcpu>4</vcpu> #CPU核心数
<iothreads>1</iothreads> #虚拟机IO线程数
<os>
<type arch='x86_64' machine='pc-i440fx-4.0'>hvm</type> #操作系统相关配置 类型为HVM 表示完全虚拟化
</os>
<features>
<acpi/> #定义虚拟机特性 包括ACPI
</features>
<cpu mode='host-passthrough' check='none'> #CPU配置,采用host-passthrough模式,表示将物理机的CPU功能全部给到虚拟机
<topology sockets='2' cores='2' threads='1'/>
</cpu>
<clock offset='utc'/> #定义虚拟机的时钟
<on_poweroff>destroy</on_poweroff> #定义虚拟机在不同状态下的行为,分别是关机、重启、崩溃时的处理方式
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices> #下面包括虚拟机的设备配置,磁盘、控制器、网络接口、串口、控制台、输入设备、视频设备
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' iothread='1'/>
<source file='/mnt/openEuler-20.03-LTS-SP3-x86_64.qcow2'/>
<target dev='vda' bus='virtio'/> #指定了虚拟机的磁盘设备名称为 vda
<boot order='1'/> #虚拟机的启动顺序为 1,表示优先从这个磁盘设备启动
</disk>
<controller type='scsi' index='0' model='virtio-scsi' />
<controller type='virtio-serial' index='0' />
<controller type='usb' index='0' model='ehci' />
<controller type='sata' index='0' />
<controller type='pci' index='0' model='pci-root'/>
<interface type='bridge'> #定义了一个网络接口,类型为 bridge,表示虚拟机连接到宿主机的桥接网络。
<source bridge='br0'/> #指定了虚拟机连接的桥接网络的名称为 virbr0。
<model type='virtio'/> #指定了虚拟网络接口的模型为 virtio
</interface>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb' />
<input type='keyboard' bus='usb' />
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<video>
<model type='vga' vram='16384' heads='1' primary='yes'/>
</video>
<memballoon model='virtio' />
<!-- 下面是添加的部分 -->
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
</source>
<alias name='hostdev0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
</hostdev>
</devices>
</domain>
这是我的虚拟机配置文件