Comparing temporary and Persistant routes in Linux

Hi

This script will help us to compare the routes which is persistent and which is not.

#################################################################################

#!/bin/bash
 ifconfig | grep addr | awk '{print $1}' > /tmp/interfaces && sed -i.bak_$time "s/inet6*//g" /tmp/interfaces
 for i in $(cat /tmp/interfaces);
 do
 echo "******* Verifying routes on $i interface ********"
 cp /etc/sysconfig/network-scripts/route-$i /tmp/route-$i
 route -n | grep -i $i | grep -i ug  |awk '{print $1}' > /tmp/currentroutes
 echo "***** Comparing Current and Persistant Routes on $i *****"
for j in $(cat /tmp/currentroutes);
         do
         cat /tmp/route-$i | grep $j
    if [ $? == 0 ]
    then echo "***** route $j is persistent on $(hostname) *****"
    else echo "#### route $j is not persistent on $(hostname) on $i ####"
    fi
    done
 done

#################################################################################

Comments

Popular posts from this blog

Python reference Interview questions

[SOLVED]* Please wait for the system Event Notification service

Rebuild the initial ramdisk image in Red Hat Enterprise Linux