Display Red IP Address
[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 GPL/Express installation to display the
IP address of Smoothwall's red interface.
This should work for most Smoothwall configurations, providing your Smoothwall's
red interface obtains a real IP from your ISP.
I've verified that it works with a dial-up modem connection, and with a D-Link DSL300+
ADSL modem.
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.
Screen Shot:
Here's a screen shot of the Smoothwall 0.9.9 GUI (configured for a dialup modem),
showing the red IP address.
Here's a screen shot of the Smoothwall 2 GUI (configured for an ethernet red interface),
showing the red IP address.
Requirements:
You'll need:
-
A Smoothwall GPL 1.0 or Express 2.0 installation (obviously...).
-
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).
Installation Instructions:
Ensure you have SSH enabled on your Smoothwall (it's configured on the
"remote access" page. This is required for logging into your Smoothwall with SSH.
Edit /home/httpd/cgi-bin/index.cgi and immediately
before the line containing
if ($pppsettings{'COMPORT'} ne '')
insert the following
print "</B>\n";
print "<center><font size='2'><br>\n";
# get current IP
$ip = `cat ${swroot}/red/local-ipaddress`;
# check if connected now
if ($ip != '')
{
print "IP: $ip<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 page.
If you also want to show which DNS servers your Smoothwall is using
(typically useful if they are being assigned to your Smoothwall by your ISP via DHCP),
then use the following code instead
(thanks to mloiterman):
print "</B>\n";
print "<center><font size='2'><br>\n";
# get current IP
$ip = `cat ${swroot}/red/local-ipaddress`;
# get current DNS
$dns = `cat ${swroot}/red/dns1 ${swroot}/red/dns2`;
# check if connected now
if ($ip != '')
{
print "IP: $ip<br>\n";
print "DNS: $dns<br>\n";
}
print "</font></center>";
To display your green IP, and orange IP (if configured), use the following code instead:
print "</B>\n";
print "<center><font size='2'><br>\n";
# get current red IP
$ip = `cat ${swroot}/red/local-ipaddress`;
# get current DNS
$dns = `cat ${swroot}/red/dns1 ${swroot}/red/dns2`;
# get green IP
$greenIP = $netsettings{'GREEN_ADDRESS'};
# get orange IP
$orangeIP = $netsettings{'ORANGE_ADDRESS'};
# check if connected now
if ($ip != '')
{
print "red IP: $ip<br>\n";
print "DNS: $dns<br>\n";
}
print "green IP: $greenIP<br>\n";
# check for orange IP
if (length($orangeIP) > 0)
{
print "orange IP: $orangeIP<br>\n";
}
print "</font></center>";
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 9 Apr 2006
|