首页 > 其他 > 详细

CentOS 6 下单独记录 iptables 日志

时间:2016-07-03 15:56:21      阅读:287      评论:0      收藏:0      [点我收藏+]

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 REJECT at line 5 in its entirety as its functionality will be moved into the LOGGING chain (where I change it to a DROP anyway):

技术分享

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

技术分享


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


本文出自 “Ilovecat(个人笔记)” 博客,请务必保留此出处http://hj192837.blog.51cto.com/655995/1795268

CentOS 6 下单独记录 iptables 日志

原文:http://hj192837.blog.51cto.com/655995/1795268

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!