I’m running OSPF with several routers using 2 different paths back to the main gateway router. It works fine for load balancing but I need half the routers to go one way and the other half to go the other way with failover. Adjusting the cost is giving me strange results and doens’t seem to work as it should. The only way this works is by disabling one of the IP addresses in each router to force them to go another way. I know I can do check gateway pings but I don’t want to manually right all my routes. There are alot and its ever changing.
So lets say my gateway has 2 IP’s, 1.1.1.1 on ether 1 and 2.2.2.2 on ether 2. If my other router has 1.1.1.5 and 2.2.2.5 I would like 1.1.1.5 normally disabled. Then it will ping 2.2.2.2 on its interface that is 2.2.2.5. If those pings go away then enabled ip address 1.1.1.5 which will automatically create the ospf routes and failover. Then if pings resume on 2.2.2.2 disabled 1.1.1.5 again.
Can someone help me with this? It seams simple but I am new to scripting.
The problem with OSPF is that I have 6 routers going back to one router. That one router acts as 2 gateways to the internet. So I can adjust cost on that router and send all 6 routers one way or another and it works fine but I need 3 of them going one way and 3 of them going the other way and for the life of me I can’t seem to make that happen since they all go back to the same 2 interfaces on the gateway router. As far as I can tell I cannot adjust cost individually for each router.
Well I’ve done that. And the 6 routers choose their default gateway accordingly but all this does is force the upload to go one direction. The gateway router still shows both paths back to the each of the 6 routers so the downloads are still sent 50/50.
My idea on failover may be usefull. I’m not doing load balancing, only failover. I have three routers: primary uplink, secondary uplink and LAN router. I’m manipulating with Default Route Metric in OSPF instance settings.
SecondaryUplink has Default Route Metric in OSPF instance setting set to 5. PrimaryUplink has Default Route Metric set to 1.
With netwach on PrimaryUplink router I’m checking reliable host on internet.
When netwatch changes status to down, executes script prim_down. When netwatch changes status to up, executes script prim_up.
Scripts change Default Route Metric parameter and disable and enable interface that is connected to LAN router, so OSPF routes are recalculated and distributed.