source routing with iptables
Posted on 2011-09-09
I've been looking at documentation on iptables and can't find anything on doing IP source routing. I assume it would be done thru using the FORWARD chain of iptables. My linux server is acting like a router. I want to do something similar to policy based routing. If the input IP is 22.214.171.124, then it is routed to tun1. If the input is 126.96.36.199, then it is routed thru tun2. Any other traffic (not from 188.8.131.52 and 184.108.40.206) is routed normally. (Or instead of pointing/forwarding to the tun interrface, you could forward to the next hop IP address at the other end of the tunnels and get the same result.)
Can someone show me some iptables lines to do the trick.
I've done this on other networks with Cisco IOS Policy Based Routing, I want to do the same thing with my linux server/router.
Thanks in advance.