Estou usando a plataforma portuxG20 sob Angstrom linux. O dispositivo coleta dados e envia para o servidor via rede #g usando o modem 3G. No log do pppd eu encontrei o seguinte:
chat: Aug 05 20:05:23 CONNECT
Serial connection established.
using channel 28
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB_utps_modem
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xb3dc4361> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x6c <asyncmap 0x0> <auth chap MD5> <magic 0x14ad140> <pcomp> <accomp>]
No auth is possible
sent [LCP ConfRej id=0x6c <auth chap MD5>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0xb3dc4361> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x6d <asyncmap 0x0> <magic 0x14ad140> <pcomp> <accomp>]
sent [LCP ConfAck id=0x6d <asyncmap 0x0> <magic 0x14ad140> <pcomp> <accomp>]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
rcvd [LCP DiscReq id=0x6e magic=0x14ad140]
rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
sent [IPCP ConfReq id=0x2 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
rcvd [IPCP ConfNak id=0x2 <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]
sent [IPCP ConfReq id=0x3 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
rcvd [IPCP ConfReq id=0x36]
sent [IPCP ConfNak id=0x36 <addr 0.0.0.0>]
rcvd [IPCP ConfRej id=0x3 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x4 <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns3 10.11.12.14>]
rcvd [IPCP ConfReq id=0x37]
sent [IPCP ConfAck id=0x37]
rcvd [IPCP ConfNak id=0x4 <addr 10.21.23.245> <ms-dns1 10.74.210.210> <ms-dns3 10.74.210.211>]
sent [IPCP ConfReq id=0x5 <addr 10.21.23.245> <ms-dns1 10.74.210.210> <ms-dns3 10.74.210.211>]
rcvd [IPCP ConfAck id=0x5 <addr 10.21.23.245> <ms-dns1 10.74.210.210> <ms-dns3 10.74.210.211>]
Could not determine remote IP address: defaulting to 10.64.64.64
local IP address 10.21.23.245
remote IP address 10.64.64.64
primary DNS address 10.74.210.210
secondary DNS address 10.74.210.211
Script /etc/ppp/ip-up started (pid 8441)
Script /etc/ppp/ip-up finished (pid 8441), status = 0x0
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
rcvd [LCP ProtRej id=0x6f 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
Connect script failed
Terminating on signal 15
Modem hangup
Connection terminated.
Connect script failed
Terminating on signal 15
Modem hangup
Connection terminated.
Connect script failed
Terminating on signal 15
Modem hangup
.
.
.
Após algum tempo, a conexão é estabelecida. Como posso descobrir por que isso está acontecendo e qual foi a causa do problema?
Meu script de provedor é assim:
debug
logfile /home/logs/pppd.log
user "vodafone"
connect "/usr/sbin/chat -v -f /home/scripts/chatscripts/pap"
/dev/ttyUSB_utps_modem
115200
noipdefault
usepeerdns
defaultroute
persist
noauth
Eu tenho um script que verifica se o ping para o servidor ntdp funciona, e se não mata o pppd e faz uma nova chamada (não tenho certeza se esta é a maneira correta para algo assim e talvez isso cause problemas):
#!/bin/bash
source /home/scripts/isconnected
TTY="$(cat /home/scripts/.gsm_plugged)"
SERVER="0.de.pool.ntp.org"
sed s/isconnected=[0-9]/isconnected=0/ -i /home/scripts/isconnected
while [ -c $TTY ]
do
sleep 30
ping -c 10 $SERVER > /dev/null
if [ $? -ne 0 ] ; then
echo "ping failed"
echo "restarting"
pkill pppd
sleep 2
/usr/sbin/pppd call provider
sleep 10
ntpdate -s 0.de.pool.ntp.org
sed s/isconnected=[0-9]/isconnected=0/ -i /home/scripts/isconnected
else
sed s/isconnected=[0-9]/isconnected=1/ -i /home/scripts/isconnected
fi
done