【发布时间】:2014-02-20 21:15:34
【问题描述】:
我正在开发一个应用程序,我在其中严重依赖 iptables 来路由流量。
我只是通过调用iptables 作为我的应用程序的外部进程来设置表格。
我想知道是否有一种方法可以直接与 iptables 所依赖的内核模块 (Netfilter) 对话,并避免为此而运行新进程的开销?
欢迎提出其他路由解决方案的建议。
【问题讨论】:
-
我认为最好的研究地点是 iptables 资源。
-
如果您一次执行多个规则,您可以通过管道将它们发送到
iptables-restore。 -
自上一个 3.13 内核以来,nftables 是 iptables 用于配置 netfilter 的继承者。广告上写着
NFTables promises to be more powerful, simpler, reduce code complication, improve error reporting, and provide more efficient handling of packet filter rules.,而技术上写着try it and make your own opinion。
标签: c++ linux linux-kernel iptables