Community discussions

MikroTik App
 
music4
just joined
Topic Author
Posts: 23
Joined: Wed Dec 07, 2016 5:12 pm

How to configure this IP firewall rule?

Wed Dec 28, 2016 5:07 pm

I want to disable all incoming UDP packet, unless source port is 1812 or 1813, or dest port is 3799. I tried to use two rules:

/ip firewall filter chain=input action=drop protocol=udp src-port=!1812,1813
/ip firewall filter chain=input action=accept protocol=udp dst-port=3799

But this doesn't seem to work. Input packet with dest port 3799 are blocked. How to correct the rules?
 
rkau045
newbie
Posts: 45
Joined: Mon Jun 25, 2012 9:14 pm

Re: How to configure this IP firewall rule?

Wed Dec 28, 2016 5:35 pm

Put the accept rule before the drop rule. Firewall rules are processed in order top to bottom.

Sent from my LG-D850 using Tapatalk
 
skuykend
Member Candidate
Member Candidate
Posts: 274
Joined: Tue Oct 06, 2015 7:28 am

Re: How to configure this IP firewall rule?

Thu Dec 29, 2016 1:09 am

how about if you put the src-port and dst-port in one line and drop on the next line? like below:
/ip firewall filter chain=input action=accept protocol=udp src-port=1812,1813 dst-port=3799
/ip firewall filter chain=input action=drop protocol=udp
That would make an AND situation. The dst port would need to be 3799 and souce either 1812 or 1813 or the packet would drop.
 
rkau045
newbie
Posts: 45
Joined: Mon Jun 25, 2012 9:14 pm

Re: How to configure this IP firewall rule?

Thu Dec 29, 2016 7:18 pm

Those rules are still AND gated. Traffic will only pass to port 3799 from either 1812 or 1813. All other packets will be dropped. The rules here are functionally the same as what was suggested in post #3, but in 3 lines rather than 2.

Sent from my LG-D850 using Tapatalk
 
User avatar
zipvault
Member Candidate
Member Candidate
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: How to configure this IP firewall rule?

Fri Dec 30, 2016 1:41 am

Not all packets are showing up in my firewal ?
 
rkau045
newbie
Posts: 45
Joined: Mon Jun 25, 2012 9:14 pm

Re: How to configure this IP firewall rule?

Fri Dec 30, 2016 2:38 am

If you have rules for Established, Related before these rules, the remaining packets are probably accepted there. These rules would only match the first packets in the connection.

Sent from my LG-D850 using Tapatalk
 
User avatar
zipvault
Member Candidate
Member Candidate
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: How to configure this IP firewall rule?

Fri Dec 30, 2016 2:42 am

My understanding is the first packet is a "new" one

Then Comes the established and related

But i see movement on my interfaces

But the firewall doesnt seem to represent the data flowing

And fastpath and fasttrack is disabled