How to launch QEMU from command line without libvirt with macvtap and vhost support
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了How to launch QEMU from command line without libvirt with macvtap and vhost support,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2189字,纯文字阅读大概需要4分钟。
内容图文
How to launch QEMU from command line without libvirt with macvtap and vhost support
This sets up a host local bridge with a macvlan interface for VM to host communication. The macvtap is setup with vhost support.
The command line options to note are
-netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>$"$tapdev" 4<>/dev/vhost-net -device virtio-net-pci,netdev=hostnet0,id=net0,mac=$(< /sys/class/net/testtap/address)
This sets up two different fd‘s. The first for macvtap and the second for vhost-net.
ip link del testbr
ip link del testvlan
ip link del testtap
ip link add name testbr type bridge
ip link add link testbr name testvlan type macvlan mode bridge
ip addr add 172.20.0.1/16 dev testvlan
ip link set dev testvlan up
ip link set dev testbr up
ip link add link testbr name testtap type macvtap mode bridge
ip link set testtap up
tapindex=$(< /sys/class/net/testtap/ifindex)
tapdev=/dev/tap"$tapindex"
echo "Tap Index :=" $tapindex
echo "Tap Dev :=" $tapdev
echo "Mac Address :="
cat /sys/class/net/testtap/address
../x86_64-softmmu/qemu-system-x86_64 -trace events=/tmp/events \
-machine pc-lite,accel=kvm,kernel_irqchip,nvdimm -cpu host -m 256,maxmem=1G,slots=2 -smp 2 -no-user-config -nodefaults -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard\
-kernel ./vmlinux-4.9.34-63.1.container -append "reboot=k panic=1 rw tsc=reliable no_timer_check noreplace-smp root=/dev/pmem0p1 \
init=/usr/lib/systemd/systemd initcall_debug rootfstype=ext4 rootflags=dax,data=ordered dhcp rcupdate.rcu_expedited=1 clocksource=kvm-clock console=hvc0 single iommu=false quiet" \
-device virtio-serial-pci,id=virtio-serial0 -chardev pty,id=charconsole0 -device virtconsole,chardev=charconsole0,id=console0 -nographic \
-object memory-backend-file,id=mem0,share,mem-path=./clear-16160-containers.img,size=235929600 -device nvdimm,memdev=mem0,id=nv0 -no-reboot
-netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>$"$tapdev" 4<>/dev/vhost-net -device virtio-net-pci,netdev=hostnet0,id=net0,mac=$(< /sys/class/net/testtap/address)
原文:https://www.cnblogs.com/dream397/p/13962231.html
内容总结
以上是互联网集市为您收集整理的How to launch QEMU from command line without libvirt with macvtap and vhost support全部内容,希望文章能够帮你解决How to launch QEMU from command line without libvirt with macvtap and vhost support所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。