Skip navigation.

Ramblings

a test …

Mobile surfing using your local network

, , , , , , , , , , ,

I tend to develop stuff for mobile phones and need to transfer applications and check that they run properly on the phone itself. Until recently I have either sent Bluetooth messages with SIS packages (for Symbian), mounted the phone directory with p3nfs or downloaded content straight from the net over GPRS or 3G. But there is another way.

Less hassle, less costs

Last time I wanted to set up p3nfs I didn't succeed for unknown reasons, this led me to do some research on the possibilities on using my personal computer as a gateway for the mobile device. After some googling and experimenting the result was succesful.

It turns out it is possible to use TCP/IP over Bluetooth from a Symbian phone via your computer and out to the Internet. To many companies, using this method for bug-testing and development might result in huge cost reductions. For some reason it seems to be a cumbersome task and at least Nokia hasn't exactly encouraged this possibility. I'll merely summarize what I have found on the Internet that let me use a Nokia 6600 phone with Symbian thru a laptop with Ubuntu connected to the Internet.

Jammin' the bluez

We'll start by installing the correct packages on Ubuntu (For MS Windows instructions check out this article).

Your kernel must have PPP(d) and Bluez support (stock Ubuntu has that). If not check this article for more info on which kernel options that must be set.

sudo apt-get install ppp bluez-utils bluez-pin iptables

Edit /etc/bluetooth/hcid.conf:

options {
  autoinit yes;
  security user;
  pairing multi;
  pin_helper /usr/bin/bluez-pin; # a program that returns a pin code, in this a pop-up dialog is used.
}

device {
  name "%h-%d"; # %d - device id, %h - host name
  class 0x100;
  iscan enable;
  pscan enable;
  lm accept;
  lp hold,sniff,park;
} 

Activate modules:

sudo modprobe rfcomm bluetooth

Ensure that /dev/rfcomm? exists:

sudo mknod -m 660 /dev/rfcomm0 c 216 0
sudo mknod -m 660 /dev/rfcomm1 c 216 0
sudo mknod -m 660 /dev/rfcomm2 c 216 0

Get up hci0 if not done automatically when inserting bluetooth device:

sudo hciconfig hci0 up

Phone setup

Sat up an access point that uses Bluetooth: Tools > Settings > Connection > Access points

Connection name: Bt (this must be named exactly like this)
Data bearer: Data call
Dial-up number: 123 (this will be removed by gnubox anyway)
User name: None
Prompt password:  No
Password: None
Authentication: Normal
Homepage: None
Data call type: Analogue
Maximum data speed: Automatic

While still being in the same screen go to: Options > Advanced settings

Phone ip address: Automatic
Primary name server: 0.0.0.0
Second. name server: 0.0.0.0
Proxy serv. address: None
Proxy port number: 0
Use callback: No
Callback type: User server no.
Callback number: None
Use PPP Compression: Yes
Use login script: No
Login script: None
Modem initialisation: None

Activate bluetooth on the phone: Connectivity > Bluetooth

Bluetooth: On
My phone's visibility: Shown to all
My phone's name: myPhone

Download Gnubox for your cellphone from this page.

Start Gnubox (might need a reboot of the phone to work properly). Tell it to use Bluetooth: Options > 2Box Direct > Bluetooth

On the computer check that you can see the phone with:

sudo hcitool scan

We have a lift-off

Start the network daemon:

sudo sdptool add --channel=0 SP
sudo dund -n --listen --channel 0 --msdun noauth 192.168.1.1:192.168.1.2 crtscts 115200 ms-dns 192.168.1.10 lock

192.168.1.1 - address of computer
192.168.1.2 - will end up as phone address
192.168.1.10 - address to a DNS server (use a real one to be able to resolve hostnames)

Mind you, you might want to use another address range than the one you are using already. for instance if you are on a network using 10.0.0.x addresses, going with 192.168.1.x like I did seems like an ok solution. (specially for the NAT-ing part)

In another shell bind the device and activate it:

rfcomm bind 0 00:11:22:33:44:55 2
echo x > /dev/rfcomm0

00:11:22:33:44:55 - the phone id that you found with sudo hcitool scan

Starting Opera on the phone using the Access point "Bt" should now let you access the computer from within the phone. You can test this by setting up a web-server on the computer and using the ip 192.168.1.2 (or whatever you et it to be) in the web browser.

Going all the way

I did promise that you would be able to surf and unless you have downloaded the Internet to your computer, or you are running a proxy of some sort, you still can't get any place from the phone. We need to set up some translation. This means basically to tell the computer to be a middle-man when the phone tries to connect to non-local IPs. Outgoing requests are sent to a host on the internet thru the computer, but the answer is sent to the computer but it doesn't necessarily know that it's for the phone. We set up a NAT (Network address translation) rule.

sudo iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE

And activate the IP4 forwarding:

# echo 1 > /proc/sys/net/ipv4/ip_forward

If everything went well, you should now be able to surf the internet from your phone, thru your local network instead of wasting money using your local telco.

If you find errors in this article or found it useful, don't hesitate in posting a comment. Also make sure you send your appreciations to the Gnubox author and the ones providing similar instructions. I have listed most beneath.

Running it all in a batch

Trippy has compiled a small script to do the whole thing automatically. You can find more info on this blog posting.

External links

King's new clothesGather up with the vikings

Comments

Espen Myhre 4. April 2006, 07:13

Great work!
I have been running the same setup for a little over a year now, and
it is very stable and realiable.

Nicolas Mendoza 4. April 2006, 07:40

Good to hear :wink:

Joen P. Olsen 4. April 2006, 08:13

Excellent work, Nico! I bet someone will find this useful - spotlighted! :smile:

Andrey Petrov 4. April 2006, 15:06

Nice!
I have Nokia 7610 and using Windows XP... just wondering if this will work?..

PaiTrakt 4. April 2006, 15:28

If only it could work on phones without Symbian...

Nicolas Mendoza 4. April 2006, 17:41

FataL:

If it works please tell me about it :wink:

(Just try :wink:

Anonymous 5. April 2006, 23:18

RobinW writes:

I've been trying to get a symbian series 60 phone - Nokia N90 - to work using the testing version of gnubox. So far I've been trying with Windows and mRouter, but I'm going to try with Linux instead.

However, I'm not sure that I set up the Bt access point correctly, and it is no longer listed but if I try to recreate it, my new one gets named Bt(01). Does anybody know how to delete an access point that is not listed in the GUI? I know how to do it in the Symbian simulator and I think gnubox can dump the rfcomm database, but I don't know how to reload it in a real phone.

Nicolas Mendoza 5. April 2006, 23:40

Anonymous 7. April 2006, 00:04

RobinW writes:

Thanks, I've done that and have now set up gnubox again.

I've followed the steps listed but when I do echo x > /dev/rfcomm0, the phone asks me for a pin. I've typed the one I have configured in /etc/bluetooth/pin, but the echo just exits saying connection refused (sorry, I'm not near the computer so I can't give you the character accurate message). This is with both "user" security and "auto"

I do not have a GUI on the gateway machine, so the gtk pin entry apps will not work.

PS, on the N90, the Bt access point can't be selected for anything after installing gnubox and selecting "create records", so I suspect you have to select "bring up if".

FYI, the options of the version of bluetooth I'm using on the N90 are different and I have found documentation saying that you have to go (IIRC) Options->Bluetooth->Serial or some such. And there is much selecting of Options->Exit after each selection. When selecting Serial, the phone searches for the device to use, so iscan must be enabled for a few seconds.

Nicolas Mendoza 7. April 2006, 03:03

Does your pin program output something in the vecinity of PIN:1234 ?

Anonymous 8. April 2006, 11:07

Anonymous writes:

xxxxx

Ramūnas 11. April 2006, 08:24

Same problem here, all i get is:
admin@ubuntu:~$ echo x > /dev/rfcomm0
bash: /dev/rfcomm0: Connection refused

My pin is: 12345
I enter it to the phone and still get the above error.

Just to make sure i did this:

admin@ubuntu:~$ cat /etc/bluetooth/pin
12345

I even tried do do:
admin@ubuntu:~$ sudo echo x > /dev/rfcomm0
bash: /dev/rfcomm0: Connection refused

I`m using nokia 6600, with latest firmware.






Ramūnas 11. April 2006, 08:38

Oh, i just solved the problem. I needed to pair the devices before

Ramūnas 11. April 2006, 08:54

Thanks a lot for this guide, it works for me now. :smile:

BTW: is there any kind of script to do all those actions automatically everytime i start my PC?

Anonymous 19. April 2006, 13:05

behrooz writes:

hi, i have question , i try to use my mobile siemense sx1 as Analogue modem to enable my laptap to send and recieve fax and internet, how can i do this?please help me!

Nicolas Mendoza 19. April 2006, 13:13

This seems to be the other way around, I have no idea unfortantely. BUt I'll write up something if I ever get to know how :wink:

Anonymous 30. August 2006, 20:08

Anonymous writes:

nice guide... but i hav a samsung C100 phone.

will it work??? :|

Anonymous 31. March 2007, 18:50

Kennt writes:

Dear Ramunas : I needed to pair the devices before

How to pair that? til now i can't get it connect, always refused. Im using debian

Thx for help

Ramūnas 31. March 2007, 19:01

I really can't remember, that was quite some time ago, but I remember editing some file, adding a pin code there, and then doing a normal pairing procedure and entering that code in the phone.

Nicolas Mendoza 25. May 2007, 15:10

> BTW: is there any kind of script to do all those actions automatically everytime i start my PC?

Ramunas: http://my.opera.com/Tripppy/blog/2007/05/22/tired-of-wasting-time

Anonymous 25. July 2007, 00:11

Maniekes writes:

hi :D
i was fighting with this 2 days but now its workin :D
and ive got some hints for everyone :D
im using panasonic x700(its almost like 6600) but gnubox for 6600 is shit ;/ it didnt change default phone number to 0 etc, so i ude gnubox for 3230, it have more options :P
u dont type Options > 2Box Direct > Bluetooth
so first u go to install > create records
later 2box bt > serialport / lan access server (look what is better for ur phone :P)
and u dont use thist port what author give u, on main is some text :P in one line is portname: btcomm::5 /dev/rfcomm5
sudo sdptool add --channel=5 SP
sudo mknod -m 660 /dev/rfcomm6 c 216 0
and so on...
cya guyz!
btw, i had error 71(dund[11286]: MSDUN failed. Protocol error(71))
and in netfront was write error with dns, solve? go to ap settings, advanced settings and write there dns (same what in dund)

Anonymous 2. July 2009, 03:08

Anonymous writes:

Hi Nicolas,

I have posted this to Adam Tripp but I might have as well ask you as I followed your guide. Thanks beforehand for any suggestions for a solution.

Karel
-----

Thanks for this script. I think I am almost "there" but still missing something as I am getting an error I can't solve. Would you be able to help? Thanks a lot

Karel
------
Nokia N70 with gnubox properly configured, I believe. I can see and browse files on my phone through bluetooth, syncronize via multisync, etc.
---------------

xxx@xxx:~/Desktop$ sudo telefon.sh
pand[5239]: Bluetooth PAN daemon version 4.42
pand[5239]: Connecting to XX:XX:XX:XX:XX:XX
pand[5239]: Connect to XX:XX:XX:XX:XX:XX failed. Connection refused(111)
bnep0: error fetching interface information: Device not found
Internet Systems Consortium DHCP Client V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

wmaster0: unknown hardware address type 801
SIOCSIFADDR: No such device
bnep0: ERROR while getting interface flags: No such device
bnep0: ERROR while getting interface flags: No such device
wmaster0: unknown hardware address type 801
Bind socket to interface: No such device
Failed to bring up bnep0.

How to use Quote function:

  1. Select some text
  2. Click on the Quote link

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

If you can't read the words, press the small reload icon.


Smilies

Download Opera, the fastest and most secure browser
December 2009
M T W T F S S
November 2009January 2010
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31