标签:
在这两篇博文中已经具体分析了iptable的原理和在openwrt里面的实例
http://www.cnblogs.com/tanhangbo/p/4550455.html
http://www.cnblogs.com/tanhangbo/p/4518254.html
可以概括出iptables/Netfilter 这一套系统就是用户空间可控的在内核空间的一套钩子
下面看看iptables究竟能做什么。
注意到下面的选项:
This module matches every ‘n‘th packet
--every value
Match every ‘value‘ packet
[--counter num]
Use internal counter number ‘num‘. Default is ‘0‘.
[--start num]
Initialize the counter at the number ‘num‘ insetad of ‘0‘. Most between ‘0‘ and ‘value‘-1.
[--packet num]
Match on ‘num‘ packet. Most be between ‘0‘ and ‘value‘-1.
来源: http://linux.die.net/man/8/iptables
BALANCE
This allows you to DNAT connections in a round-robin way over a given range of destination addresses.
--to-destination ipaddr-ipaddr
Address range to round-robin over.
这里有两个做法不同的例子:
http://www.cnblogs.com/silenceli/p/3569849.html
http://wjw465150.iteye.com/blog/423704
参考此文:
http://sookk8.blog.51cto.com/455855/321242
用户空间日志:
ULOG
This target provides userspace logging of matching packets. When this target is set for a rule, the Linux kernel will multicast this packet through a netlink socket. One or more userspace processes may then subscribe to various multicast groups and receive the packets. Like LOG, this is a "non-terminating target", i.e. rule traversal continues at the next rule.
内核日志:
LOG
Turn on kernel logging of matching packets. When this option is set for a rule, the Linux kernel will print some information on all matching packets (like most IP header fields) via the kernel log (where it can be read with dmesg or syslogd(8)). This is a "non-terminating target", i.e. rule traversal continues at the next rule. So if you want to LOG the packets you refuse, use two separate rules with the same matching criteria, first using target LOG then DROP (or REJECT).
参考资料:
http://linux.die.net/man/8/iptables
标签:
原文地址:http://www.cnblogs.com/tanhangbo/p/5327407.html