LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 11-17-2011, 09:43 AM   #1
San123
LQ Newbie
 
Registered: Nov 2011
Posts: 21

Rep: Reputation: Disabled
How to get multiple ISP's speed for every 5 seconds?


I'm using Ubuntu 11.04 server Ed., with 4 port NIC card in which three ISP's (Internet Service providers) provisioned at different band width were connected to 3 ports and 4th port is get connected to internal LAN.
I want to know 3 ISP's speed for every 5 seconds.
Is there any kernel space program for this to disply the message in user space?
Can someone please help in this regard.
 
Old 11-17-2011, 12:37 PM   #2
jthill
Member
 
Registered: Mar 2010
Distribution: Arch
Posts: 211

Rep: Reputation: 67
Do you mean you want the data rate through each interface? Here's a really, truly brute-force solution, nearly fingers-to-keyboard so do make it your own.
Code:
IFACES="eth0 eth1 eth2 eth3"
start=`date +%s.%N`
for iface in $IFACES; do
    let `ifconfig $iface | sed -nr 's/.*X bytes:([0-9]+).*X bytes:([0-9]+).*/'$iface'=\1+\2/gp'`
done
while true; do
    sleep 5
    now=`date +%s.%N`
    statline=''
    for iface in $IFACES; do
        let new=`ifconfig $iface | sed -nr 's/.*X bytes:([0-9]+).*X bytes:([0-9]+).*/\1+\2/gp'`
        statline="$statline `dc -e '4k['$iface':]n '$new' '$(($iface))'- '$now' '$start'-/n [b/s]p'`"
        let $iface=$new
    done
    start=$now
    echo $statline
done
 
Old 11-17-2011, 01:25 PM   #3
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
If you just need the ping times, fping can do it
Code:
fping -l -p 5000 www.isp1.com smtp.isp2.co.gh isp3.co.zw
 
Old 11-17-2011, 11:17 PM   #4
San123
LQ Newbie
 
Registered: Nov 2011
Posts: 21

Original Poster
Rep: Reputation: Disabled
Hi jthill...
Ya I want data rate through each interface.
Is the code given by you is kernel space program?
I'm new to kernel drivers programming.
If possible can you please elaborate this.
Thanks for your help....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ISP speed calculation rhine2 Linux - Newbie 2 10-11-2009 08:20 PM
speed + for same isp please Linux - Networking 2 07-21-2009 05:13 AM
One Cable One Wifi isp how to combine for speed on fedora core 5 zonemikel Linux - Wireless Networking 6 08-16-2006 10:50 PM
home isp speed linuxhippy Slackware 2 09-01-2005 12:37 PM
Multiple-OS-supported PCMCIA NIC works for a few seconds, then quits onu Linux - Laptop and Netbook 6 02-05-2004 12:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration