My adsl-modem looses its NAPT address, making my machine inaccessable from the outside, and I planned having my holidays.. I can detect the address-loss in a cron job, and I can restore it with a telnet session: $ telnet 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 But, being absent when this happens - is there a way to do this from the cron job? -- Wybo
Wybo Dekker wrote:
My adsl-modem looses its NAPT address, making my machine inaccessable from the outside, and I planned having my holidays..
I can detect the address-loss in a cron job, and I can restore it with a telnet session:
$ telnet 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
But, being absent when this happens - is there a way to do this from the cron job?
You should maybe look into the free service of dyndns.org. They provide a list of links for software for linux too. It basicly works like this: You devine a hostname which points to your adsl-modem. Through a cron job you check your ip and when there is a change it updates the ip your hostname is pointing at. That way your box will be accessable through the same hostname from the outside. http://checkip.dyndns.org/ http://www.dyndns.org/ Regards Ulf Rasch
On Monday 04 July 2005 01:58 am, Ulf Rasch wrote:
Wybo Dekker wrote:
My adsl-modem looses its NAPT address, making my machine inaccessable from the outside, and I planned having my holidays..
I can detect the address-loss in a cron job, and I can restore it with a telnet session:
$ telnet 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
But, being absent when this happens - is there a way to do this from the cron job?
You should maybe look into the free service of dyndns.org. They provide a list of links for software for linux too.
It basicly works like this: You devine a hostname which points to your adsl-modem. Through a cron job you check your ip and when there is a change it updates the ip your hostname is pointing at. That way your box will be accessable through the same hostname from the outside.
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. -- _____________________________________ John Andersen
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!!" -- Wybo
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. -- Ken Schneider UNIX since 1989, linux since 1994, SuSE since 1998 "The day Microsoft makes something that doesn't suck is probably the day they start making vacuum cleaners." -Ernst Jan Plugge
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
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!!"
I think it is not enough to ping the modem only but a host outside in the internet. So that there is traffic passing through the modem. Or just as you use wget get the page of google for example. That should reset the counter.
On Mon, 4 Jul 2005, Ulf Rasch wrote:
I think it is not enough to ping the modem only but a host outside in the internet. So that there is traffic passing through the modem. Or just as you use wget get the page of google for example. That should reset the counter.
OK, I added a wget -qO - http://checkip.dyndns.org >/dev/null which gives a very short response. I'll know in a few weeks if it works... Thanks. -- Wybo
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.
One thing Linux users can do, is run this command: lynx --dump "http://checkip.dyndns.org/" Not only does this genereate real web traffic, it also produces the current IP address, which can, if desired, be e-mailed somewhere.
participants (5)
-
James Knott
-
John Andersen
-
Ken Schneider
-
Ulf Rasch
-
Wybo Dekker