参考:
[qemu] qemu旧的net参数已经不再可用了,新的这样用。
QEMU's new -nic command line option
用Qemu模拟vexpress-a9 --- 配置 qemu 的网络功能
http://www.360doc.com/content/12/0611/14/7982302_217438857.shtml
Qemu版本: 4.1.0
从3.0开始,不再支持vlan,需要改为如下的方式。
1、设置添加桥接br0,修改/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto br0
iface br0 inet dhcp
bridge_ports enp3s0
2、增加/etc/qemu-ifup和/etc/qemu-ifdown
qemu-ifup:
#!/bin/bash
# up tapx
sudo ifconfig $1 0.0.0.0 promisc up
# add tapx to br0
sudo brctl addif br0 $1
# show
sudo brctl show
qemu-ifdown:
#在4.1版本上啥也不用做,对于老版本的参考上面的博客
3、Qemu启动参数
sudo qemu-system-aarch64 \
-M virt \
-cpu cortex-a72 \
-smp 4 \
-m 2048M \
-kernel ./android_kernel/linux-4.14/out64/arch/arm64/boot/Image \
-nographic \
-append "root=/dev/ram0 rw rootfstype=ext4 console=ttyAMA0 init=/linuxrc ignore_loglevel" \
-initrd ./rootfs/ramdisk.img \
-fsdev local,security_model=passthrough,id=fsdev0,path=/home/pengdl/aarch64/share \
-device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare \
-nic tap
或者:
sudo qemu-system-aarch64 \
-M virt \
-cpu cortex-a72 \
-smp 4 \
-m 2048M \
-kernel ./android_kernel/linux-4.14/out64/arch/arm64/boot/Image \
-nographic \
-append "root=/dev/ram0 rw rootfstype=ext4 console=ttyAMA0 init=/linuxrc ignore_loglevel" \
-initrd ./rootfs/ramdisk.img \
-fsdev local,security_model=passthrough,id=fsdev0,path=/home/pengdl/aarch64/share \
-device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare \
-netdev tap,id=dev0 -device virtio-net-pci,netdev=dev0
完。
来源:oschina
链接:https://my.oschina.net/u/4289606/blog/3397439