F
F
Flamy7772018-04-18 13:46:18
linux
Flamy777, 2018-04-18 13:46:18

Iptables forwarding socks?

There are two servers with socks-proxy servers configured on them. 1.2.3.4:7200 and 1.2.3.5:7201
Is it possible to redirect the connection to the first or second server through the third server 2.2.2.2 through ports 7200 and 7201, respectively?
Through iptables on the third server configured port forwarding

iptables -t nat -A PREROUTING -d 2.2.2.2 -p tcp --dport 7200 -j DNAT --to-destination 1.2.3.4:7200
iptables -A FORWARD -d 1.2.3.4 -p tcp --dport 7200 -j ACCEPT

When trying to connect to Sox through server 2.2.2.2, in the logs on server 1.2.3.4 there is an attempt to connect, but without authorization.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Tallmange, 2018-04-18
@Flamy777

Let's say the source has the address 3.3.3.3.
3.3.3.3 sends a packet to 2.2.2.2, which changes the destination address to 1.2.3.4.
The packet flies to 1.2.3.4, but the source address in it is still 3.3.3.3, not 2.2.2.2.
Therefore, the packet is sent back along the normal route, bypassing 2.2.2.2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question