Good afternoon guys,
This is my first post, started my mikrotik journey a few weeks ago and lately I had more time to get involved. I have no prior network experience so, please, don’t judge, I may have a lot of mistakes in my lines but I hope you can tell me if I have to fix something. Learned quite a bit in a few days of going through RouterOS, and I started it a bit shy because I saw a lot of messages about “how hard and complicated is the Mikrotik world”.
So, I have rules for ipv4, so please, if you can tell me if all is good or if I am very safe with this configuration, and if my order is good because I know Mikrotik needs good rules top to bottom. My router is on a ipv4 CGNAT config, but if I really want to, I can go for public ipv6, I just don’t need it for the moment. Though I dont know if I should have ipv6 firewall rules, because I let it enabled in the settings so I don’t get to websites that are not working. I don’t know if you guys turn off ipv6 when ure on a public ipv4 or cgnat but from what I have read, it is nice to let it on.
/ip firewall filter
add action=accept chain=input comment="Accept established,related" \
connection-state=established,related,untracked log=yes log-prefix=\
"input accept"
add action=drop chain=input comment="Drop invalid" connection-state=invalid \
log=yes log-prefix="drop invalid input"
add action=accept chain=input comment="Accept ICMP" protocol=icmp
add action=drop chain=input comment="Drop all not coming from LAN" \
in-interface-list=!LAN log-prefix="Drop all not from LAN"
add action=accept chain=input comment=\
"Allow VLAN65 to have Management Access" in-interface=vlan65-management
add action=accept chain=forward comment="Accept in ipsec policy" \
ipsec-policy=in,ipsec
add action=accept chain=forward comment="Accept out ipsec policy" \
ipsec-policy=out,ipsec
add action=fasttrack-connection chain=forward comment=Fasttrack \
connection-state=established,related hw-offload=yes
add action=accept chain=forward comment="Accept established,related" \
connection-state=established,related
add action=drop chain=forward comment="Drop invalid" connection-state=invalid \
log-prefix="drop invalid forward"
add action=drop chain=forward comment="Drop Inter-Vlan Communication" \
in-interface-list=VLAN out-interface-list=VLAN
add action=accept chain=forward comment="Allow VLAN to Acces the Internet" \
in-interface-list=VLAN out-interface-list=WAN
add action=drop chain=forward comment="Drop all from WAN not DSTNATed" \
connection-nat-state=!dstnat connection-state=new in-interface-list=WAN
add action=drop chain=forward comment="Dropp all WAN trafic not commented" \
log-prefix="drop all wan not commented"
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
/ip service
set telnet disabled=yes
set ftp disabled=yes
set www disabled=yes
set ssh disabled=yes
set api disabled=yes
set api-ssl disabled=yes
/ip ssh
set strong-crypto=yes
Something can come if I want to give acces to specific VLANS to specific ip adresses from other VLANS ( like a media server, or I don’t know..) but not there yet.
And here it is the the IPv6. I put a rule also to block the acces to Winbox ( also don’t know if it makes any sense but i wanted it more secure because I will never acces the router from ipv6)
/ipv6 firewall address-list
add address=::/128 comment="defconf: unspecified address" list=bad_ipv6
add address=::1/128 comment="defconf: lo" list=bad_ipv6
add address=fec0::/10 comment="defconf: site-local" list=bad_ipv6
add address=::ffff:0.0.0.0/96 comment="defconf: ipv4-mapped" list=bad_ipv6
add address=::/96 comment="defconf: ipv4 compat" list=bad_ipv6
add address=100::/64 comment="defconf: discard only " list=bad_ipv6
add address=2001:db8::/32 comment="defconf: documentation" list=bad_ipv6
add address=2001:10::/28 comment="defconf: ORCHID" list=bad_ipv6
add address=3ffe::/16 comment="defconf: 6bone" list=bad_ipv6
/ipv6 firewall filter
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 ICMPv6" protocol=\
icmpv6
add action=accept chain=input comment="defconf: accept UDP traceroute" \
dst-port=33434-33534 protocol=udp
add action=accept chain=input comment=\
"defconf: accept DHCPv6-Client prefix delegation." dst-port=546 protocol=\
udp src-address=fe80::/10
add action=accept chain=input comment="defconf: accept IKE" dst-port=500,4500 \
protocol=udp
add action=accept chain=input comment="defconf: accept ipsec AH" protocol=\
ipsec-ah
add action=accept chain=input comment="defconf: accept ipsec ESP" protocol=\
ipsec-esp
add action=accept chain=input comment=\
"defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=input comment=\
"defconf: drop everything else not coming from LAN" in-interface-list=\
!LAN
add action=drop chain=forward comment="Block Internet from accesing VLAN65" \
in-interface-list=WAN out-interface=vlan65-management
add action=drop chain=forward comment=\
"Block VLAN65 from accesing the Internet" in-interface=vlan65-management \
out-interface-list=WAN
add action=drop chain=forward comment="Block Inter-VLAN communication" \
in-interface-list=VLAN out-interface-list=VLAN
add action=fasttrack-connection chain=forward comment="defconf: fasttrack6" \
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
add action=drop chain=forward comment=\
"defconf: drop packets with bad src ipv6" src-address-list=bad_ipv6
add action=drop chain=forward comment=\
"defconf: drop packets with bad dst ipv6" dst-address-list=bad_ipv6
add action=drop chain=forward comment="defconf: rfc4890 drop hop-limit=1" \
hop-limit=equal:1 protocol=icmpv6
add action=accept chain=forward comment="defconf: accept ICMPv6" protocol=\
icmpv6
add action=accept chain=forward comment="defconf: accept HIP" protocol=139
add action=accept chain=forward comment="defconf: accept IKE" dst-port=\
500,4500 protocol=udp
add action=accept chain=forward comment="defconf: accept ipsec AH" protocol=\
ipsec-ah
add action=accept chain=forward comment="defconf: accept ipsec ESP" protocol=\
ipsec-esp
add action=accept chain=forward comment=\
"defconf: accept all that matches ipsec policy" ipsec-policy=in,ipsec
add action=drop chain=forward comment=\
"defconf: drop everything else not coming from LAN" in-interface-list=\
!LAN
Thank you a lot guys ! Feel free to “correct” my errors.
