Post the firewall filter rules, the NAT rules, and the address lists together with an exact description of what traffic (source IP/source port and destination IP/destination port tuple) is getting dropped, and what isnt.
When you’re using destination NAT to translate an router IP to an IP behind the router on the LAN, the packet now carries an IP address that isn’t on the router. So that packet is never in the input chain, it’s in the forward chain, therefore rules in the input chain can’t affect it. ‘redirect’ is a special destination NAT version that rewrites the destination address to the preferred IP address on the interface the router receives the packet through, so those packets will always be in the input chain.
Remember: ‘input’ chain = packets that have a destination IP address that is on a router interface = traffic TO the router, AFTER destination NAT. ‘forward’ chain = packet that is going THROUGH the router, AFTER destination NAT. ‘output’ chain = packet generated by the router itself. ‘prerouting’ mangle and filter = BEFORE destination NAT, both packets TO and THROUGH the router. ‘postrouting’ mangle and filter = just before source NAT.
If 1.1.1.1 is your interface IP address that rule makes no sense. You’re rewriting a packet with a destination IP address of 1.1.1.1 to have a destination address of 1.1.1.1. That’s a no-op.
The third one of those rules should also be in the forward chain, and without seeing your address list you’d probably want to add an accept based on the in-interface so that LAN hosts can initiate traffic and place it above the drop. If your address list covers all LAN hosts that should work, though.
That would work, but personally I’d take it a little further. I’m philosophically a huge fan of ‘default deny’. The last statement in any chain should always be “chain=x action=drop” so that you have to explicitly permit traffic further up. Whatever packet somehow (God knows how) circumvents that last rule because some qualifier doesn’t match would be permitted. The final drop rule should have no qualifiers at all outside of the chain name, so that it will literally drop every single packet not accepted higher up.
fewi, I agree too, default deny is always a good idea.
Also, just a note about the
connection-state=invalid action=drop
, it makes sense (as it is) higher in the chain so every firewall rule isn’t check against an invalid packet. Order of firewall rules can have a significant performance impact.
It seems to me that if you put “connection-state=invalid” higher in the list; then every packet will be tested for this, even if they are from a valid known connection.
This rule does not check if the packet is valid, it does check if the connection is valid (it will drop a packet who’s not from an established connection, and at the same time don’t have the SYN TCP flag).
So if you put this rule higher, it will test all established connection packets for nothing.
Right, I agree. The reason I picked the invalid rule was to illustrate why there was a drop rule in the mix, whereas the general idea was to put a default drop rule last, also to point out that generally, putting rules that matched more often are better higher in the chain.