IDSの前後のトラフィック用のnftableの作成

IDSの前後のトラフィック用のnftableの作成

iptablesの下位互換性がほとんどないOpenwrt 22.03で実装されているので、nftablesを学びましょう。

ルータから Suricata を実行している VM にトラフィックを転送する iptables ルールがあります。

iptables -i eth0 -t mangle -A PREROUTING --s 0/0 -j TEE --gateway 192.168.1.156
iptables  -i eth0.2 -t mangle -A POSTROUTING -s 192.168.0.0/24 -j TEE --gateway 192.168.1.156

人々はnftablesルールで何をお勧めしますか?変換結果を通して学びようとしています。ありがとうございます!

ベストアンサー1

ユーティリティを使用してくださいiptables-translate。 iptables ルールを nftables に変換します。あなたのルールのコマンドは次のとおりです。

iptables-translate -i eth0 -t mangle -A PREROUTING -s 0/0 -j TEE --gateway 192.168.1.156
iptables-translate -t mangle -A POSTROUTING -s 192.168.0.0/24 -j TEE --gateway 192.168.1.156

結果:

nft add rule ip mangle PREROUTING iifname "eth0" counter dup to 192.168.1.156
nft add rule ip mangle POSTROUTING ip saddr 192.168.0.0/24 counter dup to 192.168.1.156

ここも見てくださいhttps://wiki.nftables.org/wiki-nftables/index.php/Moving_from_iptables_to_nftables

おすすめ記事