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 would like to know if it's possible to tell a Linux kernel to route all packets destinated to X via interface/ip Y but only in case the source IP address would be a specific one.

Any idea if this is possible?

Thanks and regards,

share|improve this question

Yes that's called source routing :

ip rule add from table toto

ip route add default via dev eth1 table toto

You can have more informations here :

source routing in the lartc guide

share|improve this answer

Any routing decisions based not on destination IP address called PBR (policy-based routing). Usually, PBR is implemented via firewall, so look for possibility to change out interface for packet in iptables.

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.