iptables NAT を使用したポートの出力先変更が機能しない時があります
Issue
以下のように、iptables ルールを使用してポートの出力先を変更することができます。
iptables -t nat -A PREROUTING -i bond0 --dst x.x.x.x -p tcp --dport 1234 -j REDIRECT --to-port 4321
iptables -t nat -A PREROUTING -i bond1 --dst y.y.y.y -p tcp --dport 1234 -j REDIRECT --to-port 4321
ただし、しばらくすると、これらのルールが機能しなくなるようです。
以下のコマンドを使用して iptables ルールで使用しているポートが開いているかどうかを確認すると、NAT ルールが再度機能します。
nmap -sX x.x.x.x
Environment
- Red Hat Enterprise Linux Server リリース 5、6
- iptables
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
