Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

My server has 2 network card installed and I manage to get it up and running. I can ping both interface but I can not ssh or access any service (ie web/ftp) if I connect using second interface.

Both network card have 2 different IP address and live on different subnet.

How do I create routing table so packet are returned via the interface where the packet coming from ie : "if packet coming to eth0, it should come out from eth0 using eth0 gateway. If packet is coming from eth1, then the outgoing response also coming out from eth1 using eth1 gateway"

Is this possible ?

share|improve this question
up vote 1 down vote accepted

Yes, this is possible using policy based routing. You need to use ip route and ip rule commands

share|improve this answer
Thanks Khaled, this is exactly what I want. More specific information about ip route and ip rule to do this : – Rianto Wahyudi Jan 26 '11 at 20:12

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.