qemu-discuss
[Top][All Lists]
Advanced

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

Re: Issues to set up a tap network backend


From: Berto Furth
Subject: Re: Issues to set up a tap network backend
Date: Mon, 12 Apr 2021 09:22:06 +1000
User-agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249

Hi Daniele,

Is it possible to get a "brctl showmacs br0" on the host while QEMU is running to confirm that the mac address of the guest (which is distinct from the MAC address of the tap0 interface) is showing up in the bridge table? Please also ensure that the MAC address of your router is in the bridge table but on a different port number.

In addition can you post a copy of "ifconfig" as run on the guest?

You could also run the command "brctl showstp br0 " on the host to double check that your bridge is properly forwarding traffic on both your ethernet and tap interfaces (although it must be if you can ping the guest and the router from the host).

You mentioned that you've done some network sniffing. As you try to ping from the guest to the router and vice versa could you post the output of a command like

tcpdump -e -n -i tap0 ether host c4:aa:bb:11:22:33

where "c4"aa:bb:11:22:33" is replaced by the MAC address of the guest (not the mac-address of the tap0 interface)

Can we check whether the router is getting an ARP entry for the guest? Assuming it's a linux / openWRT / FreeBSD based router the command will be something like "arp -na" or a router with a cisco style command interface the command will be "show arp". I ask this because there's a chance that packets might be getting from the guest to the router, but packets are unable to make it back to the guest (or vice versa). That might help us to narrow down what's happening.

Finally you said that virtual-box is working. Is it setup in bridging mode or is it doing NAT? That is, can you ping the guest from the router when you're running virtual box?

Good luck!!

Berto.

On Mon, 12 Apr 2021, at 01:37, Daniele Palmisano wrote:
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]