![KVM 上的 vhost_net 和 virtio](https://linux22.com/image/1383100/KVM%20%E4%B8%8A%E7%9A%84%20vhost_net%20%E5%92%8C%20virtio.png)
通过谷歌搜索,我了解到如果“vhost”设置为“ON”,那么我正在使用 virtio。因为当我尝试在 XML 文件中用“vhost_net”替换“virtio”时,出现了错误。
/usr/libexec/qemu-kvm -name rh6_4vm8 -S -machine rhel6.4.0,accel=kvm -m 2048 -smp 2,sockets=2,cores=1,threads=1 -uuid 23a35883-6510-6857-86d2-8106e99efb98 -nographic -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/rh6_4vm8.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=utc -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive文件=/home/storage/local/images/rh6_4vm8.qcow2,如果=无,id=drive-virtio-disk0,格式=原始,缓存=无 -device virtio-blk-pci,scsi=off,总线=pci.0,地址=0x3,驱动器=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,格式=原始 -device ide-drive,总线=ide.1,单元=0,驱动器=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=19,id=hostnet0,vhost=on,vhostfd=27 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:13:15:a7,总线=pci.0,地址=0x5 -netdev tap,fd=28,id=hostnet1,vhost=on,vhostfd=29 -device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:57:1b:42,总线=pci.0,地址=0x6 -netdev tap,fd=30,id=hostnet2,vhost=on,vhostfd=31 -device virtio-net-pci,netdev=hostnet2,id=net2,mac=52:54:00:d0:1d:e7,总线=pci.0,地址=0x7 -netdev tap,fd=32,id=hostnet3,vhost=on,vhostfd=33 -device virtio-net-pci,netdev=hostnet3,id=net3,mac=52:54:00:83:e8:ea,总线=pci.0,addr=0x8 -netdev tap,fd=34,id=hostnet4,vhost=on,vhostfd=35 -device virtio-net-pci,netdev=hostnet4,id=net4,mac=52:54:00:09:58:67,总线=pci.0,addr=0x9 -netdev tap,fd=36,id=hostnet5,vhost=on,vhostfd=37 -device virtio-net-pci,netdev=hostnet5,id=net5,mac=52:54:00:86:7b:30,总线=pci.0,地址=0xa -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -device virtio-balloon-pci,id=balloon0,总线=pci.0,地址=0x4
所以我的问题是。我现在正在使用 vhost_net 吗?如果没有,我该如何将 vnic 设置为 vhost_net ?
答案1
vhost=on
-netdev 表示您正在使用 vhost_net。