增加`iptables`的详细程度并确定基于CentOS的服务器上的日志logging位置?

在英镑反向代理方面有一个奇怪的问题,就是不能再正确地在一个基于CentOS的发行版(ClearOS 6.2.x)上正确引导stream量。

我相信这是一个iptables问题或其他什么东西,我甚至没有看到任何东西,甚至表明在我/var/log/messages/var/log/system入站stream量。

我怎样才能增加iptables日志冗长,并validation它正在发生什么事情(关于日志数据的保存位置)?

以下是我在过去打开iptables日志的一般步骤。

 Modify Logging - sudo vi /etc/syslog.conf - kern.warning /var/log/iptables.log - sudo /sbin/service syslog restart - sudo vi /etc/logrotate.d/syslog - If this file is already there, add /var/log/iptables.log to the first line - If the file is not there, add it: 
 /var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron /var/log/iptables.log { sharedscripts postrotate /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true endscript } 
 Implement firewall rules • sudo vi /etc/sysconfig/iptables.script • sudo chmod 700 /etc/sysconfig/iptables.script • sudo /etc/sysconfig/iptables.script 

在我的iptables脚本中,我有所有的通用允许规则在顶部,然后到底部我有一些特定的日志logging规则。 以下是一些例子。

 # Log dropped traffic /sbin/iptables -A INPUT -j LOG -m limit --limit 10/m --log-level 4 --log-prefix "Dropped Traffic: " # Log outbound traffic for anything not equal private ip ranges (this is defined in some previous rules) /sbin/iptables -A OUTPUT -j LOG -m limit --limit 10/m --log-level 4 --log-prefix "Outbound Traffic: " # Log traffic that doesn't hit a rule above (stuff that may be blocked in the future) /sbin/iptables -A INPUT -j LOG -m limit --limit 10/m --log-level 4 --log-prefix "Potentially Dropped Traffic: " 

显然有很多事情可以用这个做。 这是一些通用信息的好链接。

您可以使用“-j LOG”目标将匹配的数据包logging到系统日志中。 你也可以用任意string作为前缀。

为了帮助您debugging问题,您可以使用wireshark或tcpdump等networking嗅探器。 另外,iptables计数器可以通过监视某个规则的变化,在不太繁忙的服务器上获得很好的信息来源。

您可以使用iptables -L -nvx查看确切的计数器。