Skip to contentSkip to conversation

iptables redirects packets to local proxy

DISCUSSION Phil Oester 2 participants 2 messages Nov 30, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 6 lines · Antonio Prado
Quoted 1 line · Phil Oester

Use -j REDIRECT --to 12345

If I get it correctly, the OP wants to redirect to 127.0.0.1:12345 after having changed destination address and port to the packets. Is that possible anyway?

You have to pick where you want to change the destination to. Either x:12345 or y:40000 - can't have it both ways. Seems the socks proxy should be configured to send the traffic to y:40000.

Phil

#2 lore raw
Quoted 1 line · Phil Oester

Seems the socks proxy should be configured to send the traffic to y:40000.

Right, without using iptables at all for redirecting, socat can do it all.

For example:
socat TCP4-LISTEN:20000,reuseaddr,fork \
SOCKS4:127.0.0.1:A.B.C.D:40000,socksport=12345

--
antonio