个人工具

UbuntuHelp:BluetoothDialup

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月13日 (日) 11:39的版本 (New page: {{From|https://help.ubuntu.com/community/BluetoothDialup}} {{Languages|php5}} This page describes how to configure PPP dialup through a Bluetooth-compatible mobile phone. The emphasis is o...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索


This page describes how to configure PPP dialup through a Bluetooth-compatible mobile phone. The emphasis is on using GPRS/EDGE services. These instruction were compiled and tested on Ubuntu 6.06 (Dapper Drake) on an IBM ThinkPad T40p with a Samsung T809 phone using T-Mobile's "Unlimited Internet VPN" plan.

Configure mobile phone data profiles

Getting the data access profile

T-Mobile

T-Mobile accounts generally require separate data profiles for WAP and general data access. (Some people have had success running a regular data connection over the WAP profile.) Getting access to general data access requires a data access plan. Currently, the "Unlimited Internet VPN" is the best deal, as it costs the same as the "Unlimited Internet" plan but gives you a real, public IP address. Incoming connections are blocked on any T-Mobile data plan. T-Mobile does not seem to offer metered data plans anymore.

There are two ways to get the data service profile on your phone. Manual configuration is probably faster and better.

Automatic

T-Mobile can send the data services profile directly to your phone via SMS. Only the "wireless data" customer service people can send the data services profile to your phone. The regular service people can only send the WAP data profile, which will not work for general use. You will have to be transferred once or twice to reach the wireless data division. Once there, simply request that the data service profile for your plan be sent to your phone. (Of course, you'll need to be signed up for a data plan.)

Once you receive the plan information, your phone will ask you where you want to store it. T-Mobile uses profile 1 for the WAP profile, so don't overwrite it. I recommend using profile 2, as it's usually the first empty profile.

After storing the data services profile, your phone will probably set it as the default. This will probably cause your WAP (T-Zones/T-Mobile Internet) to fail for your on-phone browser. Set the WAP data profile (profile 1) to default fix this. See the configuration section below for your phone's brand. Setting the default profile is usually fairly obvious once you've reach the data services configuration screen.

Manual

Access the data profiles configuration for your phone's brand using the instructions under the configuration section below. The order and name for settings is for a Samsung T809. These settings are modified from the SMS T-Mobile sends Unlimited Internet VPN plan users. By adding the DNS and proxy information, you can use this profile for either T-Zones or general web browsing.

Use the following settings for the Unlimited Internet VPN plan:

  • Name: T-Mobile VPN
  • Home URL: http://www.t-mobile.com
  • Bearer: GPRS only
  • Proxy use: Enable
  • GPRS settings
    • Proxy: 216.155.165.50
    • Proxy Port: 8080
    • DNS1: 216.155.175.105
    • DNS2: 216.155.175.106
    • APN: internet3.voicestream.com
    • Login ID: Empty
    • Password: Empty

Other companies

Call your mobile service provider and request information about data plans. Many charge by the megabyte, but unlimited plans are increasingly available. Most of the instruction for T-Mobile will probably apply.

Configuration

Sony Ericsson GSM

This is from my memory of using a T610, but it should apply to any Sony Ericsson phone. Choose the lower-left icon from the main menu.

Samsung GSM

This is tested on a T809, but should apply to any Samsung GSM phone. Enter code *#87927# from the main screen. Select "Current profile" to choose the default profile. Select "Profile settings" to manage profiles.

LG GSM

This is tested on a CU 320 and works. If you have problems authenticating from the machine, discover it from the phone.

Installing Bluetooth and dialup packages

  • If you have the ubuntu-desktop package installed, you can skip to the next section
  • Otherwise, run the following at a shell prompt; this should install the basic Bluetooth and PPP packages
sudo apt-get install bluez-utils bluez-pin ppp 
</code>

== Listing Bluetooth devices ==
* Make your phone Bluetooth discoverable.
* Run the following at a shell prompt:
<pre>
hcitool scan
</code>
* Copy the MAC address (the text with the capital letters, numbers, and ':'s) somewhere convenient. You'll need it many times.

== Pairing ==
You can skip this section if you've already paired your phone with your computer. However, consider the final optional step, as your phone might otherwise nag you every time you use if for dialup.
* Run the following, replacing your-phone-mac-address with the proper data
<pre>
sudo hcitool cc your-phone-mac-address
</code>
* Run the following, replacing your-phone-mac-address with the proper data
<pre>
sudo hcitool auth your-phone-mac-address
</code>
** If this command doesn't work, try the pairing instructions on other Bluetooth wiki pages; it seems 5.10 and older have issues with the PIN wrapper
* Enter a numeric code into the dialog box that pops up
* Accept the pairing from your phone handset
* Enter the same number on your phone
* Run the <code>hcitool auth your-phone-mac-address</code> command again if it fails
* You can remove your handset's Bluetooth discoverability now
* Some phones (notably Samsungs) require further authorization for certain Bluetooth activities, including dialup; consult your phone's user manual to avoid confirming your computer's dialup action on your phone every time

Note:  I couldn't pair using the above instructions in Edgy.  I had to install bluez-passkey-gnome, run bt-applet, then use the phone to search for the bluetooth adapter and pair with it.

== Configuring the rfcomm device ==
* Get the channel number for your phone's dialup service by running the following, replacing your-phone-mac-address with the proper data
<pre>
sdptool browse your-phone-mac-address
</code>
* Look under "Service Name: Dial-up Networking"
* Under "Protocol Descriptor List:"  and "RFCOMM", there should be a number after "Channel:"
* Remember that number; you'll need it for the rfcomm configuration
* Run
<pre>
gksudo gedit /etc/bluetooth/rfcomm.conf
</code>
* Paste the following into the file, replacing your-phone-mac-address and your-phone-rfcomm-channel with appropriate values
<pre>
rfcomm0 {
	bind yes;
	device your-phone-mac-address;
	channel your-phone-rfcomm-channel;
	comment "Bluetooth PPP Connection";
}
</code>
* Save and close the <code>rfcomm.conf</code> file
* Run the following, which will create the rfcomm0 device
<pre>
sudo /etc/init.d/bluez-utils restart
</code>

== Configuring PPP ==
* Run the following
<pre>
gksudo gedit /etc/ppp/peers/BluetoothDialup
</code>
* Paste the following into the file (the file should start out blank)(I found that on my Motorola V360 that I had to comment out #lcp-echo-failure 0 useing T-Mobile.)
<pre>
debug
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/BluetoothDialup"
usepeerdns
/dev/rfcomm0 115200
defaultroute
crtscts
lcp-echo-failure 0
</code>
* Save and close the <code>BluetoothDialup</code> file
* Run the following
<pre>
gksudo gedit /etc/chatscripts/BluetoothDialup
</code>
* Paste the following into the file (the file should start out blank), replacing your-apn-here with the APN from your data services profile and your-data-profile-number-here with the number you stored the profile into on the phone (probably 2). 

<pre>
TIMEOUT	35
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
OK	'AT+CGDCONT=2,"IP","your-apn-here"'
OK	ATD*99***your-data-profile-number-here#
CONNECT ""
</code>

== Carrier specific configuration info ==
=== T-Mobile ===

For the cheaper T-Zones (T-MobileWeb) data plan:
<pre>
TIMEOUT	35
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
OK	'AT+CGDCONT=1,"IP","wap.voicestream.com"'
OK	ATD*99#
CONNECT ""
</code>

For the full service plans:
<pre>
TIMEOUT	35
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
OK	'AT+CGDCONT=1,"IP","internet3.voicestream.com"'
OK	ATD*99#
CONNECT ""
</code>

Note: T-Mobile seems to have made changes to their connection settings during the end of 2006. If for some reason the above isn't working in your area, you can try replacing AT+CGDCONT=1 with AT+CGDCONT=2 above. Also, the data-profile-number might be 2.

=== KPN Hi ===

For a KPN Hi connection use:
<pre>
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      ATZ
OK      'AT+CGDCONT=1,"IP","internet",,0,0'
OK      ATD*99***1#
</code>

== Cingular ==

<pre>
TIMEOUT 35
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
OK      'AT+CGDCONT=1,"IP","WAP.CINGULAR"'
OK      ATD*99***1#
CONNECT ""
</code>

 The file might make a connection which doesn't allow ping. Modify your "default" configuration made via <code>pppconfig</code> to connect using the USB cable.  Adjust the username and passwords as needed for your plan.

<pre>
# This optionfile was generated by pppconfig 2.3.10.
#
#
hide-password
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/provider"
debug
/dev/rfcomm0 115200
defaultroute
noipdefault
user "WAP@CINGULARGRPS.COM"
remotename provider
ipparam provider

usepeerdns
</code>

 <code>/etc/chatscript/BluetoothDialup</code> looks like this:

<pre>
# This chatfile was generated by pppconfig 2.3.10.
# Please do not delete any of the comments.  Pppconfig needs them.
#
# ispauth PAP
# abortstring
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED
# modeminit
'' ATZ
# ispnumber
OK-AT-OK "ATDT*99***1#"
# ispconnect
CONNECT \d\c
# prelogin

# ispname
# isppassword
# postlogin

</code>

 Finally, add this to the <code>/etc/ppp/pap-secrets</code> file:

<pre>
"WAP@CINGULARGPRS.COM" BluetoothDialup "CINGULAR1"
</code>

=== Verizon ===

 This works for me on the EVDO network (but not on the 1xRTT net)

 This file is /etc/chatscripts/verizon
<pre>
# abortstring
ABORT 'NO CARRIER' ABORT 'ERROR' ABORT 'NO DIALTONE' ABORT 'BUSY' ABORT 'NO ANSWER'
# modeminit
'' ATZ
# ispnumber
OK-AT-OKL3 ATDT#777
# ispconnect
CONNECT \d\c
</code>

 My /etc/ppp/peers/verizon file looks like this (replace the XXX with your phone #):
<pre>
hide-password
/dev/rfcomm0
connect "/usr/sbin/chat -v -f /etc/chatscripts/verizon"
noauth
defaultroute
usepeerdns
connect-delay 10000
user "XXX-XXX-XXXX@vzw3g.com"
lock
lcp-echo-failure 4
lcp-echo-interval 65535

115200
</code>

 This configuration work on the 1xRTT but not EVDO.

 This file is /etc/ppp/peers/1x
<pre>
hide-password
/dev/rfcomm0
connect "/usr/sbin/chat -v -f /etc/chatscripts/1x"
noauth
defaultroute
usepeerdns
connect-delay 10000
user "qnc"
password "qnc"
lcp-echo-failure 4
lcp-echo-interval 65535s
115200
</code>
 This file is /etc/chatscripts/1x
<pre>
# abortstring
ABORT 'NO CARRIER' ABORT 'ERROR' ABORT 'NO DIALTONE' ABORT 'BUSY' ABORT 'NO ANSWER'
# modeminit
'' AT$QCMDR=2 
# ispnumber
OK-AT-OKL3 ATDT#777
# ispconnect
CONNECT \d\c
</code>
 Save and close the <code>BluetoothDialup</code> file

== Phone specific configuration details ==

=== Samsung SGH-X820 ===

This phone seems to have problems with various PPP options. Adding the following options to the relevant file in /etc/ppp/peers seemed to make it work.

<pre>
nopcomp
noaccomp
nomagic
receive-all
noccp
novj
novjccomp
</code>

== Authorizing dialout ==
* Run the following at a shell prompt, replacing your-username-here with your username:
<pre>
sudo adduser your-username-here dialout
</code>
* This concludes the one-time setup

== Connecting ==
Begin here on subsequent connections.
* If you have NetworkManager installed, right-click the applet and uncheck "Enable Wireless"; this will keep it from hopping onto wireless networks and botching your dialup DNS and default route settings

N.b.  I do have NetworkManager installed and have found a work-around so that it doesn't mess with my connection over Bluetooth.  I have not tried this in an environment where there are multiple WiFi connections _and_ yet I'm still trying to use the phone as a modem.  The work-around is to edit the file /etc/network/interfaces and to add a line at the end of the file that reads:
<pre>
iface hci0 inet static
</code>

* Run the following
<pre>
pon BluetoothDialup
</code>
* Wait about 30-60 seconds
* You should now be able to ping <code>ubuntu.com</code>; expect latencies of around one second for most GPRS services
* If pinging fails, see the troubleshooting section below
* See the disconnect section below when you're finished using the connection

== PPP and TCP/IP troubleshooting ==
Try these troubleshooting sections in order.

=== Using the correct data plan ===
* Check that you're indeed using a real data profile, as WAP-only profiles generally disallow pinging, instant messaging, file sharing, and some web browsing
* Try setting the unrestricted data profile as your default data profile on your phone
** This will only work if the profile has proper DNS settings
*** If you use the T-Mobile automatic profile setup listed above, it will '''not''' have proper on-phone DNS settings
*** The manual method '''will''' work for T-Zones
** Use the built-in WAP browser to test the profile
*** If it works, it's probably not your data plan (though it could be); continue troubleshooting below

=== PPP connection ===
* Monitor <code>/var/log/syslog</code> for dialup status information
** The following indicates PPP success, where <code>xxx</code>s can be anything
<pre>
xxx localhost pppd[xxx]: Script /etc/ppp/ip-up finished (pid xxx), status = 0x0
</code>
==== Solution if problem ====
* Make sure there's not a PPP connection with <code>rfcomm0</code> already in session; run <code>poff BluetoothDialup</code> to disconnect one in session
* Find where the error is in either the chatscripts or peers file
** Consult other help sources and update this page

=== IP address configuration ===
* Run <code>ifconfig</code> to check your PPP connection
** The <code>ppp0</code> section should be as below, where <code>xxx</code> is anything
<pre>
ppp0 Link encap:Point-to-Point Protocol
          inet addr:xxx.xxx.xxx.xxx P-t-P:xxx.xxx.xxx.xxx Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
          RX packets:xxx errors:0 dropped:0 overruns:0 frame:0
          TX packets:xxx errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:xxx
          RX bytes:xxx (xxx b) TX bytes:xxx (xxx b)
</code>
** <code>P-t-P:xxx.xxx.xxx.xxx</code> should match the address on the <code>/var/log/syslog</code> line <code>xxx localhost pppd[xxx]: remote IP address xxx.xxx.xxx.xxx</code>
** <code>inet addr:xxx.xxx.xxx.xxx</code> should match the address on the <code>/var/log/syslog</code> line <code>xxx localhost pppd[xxx]: local IP address xxx.xxx.xxx.xxx</code>
* If the addresses match, then your IP address configuration is probably fine
==== Solution if problem ====
* If a <code>/var/log/syslog</code> line seems absent, try reconnecting via <code>poff BluetoothDialup</code> and <code>pon BluetoothDialup</code>
* Make sure you're using the right data profile on your phone

=== Default route configuration ===
* Ping a valid public hostname on a connected computer, then (if it worked) try pinging the actual IP address from your PPP-connected computer
** If it didn't work, try pinging a different hostname; some block pings
** If this works, then your routing table is probably fine
* Check the routing table by running <code>route -n</code>
** Your routing table should look like the following, where <code>xxx</code> is anything
<pre>
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
xxx.xxx.xxx.xxx * 255.255.255.255 UH 0 0 0 ppp0
default * 0.0.0.0 U 0 0 0 ppp0
</code>
** The <code>xxx.xxx.xxx.xxx</code> should match the <code>P-t-P:xxx.xxx.xxx.xxx</code> in the <code>ifconfig</code> command's <code>ppp0</code> block above
* If the routing table checks out, routing is probably not the problem
==== Solutions if problem ====

===== Preferred method: Manually fix routing table =====
This needs instructions, as it should be the preferred method

===== Alternate method: Remove other interfaces =====
* Run the following
<pre>
poff BluetoothDialup
</code>
* Remove any non-loopback and <code>ppp0</code> connections by running the following, replacing your-extra-interface with the appropriate names
<pre>
sudo ifconfig your-extra-interface down
</code>
* Run the following
<pre>
pon BluetoothDialup
</code>

=== DNS configuration ===
* Try pinging the DNS servers
* Try running <code>dig hostname-here</code>, where <code>hostname-here</code> is a valid hostname
** If it resolves, DNS is probably not the problem
* Check <code>/etc/resolv.conf</code> to check your DNS configuration
** Your routing table should look like the following, where <code>xxx</code> is anything
<pre>
nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
</code>
** The lines above should match the <code>/var/log/syslog</code> lines like the following
<pre>
xxx localhost pppd[xxx]: primary DNS address xxx.xxx.xxx.xxx
xxx localhost pppd[xxx]: secondary DNS address xxx.xxx.xxx.xxx
</code>
==== Solution if problem ====
* If a <code>/var/log/syslog</code> line seems absent, try reconnecting via <code>poff BluetoothDialup</code> and <code>pon BluetoothDialup</code>
* Manually configure <code>/etc/resolv.conf</code> to point to your provider's DNS servers (or a public DNS server)
** Try pinging the manually-configured DNS servers; if it fails only on the Bluetooth dialup machine, double-check the routing configuration

== Disconnecting ==
* Run the following
<pre>
poff BluetoothDialup
</code>
* Re-enable NetworkManager's connections, if you use NetworkManager
* Re-enable any other connections, as needed

== Other useful guides ==
* [http://wiki.clug.org.za/wiki/GPRS_Internet_over_Bluetooth CLUG Wiki Guide to GPRS Internet over Bluetooth]
* [http://www.summet.com/x31/v330.html Motorola v330 Mobile Internet over Bluetooth with T-Mobile]
* [http://gehennom.net/~tool/tiki-view_blog_post.php?blogId=3&postId=22 Bluetooth dialup guide for Debian]
* [http://www.mip.sdu.dk/~pfavr/T610_Debian_GPRS_Howto.html T610 Debian GPRS]
* [http://www.resultspk.net/hackwireless/0596005598_wirelesshks-chp-2-sect-6.html Bluetooth to GPRS]
* [http://www.twoguys.org/~gregh/nokia-6310i.html Nokia 6310i and Bluetooth with Linux using T-Mobile]

----
CategoryHardware CategoryDocumentation CategoryNetworking CategoryBluetooth

[[category:UbuntuHelp]]