Answer the question
In order to leave comments, you need to log in
How to redirect all incoming traffic to a proxy using iptables?
How to redirect all tcp and udp traffic (from all ports) to port 8890
Answer the question
In order to leave comments, you need to log in
In the rules below there is no division into tcp or udp, they need to be finalized :)
I did something like this
Forwarding traffic to another server from 192.168.1.15 to 192.168.1.61
iptables -t nat -A PREROUTING -p tcp -d 192.168.1.15 -j DNAT - -to-destination 192.168.1.61
iptables -t nat -A POSTROUTING -p tcp --dst 192.168.1.61 -j SNAT --to-source 192.168.1.15
With ports from 192.168.1.15:80 to 192.168.1.61:8080
iptables - t nat -A PREROUTING -p tcp -d 192.168.1.15 --dport 80 -j DNAT --to-destination 192.168.1.61:8080
iptables -t nat -A POSTROUTING -p tcp --dst 192.168.1.61 --dport 8080 -j SNAT --to-source 192.168.1.15
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question