Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 .

share|improve this question

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


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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.