码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS 6 下单独记录 iptables 日志

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

标签:iptables log

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 日志

标签:iptables log

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!