* `iptables`的`Log Target`模块支持进行日志记录,并且支持一下选项;
* `--log-level level`:`Level of logging`,表示日志的记录级别,级别越详细,磁盘的`IO`量越大;
* `--log-prefix prefix`:`Prefix log messages with the specified prefix; up to 29 letters long, and useful for distinguishing messages in the logs.`用于指定日志的长度,最长是`29`个字符;
* `--log-tcp-sequence`:用于记录`TCP`协议的`sequence numbers`;
* `--log-tcp-options`:` Log options from the TCP packet header`;
* `--log-ip-options`:` Log options from the IP packet header.`;
* `--log-uid`:`Log the userid of the process which generated the packet.`
* 记录ping
的日志信息;
* 在INPUT
链上面添加规则
[root@server23 ~]# iptables -I INPUT 4 -d 172.25.23.23 -p icmp --icmp-type 8 -j LOG --log-prefix "< < this is ping > >"
- 接下来查看日志的记录信息