Help us enhance your Sophos Community experience. Share your thoughts in our Sophos Community survey.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DNAT and Firewall Rule Question

So I wanted to block some malicious IPs and I placed a block rule at the top of my firewall rule list.  Then I discovered to my surprise that the traffic wasn't being blocked.  This is because I am using DNAT with Automatic Firewall Rule checked.  Therefore, the traffic was being allowed before my block rule ever applied.

So upon perusing the forum, I see that there are two ways around this:

1) Add a blackhole NAT rule as the first DNAT
2) Stop using automatic firewall rules and add separate firewall rules for each NAT entry.


So my question is, are there any pros/cons to each approach?  I have about 40 DNAT rules setup, so that is a lot of firewall rules I'd have to add. But if that is a better way of doing things, I'll change it.  Any thoughts/advice?  Thanks.

Matt

P.S. Where does Country Blocking fall in w/r to DNAT?


This thread was automatically locked due to age.
Parents
  • In fact, it isn't dropped, Matt, the bits just go off to electronic Heaven. [:)]

    I prefer to kill such traffic with the DNAT method but it is possible to create a Firewall rule that actually drops the traffic:

    {Network/Group to be blocked} -> Any -> {group of all "(Address)" objects on WAN interfaces} : Drop


    You can turn on logging if you want the satisfaction of seeing the drops.  Note that the 'Destination' in the traffic selector is a group containing the "(Address)" objects created by WebAdmin when you define a new interface or an Additional Address - a regular Network definition won't work.*

    Cheers - Bob
    * But, an "irregular" one will. [;)] I always recommend that people never bind a definition to an interface - that all Host/Network definition have 'Interface: >'.  In this case, if you own the subnet 61.62.63.64/27, you could in either the DNAT or the Firewall rule, use a Network definition with your public subnet and 'Interface: External'.
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
Reply
  • In fact, it isn't dropped, Matt, the bits just go off to electronic Heaven. [:)]

    I prefer to kill such traffic with the DNAT method but it is possible to create a Firewall rule that actually drops the traffic:

    {Network/Group to be blocked} -> Any -> {group of all "(Address)" objects on WAN interfaces} : Drop


    You can turn on logging if you want the satisfaction of seeing the drops.  Note that the 'Destination' in the traffic selector is a group containing the "(Address)" objects created by WebAdmin when you define a new interface or an Additional Address - a regular Network definition won't work.*

    Cheers - Bob
    * But, an "irregular" one will. [;)] I always recommend that people never bind a definition to an interface - that all Host/Network definition have 'Interface: >'.  In this case, if you own the subnet 61.62.63.64/27, you could in either the DNAT or the Firewall rule, use a Network definition with your public subnet and 'Interface: External'.
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
Children
  • In fact, it isn't dropped, Matt, the bits just go off to electronic Heaven. [[:)]]


    Right, I understand, it's not really being blocked, it's just being NAT'd to nowhere.


    I prefer to kill such traffic with the DNAT method but it is possible to create a Firewall rule that actually drops the traffic:

    {Network/Group to be blocked} -> Any -> {group of all "(Address)" objects on WAN interfaces} : Drop




    This is what I originally did and then I discovered nothing was being blocked because I had Automatic Firewall rules on all my DNAT rules.  So the traffic was being allowed before it ever got to my block rule at the top of my firewall list.  I think I had the source being my block group on any interface with a destination of Any/Any.


    You can turn on logging if you want the satisfaction of seeing the drops.  Note that the 'Destination' in the traffic selector is a group containing the "(Address)" objects created by WebAdmin when you define a new interface or an Additional Address - a regular Network definition won't work.*

    Cheers - Bob
    * But, an "irregular" one will. [;)] I always recommend that people never bind a definition to an interface - that all Host/Network definition have 'Interface: >'.  In this case, if you own the subnet 61.62.63.64/27, you could in either the DNAT or the Firewall rule, use a Network definition with your public subnet and 'Interface: External'.


    I kinda did want the satisfaction at first of seeing the drops, but now after thinking about it, I don't want to create 40 or so firewall rules.  So I think I'll stick with the NAT to nowhere! [[:)]]  

    Why do you recommend never binding a definition to an interface?  I was binding the address/network ranges in my block list to the External interface.  Is that not a good idea?

    Thanks.

    Matt
  • Hello,
    just inserting the blackhole NAT on top (position 1) of the NAT-rules doesn't help, because the according firewall rules are in order of their first entry, and are not reordered together with the DNAT rules. If the blackhole rule has been entered last, it will remain last on the hidden firewall rules list.

    If you want to tie this up, you have to switch off all other DNAT rules, look into the hidden portion of firewall configuration list to see if the blackhole NAT rule is on top after this step, and afterwards switch the rest of the DNAT rules back on, so they get positions starting from 2 ->...

    Additionally you have to insert a DNAT target, "any" does not work anymore with newer UTM versions. I hope "External (WAN) (Address)" is the correct choice.

    Best regards,
    SA