LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   how to design gateway heart-bit signal ? (https://www.linuxquestions.org/questions/linux-networking-3/how-to-design-gateway-heart-bit-signal-657584/)

cmfarley19 07-25-2008 03:45 PM

Mr. C,
Huge amount of work???
a) Google is pretty lean. That is why I selected it.
b) Possible, but Unlikely.
c) True
d) True
e) This should be a one-liner. My sed, grep, & awk skills are a hair rusty.
f) See (e) above.

How would you achieve the task?

Mr. C. 07-25-2008 04:10 PM

a) Every interval, you are doing:

Code:

date
shell
  lynx
    tcp socket setup
      http procotol and exchange
      data download
    tcp teardown
  grep
  cut
shell
  tail
  cut
  cut

That's 10 forked/exec'd processes, and a 6000+ bytes to essentially get the state of the path to a remote system. This only requires anywhere from about 40 bytes to a few hundred.

b) I see it occasionally, and wouldn't call it unlikely or remote. I have traceroutes to google.com over the past year; it is unavailable at times.

e) the point is - do the hard work lazily; log quickly and efficiently. Standard operating procedure.

f) no, its not that easy. Appending to the end of a file is very cheap. Finding your end of record marker requires reading the entire file each and every time you append a new record. Append data quickly, post-process once.

If my goal was to maintain uptime data, I would (and do) use apps like smokeping, pingplotter, etc. These are fast, efficient and reliable tools that support multiple routes, graphics, history, etc.

If you're interested in testing your network connection, end your queries at the closest router to you that your ISP controls, or one further hop to their gateway. Since this is the only thing you can fix/complain about, there's little point testing connectivity to some (random) remote site.

Joydeep Bakshi 07-28-2008 05:04 AM

Quote:

Originally Posted by farslayer (Post 3226402)
Couldn't you also use BOTH Internet connections rather than let one sit idle until the other fails ? kind of a waste to have that bandwidth sitting there unused isn't it ?

well, I can understand your question :-) but we have one 8MB connection which we use as our primary internet connection and another 512 KB connection which is a backup connection. If the 8MB connection fails then we change to 512 KB connection. Hence I like to design the script to do this automatic changing. Till now I have learned how to check both the internet connection with the code below

===================================================

while true
do

clear
#******************************************
###########################################
# Interface for gateway1
GET1=eth1
Provider1=Tataindicom
IP1=192.168.1.3

# Interface for gatyeway2
GET2=eth2
Provider2=Airtel
IP2=192.168.0.2
###########################################
#******************************************


echo -e " checking .........."

echo -e "\n Sending heartbit signal to $Provider1\n"

# check Gateway1
#eth1
#HWaddr 00:15:17:62:39:5
#inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0

#traceroute -m 5 -s $IP1 gmail.com
###traceroute -m 5 -i $GET1 gmail.com
ping -I $IP1 gmail.com -w 3 >>/dev/null
net1=$?

echo -e "\n Sending heartbit signal to $Provider2\n"
# check Gateway2

#traceroute -m 5 -s $IP2 gmail.com
###traceroute -m 5 -i $GET2 gmail.com
ping -I $IP2 gmail.com -w 3 >>/dev/null
net2=$?

## Print Gateway status
echo -e "\n\n\n\n\n\n\n\n\n\t ***************************************************"

echo -e "\n\n\n\n\n\t\t `date`"

case $net1 in

0) echo -e "\n\n\n\n\n\t\t $Provider1 is UP";;
1) echo -e "\n\n\n\n\n\t\t $Provider1 is DOWN";;

esac

case $net2 in

0) echo -e "\n\n\n\n\n\t\t $Provider2 is UP";;
1) echo -e "\n\n\n\n\n\t\t $Provider2 is DOWN";;

esac

echo -e "\n\n\n\n"

echo -e "\n\n\n\n\n\n\n\n\n\t ***************************************************"
sleep 120
done
======================================================

The routing part i.e. changigh the default gateway is still pending.
I have gone through the iproute tutorial but have not got any working solution yet :-(

farslayer 07-28-2008 02:35 PM

Ok, well that explains that.. I was picturing more balanced connection speeds :) thanks for the response.

Joydeep Bakshi 07-31-2008 12:40 AM

Could any one suggest any linux console application or shell script to check the internet bandwidth ?

thanks


All times are GMT -5. The time now is 08:11 PM.