0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

qemu-system-aarch64でインターネット接続

Last updated at Posted at 2024-12-27

自分用

aarch64版のqemuはx86_64版のような
userモードネットワークが使用出来ない。

-netdev tap,ifname=tap0,script=no,downscript=no,id=my_net_id -device driver=virtio-net,netdev=my_net_id

でネットワークデバイスを追加して実行する

qemu起動

sudo /home/tyano/workspace/oss/build_qemu/qemu-system-aarch64 -M virt -cpu cortex-a710 -m 2048 -kernel output/images/Image -device virtio-gpu,id="display1" -display sdl,gl=on -append "root=/dev/vda console=ttyS0" -drive if=pflash,format=raw,file=efi.img,readonly=on -drive if=pflash,format=raw,file=varstore.img -drive file=./output/images/rootfs.ext2,if=virtio,format=raw -netdev tap,ifname=tap0,script=no,downscript=no,id=my_net_id -device driver=virtio-net,netdev=my_net_id -device qemu-xhci -serial stdio -device usb-mouse -device usb-kbd -device usb-tablet -monitor telnet::33333,server,nowait

tap0はqemu起動時に作成される。

ホスト側設定

sudo ip link add name br0 type bridge
sudo ip link set dev enp1s0 master br0
sudo ip link set dev tap0 master br0
sudo ip link set dev br0 up 
sudo ip link set dev enp1s0 up
sudo ip link set dev tap0 up
sudo ip a del 192.168.2.131/24 dev enp1s0
sudo ip a add 192.168.2.131/24 dev br0

qemu再起動時(ホスト設定を先にやった場合)

qemu側はip設定、ホスト側はtap0の再設定が必要

qemu側

ip a add 192.168.2.200/24 dev eth0
ip r add default dev eth0

ホスト側

sudo ip link set dev tap0 up
sudo ip link set dev tap0 master br0

qemu内でipは自動設定される

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?