PPP: Connection speed? 

Newsgroups: comp.os.linux.networking
Date: 1998/09/27
>1) I would like to trace my time spent already in the internet :-))
>   during the current session
>
>2) I would also like to trace the current connection speed to my ISP

Below is an awk script I wrote that I use in /etc/ppp/ip-up

####
#script to show connect speed and time
awk '/CONNECT/{ t=$4;s=$6 } END \
{
 print  "Connect    time: " t
 print  "Connect speed: " s
}' /var/log/modem | /usr/X11/bin/xmessage \
-display $HOSTNAME:0.0 -file - -timeout 10
####

Make sure you enter the proper path to your xmessage binary. Mine is /usr/X11/bin/ — yours may differ.

To make this script work you need to modify your chat script to add a report log. The following will work:

chat -v -r /var/log/modem \
 REPORT CONNECT \
 TIMEOUT 45 \
 etc...

This tells chat to report connection information in /var/log/modem. The awk script uses this file to display connection speed and time in a xmessage. The message will disappear after 10 seconds.

Depending on your modem settings, it will either report speed in DTE or DCE speed. DTE speed is the speed at which the PC sends and receives data from the modem and is usually reported as 115,200. DCE speed is the speed at which the modems speak to each other. This speed is usually something less than the maximum advertised modem speed, e.g., 56k or 33.6k. It is the DCE speed that most people are interested in.

If your modem is reporting DTE speed and you want DCE instead, you need to issue an AT command to reset your modem. The command to report DCE speed is usually W2. An easy way to ensure your modem is reporting DCE speed is to add the W2 command in the chat script. For example:

OK ATH0

could be changed to:

OK ATH0W2

Hope this helps.

John Riggs