Display Dialup Connect Speed
[This modification has been verified to work with Smoothwall GPL 1.0 and
Smoothwall Express 2.0.]
This page details how to get your Smoothwall installation to display the
modem dialup connection speed.
If you want your Smoothwall to display the dialup connect speed, the red IP
address, and bytes in/out, have a look at my
Dialup Info Display page.
The connection speed is written to a file each time a dialup connection
is established, and is read from this file each time index.cgi is displayed.
This ensures the connect speed can always be displayed, as previously it
would not be displayed if /var/log/messages rolled over.
Screen Shot:
Here's a screen shot of my Smoothwall GUI, showing the modem dialup connect
speed.
Requirements:
You'll need:
-
A Smoothwall GPL 1.0 or Express 2.0 installation (obviously...).
-
a dial-up internet connection (if you're not on dialup, this page isn't
going to do anything for you ;-)
-
An SCP client (such as WinSCP,
or SSH Secure File Transfer Client, part of
SSH Secure Shell)
for copying files onto your Smoothwall box.
-
A way of getting a command-line prompt on your Smoothwall box
(either by logging directly onto your Smoothwall box,
using a SSH client such as
PuTTY
or SSH Secure Shell,
or via the Smoothwall web interface).
-
The
PPPS script
(download it and rename to ppps, or download from the author's website
here)
and you may need/want
-
my sample iiNet login script (rename to iinetscript)
Installation Instructions:
Ensure you have SSH enabled on your Smoothwall (it's configured on the
"remote access" page. This is required for copying files to your Smoothwall
via SCP, and for logging into your Smoothwall with SSH.
Download and copy ppps into
/usr/local/bin/ and chmod 755
it from a command prompt.
In order to be able to display the modem connect speed, you need to be using a custom login script, and not the "PAP or CHAP" login.
Refer to the login script (iinetscript) I use for my ISP
(iiNet) - it may or may not work for you.
My iinetscript looks like:
ogin: USERNAME
assword: PASSWORD
">" ppp
Note that there are no characters missing from this script (ie, "ogin:"
will match both "Login:" and "login:").
Also, there's no need to hard-code your username and password in this script.
Smoothwall will substitute your actual username and password when establishing the
connection.
Note that some ISPs use different chat prompts (ie, Username:
instead of Login:), so modify the script as required, or
create a new one.
If you're going to use my iinetscript, copy it
into /etc/ppp/
and chmod 644 it from a command prompt.
Modify your Smoothwall dial-up profile to use other login script
and specify iinetscript as the script name.
(This is because a PAP or CHAP login doesn't log
the connect speed to /var/log/messages.)
Edit /etc/ppp/ip-up and immediately after the line
my %pppsettings;
add the following lines:
# get the connect speed
system "/usr/local/bin/ppps | head -n 1 > ${swroot}/red/connectspeed";
This will cause the connect speed to be written to a file called
/var/smoothwall/red/connectspeed each time your
Smoothwall successfully dials and connects.
Now to get your Smoothwall to display this information,
edit /home/httpd/cgi-bin/index.cgi and immediately
after the line containing
print $connstate;
insert the following
print "</B>\n";
print "<center><font size='2'><br>\n";
# get connect speed
$conspeed = `cat ${swroot}/red/connectspeed`;
# check if we have a connect speed
if ($conspeed != '')
{
print "connect speed: $conspeed<br>\n";
}
print "</font></center>";
That should be all that's required - just point your web browser at your smoothie,
and you should see the additional info on the index.cgi once you've redialled.
If you're seeing connect speeds like 115200, rather than the expected 48000 or similar,
your modem is reporting the speed of its serial link, rather than the speed of
the dial-up connection.
To rectify this, you need to add W2 to your modem init string.
In Smoothwall 2.0 beta, just append W2 to the
speaker on or other AT strings shown on the
modem configuration page.
Note that some of the Smoothwall fixes overwrite the index.cgi
with a newer version, so if you install a new fix, it may overwrite your changes,
so always keep a backup copy of your index.cgi before
patching your Smoothie, so you can reapply the changes to the new
index.cgi.
Similarly, when doing a fresh installation of Smoothwall,
only make these changes once you've fully patched the installation.
last updated 19 May 2005
|
|