0

I am having three linux PCs ( A B and C )in a LAN . I want to keep A as a client and send request to B . B in turn should forward the request to C and C should return back to B and finally B to A .

In short A should get the content of C through B .

i have used the following IP table in B

iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j DNAT --to-destination C

After this , the packets from A to B are reaching C .

Now I want ,

  1. C to reply to B without directly replying to A .
  2. B to reply to A with the content of C .

What should i do ?

Note : I have enabled ip_forward also .

kindly help .

1 Answer 1

0

Add following rule to B (I assume eth1 is the interface facing C):

iptables -A POSTROUTING -t nat -o eth1 -p tcp --dport 80 -j SNAT --to-source B

Alternative:

iptables -A POSTROUTING -t nat -d C -p tcp --dport 80 -j SNAT --to-source B

It will translate source address of the packet being forwarded (originally A) to B.

You must log in to answer this question.

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