Community discussions

MikroTik App
 
mblfone
newbie
Topic Author
Posts: 36
Joined: Sun Feb 02, 2014 2:22 am

Simple bridge firewall rule

Wed Apr 15, 2020 9:01 pm

Hello,

I am having a dreadful time getting results from a bridge firewall rule. I have my computer pinging 8.8.8.8 on ether3 and I have net on ether5. With the following bridge firewall filter, I expect to have a pause in my pinging but I do not. I have tried different IN and OUT interfaces, but this more general rule should include all traffic on the bridge... I think. I usually use firewall in a routed scenario but need to filter traffic to an IP phone via a bridge config so that I don't add an additional NAT. The configuration follows:

/interface bridge
add name=bridge1
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/interface bridge filter
add action=drop chain=forward
/interface bridge port
add bridge=bridge1 interface=ether2
add bridge=bridge1 interface=ether5
add bridge=bridge1 interface=ether4
add bridge=bridge1 interface=ether3
/interface bridge settings
set use-ip-firewall=yes
/ip address
add address=192.168.100.1/24 interface=ether1 network=192.168.100.0

This seem like it should be simple. Any thoughts or suggestions are very helpful!
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11121
Joined: Mon Dec 04, 2017 9:19 pm

Re: Simple bridge firewall rule

Wed Apr 15, 2020 9:29 pm

My guess is that setting use-ip-firewall=yes causes the bridged frames to bypass the bridge filter via the ip firewall.
 
mblfone
newbie
Topic Author
Posts: 36
Joined: Sun Feb 02, 2014 2:22 am

Re: Simple bridge firewall rule

Wed Apr 15, 2020 10:09 pm

Interesting thought! I will give that a shot and report back!
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Simple bridge firewall rule

Wed Apr 15, 2020 10:25 pm

I do not see any reason to use Bridge Firewall so that you block access to the Internet... Just use Firewall Filter...
By enabling the firewall filter in the Bridge you just force the Bridge traffic to pass through prerouting, forward and postrouting chains...
There are specific reasons to enable the Bridge filter...
 
mblfone
newbie
Topic Author
Posts: 36
Joined: Sun Feb 02, 2014 2:22 am

Re: Simple bridge firewall rule

Thu Apr 16, 2020 4:44 pm

I was not successful by turning off bridge firewall. On another note, I was not successful with IP firewall either. I actually tried that method first. I will retry IP Firewall and post the config later today.
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Simple bridge firewall rule

Thu Apr 16, 2020 5:07 pm

There are many ways you could do that on Firewall filter, one would be:
/ip firewall filter
add action=drop chain=forward in-interface=bridge1 out-interface=ether1 \
    src-address=192.168.30.254
With the above rule firewall will drop any attempt originated from the host 192.168.30.254 coming from the Bridge interface and has as exit interface my WAN ether1...
In case your computer is connected to a non Bridged port then you could as well:
/ip firewall filter
add action=drop chain=forward in-interface=ether2 out-interface=ether1
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21897
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simple bridge firewall rule

Thu Apr 16, 2020 6:13 pm

I have no idea what your requirements are based on the first post.
how many groups of users,
what are the use cases (what should they be able to do)
How are they related to the port structure you setup.
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11121
Joined: Mon Dec 04, 2017 9:19 pm

Re: Simple bridge firewall rule

Thu Apr 16, 2020 6:16 pm

@mblfone, I've forgotten the most important point... have you disabled "hardware acceleration" of the bridge by setting hw=no in the /interface bridge port rows? If not, the frames bypass the whole CPU, not just the bridge rules...
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Simple bridge firewall rule

Thu Apr 16, 2020 7:43 pm

Here is your error:
/interface bridge filter
add action=drop chain=forward...
Hardware offload can be an error as @sindy indicated, as long as Hardware offload is active e.g. when you see the H flag...

Unlike what we would use on IP Firewall Filter, notice that in case of the Bridge, when a host tries to access or communicate with e.g. 8.8.8.8 this is not a Forward action, at least not for the Bridge, since the destination is not another port of the bridge itself... Packet Flow Diagram can help you on that... https://help.mikrotik.com/docs/display/ ... n+RouterOS

Using Forward chain in the Firewall filter means we mark packets passing through the Router, routing decision takes place...
Using Forward Chain in the Bridge filter means we mark packets passing through the Bridge, bridging decision takes place...

So the correct chain here is the input...
For example
/interface bridge filter
add action=drop chain=input dst-address=8.8.8.8/32 in-interface=ether3 \
    mac-protocol=ip
The above rule will block any communication with the dst-address specified...

Take a look at the example from https://wiki.mikrotik.com/wiki/Manual:Packet_Flow
You see that our in interface is the port2 from the bridge and destination is our wan port, PPPoE in that case...
What we see is that as far as the Bridge is concerned this is an input traffic...
Image
 
User avatar
sindy
Forum Guru
Forum Guru
Posts: 11121
Joined: Mon Dec 04, 2017 9:19 pm

Re: Simple bridge firewall rule

Thu Apr 16, 2020 8:36 pm

when a host tries to access or communicate with e.g. 8.8.8.8 this is not a Forward action, at least not for the Bridge, since the destination is not another port of the bridge itself...
Now that's a question, as the OP has written
I have my computer pinging 8.8.8.8 on ether3 and I have net on ether5.
...
/interface bridge port
...
add bridge=bridge1 interface=ether5
...
add bridge=bridge1 interface=ether3
So for me this was a clear bridge forwarding - whether the rest of the setup is correct or not I didn't dare to guess this time.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21897
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simple bridge firewall rule

Fri Apr 17, 2020 1:14 am

Yes best if the smarter people stop guessing and let the OP explain his requirements more fully . ;-P
 
Zacharias
Forum Guru
Forum Guru
Posts: 3459
Joined: Tue Dec 12, 2017 12:58 am
Location: Greece

Re: Simple bridge firewall rule

Fri Apr 17, 2020 6:35 pm

Yes best if the smarter people stop guessing and let the OP explain his requirements more fully . ;-P
I just felt lucky... i like guessing some times... :lol:
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 21897
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Simple bridge firewall rule

Fri Apr 17, 2020 10:49 pm

Yes but only rich people can afford to guess LOL,

Who is online

Users browsing this forum: akakua, sindy and 39 guests