2

I need to redirect all tcp traffic coming out of local programs to the interface that is able to connect to a proxy server.

According to this picture

enter image description here

I need to add rules to the OUTPUT chain, but almost everywhere said that I need to add rules like this

sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8080

Could someone explain why ? As far as I can understand this rule is applied for all incoming traffic but not outgoing traffic ?

I have tried something like that

iptables -t nat -A OUTPUT -p tcp --jump DNAT --to-destination 192.168.56.1:8080

But this doesn't work It shows me that HTTP request is invalid.

Could someone please explain how to forward all traffic through proxy and explain why a specific table/chain is used ?

Pierre.Vriens
  • 1,159
  • 34
  • 15
  • 19
e109848
  • 23
  • 1
  • 4
  • I answered a similar question here https://serverfault.com/a/977515/265053 but that one has the proxy running on the same host. You might find some help to get started there though. – Tom Saleeba Aug 01 '19 at 05:32

0 Answers0