Why the ping action can't log into iptables.log?

November 12, 2017 74 views
Firewall Logging CentOS

My os :centos 7.
yum remove firewalld
I want to log all the ping from 111.1111.111.111 into iptables.log.

cat /etc/rsyslog.conf
kern.* /var/log/iptables.log

systemctl restart rsyslog

iptables -N LOGGING
iptables -A INPUT -j LOGGING
iptables -A INPUT -p icmp --icmp-type 8 --source 111.111.111.111 -j LOG
iptables -A INPUT -p icmp --icmp-type 8 --source 111.111.111.111 -j DROP
service iptables save
service iptables restart

Now to ping from 111.111.111.111 to my vps.

  1. iptables -A INPUT -p icmp --icmp-type 8 --source 111.111.111.111 -j DROP can work. ping 104.223.65.117 PING 104.223.65.117 (104.223.65.117) 56(84) bytes of data. ^C --- 104.223.65.117 ping statistics --- 23 packets transmitted, 0 received, 100% packet loss, time 22003ms

2.iptables -A INPUT -p icmp --icmp-type 8 --source 111.111.111.111 -j LOG can't work

cat /var/log/iptables.log

Nothing in it.

Be the first one to answer this question.