Iptables output redirect quest
Posted on 2009-02-24
I have an application that sends output out on a sample port which must be redirected at the server level back to a second port in order for the application to process the information correctly.
For example, we will use:
Redirect from: 443
Redirect to: 8443
2nd IP: 22.214.171.124
I have the following rule which works fine running by itself, but I need to introduce a second IP into the system and each IP needs to redirect their output back to themselves on the new port.
/sbin/iptables -t nat -A OUTPUT -j REDIRECT -p tcp -d 126.96.36.199/32 --dport 443 --to-ports 8443
/sbin/iptables -t nat -A OUTPUT -j REDIRECT -p tcp -d 188.8.131.52/32 --dport 443 --to-ports 8443
Does anyone know how I could accomplish this? Using PREROUTING will not work as it isn't redirecting the output like the rule above does.