/ip firewall raw
add action=drop chain=prerouting comment=“defconf: drop bogon IP’s” src-address-list=bad_ipv4
add action=drop chain=prerouting comment=“defconf: drop bogon IP’s” dst-address-list=bad_ipv4
add action=drop chain=prerouting comment=“defconf: drop bogon IP’s” src-address-list=bad_src_ipv4
add action=drop chain=prerouting comment=“defconf: drop bogon IP’s” dst-address-list=bad_dst_ipv4
add action=drop chain=prerouting comment=“defconf: drop non global from WAN” src-address-list=not_global_ipv4 in-interface-list=WAN
add action=drop chain=prerouting comment=“defconf: drop forward to local lan from WAN” in-interface-list=WAN dst-address=192.168.88.0/24
add action=drop chain=prerouting comment=“defconf: drop local if not from default IP range” in-interface-list=LAN src-address=!192.168.88.0/24
add action=drop chain=prerouting comment=“defconf: drop bad UDP” port=0 protocol=udp
add action=jump chain=prerouting comment=“defconf: jump to ICMP chain” jump-target=icmp4 protocol=icmp
add action=jump chain=prerouting comment=“defconf: jump to TCP chain” jump-target=bad_tcp protocol=tcp
add action=accept chain=prerouting comment=“defconf: accept everything else from LAN” in-interface-list=LAN
add action=accept chain=prerouting comment=“defconf: accept everything else from WAN” in-interface-list=WAN
add action=drop chain=prerouting comment=“defconf: drop the rest”
Once applyied, I’m getting ejected from router! So I connect to router by console to delete firewall raw rules.
Can someone explain to me why this part of rules reject me.
Why. a ROUTER is for routing authorized traffic, you seem intent or focussed on blocking traffic.
Most of that is not needed.
Best start of with a basic firewall, ensure users on lan have access to services on input chain,
access to wan on forward chain and drop all else in both chains. Suffices for 95% of cases.
Hi,
Thanks for your reply.
Why? because it’s indicated in official support page! It seems that it rise the device performance by handling trafic before arriving at firewall rules.
Am I wrong? All I want is to maximize security.
Thanks in advance
I would say unless you understand what each rule is doing, what raw means vice other filter categories etc… then you are over your head and shouldnt be applying these rules… and should go for a clean lean and safe config. If interested let me know.
@llamajaja has good wisdon… but if this is your personal device then go hack it.
Although consider something like GNS3 (it can virtualize RouterOS). It’s better because you won’t “brick” your LAN and can always reset to a clean slate.
Hi there!
I won’t help you, because I didn’t do this kind of rules, but it’s interesting for me. Can I ask you a few questions?
Are you doing it (or planning to do so) in running environment?
What’s the biggest expected advantage for you and why? Security or better CPU performance maybe?
If you have just one network 192.168.88.0/24 I think you don’t really need to do it so advanced but it’s your network - try, learn, rise
If you are just using the examples from article to ask but your network is more complex - good luck
EDIT: Of course others can share their thoughts as well
I have ipv6 running well with the Basic Mikrotik ipv6 firewall, but I had to make a couple of modifications to get it to work with my internet provide - Starlink. I wanted to test the Advanced firewall in Mikrotik to learn and see whether I had any weaknesses in the Basic implementation given the modifications I made…
So, I have a couple of spots where I had to change the RAW section in order to get it to work and I’d appreciate a nudge in helping to understand why:
I need to disable the following address list item: add address=::1/128 comment=“defconf: RFC6890 lo” list=bad_ipv6 (latest versions of iOS 7 have an Io interface that shows up automatically, so maybe there is a reason why this now needs to be disabled?)
I need to disable the last rule in the RAW ICMPv6 list: add action=drop chain=icmp6 comment=“defconf: drop other icmp” protocol=icmpv6
This next one bothers me more - what ICMPv6 packets could have failed to be accepted in the previous accepted rules in RAW that the firewall wants to drop, but I need to disable in order to get ipv6 working?
The log errors show ICMP codes 136, 134 (router and neighbor advertisements) and 143 (multicast)
Currently, I have to disable the address list item that shows an “X” below - the Io-related one and I have to disable the last drop rule in the advanced ipv6 firewall to get it to work. The above error codes show up in the log if I enable the last drop rule. Thanks for your help!
Flags: D - DYNAMIC; G - GLOBAL, L - LINK-LOCAL
Columns: ADDRESS, FROM-POOL, INTERFACE, ADVERTISE
# ADDRESS FROM-POOL INTERFACE ADVERTISE
0 G 2605:xxxx:xxxx:xx00:xxxx:xxff:fexx:6245/64 Starlink-v6 Local yes
1 G 2605:xxxx:xxxx:xx03:xxxx:xxff:fexx:6245/64 Starlink-v6 VLAN-10-Main yes
2 G 2605:xxxx:xxxx:xx01:xxxx:xxff:fexx:6245/64 Starlink-v6 VLAN-20-Guest yes
3 G 2605:xxxx:xxxx:xx02:xxxx:xxff:fexx:6245/64 Starlink-v6 VLAN-30-IoT yes
4 D ::1/128 lo no
5 DL fe80::xxxx:xxff:fexx:6245/64 VLAN-10-Main no
6 DL fe80::xxxx:xxff:fexx:6245/64 Local no
7 DL fe80::xxxx:xxff:fexx:6245/64 VLAN-30-IoT no
8 DL fe80::xxxx:xxff:fexx:6245/64 VLAN-20-Guest no
9 DL fe80::xxxx:xxff:fexx:6243/64 WAN2-Verizon no
10 DL fe80::xxxx:xxff:fexx:6242/64 WAN1-Starlink no
11 DL fe80::xxxx:xxff:fexx:6244/64 WAN3-Eclipse no
12 DG 2605:xxxx:xxxx:xxxx:xxxx:xxff:fexx:6242/64 WAN1-Starlink no
Columns: LIST, INTERFACE
# LIST INTERFACE
0 LAN Local
1 WAN WAN1-Starlink
2 VLAN VLAN-20-Guest
3 VLAN VLAN-30-IoT
4 VLAN VLAN-10-Main
5 WAN WAN2-Verizon
6 WAN WAN3-Eclipse
7 VLAN Local
Note that in the respective ICMP RAW rules I have replaced the standard advanced firewall “LAN” in-interface-list with “VLAN” - I have my bridge in LAN and also in VLAN, so it’s a broader list than just LAN. The firewall (as opposed to RAW tab) modifications I had to make for Starlink were based on a user’s post in Github or Reddit specific to Starlink ipv6 implementation in Mikrotik - in addition to the multicast range, I also have to specifically accept packets sourced from the Global addresses given to my LAN interfaces (bridge and VLANs below) and the Global address Starlink provides to the router itself. I am not sure why the link-local information isn’t enough as it would seem to be from the Mikrotik-provided firewall configurations.
Then I am confused - you said you had issues when you added the ip firewall raw rules - do you mean you have issues when you do the same with the ipv6 firewall raw rules?
I have been using a slightly modified version of MT’s basic ipv6 firewall - I am not clear on why my Starlink internet connection seems to require these slight modifications. I thought I would try the MT advanced ipv6 firewall to see if I could drill down to see where the problem is. To get the advanced ipv6 firewall to allow ipv6 to work I have to do the following:
Disable the address list item: add address=::1/128 comment=“defconf: lo” disabled=no dynamic=no list=bad_ipv6
Disable the final advanced ipv6 RAW rule: Drop other ICMP
I still have to include in the advanced ipv6 firewall an accept input and accept forward rules that permit traffic from my global address for the Starlink internet and the global addresses for my bridge and VLANs.
On #2, the ICMP traffic that is getting dropped are not getting picked up by the LAN-only accept rules for ICMP types 134, 136 and 143 - it seems that some of the traffic getting dropped has the global address of the Starlink interface.
I’m not sure why MT’s ipv6 firewalls do not work without the above - the standard uses LAN and !LAN - which I have replaced with VLAN (which my definition includes the bridge (LAN) and three VLANs). Does an address list that refers to LAN or VLAN include both the ipv4 and ipv6 addresses? If so, does it include the global as well as link-local addresses?
OK! I was uncertain as you posted the ip firewall raw for IPv4 and information for IPv6 - but mentioned the issues related to connectivity so I went with IPv4. I saw a few things in the info you sent, namely that you use the interface-list name “VLAN” and not “LAN”, keep in mind that that means that WAN and VLAN are matched by “!LAN”.
IPv4 and IPv6 are different parts of the firewall, filtering one doesn’t change the other.
Instead of disabling the rules, can you change it to passthrough with log and then attach here the packets whose dropping breaks your network, exactly as it appears in the log?
The rule that only allows ICMPv6 Type 134 from LAN is plain wrong for an edge router: it is supposed to receive RAs from the upstream (WAN), configure itself and then advertise itself to the downstream (LAN).