Automatically run dial-up connection if DSL stops
Moderator: DosItHelp
-
- Posts: 12
- Joined: 25 Oct 2012 08:44
Automatically run dial-up connection if DSL stops
Hello gentlemen,
I need to setup a dial-up connection to automatically starts with no interaction with the user when the DSL stops.
My computer is connected to a router, which is responsible to establish the DSL connection with the ISP.
I don't use the internet connection to navigate on the web, I'm not using a browser.
I have an application running on the background which needs the internet connection.
I'm trying to build a script that would ping an external website (i.e. www.google.com) and IF the ping is not successfull, it will trigger the dial-up connection.
Is this the best way to go?
Can anyone give me a suggestion?
Thanks a lot!
I need to setup a dial-up connection to automatically starts with no interaction with the user when the DSL stops.
My computer is connected to a router, which is responsible to establish the DSL connection with the ISP.
I don't use the internet connection to navigate on the web, I'm not using a browser.
I have an application running on the background which needs the internet connection.
I'm trying to build a script that would ping an external website (i.e. www.google.com) and IF the ping is not successfull, it will trigger the dial-up connection.
Is this the best way to go?
Can anyone give me a suggestion?
Thanks a lot!
Re: Automatically run dial-up connection if DSL stops
ping the google website and post the message that appear when there is no connection like does it display time out or Destination host unreachable. or something like that.
ping using this command:
ping using this command:
Code: Select all
ping www.google.com -n 1 -l 1
-
- Posts: 12
- Joined: 25 Oct 2012 08:44
Re: Automatically run dial-up connection if DSL stops
C:\Users\reggie>ping www.google.com -n 1 -l 1
Pinging www.google.com [173.194.37.82] with 1 bytes of data:
Request timed out.
Ping statistics for 173.194.37.82:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
Pinging www.google.com [173.194.37.82] with 1 bytes of data:
Request timed out.
Ping statistics for 173.194.37.82:
Packets: Sent = 1, Received = 0, Lost = 1 (100% loss),
Re: Automatically run dial-up connection if DSL stops
what windows do you use ? XP or 7
-
- Posts: 12
- Joined: 25 Oct 2012 08:44
Re: Automatically run dial-up connection if DSL stops
abc0502 wrote:what windows do you use ? XP or 7
I use Windows 7
Re: Automatically run dial-up connection if DSL stops
can you run this command in your cmd and till me the number that show in the begining of the line,
i'm trying to make my network show the same error but i can't
i'm trying to make my network show the same error but i can't
Code: Select all
For /F "tokens=* delims=" %a in ('Ping www.google.com -n 1 -l 1 ^|Findstr /I /N /C:" Request timed out."') Do echo %a
-
- Posts: 12
- Joined: 25 Oct 2012 08:44
Re: Automatically run dial-up connection if DSL stops
abc0502 wrote:can you run this command in your cmd and till me the number that show in the begining of the line,
i'm trying to make my network show the same error but i can'tCode: Select all
For /F "tokens=* delims=" %a in ('Ping www.google.com -n 1 -l 1 ^|Findstr /I /N /C:" Request timed out."') Do echo %a
It does not show anything when I run this command
Re: Automatically run dial-up connection if DSL stops
sorry, try this now:
try it using a batch
Code: Select all
For /F "tokens=* delims=" %%a in ('Ping www.google.com -n 1 -l 1 ^|Findstr /I /N /C:"Request timed out."') Do echo %%a
try it using a batch
-
- Posts: 12
- Joined: 25 Oct 2012 08:44
Re: Automatically run dial-up connection if DSL stops
abc0502 wrote:sorry, try this now:Code: Select all
For /F "tokens=* delims=" %%a in ('Ping www.google.com -n 1 -l 1 ^|Findstr /I /N /C:"Request timed out."') Do echo %%a
try it using a batch
This is what I got:
C:\Users\reggie>echo 3:Request timed out.
3:Request timed out.
Re: Automatically run dial-up connection if DSL stops
Ok that's what i have till now,
the batch check every 60 sec the connection, when it find that the out put of the ping command is Request timeout. it will go to the dail label where it will connect to the internet through the dail-up
if it didn't find the word it will go to the loop label where it will wait for another 60 sec and then check again
the problem now i never used a dail up connection so i don't know how to start the connection.
i found these to article, here and here
so try this commands
first get the name of the connection that uses the dsl and the dail
and try disconnecting the dsl like this:
and do the same to the dail-up
then try to connect to dsl and dail by this:
Code: Select all
@echo off & Color 0c
:loop
:: Check every 60 seconds
Ping localhost -n 60 >nul
setlocal enabledelayedexpansion
For /F "tokens=* delims=:" %%a in ('Ping www.google.com -n 1 -l 1 ^|Findstr /I /N /C:"Request"') Do set "out=%%a"
IF "%out:~0,1%" equ "3" ( Goto Dail
) Else ( Goto loop )
:Dail
echo dail-up
pause
Exit /B
the batch check every 60 sec the connection, when it find that the out put of the ping command is Request timeout. it will go to the dail label where it will connect to the internet through the dail-up
if it didn't find the word it will go to the loop label where it will wait for another 60 sec and then check again
the problem now i never used a dail up connection so i don't know how to start the connection.
i found these to article, here and here
so try this commands
first get the name of the connection that uses the dsl and the dail
and try disconnecting the dsl like this:
Code: Select all
rasdial <dsl_connection_name> /disconnect
and do the same to the dail-up
then try to connect to dsl and dail by this:
Code: Select all
rasdial <dsl_connection_name> <user_name> <password>
-
- Posts: 12
- Joined: 25 Oct 2012 08:44
Re: Automatically run dial-up connection if DSL stops
abc0502 wrote:Ok that's what i have till now,Code: Select all
@echo off & Color 0c
:loop
:: Check every 60 seconds
Ping localhost -n 60 >nul
setlocal enabledelayedexpansion
For /F "tokens=* delims=:" %%a in ('Ping www.google.com -n 1 -l 1 ^|Findstr /I /N /C:"Request"') Do set "out=%%a"
IF "%out:~0,1%" equ "3" ( Goto Dail
) Else ( Goto loop )
:Dail
echo dail-up
pause
Exit /B
the batch check every 60 sec the connection, when it find that the out put of the ping command is Request timeout. it will go to the dail label where it will connect to the internet through the dail-up
if it didn't find the word it will go to the loop label where it will wait for another 60 sec and then check again
the problem now i never used a dail up connection so i don't know how to start the connection.
i found these to article, here and here
so try this commands
first get the name of the connection that uses the dsl and the dail
and try disconnecting the dsl like this:Code: Select all
rasdial <dsl_connection_name> /disconnect
and do the same to the dail-up
then try to connect to dsl and dail by this:Code: Select all
rasdial <dsl_connection_name> <user_name> <password>
We could connect to the dial-up by calling up another batch with the rasdial syntax.
How would the batch be then if we want to call this other batch (i.e. dial.bat) when the ping fails?
Re: Automatically run dial-up connection if DSL stops
you understand me wrong, we can add the connecing code under the dail label, but first test this command in your pc to see if they work or not
disconnect dsl
connect dail-up
if they work with you we will put them under the dail label in the above batch
disconnect dsl
Code: Select all
rasdial <dsl_connection_name> /disconnect
connect dail-up
Code: Select all
rasdial <dail_connection_name> <user_name> <password>
if they work with you we will put them under the dail label in the above batch
-
- Posts: 12
- Joined: 25 Oct 2012 08:44
Re: Automatically run dial-up connection if DSL stops
abc0502 wrote:you understand me wrong, we can add the connecing code under the dail label, but first test this command in your pc to see if they work or not
disconnect dslCode: Select all
rasdial <dsl_connection_name> /disconnect
connect dail-upCode: Select all
rasdial <dail_connection_name> <user_name> <password>
if they work with you we will put them under the dail label in the above batch
Ok, they actually work.
I've tried them before.
On my scenario, I don't need to disconnect the DSL because this connection is being handled by a router on the network.
What I just need is really to dial-up whenever the ping fails.
Thank you!
Re: Automatically run dial-up connection if DSL stops
Then this should work, give it a try
Replace the <dail_connection_name>, <user_name> and <password> with the real information between double quotes like "password" and the rest
Code: Select all
@echo off & Color 0c
:loop
:: Check every 60 seconds
Ping localhost -n 60 >nul
setlocal enabledelayedexpansion
For /F "tokens=* delims=:" %%a in ('Ping www.google.com -n 1 -l 1 ^|Findstr /I /N /C:"Request"') Do set "out=%%a"
IF "%out:~0,1%" equ "3" ( Goto Dail
) Else ( Goto loop )
:Dail
rasdial <dail_connection_name> <user_name> <password>
Exit /B
Replace the <dail_connection_name>, <user_name> and <password> with the real information between double quotes like "password" and the rest
-
- Posts: 12
- Joined: 25 Oct 2012 08:44
Re: Automatically run dial-up connection if DSL stops
abc0502 wrote:Then this should work, give it a tryCode: Select all
@echo off & Color 0c
:loop
:: Check every 60 seconds
Ping localhost -n 60 >nul
setlocal enabledelayedexpansion
For /F "tokens=* delims=:" %%a in ('Ping www.google.com -n 1 -l 1 ^|Findstr /I /N /C:"Request"') Do set "out=%%a"
IF "%out:~0,1%" equ "3" ( Goto Dail
) Else ( Goto loop )
:Dail
rasdial <dail_connection_name> <user_name> <password>
Exit /B
Replace the <dail_connection_name>, <user_name> and <password> with the real information between double quotes like "password" and the rest
It didn't work now because I got a different error message when trying to ping www.google.com
Code: Select all
C:\Users\reggie>ping www.google.com
Ping request could not find host www.google.com. Please check the name and try a
gain.