Community discussions

MikroTik App
 
g21
newbie
Topic Author
Posts: 25
Joined: Thu Apr 01, 2021 2:25 pm

firewall help

Thu Jan 19, 2023 8:23 pm

I want to see all blocked ip that firewall drop and maybe add them to a dynamic address list .

or with another way.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: firewall help

Thu Jan 19, 2023 9:07 pm

 
g21
newbie
Topic Author
Posts: 25
Joined: Thu Apr 01, 2021 2:25 pm

Re: firewall help

Thu Jan 19, 2023 9:31 pm

i dont undestand how this help me thnx
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: firewall help

Thu Jan 19, 2023 9:43 pm

In that case I would advise you not to try things like that until you have a better understanding how it works and what the risks are!
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19325
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: firewall help

Thu Jan 19, 2023 9:49 pm

Why, a huge waste of time.
All you need is..

/ip firewall filter
{Input Chain}
(default rules)
add action=accept chain=input comment="defconf: accept established,related,untracked" connection-state=established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
(user rules - what traffic should be allowed)
add action=accept chain=input in-interface-list=LAN *****
add action=drop chain=input comment="drop all else"
{forward chain}
add action=fasttrack-connection chain=forward comment="defconf: fasttrack" connection-state=established,related
add action=accept chain=forward comment="defconf: accept established,related, untracked" connection-state=established,related,untracked
add action=drop chain=forward comment="defconf: drop invalid" connection-state=invalid
(user rules - what traffic should be allowed)
add action=accept chain=forward comment="allow internet traffic" in-interface-list=LAN out-interface-list=WAN
add action=accept chain=forward comment="allow port forwarding" connection-nat-state=dstnat
add action=drop chain=forward comment="drop all else"

***** Typically, one has a single trusted subnet, (not used for guests or media or iot etc......) but the rule above allows all subnet traffic for initial connectivity for router services and to config the router. Better to split router services for everyone and ONLY the admin to config the router! Thus the rule should be modified further three rules:
add action=accept chain=forward src-address-list=Authorized
add action=accept chain=forward dst-port=53,123 protocol=tcp in-interface-list=LAN
(drop port 123 if NTP not a service provided)
add action=accept chain=forward dst-port=53 protocol=udp in-interface-list=LAN

Where Authorized is a firewall address list comprised of (nominally) the following:
add address=IPofadmin1 list=Authorized ( desktop )
add address=IPofadmin2 list=Authorized ( laptop wifi )
add address=IPofadmin3 list=Authorized ( Ipad/iphone wifi )
add address=IPofadmin4 list=Authorized ( Road Warrior IP through wireguard connection - laptop )
add address=IPofadmin5 list=Authorized ( Road Warrior IP through wireguard connection - Ipad/iphone )
etc.....


Note: Assumes addresses behind router are set as fixed static leases.

++++++++++++++++++++++++++++++++++++++++

Thus one does not really have to care or bother with what or who is attempting to ping router.
All traffic is dropped by both input and forward chains. The only allowed traffic is that you have stated (user allowed rules)
 
g21
newbie
Topic Author
Posts: 25
Joined: Thu Apr 01, 2021 2:25 pm

Re: firewall help

Thu Jan 19, 2023 10:32 pm

the problem is that my customer wants to see all the droped ip and that cause i want to add them on address list ...

i have also do that with a script for ipsec spam ... but i need something similar for droped ip
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: firewall help

Thu Jan 19, 2023 10:34 pm

You can put the dropped IP in an address list (see the help page I gave you before), but I think the next thing you will do is drop all packets from the IP in the address list before even doing anything else (e.g. in raw) and THAT WILL BITE YOU BIG TIME!
So it is better not to do such things.
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19325
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: firewall help

Thu Jan 19, 2023 11:31 pm

Tell the customer its $5 per line item. After 10,000 hits................ :-)

Just tell him that extra logging slows down the router for no benefit and ask what he customer intends on doing with many random IP addresses. Makes NO F sense.
 
g21
newbie
Topic Author
Posts: 25
Joined: Thu Apr 01, 2021 2:25 pm

Re: firewall help

Fri Jan 20, 2023 3:00 pm

i think if in drop rule set log=yes then with any way can a script put this ip in an address list like i did with ipsec attacks?
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19325
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: firewall help

Fri Jan 20, 2023 3:20 pm

Yes you could try that.............

add action=accept chain=forward src-address-list=Authorized
add action=accept chain=forward dst-port=53,123 protocol=tcp in-interface-list=LAN (drop port 123 if NTP not a service provided)
add action=accept chain=forward dst-port=53 protocol=udp in-interface-list=LAN
add chain=input action=add-src-to-address-list address-list=WasteOfTime in-interface-list=WAN
add chain=input action=drop comment="drop all else"
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: firewall help

Fri Jan 20, 2023 3:50 pm

i think if in drop rule set log=yes then with any way can a script put this ip in an address list like i did with ipsec attacks?
Did you already read the help page I referred you to? It tells you how to do it.
When you cannot read that, question your ability to service your customer. Get a MikroTik admin course.
Doing cut-and-paste admin of firewalls without understanding the matter is not going to do you any good.
 
g21
newbie
Topic Author
Posts: 25
Joined: Thu Apr 01, 2021 2:25 pm

Re: firewall help

Fri Jan 20, 2023 5:32 pm

my problem is only that i cant find any way to send from log the ip to an adress list dynamic ….
 
g21
newbie
Topic Author
Posts: 25
Joined: Thu Apr 01, 2021 2:25 pm

Re: firewall help

Fri Jan 20, 2023 5:38 pm

my problem is only that i cant find any way to send from log the ip to an adress list dynamic ….
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: firewall help

Fri Jan 20, 2023 7:02 pm

It is better that you do not touch these things. I told you were to find it, Anav showed you an example, and still you can't.
Find someone who can!
 
g21
newbie
Topic Author
Posts: 25
Joined: Thu Apr 01, 2021 2:25 pm

Re: firewall help

Fri Jan 20, 2023 7:13 pm

i did it with the firewall rules that attached thnx ….

Who is online

Users browsing this forum: stef70 and 130 guests