I am trying to set up iptables to log connection attempts to port 21 on a server, then deny the connection. The logging works, but I can't get iptables to actually reject the connection or drop the packets, no matter what I try.
Chain INPUT (policy ACCEPT) num target prot opt source destination 1 LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21 LOG flags 0 level 7 prefix `FTP connection: '
I've tried getting iptables to DROP and REJECT port 21 as the second rule, but it doesn't work and I can still reach the server on 21.
2 REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21 reject-with icmp-port-unreachable
is one, which doesn't work.