Utilizar el módem de un teléfono móvil Nokia por Bluetooth para conexión 3G / GPRS de Vodafone en un portátil con Ubuntu
De GALPon WiKi
Documento creado por capri99 (Carlos Rodríguez). Cualquier aportación será bienvenida :-)
Información extraída de:
Contenido |
Emparejando el teléfono (móvil)
Antes de empezar, es preciso emparejar el teléfono Bluetooth con el equipo. Se puede hacer con alguna herramienta, ya sea de KDE o GNOME.
En KDE
kbluetooth --> configuración --> dispositivos de entrada --> Añadir dispositivo nuevo
Cuando lo queramos emparejar nos pedirá el código PIN (en nuestro caso "0000").
También tengo entendido que para pasarle el PIN se puede hacer desde modo consola con passkey-agent.
Reconociendo nuestro teléfono móvil y el canal necesario
Haremos una detección de dispositivos a nuestro alrededor con el siguiente comando:
hcitool scan
(y saldrá algo como esto)
Scanning ...
00:12:D1:6F:32:3D NokiaE60
Luego haremos una búsqueda de los servicios que tiene ese dispositivo con el comando:
sdptool search dun
Y saldrá algo como esto:
Inquiring ...
Searching for dun on 00:12:D1:6F:32:3D ...
Service Name: Dial-Up Networking
Service RecHandle: 0x10035
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100
Nos quedamos con el canal que emplea el servicio "Dialup Networking". En este caso es el Channel 2.
Enlazando rfcomm con el servicio Dialup Networking
Ahora enlazamos la dirección "rfcomm0" entre el equipo y el teléfono con el comando:
sudo rfcomm bind 0 00:12:D1:6F:32:3D 2
Donde "0" representa la dirección rfcomm (puede ser 0,1,2,3...), luego viene la MAC del dispositivo Bluetooth y finalmente en canal "2".
Podemos añadir estos datos ya en el archivo /etc/bluetooth/rfcomm.conf que quedaría así:
#
# RFCOMM configuration file.
#
rfcomm0 {
# # Automatically bind the device at startup
bind yes;
#
# # Bluetooth address of the device
device 00:12:D1:6F:32:3D;
#
# # RFCOMM channel for the connection
channel 2;
#
# # Description of the connection
comment "modem bluetooth Nokia E60";
}
Creando scripts para facilitar la conexión
Por otro lado creamos el script que facilitará la manipulación de esta conexión:
sudo vim /etc/ppp/peers/vodafone
Con el siguiente contenido:
# from www.hingston.demon.co.uk/mike/nokia6680.html noauth # change this if you move the path to your connect script connect "/usr/sbin/chat -v -f /etc/chatscripts/vodafone-connect" #change this if you move the path to your disconnect script disconnect "/usr/sbin/chat -v -f /etc/chatscripts/vodafone-disconnect" #I found that I needed this to remove problems with loopback on connecting silent #remove this if you don't want lots of information going to /var/log/messages debug #this is the device specified in your rfcomm.conf file /dev/rfcomm0 #speed at which to connect - might be worth trying higher... 115200 #this is needed so that a default route is added to your routing table defaultroute #this is needed so that you pick up Orange's DNS settings usepeerdns
Lo mismo hacemos con el script de conexión:
sudo vim /etc/chatscripts/vodafone-connect
Que contendrá lo siguiente:
#from www.hingston.demon.co.uk/mike/nokia6680.html TIMEOUT 5 ECHO ON ABORT '\nBUSY\r' ABORT '\nERROR\r' ABORT '\nNO ANSWER\r' ABORT '\nNO CARRIER\r' ABORT '\nNO DIALTONE\r' ABORT '\nRINGING\r\n\r\nRINGING\r' '' \rAT TIMEOUT 12 OK ATE1 #here's the magic bit! OK 'AT+cgdcont=1,"IP","airtelnet.es"' OK ATD*99***1#
Y finalmente el script de desconexión:
sudo vim /etc/chatscripts/vodafone-disconnect
que contendrá lo siguiente:
# from www.hingston.demon.co.uk/mike/nokia6680.html ABORT "BUSY" ABORT "ERROR" ABORT "NO DIALTONE" SAY "\nSending break to the modem\n" "" "\K" "" "\K" "" "\K" "" "+++ATH" "" "+++ATH" "" "+++ATH" SAY "\nPDP context detached\n"
Conectando, por fin
Finalmente para realizar la conexión haremos lo siguiente:
Reinicializar la dirección "0" del Bluetooth:
sudo rfcomm release 0
Y enlazamos de nuevo:
sudo rfcomm connect 0
Aparecerá en la consola algo como esto:
Connected /dev/rfcomm0 to 00:12:D1:6F:32:3D on channel 2 Press CTRL-C for hangup
En otro terminal ejecutaremos el script de conexión:
pon vodafone
Saldrá en el /var/log/messages:
pppd 2.4.4 started by carlos, uid 1000 timeout set to 5 seconds abort on (\nBUSY\r) abort on (\nERROR\r) abort on (\nNO ANSWER\r) abort on (\nNO CARRIER\r) abort on (\nNO DIALTONE\r) abort on (\nRINGING\r\n\r\nRINGING\r) send (^MAT^M) timeout set to 12 seconds expect (OK) ^MAT^M^M OK -- got it send (ATE1^M) expect (OK) ^M ATE1^M^M OK -- got it send (AT+cgdcont=1,"IP","airtelnet.es"^M) expect (OK) ^M AT+cgdcont=1,"IP","airtelnet.es"^M^M OK -- got it send (ATD*99***1#^M) Serial connection established. Using interface ppp0 Connect: ppp0 <--> /dev/rfcomm0 PAP authentication succeeded local IP address 77.209.95.82 remote IP address 10.6.6.6 primary DNS address 212.73.32.3 secondary DNS address 212.73.32.67
Y cuando acabemos ejecutaremos el correspondente script de desconexión:
poff vodafone

