For load balancing purposes, occasionally our servers forward requests to a different port; The default port for our service is port 5000.
This is the code used: iptables -t nat -A PREROUTING -p tcp --dport 5000 -j REDIRECT --to-port 5001
After applying this code, the port forwarding works great for new requests.
New requests on port 5000 are forwarded to our service on port 5001. However, existing connections remain connected to port 5000, as displayed by netstat.
My question is, how do I force this iptables rule to immediately apply to all connections, both new and existing (established) - without dropping all connections first?
Thanks in advance