Accessing the Internet via Bluetooth and Mobile Phone
Problem
As road warrior and during travel time you often have the need to access the Internet via mobile devices.
Solution
This cool solution describes how to use the bluetooth stack of SUSE Linux Enterprise Desktop 10 Service Pack 2 (SLED10SP2) in combination with a mobile phone, which supports modem connections via bluetooth. This sample implementation uses a Nokia E51 mobile phone.
Implementation of the modem access
- As the first step you should have installed the bluetooth packages. A typical installation includes these packages:
bluez-libs-2.24-12.2 multisync-irmc-bluetooth-0.82+cvs-25.2 yast2-bluetooth-2.13.3-8.2 gnome-bluetooth-0.7.0-23.2 bluez-utils-2.24-17.2 bluez-hcidump-1.29-12.2
- Now we check, wether we can find a local bluetooth device. The tool hciconfig should show local bluetooth devices and the output should be similar to:
simplon:~ # hciconfig hci0: Type: USB BD Address: 00:1A:FF:FF:FF:FF ACL MTU: 384:8 SCO MTU: 64:8 UP RUNNING RX bytes:3144327 acl:10379 sco:0 events:3521 errors:0 TX bytes:405619 acl:3502 sco:0 commands:18 errors:0
The original BD-Address has been changed.
- To configure the basic settings of bluetooth at your system start the system configuration tool yast2 (yast2 bluetooth).
You need to configure the device name (bluetooth name) of your computer and the local pin. This pin will be used later during the initial pairing between you computer and the mobile device.
- Next we have to configure, which services should be available via bluetooth. You should enter the “Advanced Daemon Configuration”.
At least HCI and RFCOMM should be activated. The screenshot shows a configuration, which includes the possibility of computer-computer direct network links via bluetooth (PAND).
- Additional to these two basic configuration steps, you could also configure “Security Options” and “Device and Service Classes”.
- Your mobile phone should be setup to accept bluetooth connections and should be configured “visible”. To be secure you should change the visible option back to “unvisible” later. Some devices also support a “temporary visible” option.
- We try to find the mobile device using the hcitool:
simplon:~ # hcitool scan Scanning ... 00:22:FC:FF:FF:FF Nokia E51
Select your mobile device from the list. If you see tons of devices you know, why to switch your mobile device to unvisible after that step :-). The above list has been shortened and the address of the mobile device has been changed. Please remember the scanned address (here 00:22:FC:FF:FF:FF).
- We need to figure out an additional parameter: The channel to access the dial-up-network (dun) device of your mobile phone. The sdptool could be used to search and browse services.
simplon:/etc # sdptool search dun Inquiring ... Searching for dun on 00:22:FC:FF:FF:FF ... Service Name: Dial-Up Networking Service RecHandle: 0x10002 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
In this setup sdptool has found channel 2 for the mobile device 00:22:FC:FF:FF:FF and service rfcomm.
- Bluetooth has to been configured to use the found device address and service channel. The file /etc/bluetooth/rfcomm.conf should be similar to:
# # RFCOMM configuration file. # rfcomm0 { # Automatically bind the device at startup bind yes; # Bluetooth address of the device device 00:22:FC:FF:FF:FF; # RFCOMM channel for the connection channel 2; # Description of the connection comment "Example Bluetooth device"; }
Of course you have to exchange the values of device and channel with the address and channel number found before.
- Restart the service bluetooth:
simplon:~ # rcbluetooth restart Shutting down bluetooth ( pand hidd sdp hcid) done Starting bluetooth: hcid sdpd hidd rfcomm pand done
- rfcomm should now create the following output:
simplon:~ # rfcomm show rfcomm0: 00:22:FC:FF:FF:FF channel 2 closed
- Optional step: You could try to access the bluetooth connected modem via a serial terminal program as kermit (using set line /dev/rfcomm0; set speed 460800; set carrier-watch off; connect; AT (should reply OK); ESCAPE sequence see output of kermit; quit). Now we are sure, that we are able to access the modem.
Implementation of the modem and internet access configuration
- To configure the modem and internet access use yast2 modem.
Depending on you configuration you have either to add or change a modem setup. Using the “Add”-Dialog, you have to specify the “Modem Device” (/dev/rfcomm0 for the first bluetooth device).
In the “Details” of that dialog you should specify the baud rate (460800) and the modem init strings.
The init strings depends on provider to be used, so we could only provide an example here:
at+cgdcont=1,"IP","event.vodafone.de"
Note: This init string may not match your needs, if you use an other mobile provider or access point. - After the mobile modem is setup, you have to configure your Internet provider. Press “Next” to access the provider setup dialog.
You should ask your internet provider, which values to be used in the profile.
Accessing the Internet
You could either use the “network manager” or kinternet to control the access to the Internet. In the sample setup the “network control” and kinternet are used with success.
Remark
You may check your security policies and at least the firewall setup, when accessing the internet. And also do not forget to hide your mobile device by switching to hidden (unvisible) for others.
Related Articles
Feb 23rd, 2022
Avoid command injection with Apache Common CLI
Mar 27th, 2023
Comments
There is not in SLE 11 yast-bluetooth. How way can I solve this problem? I would like to configure my internet via bluetooth nokia 6120i