I have iptables setup for selective routing. In the current configuration it checks if the dst address is listed in a specific chain and if it is not it redirects the traffic to my proxy port which is active on port 1080.
This works fine with the following setup:
iptables -t nat -N PROXY # Do not redirect iptables -t nat -A PROXY -d external.proxy.address.1 -j RETURN iptables -t nat -A proxy -d external.proxy.address.2 -j RETURN iptables -t nat -A PROXY -d 220.127.116.11/255.240.0.0 -j RETURN iptables -t nat -A PROXY -d 18.104.22.168/255.128.0.0 -j RETURN iptables -t nat -A PROXY -d 22.214.171.124/255.128.0.0 -j RETURN ... [and many more address] ... # Redirect everything else to the proxy listening on port 1080 iptables -t nat -A PROXY -p tcp -j REDIRECT --to-ports 1080 iptables -t nat -I PREROUTING -p tcp -j PROXY
As mentioned this works fine for proxy1 but I am trying to redirect traffic in a similar way for destination 10.0.0.15 to a different proxy (proxy2) which listens on port 1088.
I've tried several ways to accomplish this without success.
Configuration I have tried :
iptables -t nat -A PROXY -d 10.0.0.15 -j REDIRECT --to-ports 1088 # didn't do anything
What would be the best way to achieve this (if it's possible)