Urgent Help needed

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

There's some very silly mistake i've done in my configuration. I did by reading material on web. I'm enclosing my configuration script below. The problem is its not routing the trafic from other interface in case the first interface is down....which should be the wright case. Kindly please guide me what i can do to make it work..dynamically..

Thanks,

Pankaj Agarwal

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~The Script~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/bin/sh
#script written by Pankaj Agarwal <pankaj@xxxxxxxxxxxxxxxxxxxx>
#defining location of ip binary
IP=/sbin/ip
#flushing all the IP/Routing cache
echo "removing old rules"
$IP rule del prio 50 table main
$IP rule del prio 201 from 61.11.104.0/24 table 201
$IP rule del prio 202 from 220.227.153.48/28 table 202
$IP rule del prio 222 table 222
echo "flushing tables"
$IP route flush table 201
$IP route flush table 202
$IP route flush table 222
echo "removing tables"
$IP route del table 201
$IP route del table 202
$IP route del table 222
#setting loop interface
$IP link set lo up
$IP addr flush dev lo
$IP addr add 127.0.0.1/8 brd + dev lo
#setting up the private device
$IP link set eth1 up
$IP addr flush dev eth1
$IP addr add 192.168.2.5/24 brd + dev eth1
$IP rule add prio 50 table main
$IP route del default table main
#setting up the public devices
$IP link set eth0 up
$IP addr flush dev eth0
$IP addr add 61.11.104.63/24 brd 61.11.104.255 dev eth0
$IP link set eth2 up
$IP addr flush dev eth2
$IP addr add 220.227.153.61/28 brd 220.227.153.63 dev eth2
#configuring route
$IP rule add prio 222 table 222
$IP route add default table 222 proto static nexthop via 61.11.104.1 dev eth0 weight 1 nexthop via 220.227.153.51 dev eth2 weight 3
#configuring for static routes for one connection
$IP rule add prio 201 from 61.11.104.0/24 table 201
$IP route add default via 61.11.104.1 dev eth0 src 61.11.104.63 proto static table 201
$IP route append prohibit default table 201 metric 1 proto static
$IP rule add prio 202 from 220.227.153.48/28 table 202
$IP route add default via 220.227.153.51 dev eth2 src 220.227.153.61 proto static table 202
$IP route append prohibit default table 202 metric 1 proto static
$IP route flush cache
while : ; do
/bin/ping -c 1 220.227.153.51 >> /dev/null
/bin/ping -c 1 61.11.104.1 >>/dev/nyll
sleep 60
done


_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux