qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Question] Inquiry about creating virtual IP in qemu


From: 길동균
Subject: [Question] Inquiry about creating virtual IP in qemu
Date: Sun, 17 Apr 2022 13:50:41 +0900

hello

 

I want to create a virtual ip to a virtual guest through qemu without any additional device and communicate with the host.

I know I need to have the ip of the guest to use nfs, ssh, etc. 

I read the qemu network (including NAT) document and set it up according to tap, nat, and script, but I'm not sure.

My development environment is

Host: ubuntu 20.04.3, x86_64, kernel 5.13.37, laptop wireless-LAN

Guest: kernel 5.11.22 (Non-Ubuntu) via qemu-system-x86_64 command, rootfs via buildroot

 

Here is the qemu command on the host.

sudo qemu-system-x86_64 -kernel sysbuild/kernel/linux-5.11.22/arch/x86/boot/bzImage -netdev tap,id=tap0 -device e1000,netdev=tap0 -m 4096M -smp 1 -boot c -hda buildroot-2022.02/output/images/rootfs.ext2 -append "root=/dev/sda rw console=tty0 console=ttyS0,115200 acpi=off" -serial stdio

 

As above, after executing qemu's tap and NAT related commands, ifconfig -a command on the host creates tap0 and br0 that did not exist as shown below.

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

        inet 192.168.53.1 netmask 255.255.255.0 broadcast 192.168.53.255

        inet6 fe80::1070:2aff:feff:2112 prefixlen 64 scopeid 0x20<link>

        ether ea:a7:5a:d0:e2:1b txqueuelen 1000 (Ethernet)

        ~

enp4s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 

        ether 00:24:54:28:bf:8a txqueuelen 1000 (Ethernet)

        ~

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 

        inet 127.0.0.1 netmask 255.0.0.0

        inet6 ::1 prefixlen 128 scopeid 0x10<host>

        loop txqueuelen 1000 (Local Loopback)

        ~

tap0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 

        inet6 fe80::e8a7:5aff:fed0:e21b prefixlen 64 scopeid 0x20<link>

        ether ea:a7:5a:d0:e2:1b txqueuelen 1000 (Ethernet)

        ~

 

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

        inet 192.168.45.168 netmask 255.255.255.0 broadcast 192.168.45.255

        inet6 fe80::54ce:3341:d5d9:3961 prefixlen 64 scopeid 0x20<link>

        ether b4:82:fe:95:08:41 txqueuelen 1000 (Ethernet)

        ~

 

Is 192.168.53.1 of br0 the guest ip above? In the guest, the ifconfig -a command is only lo 

How can host and guest network with each other?

To check, Is it possible to ping host->guest or guest->host?

 

Please advise.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]