1. First, add a new chain with a reasonable name:
Iptables-n LOGGING
2. Next, insert a rule at the appropriate point (hence me using --line-numbers
above). You could replace the existing at line 5 with its entirety as its functionality'll be REJECT
moved into the LOGGING
chain (WH Ere I change it to a DROP
anyway):
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/83/9E/wKiom1d4h1vCJA1OAAF95dhUPJ4791.jpg "title=" Snap1.jpg "alt=" Wkiom1d4h1vcja1oaaf95dhupj4791.jpg "/>
Iptables-i INPUT 5-j LOGGING
3. Add the actual logging rule next
Iptables-a logging-j LOG--log-prefix "DROP:"--log-level 7
Iptables-a logging-j DROP
Service Iptables Save
Service Iptables Restart
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/83/9F/wKiom1d4iNGzFVhIAAH_v_nkipc207.jpg "title=" Snap2.jpg "alt=" Wkiom1d4ingzfvhiaah_v_nkipc207.jpg "/>
4. vi/etc/rsyslog.conf
Kern . Debug /var/log/iptables. Log
Service Rsyslog Restart
5. Vi/etc/logrotate.d/syslog
Add /var/log/iptables. Log to List of filenames
This article is from the "ilovecat (personal note)" blog, so be sure to keep this source http://hj192837.blog.51cto.com/655995/1795268
Iptables logs are logged separately under CentOS 6