Void Main wrote:Do you even need policy based routing? Like I said, you can make your default route your cheap line and then add static network routes for address ranges you want to go out the expensive interface:
# route add default gw 18.104.22.168 eth1
# route add -net 22.214.171.124 netmask 255.255.0.0 gw 126.96.36.199 eth0
188.8.131.52/16 addresses will take the expensive route while everything else takes the cheap way out. Add as many static network routes as you need. That all assumes that you know which networks you want taking the expensive route ahead of time.
There's too many addresses to do them individually. I just want everything to respond on the same interface it comes in on.
It's just weird because half the time this method works, and sometimes it doesn't, even when I do the same thing.
This is what I have run during bootup now:
ip rule add from 184.108.40.206/27 table 1
ip route add default table 1 via 220.127.116.11
ip rule add from 18.104.22.168/24 table 2
ip route add default table 2 via 22.214.171.124
ip route flush cache
usually on bootup, it doesn't work. I check the rules and routes and they are there. I delete them, run that script manually, and then it starts working. I've added the sleep 60 to the top in case its run before the network starts (its scheduled for boot through cron).
just tested it a few times, and i think its working great. If there's ever an exception (which would be rare) i can add it easily.
Frusterating, I did the same thing yesterday and it wasn't working, and now it is.