ultra
April 15, 2013, 4:20pm
1
Dear all,
i have been using mikrotik, but i still confuse about firewall configuration.
like in
/ip firewall
, there are:
- MANGLE
- FILTER
- NAT
when will i use the mangle, filter and nat?
what the predecessor for:
for example if i create FILTER chain , should i do configure the MANGLE first?
if no? what is the mandatory for FILTER depend from MANGLE ?
thanks for your help
Try to read the packet flow diagram.
Picture says more than 1000 words.
http://wiki.mikrotik.com/wiki/Manual:Packet_Flow
ultra
April 15, 2013, 4:32pm
3
thanks patrikg , i will learn about it. but can you help me as a simple flow, because when i see the picture in packet flow, there are so many steps. let me know for a simple flow
thanks
ultra
April 15, 2013, 5:27pm
5
i tried
/ip firewall filter
i have 2 scenarios :
Scenario 1
chain=forward action=reject reject-with=icmp-admin-prohibited protocol=icmp
the Result is:
ip ping google.com and showed me :
Destination net unreachable
but i can ping my ip router
Scenario 2
i disabled the scenario 1 and then enable this one
chain=output action=reject reject-with=icmp-admin-prohibited protocol=icmp
i ping to:
ping google.com and return reply
ping my ip router and showed : Destination net unreachable
so, why when i used the scenario 2, google still return reply, i think google and my router will return unreacheable
thanks
Feklar
April 15, 2013, 6:39pm
7
ultra:
i tried
/ip firewall filter
i have 2 scenarios :
Scenario 1
chain=forward action=reject reject-with=icmp-admin-prohibited protocol=icmp
the Result is:
ip ping google.com and showed me :
Destination net unreachable
but i can ping my ip router
Scenario 2
i disabled the scenario 1 and then enable this one
chain=output action=reject reject-with=icmp-admin-prohibited protocol=icmp
i ping to:
ping google.com and return reply
ping my ip router and showed : Destination net unreachable
so, why when i used the scenario 2, google still return reply, i think google and my router will return unreacheable
thanks
Filter is to filter traffic (your firewall functions)
NAT is for Network Address Translation
Mangle is to mark packets/connections/etc for internal use with the router, and change some other possible fields. (QoS, policy based routing, etc.)
Input is for traffic specifically destined for the router itself. I.E. a service that the router will serve (ssh interface, web interface, etc.).
Forward is for traffic that is going through the router. I.E. traffic leaving a client going to google.com and google.com ’s response to the client.
Output is for traffic generated by the router itself. A response to a ping or BGP updates.
ultra
April 16, 2013, 4:30am
8
Thanks bro..
Feklar:
ultra:
i tried
/ip firewall filter
i have 2 scenarios :
Scenario 1
chain=forward action=reject reject-with=icmp-admin-prohibited protocol=icmp
the Result is:
ip ping google.com and showed me :
Destination net unreachable
but i can ping my ip router
Scenario 2
i disabled the scenario 1 and then enable this one
chain=output action=reject reject-with=icmp-admin-prohibited protocol=icmp
i ping to:
ping google.com and return reply
ping my ip router and showed : Destination net unreachable
so, why when i used the scenario 2, google still return reply, i think google and my router will return unreacheable
thanks
Filter is to filter traffic (your firewall functions)
NAT is for Network Address Translation
Mangle is to mark packets/connections/etc for internal use with the router, and change some other possible fields. (QoS, policy based routing, etc.)
Input is for traffic specifically destined for the router itself. I.E. a service that the router will serve (ssh interface, web interface, etc.).
Forward is for traffic that is going through the router. I.E. traffic leaving a client going to google.com and google.com ’s response to the client.
Output is for traffic generated by the router itself. A response to a ping or BGP updates.
Ok… i see…
any body,please posting here about simple firewall
thanks
The most easiest powerful firewall is to turn off the device.
As all of us, we need to learn the hard way.
ultra
April 16, 2013, 7:51am
10
patrikg:
The most easiest powerful firewall is to turn off the device.
As all of us, we need to learn the hard way.
yeah.. i want to know the concept first then try and try to implement
Feklar
April 16, 2013, 4:25pm
11
The most basic firewall that will cover around %95 of situations is this:
/ip firewall filter
add action=accept chain=forward comment="Accept established connections" connection-state=established disabled=no
add action=accept chain=forward comment="Accept related connections" connection-state=related disabled=no
add action=drop chain=forward comment="Drop invalid connections" connection-state=invalid disabled=no
add action=accept chain=forward disabled=no in-interface="<LAN Interface>" out-interface="<WAN Interface>" comment="Allow internet connections from LAN"
add action=drop chain=forward disabled=no comment="Drop everything else"
add action=accept chain=input comment="Accept established connections" connection-state=established disabled=no
add action=accept chain=input comment="Accept related connections" connection-state=related disabled=no
add action=drop chain=input comment="Drop invalid connections" connection-state=invalid disabled=no
add action=accept chain=input disabled=no in-interface="<LAN Interface>" comment="Allow connections to router from LAN"
add action=drop chain=input disabled=no comment="Drop Everything else"
Basically this will allow outbound connections from the LAN, and connections to the router from the LAN interface. It will drop everything else. If you want to allow more forwards or input options, put in the needed accept rules above the “drop everything else” rules on the appropriate chain.
ultra
April 16, 2013, 4:49pm
12
Feklar:
The most basic firewall that will cover around %95 of situations is this:
/ip firewall filter
add action=accept chain=forward comment="Accept established connections" connection-state=established disabled=no
add action=accept chain=forward comment="Accept related connections" connection-state=related disabled=no
add action=drop chain=forward comment="Drop invalid connections" connection-state=invalid disabled=no
add action=accept chain=forward disabled=no in-interface="<LAN Interface>" out-interface="<WAN Interface>" comment="Allow internet connections from LAN"
add action=drop chain=forward disabled=no comment="Drop everything else"
add action=accept chain=input comment="Accept established connections" connection-state=established disabled=no
add action=accept chain=input comment="Accept related connections" connection-state=related disabled=no
add action=drop chain=input comment="Drop invalid connections" connection-state=invalid disabled=no
add action=accept chain=input disabled=no in-interface="<LAN Interface>" comment="Allow connections to router from LAN"
add action=drop chain=input disabled=no comment="Drop Everything else"
Basically this will allow outbound connections from the LAN, and connections to the router from the LAN interface. It will drop everything else. If you want to allow more forwards or input options, put in the needed accept rules above the “drop everything else” rules on the appropriate chain.
Many Thanks to you…
can you explain to me, above your script in line 3
add action=drop chain=forward comment="Drop invalid connections" connection-state=invalid disabled=no
when will i use the connection-state=INVALID ?
i checked in
/ip firewall connection pr
but i cant find state = INVALID , only established, syn-sent , etc on my router.
can you explain it for the case? for what the condition can be occur the invalid state?
thanks