how to see the log of dropped packets from iptables

Issues related to configuring your network
Post Reply
aaaa2209
Posts: 1
Joined: 2018/08/21 22:34:07

how to see the log of dropped packets from iptables

Post by aaaa2209 » 2023/09/03 01:41:52

Hello. I am not sure if this is possible. I apply "iptables -I INPUT -s a.b.c.d -j DROP" rules for many IP to block attackers. The Centos server is doing fine. I am curios if I can see the log of the firewall when it applies the rule. Like it tells me the IP a.b.c.d try to scan and sign in with a wrong password, and the firewall drops the packet.
Thank you. Let me know if you need more information.

Regards,
Jack

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: how to see the log of dropped packets from iptables

Post by TrevorH » 2023/09/03 03:12:09

Create a new chain, called say LOGDROP and in that chain you have two rules, the first -j LOG and the second -j DROP. Then instead of using -j DROP on your original rule, you change it to -j LOGDROP.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

BShT
Posts: 585
Joined: 2019/10/09 12:31:40

Re: how to see the log of dropped packets from iptables

Post by BShT » 2023/09/04 13:12:40

use fail2ban

Post Reply