2

I'm currently trying to setup a redundant routing on RHEL 5. The target goal is to have a primary route to a subnet and a backup route to that subnet, to be used only if the gateway of the primary route becomes unreachable.

Any idea how to achieve this? Integration with standard RHEL files is a plus here :)

Thanks in advance,

2 Answers2

3

You can use quagga and OSPF

# yum info quagga
Loaded plugins: changelog, fastestmirror, presto, security, versionlock
Loading mirror speeds from cached hostfile
 * base: ftp.colocall.net
 * epel: ftp.colocall.net
 * extras: ftp.colocall.net
 * ius: ius.cu.be
 * rpmforge: ftp.colocall.net
 * updates: ftp.colocall.net
Available Packages
Name        : quagga
Arch        : x86_64
Version     : 0.99.15
Release     : 7.el6_3.2
Size        : 1.1 M
Repo        : base
Summary     : Routing daemon
URL         : http://www.quagga.net
License     : GPLv2+
Description : Quagga is a free software that manages TCP/IP based routing
            : protocol. It takes multi-server and multi-thread approach to resolve
            : the current complexity of the Internet.
            :
            : Quagga supports BGP4, BGP4+, OSPFv2, OSPFv3, RIPv1, RIPv2, and RIPng.
            :
            : Quagga is intended to be used as a Route Server and a Route Reflector. It is
            : not a toolkit, it provides full routing power under a new architecture.
            : Quagga by design has a process for each protocol.
            :
            : Quagga is a fork of GNU Zebra.

And use different weight (cost) for each gateway

router1.example.net# conf t
router1.example.net(config)# int tun0
router1.example.net(config-if)# ip ospf authentication message-digest
router1.example.net(config-if)# ip ospf message-digest-key 1 md5 SHdJLapbQ1
router1.example.net(config-if)# ip ospf cost 10
router1.example.net(config-if)# write
Configuration saved to /etc/quagga/ospfd.conf

router1.example.net# conf t
router1.example.net(config)# int tun1
router1.example.net(config-if)# ip ospf authentication message-digest
router1.example.net(config-if)# ip ospf message-digest-key 1 md5 SHdJLapbQ1
router1.example.net(config-if)# ip ospf cost 20
router1.example.net(config-if)# write
Configuration saved to /etc/quagga/ospfd.conf
ALex_hha
  • 7,193
  • 1
  • 25
  • 40
  • isn't it possible to do it with ip route command ? – Henry-Nicolas Tourneur Feb 20 '14 at 14:36
  • AFAIK OPSF is production ready protocol. You could try to use ip route + custom bash script. For e.g. a long time ago I have used custom bash script - http://pastebin.com/a5M7dd42 . But OSPF is more flexible and more powerful. And more complex :) – ALex_hha Feb 20 '14 at 15:03
0

Wow that's cool, never heard of quagga. I would have done it old school and script it and run it out of cron :) (VERY KLUDGY)

something like creating two files first.

# cat /root/route1.txt
1.1.1.1
# cat /root/route2.txt
2.2.2.2

then a script like this out of cron (or in a "while true" loop)

#!/bin/bash

route1=`cat /root/route1.txt`
route2=`cat /root/route2.txt`

$status=`ping -n -c 1 -q $route1 | grep -c "1 received"`
if [ "$status" == "1" ]; 
then 
    echo "good stuff" > /dev/null
else 
    echo "bad stuff" > /dev/null
    route del [rest of command to delete current default $route1]
    route add default gateway $route2
    echo "$route1" > /root/route2.txt
    echo "$route2" > /root/route1.txt
fi

Like i said, very kludgy huh? :)

ben
  • 101
  • 5