Page 1 of 1

Switch rules

Posted: Sat Sep 21, 2024 6:22 am
by Hyunckel
Hello,

I'm trying to add a switch rule but I'm not sure I'm using it correctly.

I want to drop forward packets, I was using the Bridge filter before. but after I enabled HW-offload it stopped working.

The bridge filter rule that I was using:
/interface bridge filter
add action=drop chain=forward comment="Drop unauthorized access" dst-address=\
    10.10.0.0/22 in-bridge=bridge1 mac-protocol=ip out-bridge=bridge1 \
    src-address=10.10.4.0/22
The switch rule I added:
/interface ethernet switch rule
add dst-address=10.10.0.0/22 ports=ether5 redirect-to-cpu=yes \
    src-address=10.10.4.0/22 switch=switch1
The switch rule seems to be working. But I'm not an expert and want to ensure it's the correct configuration.

Re: Switch rules

Posted: Sat Sep 21, 2024 2:55 pm
by sindy
As-is, the rule does not drop the matching frames but redirects them to CPU. To actually drop them, you should use new-dst-ports="" instead of redirect-to-cpu=yes.

Re: Switch rules

Posted: Sun Sep 22, 2024 9:47 am
by Hyunckel
As-is, the rule does not drop the matching frames but redirects them to CPU. To actually drop them, you should use new-dst-ports="" instead of redirect-to-cpu=yes.
I used new-dst-ports="" and I had to add another rule before this one to allow users to reach the router 10.10.0.1

Thank you

Re: Switch rules

Posted: Sun Sep 22, 2024 10:16 am
by sindy
Ah, sorry - new-dst-ports=switch1-cpu is what you need. I forgot that you only needed to drop traffic from one external port to another.

Re: Switch rules

Posted: Mon Sep 23, 2024 7:22 am
by Hyunckel
Ah, sorry - new-dst-ports=switch1-cpu is what you need. I forgot that you only needed to drop traffic from one external port to another.
I removed the accept rule and edited the original with "new-dst-ports=switch1-cpu" and now it works as intended.

Thank you, good sir.