vinuthomas.com
Toggle Content .:: Home :: Community Forums :: Image Gallery :: Blogs :: My Account ::. Toggle Content

Menu[x]
 Home Community Members options Forums Tools
 My Tech Blog
 Tutorials

Ads[x]

News Feed[x]
Get our RSS/XML News Feed Here
News & Articles:
RSS Feed
Latest @ the Forums:
RSS Feed

Discussion Forum >> BSNL Dataone >> BSNL DataOne: Software >> Schedule router disconnect and dial in Linux and Windows

Schedule router disconnect and dial in Linux and Windows
Software Configuration, Monitoring Software, Recomended Software
Go to page 1, 2  Next
Forum Index >> BSNL DataOne: Software
Post new topic   Reply to topic   Printer Friendly Page View previous topic { View newer topic }
Author Message
noobiont
Where's my Signal?
Where's my Signal?


Joined: October 14 2006
Posts: 18
Location: Chennai

PostPosted: Sun Mar 04, 2007 4:58 am    Post subject: Schedule router disconnect and dial in Linux and Windows Reply with quote

Here is a method you can use to make 100 % sure that you don't get over billed for night time usage plan like HOME500.
This procedure assumes that your router/modem is connected to one Ethernet card in your machine.

This was tested on SmartAX MT882 Router, Windows XP, and Ubuntu Edgy.

For Linux (Ubuntu Edgy Eft)

1 RECOMMENDED:- configure your modem to autodial
2 install expect
3 install kalarm in gnome or KDE if it is not already installed, and make sure it run at startup or add the daemon to sessions
4 RECOMMENDED:- Disable internet time server updates (NTP)
sudo update-rc.d ntp-server remove
5 create a file router.exp with the following contents
Code:

#!/usr/bin/expect -f

set timeout 20
set echo  off

# router user name
set name admin

# router password
set pass admin

# your router IP address
set routerip 192.168.1.1

# Read command as arguments to this script

set switch [ lrange $argv 0 1]

if {$switch == "" } {send_user "usage:\n\trouter ON\n\trouter OFF\n\trouter validcommand\n\n"
exit
} else {

   if {$switch == "ON"} {set routercmd "pppoe set transport 1 autoconnect enabled\r"
   } else {
   if {$switch == "on"} {set routercmd "pppoe set transport 1 autoconnect enabled\r"
   } else {
   if {$switch == "OFF"} {set routercmd "pppoe set transport 1 disabled\r"
   } else {
   if {$switch == "off"} {set routercmd "pppoe set transport 1 disabled\r"
   } else {
   set switch [ lrange $argv 0 9]
   set routercmd "$switch\r"
   }}}}
   
}

send_user "sending router:- $switch \n"

#other useful commands
# set routercmd "pppoe list transports\r"
# set routercmd "pppoe show transport 1\r"
# set routercmd "pppoe list transports\r"

# start telnet
spawn telnet $routerip

# send username & password
expect "Login: "
send "$name\r"
expect "Password: "
send "$pass\r"
expect -i "--> "
send $routercmd
send '^]'
expect "telnet> "
send "close\r"
send_user "\nDone!\n"
exit

6. Enter your router IP, router username, router password in the script
NOTE:(if you have some other router change the script to respond according to the menu that you get while you telnet your router)

7. Schedule the following commands in kalarm to run in terminal
Code:
/your_script_location/./router.exp OFF
1:50am and 7:50am ( or fancy your time ! )
Code:
/your_script_location/./router.exp ON
2:10am ( or fancy your time ! )
! be careful with the schedules and make sure that you test it

For Windows XP

This method is safer than using a dialer like the one in DAP because in XP there is a good probability that things can crash.

1) RECOMMENDED:- configure your modem to autodial
2) download TS10 from www.winsite.com/bin/In...0000000873
3) create two text files

enable.txt

Code:
192.168.1.1
WAIT "Login: "
SEND "admin\m"
WAIT "Password: "
SEND "admin\m"
WAIT "--> "
SEND "pppoe set transport 1 autoconnect enabled\m"

disable.txt

Code:
192.168.1.1
WAIT "Login: "
SEND "admin\m"
WAIT "Password: "
SEND "admin\m"
WAIT "--> "
SEND "pppoe set transport 1 disabled\m"


4) create two .bat files (open notepad and save as "routerON.bat" and "routerOFF.bat")
with the following contents

routerON.bat
Code:
chdir C:\RouterSwitch
c:
TST10 /r:enable.txt /o:last_log.txt

routerOFF.bat
Code:
chdir C:\RouterSwitch
c:
TST10 /r:disable.txt /o:last_log.txt
5) Create an empty file called last_log.txt to diagnose output of the last run script.Save all the files TST10.exe,enable.txt,disable.txt,routerON.bat,routerOFF.bat
in C:\RouterSwitch

6) schedule the routerOFF.bat to run 1:50am and 7:50am (! or fancy your time )
schedule the routerON.bat to run 2:10am (! or fancy ur time )

7) RECOMMENDED :- to shutdown your computer you don't need to trust a third party app , forced shutdown is probably more successful in different conditions
to do that create a file shut.bat with the following line

Code:
shutdown -f -s -t 30
and schedule to run at your time
this will display a 30 sec warning to all users logged in to your computer

(make sure that u run the scripts once, and test it and make sure your firewall and/or anti virus remembers the settings)

For dynamic IP users (eg-HOME500)
whenever you wanna change your external IP,
(that is disconnect and reconnect)
when autodial is enabled in router you dont need to reach for router switch.
Just run this at terminal or command prompt
Quote:
in linux

./router.exp OFF
./router.exp ON

in windows

routerOFF
routerON

Exclamation [NOTE:- in case of power failure or modem restart, you will still be in automatically connected after disconnected by routerOFF.bat in windows
or ./router.exp OFF in linux]


Very Happy
A worst case scenario:
just a good UPS will save you

router OFF at 7:55am (BSNL TIME Twisted Evil )
PC shutdown at 7:56am (BSNL TIME )
power fluctuation or modem restart at 7:57am (BSNL TIME ) Question
modem has LAN link even after PC shutdown Question
your router gets auto connected Exclamation

You will be charged for Question



router.zip
 Description:
Linux (expect script)
 Filename:  router.zip
 Filesize:  576 Bytes
 Downloaded:  417 Time(s)

routerswitch.zip
 Description:
For Windows XP
 Filename:  routerswitch.zip
 Filesize:  191.21 KB
 Downloaded:  1020 Time(s)
Back to top View user's profile Visit poster's website MSN Messenger Yahoo Messenger
jholman
Where's my Signal?
Where's my Signal?


Joined: April 17 2007
Posts: 1

PostPosted: Wed Apr 18, 2007 3:26 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

Hi, thanks for the post, hope I had discovered it few days back. Anyway I was trying what you said with my WA3002-g1 router, but the pppoe command is not present. Do I need to enable it in the router configuration?

Also How would I find if the ID is 1 or something else?

Cheers
Back to top View user's profile
noobiont
Where's my Signal?
Where's my Signal?


Joined: October 14 2006
Posts: 18
Location: Chennai

PostPosted: Wed Apr 18, 2007 3:14 pm    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

reset your router. there must be a reset button somewhere in your model.

telnet [your_router_gateway_ip]

usually gateway is 192.168.1.1 and username and password is admin admin
this is what you should get

Quote:
telnet 192.168.1.1
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.

Login: admin
Password: *****

Login successful

--> help


type help or ? which might give you list of commands.
read the manual !
you should be able to figure out your command for disconnect and connect

this is what i get when i try my wired router, your's is a wireless router and also things might look diff, but I think what I wrote is possible in your case too, i never tried using a wireless router.
Quote:


ATMOS CLI Help
--------------

Within the CLI, the following functions can be used:

* Hitting ? halfway through a word shows all valid completions of that prefix
* Hitting ? after a word shows a list of the words that can follow it
* Hitting TAB halfway through a word completes it, if it is unique
* The UP and DOWN cursor keys move back and forward through the command history
* LEFT and RIGHT cursor keys can be used for line-editing, and CTRL+A and
CTRL+E move the cursor to the start and end of the line respectively

Pressing ? at the top-level prompt will display a list of the command groups
available. Typing one followed by a space and then hitting ? will show the
subcommands within that group, and so on.


--> ?
agent Get a file from a remote host
bridge Configure layer 2 bridge
console Old console access
ddns
dhcpclient DHCP client configuration commands
dhcpserver DHCP server configuration commands
diagnosticTest
dnsclient DNS client configuration commands
dnsrelay DNS relay configuration
ethernet Commands to configure ethernet transports
firewall Firewall configuration commands
help Top level CLI help
igmp
imdebug Directly access the information model
ip Configure IP router
ipoa IP over ATM configuration
logger Log to a remote host using syslog
nat NAT configuration commands
oam
port Physical port configuration commands
pppoa PPP over ATM configuration
pppoe
rfc1483 Commands to configure RFC1483 transports
security Security configuration commands not specific to NAT or firewall
sntpclient
source Read a file of commands
system System administration commands
transports Transport configuration commands
user User commands
webserver Webserver configuration commands

note down the prompt and escape character in your case, mine as u can see is "--> "
and escape character is '^]'
and also both the commands by navigating thru your menu

As I am not very good at networking, I may not be able to help u if u r not able to telnet ur router and also if any advanced router configurations are needed in your case.

_________________
"Life is pain, anyone who says differently is selling something."

|
ASUS A8NVM-CSM, AMD64 3200+, 2GB RAM, 200GB SATA, 80GB USB External ATA HDD, 40GB PATA HDD
|
Compaq Presario Laptop MT2512AU, DDR2 768MB RAM, 80GB PATA HDD
|
Intel 810, PIII 550E, 320MB SD RAM, 40GB PATA HDD + 8GB PATA HDD
|

Agios, Athanatos, Ischyros.

"There are only 10 types of people in this world, those who understand binary and those who dont."
Back to top View user's profile Visit poster's website MSN Messenger Yahoo Messenger
harigokul
Where's my Signal?
Where's my Signal?


Joined: June 20 2006
Posts: 17

PostPosted: Tue Jun 05, 2007 8:03 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

thx
nice instructions u r gven here
very useful thx once again
keep it up
Back to top View user's profile
ashishrs
Can I use the phone?
Can I use the phone?


Joined: August 19 2006
Posts: 218

PostPosted: Tue Jun 05, 2007 8:40 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

Moderators make this post sticky!
Back to top View user's profile
phoenix
Moderator
Moderator


Joined: May 26 2006
Posts: 2091
Location: Bangalore

PostPosted: Tue Jun 05, 2007 8:45 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

yes .. made this post sticky Smile

_________________


Back to top View user's profile
santhosh44
Where's my Signal?
Where's my Signal?


Joined: September 25 2006
Posts: 15

PostPosted: Mon Jun 18, 2007 9:15 pm    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

wa 1003a users , plz check the following thread.. u need to use the 'kill' command for restarting the router.

vinuthomas.com/Forums/...75124.html

thanks to nktrox Smile
Back to top View user's profile
ratulinfo
Where's my Signal?
Where's my Signal?


Joined: August 06 2007
Posts: 19

PostPosted: Tue Aug 07, 2007 7:24 am    Post subject: Re: Schedule router disconnect and dial in Windows XP Reply with quote

I want the procedure to auto login t Data1 using my modem Huwawei SmartAX MT 882. Kindly explain in detail ......
Thanks
Back to top View user's profile
math_1048
Where's my Signal?
Where's my Signal?


Joined: March 26 2006
Posts: 15

PostPosted: Sun Nov 25, 2007 5:57 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

dear noobiont
thank you very much for this tutorial
I have huawei mt800 adsl modem
but the command
SEND "pppoe set transport 1 autoconnect enabled\m"
dont work with it I test it with normal telnet too, but no respond from the modem and doesnt exist message appear
are there specific command can do that for mt800,
thanks
best regards
Back to top View user's profile
rforums
Where's my Signal?
Where's my Signal?


Joined: October 27 2006
Posts: 2

PostPosted: Sun Nov 25, 2007 11:15 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

@math_1048

Huawei users can try this:
after reaching this -->
Code:
SEND "console enable\m"
SEND "restart\m"
Back to top View user's profile
math_1048
Where's my Signal?
Where's my Signal?


Joined: March 26 2006
Posts: 15

PostPosted: Sun Nov 25, 2007 2:17 pm    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

Thank you dear rforums for hrlp
I try the command but doesnt work
I think I have old firmware or some thing
because when I press help or ? at console
I just get those commands

Code:
$help
Command        Description
-------        -----------
alias          To Alias a command
apply          Apply configuration/image file
commit         Commit the active config to the flash
create         Create a new entry of specified type
delete         Delete the specified entry
download       Download a file on to the Device
exit           To exit the CLI shell
get            Display info for the search
help           Provides help
list           List files
modify         Modify information for specified entry
passwd         To modify user password
ping           The normal ping command
prompt         Change the user prompt
reboot         Reboot the device
remove         Remove file
reset          Reset info for the specified entry
size           ATM Sizing Information
traceroute     The normal traceroute command
trigger        To set trigger
unalias        To undefine previously defined alias
verbose        Switch ON/OFF the verbose mode

theres no pppoe/pppoa commands
or theres no restart command
thank you very much
Back to top View user's profile
krishnan
Half way there
Half way there


Joined: August 28 2006
Posts: 781
Location: Chennai

PostPosted: Mon Nov 26, 2007 12:37 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

try reboot command , instead of reset

_________________
picasaweb.google.com/b.jayakrishnan
Back to top View user's profile
math_1048
Where's my Signal?
Where's my Signal?


Joined: March 26 2006
Posts: 15

PostPosted: Mon Nov 26, 2007 2:23 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

Dear krishnan
yes reboot command are work fine
but I instead of rebooting, are there disable/enable ppp connection command can use because
I fear many reboot command can crash device ?I dont know!
explain: I schedule the downloads from rapishare/IP checkers sites to run the script after download a file, so continue to next file and so on,
so many reboot will happen.
I try with command modify , but there no help how to use it
thank you very much
Back to top View user's profile
chiru
Need a signal boost
Need a signal boost


Joined: January 12 2007
Posts: 56

PostPosted: Mon Nov 26, 2007 9:42 am    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

I'm unable to telnet into my own modem. I've enabled telnet service on my system and also in the modem. I'm on H500 NETGEAR adsl modem
Back to top View user's profile Visit poster's website
santosh66
Where's my Signal?
Where's my Signal?


Joined: December 09 2007
Posts: 1

PostPosted: Sun Dec 09, 2007 2:03 pm    Post subject: Re: Schedule router disconnect and dial in Linux and Windows Reply with quote

thanks.. u rescued my sleep Smile
Back to top View user's profile
Display posts from previous:   
Post new topic   Reply to topic   Printer Friendly Page     Forum Index -> BSNL DataOne: Software All times are GMT + 5.5 Hours
Go to page 1, 2  Next
Page 1 of 2


Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Site Search[x]

Login[x]
Welcome Guest

Nickname

At The Forum[x]
Last 10 Forum Messages

BSNL broadband flaky connection / cycling connect-disconnect
Last post by raviagrawal in BSNL Dataone on Jul 31, 2010 at 09:30:44

need suggestions about buying mp3 player
Last post by pradeep in General Hardware Discussions on Jul 30, 2010 at 06:44:14

meghbela broadband
Last post by partha_777 in Other DSL Broaband Services on Jul 28, 2010 at 13:07:40

I get Error:691 invalid username and password
Last post by narayanasparta in BSNL Dataone on Jul 28, 2010 at 05:23:13


Uncapping bsnl limit?
Last post by din4204u in BSNL DataOne: Hardware on Jul 27, 2010 at 15:30:39

Olive Pad VT100 - Indian Android tablet
Last post by pradeep in General Hardware Discussions on Jul 26, 2010 at 04:33:30

does anyone know where to get a black rose?
Last post by pitamm in The Lounge on Jul 25, 2010 at 04:32:08

Internet connection problem - it only connects in battery
Last post by pitamm in BSNL DataOne: Plans / Services / Billing on Jul 25, 2010 at 04:29:46

Slooowww connection...
Last post by d11dmb in BSNL Dataone on Jul 24, 2010 at 09:03:36

BSNL Broadband Users
Last post by raviagrawal in BSNL Dataone on Jul 23, 2010 at 14:10:28




All logos and trademarks and articles on this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2000-2008 Vinu Thomas

 
Interactive software released under GNU GPL, Code Credits, Privacy Policy