# GPRS via Bluetooth



## Nicholas (Oct 14, 2009)

Hi everybody.
I'm trying to get GPRS on my FreeBSD (8.0-RC1)
the phone is Samsung SGH-J210 (j210 in /etc/bluetooth/hosts)
Bluetooth works good. hcsecd is run, hccontrol finds phone and sdpcontrol can browse phone's services.


The label in /etc/ppp/ppp.conf:

```
tele2:
 enable force-scripts
 set phone *99**1*1#
 set authname
 set authkey
 #set ctsrts off
 set dial "ABORT BUSY \\
        ABORT ERROR \\
        ABORT NO\\sCARRIER \\
        ABORT NO\\sDIALTONE \\
        ABORT NO\\sANSWER  \\
        TIMEOUT 5 \\
        \"\" AT \\
        OK-AT-OK ATE1Q0 \\
        OK AT+CGDCONT=1,\"IP\",\"internet.tele2.ru\" \\
        OK \\dATDT\\T \\
        TIMEOUT 60 \\
        CONNECT"
 set login
 set timeout 1800
 disable pap
 disable chap
 disable ipv6cp
 enable dns
 resolv rewrite

 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0
 add default HISADDR
```

(initialisation string, provided by TELE2 support is *AT+CGDCONT=1,"IP","internet.TELE2.ru"*; login and password are empty)

`% rfcomm_pppd -d -a j210 -C DUN -l tele2` only waits for me to aswer phone's question "Dial-Up connection with lettuce (ubt0)?" and then stops.

Help me to figure the problem out, please.

cheers


----------



## aragon (Oct 15, 2009)

I've never used GPRS with bluetooth so not sure if this is the cause of your problem, but I did notice an error in your ppp.conf:


```
set phone *99**1*1#
```

The "#" needs to be escaped:


```
set phone *99**1*1\#
```


----------



## Nicholas (Oct 15, 2009)

Thanks, but it didn't help.


----------



## yks (Jul 6, 2010)

*GPRS via Bluetooth, continued*

The conditions are almost the same:
FreeBSD 8.0 i386, bluetooth USB dongle, Nokia 5800 phone, Tele2 GSM operator. 
The problem is that after executing CONNECT and logging in (with arbitrary login/password, because these are not required) PPP terminates without any visible reason.
I have read thoroughly the docs sections on Bluetooth and PPP, and man pages on rfcomm_pppd, but found nothing appropriate, and playing with PPP settings didn't help either.
The bluetooth connection to the phone is otherwise stable.

The command:
`# rfcomm_pppd -a $BDADDR -c -C dun -l btdun`
exits with $?=0.

This is the contents of /etc/ppp/ppp.conf:

```
default:
 set log Phase Chat LCP IPCP CCP tun command 
 ident user-ppp VERSION (built COMPILATIONDATE)
 enable force-scripts
 set speed 115200
 set timeout 0
 enable dns
####
btdun:
 set dial "ABORT NO\\sCARRIER TIMEOUT 5 \
           \"\" AT OK-AT-OK AT+CGDCONT=1,\\\"IP\\\",\\\"internet.tele2.ru\\\" OK \\dATDT\\T TIMEOUT 40 CONNECT"
 accept pap mppe protocomp vjcomp deflate pred1
 disable pap mppe protocomp vjcomp deflate pred1
 set authname USERNAME
 set authkey PASSWORD
 set login 
 set phone "*99#"
 resolv rewrite
 set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.255
 add default HISADDR
```
(Compression was disabled because it prevented the connection from opening, commenting out any lines, except dial and phone, doesn't help solve the main problem).

Here is the ppp.log (the probable place where the problem appears is marked with -->):

```
Jul  6 20:58:55 pm1700 ppp[1158]: Phase: Using interface: tun0
20:58:55 pm1700 ppp[1158]: Phase: deflink: Created in closed state
20:58:55 pm1700 ppp[1158]: tun0: Command: default: ident user-ppp VERSION (built 
 (( other commands appear here as in ppp.conf ))
20:58:56 pm1700 ppp[1158]: tun0: Phase: PPP Started (direct mode).
20:58:56 pm1700 ppp[1158]: tun0: Phase: bundle: Establish
20:58:56 pm1700 ppp[1158]: tun0: Phase: deflink: closed -> opening
20:58:56 pm1700 ppp[1158]: tun0: Phase: deflink: Connected!
20:58:56 pm1700 ppp[1158]: tun0: Phase: deflink: opening -> dial
20:58:56 pm1700 ppp[1158]: tun0: Chat: Phone: *99#
20:58:56 pm1700 ppp[1158]: tun0: Chat: deflink: Dial attempt 1 of 1
20:58:56 pm1700 ppp[1158]: tun0: Chat: Send: AT^M
20:58:56 pm1700 ppp[1158]: tun0: Chat: Expect(5): OK
20:58:56 pm1700 ppp[1158]: tun0: Chat: Received: AT^M^M
20:58:56 pm1700 ppp[1158]: tun0: Chat: Received: OK^M
20:58:56 pm1700 ppp[1158]: tun0: Chat: Send: AT+CGDCONT=1,"IP","internet.tele2.ru"^M
20:58:56 pm1700 ppp[1158]: tun0: Chat: Expect(5): OK
20:58:56 pm1700 ppp[1158]: tun0: Chat: Received: AT+CGDCONT=1,"IP","internet.tele2.ru"^M^M
20:58:56 pm1700 ppp[1158]: tun0: Chat: Received: OK^M
20:58:56 pm1700 ppp[1158]: tun0: Chat: Send: ATDT*99#^M
20:58:58 pm1700 ppp[1158]: tun0: Chat: Expect(40): CONNECT
20:58:58 pm1700 ppp[1158]: tun0: Chat: Received: ATDT*99#^M^M
20:58:58 pm1700 ppp[1158]: tun0: Chat: Received: CONNECT^M
20:58:58 pm1700 ppp[1158]: tun0: Phase: deflink: dial -> carrier
20:58:58 pm1700 ppp[1158]: tun0: Phase: deflink: carrier -> login
20:58:58 pm1700 ppp[1158]: tun0: Phase: deflink: login -> lcp
20:58:58 pm1700 ppp[1158]: tun0: LCP: FSM: Using "deflink" as a transport
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: State change Initial --> Closed
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: LayerStart
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: SendConfigReq(1) state = Closed
20:58:58 pm1700 ppp[1158]: tun0: LCP:  ACFCOMP[2]
20:58:58 pm1700 ppp[1158]: tun0: LCP:  ACCMAP[6] 0x00000000
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MRU[4] 1500
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MAGICNUM[6] 0x9af4a156
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: State change Closed --> Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: RecvConfigRej(1) state = Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: SendIdent(0) state = Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MAGICNUM 9af4a156
20:58:58 pm1700 ppp[1158]: tun0: LCP:  TEXT user-ppp 3.4.2 (built COMPILATIONDATE)
20:58:58 pm1700 ppp[1158]: tun0: LCP:  ACFCOMP[2]
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MAGICNUM[6] 0x9af4a156
20:58:58 pm1700 ppp[1158]: tun0: LCP:  Magic 0x9af4a156 is REJected!
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: SendConfigReq(2) state = Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: LCP:  ACCMAP[6] 0x00000000
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MRU[4] 1500
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: RecvCodeRej(0) state = Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: RecvConfigAck(2) state = Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: LCP:  ACCMAP[6] 0x00000000
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MRU[4] 1500
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: State change Req-Sent --> Ack-Rcvd
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: RecvConfigReq(0) state = Ack-Rcvd
20:58:58 pm1700 ppp[1158]: tun0: LCP:  AUTHPROTO[4] 0xc023 (PAP)
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MRU[4] 1500
20:58:58 pm1700 ppp[1158]: tun0: LCP:  ACCMAP[6] 0x000a0000
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: SendConfigAck(0) state = Ack-Rcvd
20:58:58 pm1700 ppp[1158]: tun0: LCP:  AUTHPROTO[4] 0xc023 (PAP)
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MRU[4] 1500
20:58:58 pm1700 ppp[1158]: tun0: LCP:  ACCMAP[6] 0x000a0000
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: State change Ack-Rcvd --> Opened
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: LayerUp
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: SendIdent(1) state = Opened
20:58:58 pm1700 ppp[1158]: tun0: LCP:  MAGICNUM 00000000
20:58:58 pm1700 ppp[1158]: tun0: LCP:  TEXT user-ppp 3.4.2 (built COMPILATIONDATE)
20:58:58 pm1700 ppp[1158]: tun0: Phase: bundle: Authenticate
20:58:58 pm1700 ppp[1158]: tun0: Phase: deflink: his = PAP, mine = none
20:58:58 pm1700 ppp[1158]: tun0: Phase: Pap Output: USERNAME ********
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: RecvCodeRej(1) state = Opened
20:58:58 pm1700 ppp[1158]: tun0: Phase: Pap Input: SUCCESS ()
20:58:58 pm1700 ppp[1158]: tun0: CCP: FSM: Using "deflink" as a transport
20:58:58 pm1700 ppp[1158]: tun0: CCP: deflink: State change Initial --> Closed
20:58:58 pm1700 ppp[1158]: tun0: CCP: deflink: State change Closed --> Stopped
20:58:58 pm1700 ppp[1158]: tun0: Phase: deflink: lcp -> open
20:58:58 pm1700 ppp[1158]: tun0: Phase: bundle: Network
20:58:58 pm1700 ppp[1158]: tun0: IPCP: FSM: Using "deflink" as a transport
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: State change Initial --> Closed
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: LayerStart.
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: SendConfigReq(1) state = Closed
20:58:58 pm1700 ppp[1158]: tun0: IPCP:  IPADDR[6] 10.0.0.1
20:58:58 pm1700 ppp[1158]: tun0: IPCP:  PRIDNS[6] 192.168.1.1
20:58:58 pm1700 ppp[1158]: tun0: IPCP:  SECDNS[6] 255.255.255.255
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: State change Closed --> Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: RecvConfigReq(0) state = Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: IPCP:  IPADDR[6] 10.6.6.6
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: SendConfigAck(0) state = Req-Sent
20:58:58 pm1700 ppp[1158]: tun0: IPCP:  IPADDR[6] 10.6.6.6
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: State change Req-Sent --> Ack-Sent
-->20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: RecvTerminateReq(1) state = Opened
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: LayerDown
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: SendTerminateAck(1) state = Opened
20:58:58 pm1700 ppp[1158]: tun0: LCP: deflink: State change Opened --> Stopping
20:58:58 pm1700 ppp[1158]: tun0: CCP: deflink: State change Stopped --> Closed
20:58:58 pm1700 ppp[1158]: tun0: CCP: deflink: State change Closed --> Initial
20:58:58 pm1700 ppp[1158]: tun0: Phase: deflink: open -> lcp
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: State change Ack-Sent --> Starting
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: LayerFinish.
20:58:58 pm1700 ppp[1158]: tun0: IPCP: Connect time: 0 secs: 0 octets in, 0 octets out
20:58:58 pm1700 ppp[1158]: tun0: IPCP: 0 packets in, 0 packets out
20:58:58 pm1700 ppp[1158]: tun0: IPCP:  total 0 bytes/sec, peak 0 bytes/sec on Tue 20:58:58 2010
20:58:58 pm1700 ppp[1158]: tun0: IPCP: deflink: State change Starting --> Initial
20:58:58 pm1700 ppp[1158]: tun0: Phase: bundle: Terminate
20:59:01 pm1700 ppp[1158]: tun0: LCP: deflink: LayerFinish
20:59:01 pm1700 ppp[1158]: tun0: LCP: deflink: State change Stopping --> Stopped
20:59:01 pm1700 ppp[1158]: tun0: LCP: deflink: State change Stopped --> Closed
20:59:01 pm1700 ppp[1158]: tun0: LCP: deflink: State change Closed --> Initial
20:59:01 pm1700 ppp[1158]: tun0: Phase: deflink: Disconnected!
20:59:01 pm1700 ppp[1158]: tun0: Phase: deflink: lcp -> logout
20:59:01 pm1700 ppp[1158]: tun0: Phase: deflink: logout -> hangup
20:59:01 pm1700 ppp[1158]: tun0: Phase: deflink: Disconnected!
20:59:01 pm1700 ppp[1158]: tun0: Phase: deflink: Connect time: 5 secs: 275 octets in, 343 octets out
20:59:01 pm1700 ppp[1158]: tun0: Phase: deflink: 7 packets in, 9 packets out
20:59:01 pm1700 ppp[1158]: tun0: Phase:  total 123 bytes/sec, peak 153 bytes/sec on Tue 20:58:59 2010
20:59:01 pm1700 ppp[1158]: tun0: Phase: deflink: hangup -> closed
20:59:01 pm1700 ppp[1158]: tun0: Phase: bundle: Dead
20:59:01 pm1700 ppp[1158]: tun0: Phase: PPP Terminated (normal).
```


----------



## yks (Jul 6, 2010)

*I did it!*

A little googling and voila, I managed to start GPRS over Bluetooth.
This is the contents of ppp.conf which works with Tele2 in St.Petersburg Russia:


```
default:
 set log Phase Chat LCP IPCP CCP tun command 
 ident user-ppp VERSION (built COMPILATIONDATE)

 enable force-scripts
 set timeout 0
 enable dns
####
btdun:

 set dial "ABORT NO\\sCARRIER TIMEOUT 5 \
           \"\" AT OK-AT-OK ATE1Q0 OK AT+CGDCONT=1,\\\"IP\\\",\\\"internet.tele2.ru\\\" OK \\dATDT\\T TIMEOUT 40 CONNECT"

 accept pap mppe protocomp vjcomp deflate pred1
 disable pap mppe protocomp vjcomp deflate pred1

 set phone "*99***1#"
 set ifaddr 0 0 255.255.255.255
 add default HISADDR
 resolv rewrite
```
I actually don't notice any crucial differences from the previous config but nevertheless it works. By the way, the config that works with Megafon Russia(North-West at least) is just the following (instead of btdun section above)

```
megafon:
 set dial "ABORT NO\\sCARRIER TIMEOUT 5 \
           \"\" AT OK-AT-OK ATE1Q0 OK AT+CGDCONT=1,\\\"IP\\\",\\\"internet\\\" OK \\dATDT\\T TIMEOUT 40 CONNECT"
 set phone "*99#"
 resolv rewrite
 set ifaddr 0 0 255.255.255.255
 add default HISADDR
```
Easy as that.
Maybe the command ATE1Q0 made it. Dunno.
Hope someone finds this useful, though there are articles in Russian on opennet.ru and elsewhere.
And in any case, the setup of the Internet connection is the final nail into the MS coffin - windows on my notebook.
FreeBSD rocks!


----------

