Score:0

How to redirect all HTTP traffic to a proxy server?

gp flag

I am looking to redirect all HTTP traffic to a proxy server and the these iptables commands doesn't work:

iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp –dport 80 -j DNAT –to-destination 10.0.0.1:3128
iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp –dport 80 -j REDIRECT –to-ports 3128

Error message:

iptables v1.8.4 (legacy): unknown option "-m"
Score:0
us flag

There are two issues with your commands:

  1. -m tcp is not needed.
  2. dport is an option for -p tcp, and suboptions like this need to be specified with double dashes: --dport

Also, for your purpose, only second command is needed.

1n4ho12 avatar
gp flag
Thank you for the answer. I edited to "iptables -t nat -A PREROUTING -i eth0 -p tcp -–dport 80 -j REDIRECT –to-ports 3128" and still receive an error: "iptables v1.8.4 (legacy): unknown option "-p""
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.