qemu-discuss
[Top][All Lists]
Advanced

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

Issues to set up a tap network backend


From: Daniele Palmisano
Subject: Issues to set up a tap network backend
Date: Sun, 11 Apr 2021 17:37:09 +0200

Hi,
I am writing as I am having some networking issues while I emulate a Raspberry PI image using QEMU on my Ubuntu 18.04 host machine.  I was wondering whether you could give me a hand to troubleshoot the issue.

I would like to use a bridged adapter as a guest network type. Following the official Qemu documentation https://wiki.qemu.org/Documentation/Networking#Tap and an Archlinux section https://wiki.archlinux.org/index.php/QEMU#Bridged_networking_using_qemu-bridge-helper I ran the Rapberry PI using the following command:


sudo qemu-system-arm \
-kernel ./qemu-rpi-kernel/kernel-qemu-4.4.34-jessie \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-hda 2021-01-11-raspios-buster-armhf-full.img \
-cpu arm1176 -m 256 \
-M versatilepb \
-no-reboot \
-serial stdio \
-net nic,netdev=mynet0 -netdev bridge,br=br0,id=mynet0

Before running the `qemu-system-arm` command, on the host, I created a bridge br0 with an IP address (192.168.0.14/24) removing the address previously assigned to the physical interface.
My `ip address` output will look like:

152: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
    link/ether 4c:e1:73:4a:a7:80 brd ff:ff:ff:ff:ff:ff

157: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 4c:e1:73:4a:a7:80 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.14/24 brd 192.168.0.255 scope global dynamic br0
       valid_lft 80984sec preferred_lft 80984sec
    inet6 fe80::4ee1:73ff:fe4a:a780/64 scope link
       valid_lft forever preferred_lft forever

After running the `qemu-system-arm` command, a `tap0` interface will also be created and added into the bridge br0.

XPS-13-7390 /etc/netplan » sudo brctl show
bridge name bridge id STP enabled interfaces
br0 8000.4ce1734aa780 no eth0
tap0

 
XPS-13-7390 /etc/netplan » ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
...
152: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
    link/ether 4c:e1:73:4a:a7:80 brd ff:ff:ff:ff:ff:ff
157: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 4c:e1:73:4a:a7:80 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.14/24 brd 192.168.0.255 scope global dynamic br0
       valid_lft 80720sec preferred_lft 80720sec
    inet6 fe80::4ee1:73ff:fe4a:a780/64 scope link
       valid_lft forever preferred_lft forever
158: tap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UNKNOWN group default qlen 1000
    link/ether fe:c1:a1:b7:45:bc brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fcc1:a1ff:feb7:45bc/64 scope link
       valid_lft forever preferred_lft forever

From the host I have got the Internet connectivity.
From the guest OS, It is not able to get an IP address using the DHCP protocol, therefore I am forced to assign a static address to the guest interface (192.168.0.30/24). Nevertheless it shows that the interface is in UNKNOWN state.

From here ( guest machine) I can ping the host but I cannot reach any other machines inside the host LAN. Not even the gateway. Hence, I don't have Internet connectivity either.

In fact, using TCPDUMP tool I can see ICMP requests on the BR0 interface but I can't on the host physical interface ETH0. On the other hand, if I try to ping the guest machine from any other machine inside the LAN, I can see ICMP request packets on the BR0 but not on the tap interface tap0.

IP forwarding is also enabled:

 cat /proc/sys/net/ipv4/ip_forward
1

I am trying to troubleshoot this issue for one month now. I really hope I can hear back from you.

As an additional note,  my host physical network interface is not an embedded one. I am using an USB adapter with the ethernet cable. If I try to emulate a linux machine with VirtualBox, instead, using the same host network configuration, I can reach the Internet from the Guest machine.

I look forward to hearing from you.
Many Thanks and regards,
Daniel

reply via email to

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