允许在openwrt中使用iptables访问特定IP的stream量

我有一个openwrt tp-link路由器。 我有2个iptables规则来阻止P2P连接。 阻塞工作正常,但现在我需要一个规则,允许stream量来自特定的IP。

我的屏蔽规则:

iptables -I FORWARD -m string --string "BitTorrent protocol" --algo bm -j DROP iptables -I FORWARD -m string --string ".torrent" --algo bm -j DROP 

我添加这个规则:

 iptables -I FORWARD -s 192.168.64.XX -j ACCEPT iptables -I FORWARD -d 192.168.64.XX -j ACCEPT 

但不起作用。

我尝试了一些修改:

 iptables -A FORWARD -s 192.168.64.XX -j ACCEPT iptables -A FORWARD -d 192.168.64.XX -j ACCEPT 

依然不起作用。 每次更改规则后,我都重新启动了路由器。

现在我看不到我在防火墙的修改,我只看到这个:

 Chain FORWARD (Policy: DROP, Packets: 0, Traffic: 0.00 B) Rule # Pkts. Traffic Target Prot. Flags In Out Source Destination Options 1 0 0.00 B DROP all -- * * 0.0.0.0/0 0.0.0.0/0 STRING match ".torrent" ALGO name bm TO 65535 2 96 10.39 KB DROP all -- * * 0.0.0.0/0 0.0.0.0/0 STRING match "BitTorrent protocol" ALGO name bm TO 65535 

我做错了什么?

请帮忙。

除非init系统负责在启动之间保存和恢复它们,否则用iptables手动添加的规则在重新启动后无法存活。 我不认为openwrt在它的默认configuration。

寻找另一个地方添加自定义防火墙规则。 也许/etc/config/firewall

有关configuration格式的详细信息,请访问: https : //wiki.openwrt.org/doc/uci/firewall