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

Posted November 12, 2017 2.2k views

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 -j LOG
iptables -A INPUT -p icmp –icmp-type 8 –source -j DROP
service iptables save
service iptables restart

Now to ping from to my vps.

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

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

cat /var/log/iptables.log

Nothing in it.

Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!