Script para configurar Vivo 3G sem pppconfig e wvdial
Publicado por Francisco Raimundo da Silva (última atualização em 01/03/2012)
[ Hits: 13.228 ]
Homepage: http://www.facebook.com/profile.php?id=100003055572272
Este script cria uma configuração funcional para a conexão banda larga móvel 'Vivo 3G'. Foi criada na distro Aptosid e testada em livecd do Toorox (baseado no Gentoo), Chakra (baseado no Arch).
É necessário que a distro tenha somente o pacote 'ppp' instalado. Podem usar e modificar a vontade. Após rodar o script, rode como root ou usando o sudo:
# pon vivo
Para sair da conexão
# poff -a
Bom proveito!
#!/bin/sh -v
# Script criado por Francisco Raimundo da Silva
# Este script configura sua conexão 3G da Vivo
# especificamente para o modem ZTE MF110.
# Caso necessário modifique e adapte conforme
# suas necessidades!
echo "Criação de backups"
# echo "Fazendo backup de /etc/wvdial.conf"
# cp -fv /etc/wvdial.conf /etc/wvdial.conf-`date +%d%m%Y-%T`
#if [ -f "/etc/wvdial.conf" ]
# then
# cp -fv /etc/wvdial.conf /etc/wvdial.conf-`date +%d%m%Y-%T`;
# else
# exit 0;
#fi
echo "Fazendo backup de /etc/ppp/options"
if [ -f "/etc/ppp/options" ]
then
cp -fv /etc/ppp/options /etc/ppp/options-`date +%d%m%Y-%T`;
else
exit 0;
fi
#echo "Fazendo backup de /etc/resolv.conf"
#
#if [ -f "/etc/resolv.conf" ]
# then
# cp -fv /etc/resolv.conf /etc/resolv.conf-`date +%d%m%Y-%T`;
# else
# exit 0;
#fi
echo "Fazendo backup de /etc/modules"
if [ -f "/etc/modules" ]
then
cp -fv /etc/modules /etc/modules-`date +%d%m%Y-%T`;
else
exit 0;
fi
# Verifica se o diretório /etc/chatscripts existe
if [ -d "/etc/chatscripts" ]
then
echo "O diretório /etc/chatscripts existe!!!"
else
mkdir -p /etc/chatscripts
fi
echo "Início da configuração"
echo "
# This chatfile was generated by pppconfig 2.3.18.
# Please do not delete any of the comments. Pppconfig needs them.
#
# ispauth PAP
# abortstring
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED
# modeminit
'' ATZ
# ispnumber
OK-AT-OK "ATDP*99#"
# ispconnect
CONNECT \d\c
# prelogin
# ispname
# isppassword
# postlogin
# end of pppconfig stuff
" > /etc/chatscripts/vivo
echo "
#
# /etc/ppp/pap-secrets
#
# This is a pap-secrets file to be used with the AUTO_PPP function of
# mgetty. mgetty-0.99 is preconfigured to startup pppd with the login option
# which will cause pppd to consult /etc/passwd (and /etc/shadow in turn)
# after a user has passed this file. Don't be disturbed therefore by the fact
# that this file defines logins with any password for users. /etc/passwd
# (again, /etc/shadow, too) will catch passwd mismatches.
#
# This file should block ALL users that should not be able to do AUTO_PPP.
# AUTO_PPP bypasses the usual login program so it's necessary to list all
# system userids with regular passwords here.
#
# ATTENTION: The definitions here can allow users to login without a
# password if you don't use the login option of pppd! The mgetty Debian
# package already provides this option; make sure you don't change that.
# INBOUND connections
# Every regular user can use PPP and has to use passwords from /etc/passwd
* hostname "" *
# UserIDs that cannot use PPP at all. Check your /etc/passwd and add any
# other accounts that should not be able to use pppd!
guest hostname "*" -
master hostname "*" -
root hostname "*" -
support hostname "*" -
stats hostname "*" -
# OUTBOUND connections
# Here you should add your userid password to connect to your providers via
# PAP. The * means that the password is to be used for ANY host you connect
# to. Thus you do not have to worry about the foreign machine name. Just
# replace password with your password.
# If you have different providers with different passwords then you better
# remove the following line.
# * password
"vivo" vivo "vivo"
" > /etc/ppp/pap-secrets
echo "
# This optionfile was generated by pppconfig 2.3.18.
#
#
hide-password
noauth
connect '/usr/sbin/chat -v -f /etc/chatscripts/vivo'
debug
/dev/ttyUSB2
115200
defaultroute
noipdefault
user "vivo"
remotename vivo
ipparam vivo
persist
usepeerdns
" > /etc/ppp/peers/vivo
# Verifica se /etc/ppp/resolv existe, caso contrário o cria
if [ -d "/etc/ppp/resolv" ]
then
echo "O diretório /etc/chatscripts existe!!!"
else
mkdir -p /etc/ppp/resolv
fi
echo "
# resolv.conf created by pppconfig for vivo
" > /etc/ppp/resolv/vivo
echo "nameserver 200.142.132.32
nameserver 200.220.227.57
" > /etc/ppp/resolv.conf
echo "auth
crtscts
lock
hide-password
modem
mru 296
mtu 296
lcp-echo-interval 30
lcp-echo-failure 4
noipx
persist
asyncmap 0xa0000
mru 1500
refuse-chap
ipcp-max-failure 30
" > /etc/ppp/options
# Ajusta o modem para a conexão
function ativar_modem()
{
/sbin/rmmod -v -f -s usb_wwan
/sbin/rmmod -v -f -s option
/sbin/rmmod -v -f -s usbserial
/sbin/modprobe usbserial vendor=0x19d2 product=0x0031
/sbin/modprobe usb_wwan
/sbin/modprobe option
sleep 1
echo "wait.."
sleep 1
echo "wait..."
sleep 1
echo "wait...."
sleep 1
echo "wait....."
sleep 1
echo "wait......"
sleep 1
dmesg|tail
echo
echo
ls -l /dev|grep USB
}
# Testa se o device /dev/ttyUSB2 existe
# caso negativo, reconfigura o modem
if [ -f /dev/ttyUSB2 ];
then
echo "O dispositivo /dev/ttyUSB2 existe";
else
ativar_modem;
fi
echo "ppp_async" >> /etc/modules
echo "usbserial" >> /etc/modules
echo "options usbserial vendor=0x19d2 product=0x0031" >> /etc/modules
echo "Fim da configuração!!!"
echo "Sua conexão 3G já está configurada"
echo "Para usar, rode como root ou usando o sudo:"
echo "pon vivo"
Backup com rsync em maquina da rede.
Numlock automático no Slackware
Zwifi - Conectar em rede Wi-Fi via terminal
newchangelog - Script para gerar changelog.
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
IA Turbina o Desktop Linux enquanto distros renovam forças
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Ativando e usando "zoom" no ambiente Cinnamon
Vídeo Nostálgico de Instalação do Conectiva Linux 9
Como realizar um ataque de força bruta para desobrir senhas?
Estou tentando ser legalista, mas tá complicado! (8)
Thinkpads são bons mesmo ?! (0)
Queda no serviços da Cloudflare, alguns sites estão fora do ar. (1)









