On Mon, 4 Jul 2005, Ken Schneider wrote:
On Mon, 2005-07-04 at 13:11 +0200, Wybo Dekker wrote:
On Mon, 4 Jul 2005, John Andersen wrote:
I read his problem as being the fact that an unused ADSL connection will drop, and without some activity from the Inside, it will stay down.
He either needs to keep it up, or restart it periodically.
I had the same problem with a remote computer, and found that one ping every 3 minutes would keep it alive.
man ping
Set interval for 180 seconds, or run ping c1 from a cron job. I also found that setting -Q 4 necessary as ISPs are on to the ping trick and in many cases do not consider pings as an in-use connection and will drop you anyway.
Do you mean a ping to the modem? If so, I do already a wget to it every minute, in order to warn myself :
wget -mq -O - --http-user=wybo --http-passwd=my_password \ http://10.0.0.138/cgi/nat/* | grep 'There are no NAPT entries defined' >/dev/null && xmessage "Port 80 unreachable!!"
You might also look into using an expect program program. Expect is used running a script that would usually require an interactive session. When i was working I used it quite often to connect to Cisco routers for wide spread config changes when many, 50 +, routers needed changes. Should work very well for what you want to do. The docs have many examples.
That worked, thanks! It's even extremely simple: 1. make a script with autoexpect: $ autoexpect telnet 10.0.0.138 autoexpect started, file is script.exp Trying 10.0.0.138... Connected to 10.0.0.138. Escape character is '^]'. Username : wybo Password : ****** =>nat create protocol=tcp outside_addr=84.84.54.213 outside_port=80 \ inside_addr=10.0.0.150 inside_port=80 =>exit Connection closed by foreign host. autoexpect done, file is script.exp $ 2. After this, the whole session can be repeated with: $ expect script.exp -- Wybo