I have a docker container running QEMU that I need to give access to 2 interfaces. 1 a macvlan so that it can send/receive messages through a broadcast address as well as communicating with other devices on that network. 2 a bridge network for access to other networks and the internet.
As it stands:
- the docker container and QEMU VM can ping each other
- the docker container and other devices on the network can ping each other
- the QEMU VM can access devices connected to the bridge network
- the QEMU VM and other devices on the network are unable to ping each other
Dockerfile
it should be mentioned that the host machine is the gatewaydocker-compose.ymlI am configuring the network and QEMU VM by interactively running the following commands:Which provides the following output:Below is the VM ipconfig and ping result:What can I do to ensure that I can ping 192.168.2.1 or and devices on the network?
As it stands:
- the docker container and QEMU VM can ping each other
- the docker container and other devices on the network can ping each other
- the QEMU VM can access devices connected to the bridge network
- the QEMU VM and other devices on the network are unable to ping each other
Dockerfile
it should be mentioned that the host machine is the gateway
Code:
FROM debian:trixie-20240926-slimRUN apt-get update && \apt-get --no-install-recommends -y install qemu-system-x86 \qemu-utils \samba \iproute2 \net-tools \iputils-ping \tcpdumpENTRYPOINT ["tail"]CMD ["-f","/dev/null"]
Code:
services: windows: privileged: true image: myimage networks: bridge: private: ipv4_address: "192.168.5.206" container_name: windows devices: - /dev/vhost-net device_cgroup_rules: - 'c *:* rwm' cap_add: - NET_ADMIN ports: - 8006:8006 - 3389:3389/tcp - 3389:3389/udp stop_grace_period: 2m volumes: - /var/win:/storage - /home/someone:/sharednetworks: bridge: driver: bridge private: driver: macvlan driver_opts: parent: enp0s8 attachable: true ipam: config: - subnet: "192.168.0.0/17" gateway: "192.168.5.201"
Code:
ip link add br0 type bridgeip tuntap add dev tap0 mode tapip link set dev tap0 master br0 ip link set dev eth1 master br0 ip link set dev br0 upip address delete 192.168.5.206/17 dev eth1ip address add 192.168.5.206/17 dev br0qemu-system-x86_64 -enable-kvm -cpu host -drive file=/storage/windows-c-drive.img,id=data3,format=raw,cache=none,aio=native,discard=on,detect-zeroes=on,media=disk,if=none -device virtio-scsi-pci,id=scsi -device scsi-hd,drive=data3 -m 4G -monitor stdio -boot d -drive file="shared/shared/Windows.iso",media=cdrom -drive file="shared/shared/virtio-win-0.1.217.iso",media=cdrom -display vnc=:0,websocket=5700 -netdev tap,id=mynet1,ifname=tap0 -device e1000,netdev=mynet1 -netdev user,id=mynet0 -device e1000,netdev=mynet0
Code:
W: /etc/qemu-ifup: no bridge for guest interface foundQEMU 9.1.0 monitor - type 'help' for more information(qemu)
Code:
C:\Users\qemu>ipconfigWindows IP ConfigurationEthernet adapter Ethernet Instance 0 2: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::871f:325f:dfda:6dd0%5 IPv4 Address. . . . . . . . . . . : 192.168.5.207 Subnet Mask . . . . . . . . . . . : 255.255.128.0 Default Gateway . . . . . . . . . : 192.168.5.201Ethernet adapter Ethernet Instance 0 3: Connection-specific DNS Suffix . : Site-local IPv6 Address . . . . . : fec0::7ed:baae:b34c:f6bc%1 Link-local IPv6 Address . . . . . : fe80::a135:7c5b:16c:69bd%4 IPv4 Address. . . . . . . . . . . : 10.0.2.15 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : fe80::2%4 10.0.2.2C:\Users\qemu>ping 192.168.5.206 -S 192.168.5.207Pinging 192.168.5.206 from 192.168.5.207 with 32 bytes of data:Reply from 192.168.5.206: bytes=32 time<1ms TTL=64Reply from 192.168.5.206: bytes=32 time<1ms TTL=64Reply from 192.168.5.206: bytes=32 time<1ms TTL=64Reply from 192.168.5.206: bytes=32 time<1ms TTL=64Ping statistics for 192.168.5.206: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0msC:\Users\qemu>ping 192.168.2.1 -S 192.168.5.207Pinging 192.168.2.1 from 192.168.5.207 with 32 bytes of data:Reply from 192.168.5.207: Destination host unreachable.Reply from 192.168.5.207: Destination host unreachable.Ping statistics for 192.168.2.1: Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),Control-C^CC:\Users\qemu>\
Statistics: Posted by Curtis_L — 2024-10-10 12:55 — Replies 0 — Views 34