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 204.15.230.1 eth1
# route add -net 12.12.0.0 netmask 255.255.0.0 gw 64.34.37.225 eth0
12.12.0.0/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:
sleep 60
ip rule add from 64.34.37.0/27 table 1
ip route add default table 1 via 64.34.37.225
ip rule add from 204.15.230.0/24 table 2
ip route add default table 2 via 204.15.230.1
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.