1

I've this schenario

 -----------------                   ----------------        ----------
| SERVER A        | ---(port:2128)> | PROXY          | ---> | INTERNET |
| (10.30.1.1)     |                 | (10.30.2.2)    |      -----------
 -----------------                   ----------------        

Now I've a SERVER B (10.31.1.1) who can not access to PROXY, bu can access to SERVER A

What I need is to configure SERVER A to accept request from SERVER A an forward them to PROXY so it can reach internet..

I tried via iptables in this way:

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -p tcp -i 10.30.1.1 --dport 3128 -d 10.30.2.2 -j ACCEPT
iptables -t nat -I PREROUTING -p tcp -i 10.30.1.1 --dport 3128 -j DNAT --to 10.30.2.2:3128

but on SERVER B i got

Unable to connect to 10.30.1.1
1
  • Why isn't server B able to reach the proxy? TCP is bi-directional. Your rules simply changed the destination address. How are packets from the proxy going to get back to Server B? Can the proxy reach Server B.
    – Zoredache
    Feb 21, 2014 at 17:31

1 Answer 1

2

I'm not sure to have pretty well understood everything. Did the proxy 10.30.2.2 filter input request and know how to route the packet ?

In this case, I think you will have to use MASQUERADE's option to replace the sender's address:

iptables -t nat -I PREROUTING -p tcp -i 10.30.1.1 -s 10.31.1.1 -J MASQUERADE

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .