On Banana Pi R3
Is there a way to configure a mirror port (wan for example) to receive a copy of traffic on other ports (Rx and TX of lan1, lan2, lan3 and lan4 ports) ?
I would be very happy to know that such function exists, because this is a must to analyse network traffic with tcpdump, wireshark or other tools.
I am using Ubuntu 22.04 (official image).
Mt7531 has mirror option in CFC (cpu forward control) register 0x4
Bit 19 MIRROR_EN Mirror Port Enable Enable the mirror port specified in MIRROR_PORT.
0: No mirror available 1: Enable mirror
Bits 18:16 MIRROR_PORT Mirror Port Number Set the mirror port number.
3'h0: Port 0
Thank you very much, you give me hope.
Could you tell me please how to write these values into MT7531 register ?
Is there an existing tool or application ? a command line to excute ? or it is necessary to modify the driver, modify mt7530.c, rebuild driver and install new kernel ?
I am using official image Ubuntu 22.04.
I used to achieve this with tc qdisc on r2-pro, albeit there are an extra set of kernel configs need to be changed during compilation. Also, tc uses CPU and reduces the throughput from 940 Mbps to 630 Mbps (could be brought back to 940 Mbps after reassigning the irq-balance and queues, since r2-pro’s CPU is capable of 2.2Gbps+ forwarding), so not exactly desirable. Better to do it is through the MT7531, which is hardware based.
R3 has a worse CPU than R2-Pro, so tc is again not the best solution.
Hello lalmi, I forget which kernel modules are required to get the tc to work correctly, so an archaeological dig is required either to get tc working, or get the port mirroring on the MT7531 working. Given getting the hw port mirroring is a better bet than tc for both performance and intention, then we should go explore the MT7531 way.
So tc is still required even if modifications are done on MT7531 driver ?
There are options in mt7530.c to activate mirroring, I don’t know this option was not activated by default, it is very important to analyse network traffic…
I don’t know this option was not activated by default, it is very important to analyse network traffic
To be clear, Linux is largely a community-driven project. There is no need to insinuate the importance or triviality of certain features, or imply someone’s job could be done better. We are largely volunteering our time here.