如果輸入 iptables - hashlimit 規則 (OpenWRT),強制入口網站 (nodogsplash) 將停止運作

如果輸入 iptables - hashlimit 規則 (OpenWRT),強制入口網站 (nodogsplash) 將停止運作

我已經用 openwrt 設定了熱點設備。它安裝了用於熱點功能的 nodogsplash 和用於限制頻寬的 iptables。當我測試速度限制腳本時,出於測試目的,熱點被禁用,所以我當時沒有註意到衝突。問題是我的 iptables 腳本和 nodogsplash 都在 iptables 上使用“MARK”進行流量控制,我認為衝突從這裡開始。因為這兩個程式都使用“0xa”等指定字串來標記流量。有沒有辦法解決這個問題或有其他方法來控制每個 ip 的頻寬?

iptables -t nat -A prerouting_rule -m mac --mac-source 1c:91:48:xx:xx:xx -j MARK --set-mark 0x0A -m comment --comment "PC"
iptables -t nat -A prerouting_rule -m mark --mark 0xA -j CONNMARK --save-mark
iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark
iptables  -A forwarding_rule -m mark --mark 0xA -m conntrack --ctstate ESTABLISHED,RELATED -m hashlimit --hashlimit-name "Limit" --hashlimit-above 24kb/s -j DROP

這些是我的腳本中建立 iptables 規則的部分。

下面是 nodogsplsh 所建立的一些 iptable 規則

DROP       all  --  anywhere             anywhere             mark match 0x10000/0x30000
ndsAUT     all  --  anywhere             anywhere             mark match 0x30000/0x30000
ACCEPT     all  --  anywhere             anywhere             mark match 0x20000/0x30000

我嘗試提供足夠的信息,但不要太多:)我希望這足夠了。

答案1

如果有人需要解決方案;

iptables -A forwarding_rule -d 192.168.1.10 -m hashlimit --hashlimit-name "speedLimit" --hashlimit-above 100kb/s -j DROP

選項:

  • -d:客戶端的ip位址

  • --hashlimit-名稱:一些名字,喜歡評論

  • --hashlimit-上面:速度限制值(kb/s)

相關內容