---
title: "Ubuntu 使用 iPhone 藍芽和 USB 上網分享"
url: https://sammy.hk/ubuntu-use-iphone-bluetooth-usb-tethering/
author: Sammy Fung
published: 2010-02-14T03:23:07+08:00
modified: 2021-06-01T00:43:14+08:00
description: "前晚在版圖遊戲聚會時拿出 ThinkPad T400s 來上網時，才發現沒在這台電腦的 Ubuntu 9.10 上，預先設定透用 iPhone 藍芽作 tethering。 跟著昨晚回家後便開始設定了，以下 Five Minutes: Tethering iPhone 3.0 to Ubuntu 9.04 提供的方法是…"
categories: ["科技", "開放源碼"]
tags: [ubuntu]
source: https://sammy.hk
---
前晚在版圖遊戲聚會時拿出 ThinkPad T400s 來上網時，才發現沒在這台電腦的 Ubuntu 9.10 上，預先設定透用 iPhone 藍芽作 tethering。

跟著昨晚回家後便開始設定了，以下 [Five Minutes: Tethering iPhone 3.0 to Ubuntu 9.04](http://xn--9bi.net/2009/06/17/tethering-iphone-3-0-to-ubuntu-9-04/) 提供的方法是以往我所用的。

下載 bluez-compat：
$ apt-get install bluez-compat

在 /etc/default/bluetooth 內加入以下兩行，然後重新啟動 /etc/init.d/bluetooth：
PAND\_ENABLED=1
PAND\_OPTIONS=”–role=PANU”

在 /etc/network/interfaces 內加入以下一行：
iface bnep0 inet dhcp

在 GNOME 的 Bluetooth applet 跟 iPhone 的藍芽 pair，right click 可以作設定。為了方便設定，Ubuntu 的 Bluetooth 最好是設定在可被搜尋的，以便在 Bluetooth applet 指定設定 iPhone 時，iPhone 彈出確認由 Ubuntu 發出的 PIN 訊息。

完成設定後，每次連接時只需輸入藍芽地址：
(假設 00:aa:bb:cc:dd:ee 是 iPhone
$ sudo pand –connect 00:aa:bb:cc:dd:ee -n
$ sudo ifup bnep0

中斷連結時：
$ sudo ifdown bnep0
$ sudo pand -K

昨晚我也發現了另一個網站 [Ubuntu Geek – iPhone Tethering on Ubuntu 9.10 (Karmic)](http://www.ubuntugeek.com/iphone-tethering-on-ubuntu-9-10-karmic.html) 提到，已有用戶貢獻的 PPA repository 提供更簡便的安裝方法。而且剛發現 Linux 社群已有經 USB 使用 iPhone Tethering 的方法了，以前 iPhone Tethering 剛出時，Linux 暫未能辨別和使用 iPhone 的 USB tethering 作 network device。所以我也在 ThinkPad 上試裝了 iPhone USB tethering 方法。

$ sudo add-apt-repository ppa:pmcenery/ppa
$ sudo apt-get update
$ sudo apt-get install gvfs ipheth-utils

在裝好了 packages 和插入 USB 來連接 iPhone 後，Network Manager 應該可以自動使用新的 ethernet 裝置，並自動取得 IP 地址，但我需要 reboot 一次 Ubuntu 才成。

### 相關文章：

1. [找尋更合適我的Linux桌面系統](https://sammy.hk/%e6%89%be%e5%b0%8b%e6%9b%b4%e5%90%88%e9%81%a9%e6%88%91%e7%9a%84linux%e6%a1%8c%e9%9d%a2%e7%b3%bb%e7%b5%b1/ "找尋更合適我的Linux桌面系統")
2. [成功在 notebook 的 Ubuntu 上設定 Compiz 3D compositing](https://sammy.hk/%e6%88%90%e5%8a%9f%e5%9c%a8-notebook-%e7%9a%84-ubuntu-%e4%b8%8a%e8%a8%ad%e5%ae%9a-compiz-3d-compositing/ "成功在 notebook 的 Ubuntu 上設定 Compiz 3D compositing")
3. [F-Spot 與我的 Gallery 相簿](https://sammy.hk/f-spot-%e8%88%87%e6%88%91%e7%9a%84-gallery-%e7%9b%b8%e7%b0%bf/ "F-Spot 與我的 Gallery 相簿")
4. [Linux Flash Player 9 的正式版的中文支援](https://sammy.hk/linux-flashplayer9-chinese-support/ "Linux Flash Player 9 的正式版的中文支援")
