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: 220.127.116.11
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 18.104.22.168/32 --dport 443 --to-ports 8443
/sbin/iptables -t nat -A OUTPUT -j REDIRECT -p tcp -d 22.214.171.124/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.