Skip navigation.

exploreopera

| Help

Sign up | Help

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

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

By Wargamez, # 4. April 2006, 07:13:42

avatar
Good to hear :wink:

By nicomen, # 4. April 2006, 07:40:10

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

By Joen, # 4. April 2006, 08:13:15

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

By FataL, # 4. April 2006, 15:06:06

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

By PaiTrakt, # 4. April 2006, 15:28:48

avatar
FataL:

If it works please tell me about it :wink:

(Just try :wink:

By nicomen, # 4. April 2006, 17:41:57

avatar
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.

By anonymous user, # 5. April 2006, 23:18:55

avatar

By nicomen, # 5. April 2006, 23:40:34

avatar
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.

By anonymous user, # 7. April 2006, 00:04:01

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

By nicomen, # 7. April 2006, 03:03:52

avatar
Anonymous writes:

xxxxx

By anonymous user, # 8. April 2006, 11:07:26

avatar
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.






By Ramunas, # 11. April 2006, 08:24:17

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

By Ramunas, # 11. April 2006, 08:38:52

avatar
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?

By Ramunas, # 11. April 2006, 08:54:18

avatar
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!

By anonymous user, # 19. April 2006, 13:05:43

avatar
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:

By nicomen, # 19. April 2006, 13:13:19

avatar
Anonymous writes:

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

will it work??? :|

By anonymous user, # 30. August 2006, 20:08:04

avatar
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

By anonymous user, # 31. March 2007, 18:50:57

avatar
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.

By Ramunas, # 31. March 2007, 19:01:22

avatar
> 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

By nicomen, # 25. May 2007, 15:10:54

avatar
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 <so i use 5 :P
it mean type 5 channel, not 0
i didnt have time, so i change alls 0s for 5 and it started working :D:D
i mean this:
echo x > /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)

By anonymous user, # 25. July 2007, 00:11:50

Write a comment

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

Please type this security code : 9c6d7b

Smilies

July 2008
SMTWTFS
June 2008August 2008
12345
6789101112
13141516171819
20212223242526
2728293031