[ previous ] [ next ] [ threads ]
 
 From:  "Kim Hartlev" <kam at stofanet dot dk>
 To:  <m0n0wall at lists dot m0n0 dot ch>
 Subject:  Keep alive
 Date:  Wed, 25 Jun 2003 10:31:02 +0200
Hi,
 
I'm using an ISP that only allows 2 hours of idle time - after that you're
logged of the gateway.
 
My old setup:
I started out by pinging my old firewall every 1 hour from an external
machine but this approach didn't help against maintenance on the ISP servers
(They just log you off).
To get arround this I made a small perl script (see below) on the FW that
logged on to the gateway every 1 hour instead. 
 
Are there any easy way to make this kind of keep alive functionality on the
m0n0wall?
The ISP provides both a telnet and web interface for logging on to the
gateway.
 
Regards
Kim
 
# keepalive.pl ip port uri
 
#!/usr/bin/perl
 
use strict;
use Socket;
 
socket(SH, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || die "Error
creating socket\n";
my $dest = sockaddr_in($ARGV[1], inet_aton($ARGV[0]));
connect(SH, $dest) || die "Error connecting\n";
 
select(SH); $| = 1; select(STDOUT);
print SH "GET $ARGV[2] HTTP/1.0\n\n";
while (<SH>) {
   print;
}
close SH;