I have a bare metal running Ubuntu server 16.04 with KVM and 3 NIC's that are connected by bridges br1, br2 and br3 to a guest VM running also Ubuntu server 16.04.
The first NIC - br1 - is connected to the internet and it's router address is defined as the default gateway for the guest.
I have a code running on my guest that needs to listen to the packets received by br2 and br3, the code should listen to 1 NIC only,
I tried forwarding the traffic from en2 (the name of the guest NIC that is bridged via br2) to en3 (the same with br3) by following this:
sudo nano /etc/sysctl.conf
uncomment net.ipv4.ip_forward = 1
sudo sysctl -p
sudo iptables -t nat -A POSTROUTING --out-interface en3 -j MASQUERADE
sudo iptables -A FORWARD --in-interface en2 --out-interfac en3 -j ACCEPT
Yet there is nothing recorded when using sudo tpcdump -i en3
and send a ping message to NIC2 (while if I run sudo tpcdump -i en2
i can see the ping messages)
What am I missing here? Is there a better way for me to get my desired result (that my code will listen to 1 NIC and get both NIC's trafic) ?
tcpdump: NFLOG link-layer type filtering not implemented
– Mladen B. Mar 06 '23 at 17:40