Automate switching between 2 ADSL accounts from Android?

modprobe

Well-Known Member
Joined
Mar 29, 2009
Messages
140
Reaction score
0
Location
Western Cape
I would be glad if someone can point me in the right direction with the problem I have:

1) I need to automate switching between my two ADSL accounts on the router depending on the time of day.
2) The switching should be initiated from an android device on the same LAN, e.g. an ssh script, telnet or other.

If you use an exisiting solution that is better than what I have in mind, could you share it here?
 
Can you not ssh into the router and change login details then reset? Should be easy to have a terminal script for the android device to execute.
 
Why not run something like PfSense and have that automatically do it for you?

No need to have it done via Android. Otherwise I am sure you can have it automated via a Mikrotik router as well.



I personally make use of PfSense and I love it - it switches between accounts at various times as I need it to. It does a whole lot more for me as well, limits my sisters speed so that I do not lag when she downloads, load balancing, failover etc.

DrJohnZoidberg has done a few guides on this forum - go take a look :)
 
thanks for your reply, agentrfr! it's more or less what I want to do. I can write a shell script, but I am looking for connection creation syntax, etc., as I have never worked with the router adsl and ppp commands. is there perhaps an example somewhere you can point me to?
 
thanks for your reply, agentrfr! it's more or less what I want to do. I can write a shell script, but I am looking for connection creation syntax, etc., as I have never worked with the router adsl and ppp commands. is there perhaps an example somewhere you can point me to?

What router is it? Would it not change depending on the chipset?
 
I have a script that uses Telnet to switch accounts for me on my TP-Link router. It's not a great script but it is working. Will share it when I get home from work.
 
Why not run something like PfSense and have that automatically do it for you?

No need to have it done via Android. Otherwise I am sure you can have it automated via a Mikrotik router as well.



I personally make use of PfSense and I love it - it switches between accounts at various times as I need it to. It does a whole lot more for me as well, limits my sisters speed so that I do not lag when she downloads, load balancing, failover etc.

DrJohnZoidberg has done a few guides on this forum - go take a look :)

thanks for the recommendation, psyclown! I read up on this, and it seems to be a great piece of software. pity, at this stage, i don't think my spare i7 box could be a good candidate. (thinking power consumption and intermittent eskom power cuts:)
 
thanks for your reply, agentrfr! it's more or less what I want to do. I can write a shell script, but I am looking for connection creation syntax, etc., as I have never worked with the router adsl and ppp commands. is there perhaps an example somewhere you can point me to?

Running PFsense it would do the PPPoE switch for you, no scripts required.

You would just use the Router as a Modem and PFsense would do all the routing for you.
 
Some deep stuff going on here.

My netgear router has profiles that you can configure. That's how I swop between my 2 accounts.
 
Running PFsense it would do the PPPoE switch for you, no scripts required.

You would just use the Router as a Modem and PFsense would do all the routing for you.

a solid option, now it seems, SauRoNZA. i will definitely consider it in the future. thank you!
 
Some deep stuff going on here.

My netgear router has profiles that you can configure. That's how I swop between my 2 accounts.

And mine allows me to pre-configure only 1 profile for the same vci/vpi pair :) I think an on-the-fly connection via a scheduled telnet script would be a solution...
 
Last edited:
Sorry for only posting now, last night was quite busy. Here is my script. It's nothing spectacular but it works.

#!/bin/bash

now=$(date +"%H%M")
dayofweek=$(date +"%u")
time1=$(date -d 05:30 +"%H%M")
time2=$(date -d 18:00 +"%H%M")
current='pppoe_8_35_3_d'
other='pppoe_8_35_2_d'

if [ $now -gt $time1 ] && [ $now -lt $time2 ] ; then
current='pppoe_8_35_3_d'
other='pppoe_8_35_2_d'
else
current='pppoe_8_35_2_d'
other='pppoe_8_35_3_d'
fi

if [ "$dayofweek" == 6 ] || [ "$dayofweek" == 7 ] ; then
current='pppoe_8_35_2_d'
other='pppoe_8_35_3_d'
fi

expect << EOF
spawn telnet 192.168.0.1
expect "username:"
sleep 1
send "admin\r"
expect "password:"
sleep 1
send "initpass\r"
sleep 2
expect "*#"
send "wan show defaultgw\r"
sleep 1
expect {
"*$other*" {
send "wan set defaultgw $current\r"
sleep 4
expect "cmd:SUCC"
}
}

send "logout"
exit


EOF

curl -L -o /dev/null http://www.unotelly.com/unodns/auto_auth/hash_update/updateip.php?user_hash=
 
Sorry for only posting now, last night was quite busy. Here is my script. It's nothing spectacular but it works.

I really appreciate you posting this. Thank you so much.

From these lines (current='pppoe_8_35_2_d'; other='pppoe_8_35_3_d') it appears that you have pre-configured the connection profiles on the router. I am still to figure out this on mine, as it stupidly seems to allow only one (despite its claims to support up to 8 - maybe someone had success with that on dlink 2750u?..)

If that fails, I'll try to expand the script to create an on-the-fly connection.
 
Yes those connections are pre-configured. I have no idea how you do that with a Dlink 2750u but it should support it. I have a really old Dlink router and that one supported it.
 
Top
Sign up to the MyBroadband newsletter
X