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

Deny public IP´s on DNAT ftp rule

Hi!

I cant figure out how to deny selected public ip/networks for my DNAT rule for ftp. The DNAT itself works great but when i try to create a rule for my WAN interface there is no success. I have created a network group in which i put my not wanted networks to accessing my ftp. 

Rule -> Not_wanted_Networks - FTP - WAN  -> Drop

How should i do it?


This thread was automatically locked due to age.
  • Please show pictures of your DNAT and of your packet filter drop rule.

    Cheers - Bob
  • I believe DNAT rules are processed before the packet filter, therefore the traffic will not match your drop rule. You will want to not use the automatic packet filter rule in the DNAT and instead use manual packet filter rules. Place the drop rule above the allow rule with a destination of your internal ftp server as order does matter.

    example rules:
    DNAT
    Source: Any
    Service: FTP
    Destination: External Wan address
    Change Destination to: Internal ftp server IP

    Packet filter:
    1. Not_wanted_Networks - FTP - Internal ftp server IP -> Drop
    2. Any - FTP - Internal ftp server IP -> Allow

    Another option would be to only allow specific Networks instead of having "Any" in the dnat and packet filter rules.
  • Thanks i will try that!

    /Linkan 

    I believe DNAT rules are processed before the packet filter, therefore the traffic will not match your drop rule. You will want to not use the automatic packet filter rule in the DNAT and instead use manual packet filter rules. Place the drop rule above the allow rule with a destination of your internal ftp server as order does matter.

    example rules:
    DNAT
    Source: Any
    Service: FTP
    Destination: External Wan address
    Change Destination to: Internal ftp server IP

    Packet filter:
    1. Not_wanted_Networks - FTP - Internal ftp server IP -> Drop
    2. Any - FTP - Internal ftp server IP -> Allow

    Another option would be to only allow specific Networks instead of having "Any" in the dnat and packet filter rules.
  • dilandau is totally correct.
    The firewall rules that are automatically created when creating a DNAT rule and enabling the "auto packetfilter rule" are placed into the AUTO_FORWARD chain of iptables.

    All manually, user-created  packetfilter rules (rules which are manually created under Network Security - Packetfilter - Rules) are placed into the USER_FORWARD chain of iptable.

    AUTO_.... rules are always checked _before_ USER_ rules, thus you never can block a " automatic packetfilter rule" by a "manuel packtefilter rule".