个人工具
登录
查看“UbuntuHelp:CableDialup/zh”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:CableDialup/zh”的源代码
来自Ubuntu中文
←
UbuntuHelp:CableDialup/zh
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{Translation}} {{From|https://help.ubuntu.com/community/CableDialup}} {{Languages|UbuntuHelp:CableDialup}} == 通过 USB 用手机上网 == 原文出处: 原文作者: 授权许可: * [http://creativecommons.org/licenses/by-sa/2.0/ 创作共用协议Attribution-ShareAlike 2.0] *[http://forum.ubuntu.org.cn/viewtopic.php?f=116&t=215635 http://forum.ubuntu.org.cn/viewtopic.php?f=116&t=215635] * [http://www.gnu.org/copyleft/fdl.html GNU自由文档许可证] 翻译人员: LiuJiahui 校正人员: 贡献人员: 适用版本: 文章状态:[[等待翻译]] ---- This page describes how to use a cell phone and a USB cable to connect your pc to the internet. For this example I used: 本页描述如何使用手机和USB连接线连接你的电脑来上网。 在这个例子中,我使用以下环境: * Ubuntu Breezy * 诺基亚 6021 手机 * CA-42 连接线 * 意大利Vodafone 移动服务供应商 The instructions should be valid with minimal modifications also for a Bluetooth or infrared connection and for other providers. 少量修改这些操作也可以使其适用于蓝牙或者红外线连接和其它的移动供应商。 I used the packages '''wvdial''' and '''netenv''', which can be installed by 我使用wvdial和netenv软件包,它们可以通过以下命令安装 <pre><nowiki> sudo apt-get install wvdial sudo apt-get install netenv </nowiki></pre> === Configuring the cell phone === === 设置手机 === The cell phone is configured by chosing 手机设置如下: * Menù -> Impostazioni -> Connettività -> GPRS -> Impostazioni modem gprs * "Punto di accesso attivo": VO GPRS * "Punto di accesso gprs": web.omnitel.it (may be this is is not really necessary, but it was suggested by the Vodafone customer care and I have not tried without it). (也许这些设置不是必须的,但Vodafone客服建议这么做,我没有在不进行这些设置的情况下操作过。) === Connecting the cell phone to the pc === === 连接手机到电脑 === The cell phone is connected to the pc by the cable and a USB port. Observing the file '''/var/log/syslog''' we see that a file '''/dev/ttyACM0''' is created. It will be used to communicate with the cell phone: 手机通过数据线和USB接口连接到电脑。查看文件 /var/log/syslog,可以看到/dev/ttyACM0被创建。它将被用来与手机通信。 <pre><nowiki> $ tail -F /var/log/syslog Apr 15 12:00:28 localhost kernel: [4299673.731000] usb 3-1: new full speed USB device using uhci_hcd and address 2 Apr 15 12:00:29 localhost kernel: [4299674.411000] drivers/usb/class/cdc-acm.c: This device cannot do calls on its own. It is no modem. Apr 15 12:00:29 localhost kernel: [4299674.411000] cdc_acm 3-1:1.0: ttyACM0: USB ACM device Apr 15 12:00:29 localhost kernel: [4299674.415000] usbcore: registered new drive r cdc_acm Apr 15 12:00:29 localhost kernel: [4299674.415000] drivers/usb/class/cdc-acm.c: v0.23:USB Abstract Control Model driver for USB modems and ISDN adapters Apr 15 12:00:29 localhost usb.agent[17575]: cdc-acm: loaded successfully </nowiki></pre> === Finding the modem parameters === === 查找调制解调器参数 === Using the command '''wvdialconf''' the cell phone modem is recognized and the relevant parameters are written in '''/etc/wvdial.conf''': 用wvdialconf命令识别手机上的调制解调器并将相关参数写入/etc/wvdial.conf: <pre><nowiki> $ sudo wvdialconf /etc/wvdial.conf Password: Scanning your serial ports for a modem. Port Scan<*1>: S0 S1 S2 S3 S4 S5 S6 S7 Port Scan<*1>: S8 S9 S10 S11 S12 S13 S14 S15 Port Scan<*1>: S16 S17 S18 S19 S20 S21 S22 S23 Port Scan<*1>: S24 S25 S26 S27 S28 S29 S30 S31 Port Scan<*1>: S32 S33 S34 S35 S36 S37 S38 S39 Port Scan<*1>: S40 S41 S42 S43 S44 S45 S46 S47 Port Scan<*1>: S48 S49 S50 S51 S52 S53 WvModem<*1>: Cannot get information for serial port. ttyACM0<*1>: ATQ0 V1 E1 -- OK ttyACM0<*1>: ATQ0 V1 E1 Z -- OK ttyACM0<*1>: ATQ0 V1 E1 S0=0 -- OK ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK ttyACM0<*1>: Modem Identifier: ATI -- Nokia ttyACM0<*1>: Speed 4800: AT -- OK ttyACM0<*1>: Speed 9600: AT -- OK ttyACM0<*1>: Speed 19200: AT -- OK ttyACM0<*1>: Speed 38400: AT -- OK ttyACM0<*1>: Speed 57600: AT -- OK ttyACM0<*1>: Speed 115200: AT -- OK ttyACM0<*1>: Speed 230400: AT -- OK ttyACM0<*1>: Speed 460800: AT -- ttyACM0<*1>: Speed 460800: AT -- ttyACM0<*1>: Speed 460800: AT -- ttyACM0<*1>: Max speed is 230400; that should be safe. ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK Found an USB modem on /dev/ttyACM0. Modem configuration written to /etc/wvdial.conf. ttyACM0<Info>: Speed 230400; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0" </nowiki></pre> === Modifying the configuration file === === 修改配置文件 === The file '''/etc/wvdial.conf''' has to be manually modified to add the row with the initialization string '''Init3''', the Vodafone phone number ('''*99#''') and the empty string for '''Username''' and '''Password''': 手工修改/etc/wvdial.conf,加入初始化字符串Init3,沃达丰手机号码(*99#)和用户名与密码的空字符串。 <pre><nowiki> $ sudo cat /etc/wvdial.conf [Dialer Defaults] Modem = /dev/ttyACM0 Baud = 230400 Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1,"IP","web.omnitel.it" ISDN = 0 Modem Type = USB Modem Phone = *99# Username = '' </nowiki></pre> === Modifying /etc/network/interfaces === === 修改/etc/network/interfaces === The files '''/etc/network/interfaces''' and '''/etc/resolv.conf''' should be modified as follows: /etc/network/interfaces 和/etc/resolv.conf 文件修改如下: <pre><nowiki> $ cat /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ppp0 iface ppp0 inet wvdial </nowiki></pre> <pre><nowiki> $ cat /etc/resolv.conf nameserver 83.224.66.134 nameserver 83.224.65.134 </nowiki></pre> (modifying /etc/resolv.conf is probably unnecessary but I have not tried without it) (修改/etc/resolv.conf可能不是必须的,但我没有省略。) === Connecting === === 连接 === Connect using the command '''wvdial'''. The correct establishment of the connection can be verified by observing the file '''/var/log/syslog'''. At the moment of the connection the Nokia 6021 screen shows that a GPRS connection is being established. All recent Vodafone cell phone cards in Italy have GPRS modem connection enabled by default, just call the number 190 to know the cost. 用wvdial命令来连接。连接的正确建立可以通过查看/var/log/syslog文件来确认。连接时,诺基亚6021的屏幕会显示一个GPRS连接正在建立。意大利所有近期的沃达丰手机卡都缺省开通了GPRS调制解调器连接,只要拨打190就可以知道资费。 <pre><nowiki> $ sudo wvdial --> WvDial: Internet dialer version 1.54.0 --> Cannot get information for serial port. --> Initializing modem. --> Sending: ATZ ATZ OK --> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 OK --> Sending: AT+CGDCONT=1,"IP","web.omnitel.it" AT+CGDCONT=1,"IP","web.omnitel.it" OK --> Modem initialized. --> Sending: ATDT*99# --> Waiting for carrier. ATDT*99# CONNECT ~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~ --> Carrier detected. Waiting for prompt. ~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~ --> PPP negotiation detected. --> Starting pppd at Sat Apr 15 12:02:02 2006 --> pid of pppd: 18018 --> Using interface ppp0 --> local IP address 83.225.55.243 --> remote IP address 10.6.6.6 --> primary DNS address 83.224.66.134 --> secondary DNS address 83.224.65.134 </nowiki></pre> <pre><nowiki> $ tail -F /var/log/syslog Apr 15 12:02:02 localhost kernel: [4299768.004000] CSLIP: code copyright 1989 Regents of the University of California Apr 15 12:02:02 localhost kernel: [4299768.017000] PPP generic driver version 2. 4.2 Apr 15 12:02:02 localhost pppd[18018]: pppd 2.4.3 started by root, uid 0 Apr 15 12:02:02 localhost pppd[18018]: Using interface ppp0 Apr 15 12:02:02 localhost pppd[18018]: Connect: ppp0 <--> /dev/ttyACM0 Apr 15 12:02:08 localhost pppd[18018]: PAP authentication succeeded Apr 15 12:02:08 localhost kernel: [4299773.958000] PPP BSD Compression module registered Apr 15 12:02:08 localhost kernel: [4299774.038000] PPP Deflate Compression module registered Apr 15 12:02:10 localhost pppd[18018]: Cannot determine ethernet address for proxy ARP Apr 15 12:02:10 localhost pppd[18018]: local IP address 83.225.55.243 Apr 15 12:02:10 localhost pppd[18018]: remote IP address 10.6.6.6 Apr 15 12:02:10 localhost pppd[18018]: primary DNS address 83.224.66.134 Apr 15 12:02:10 localhost pppd[18018]: secondary DNS address 83.224.65.134 </nowiki></pre> === Interrupting the connection === === 中断连接 === The connection can be interrupted by a '''Ctrl-C'''. The result is shown in '''/var/log/syslog''': 按Ctrl—C可以中断连接。结果会记录在/var/log/syslog: <pre><nowiki> Caught signal #2! Attempting to exit gracefully... --> Terminating on signal 15 --> Connect time 0.3 minutes. --> Disconnecting at Sat Apr 15 12:02:28 2006 </nowiki></pre> <pre><nowiki> $ tail -F /var/log/syslog Apr 15 12:02:27 localhost pppd[18018]: Terminating on signal 15 Apr 15 12:02:27 localhost pppd[18018]: Connect time 0.3 minutes. Apr 15 12:02:27 localhost pppd[18018]: Sent 0 bytes, received 0 bytes. Apr 15 12:02:27 localhost pppd[18018]: Connection terminated. </nowiki></pre> === Connecting using /etc/init.d/networking === === 通过/etc/init.d/networking连接 === The connection can be established and interrupted also by the following commands (if point 5 has been followed): 也可以通过以下命令建立和中止连接(如果按照第五点来做): <pre><nowiki> $ sudo /etc/init.d/networking start * Configuring network interfaces... [ ok ] $ sudo /etc/init.d/networking stop * Deconfiguring network interfaces... [ ok ] </nowiki></pre> === Connecting using netenv === === 通过netenv连接 === The '''netenv''' package can be used to select different laptop network configurations. Just copy '''/etc/network/interfaces''' and '''/etc/resolv.conf''' to '''/etc/netenv/interfaces.netenv-ppp''' and '''/etc/netenv/resolv.conf.netenv-ppp''', and create '''/etc/netenv/setup-ppp''', '''/etc/netenv/<localhost>-ppp''' in such a way that the ppp connection can be established by the command '''sudo netenv'''. Substitute '''<localhost>''' with the name of the machine you are using. (The following example is Debian specific, see netenv documentation). netenv软件包可以用来选择不同的移动网络设置。只需复制/etc/network/interfaces和/etc/resolv.conf/到/etc/netenv/interfaces.netenv-ppp和/etc/netenv/resolv.conf.netenv-ppp,和创建/etc/netenv/setup-ppp,/etc/netenv/<localhost>-ppp,通过这种方式用sudo netenv命令建立ppp连接。<localhost>是你所使用的电脑的名称。(以下例子适用于Debian,见于netenv文档)。 $ cat setup-ppp #!/bin/sh if [ -r /etc/netenv/interfaces.netenv-ppp ]; then * mv /etc/network/interfaces /etc/network/interfaces.netenv-old ln -s /etc/netenv/interfaces.netenv-ppp /etc/network/interfaces fi if [ -r /etc/netenv/resolv.conf.netenv-ppp ]; then * mv /etc/resolv.conf /etc/resolv.conf.netenv-old ln -s /etc/netenv/resolv.conf.netenv-ppp /etc/resolv.conf fi <pre><nowiki> $ cat <localhost>-ppp netenv_id=ppp </nowiki></pre> ---- == 针对黑莓手机简单的解决方法:Berry4all工具== 我们使用Berry4all,另外还有用Barry实现的(请参考http://bbs.maxpda.com/viewthread.php?tid=240390&page=1&extra=page%3D1#pid4918836)。 1. 下载Berry4all,并解压到到随便一个文件夹下,这里记成$Berry4all$> http://www.colar.net/websvn/filedetails ... tether.tgz 2. Berry4all是不用安装的,但是要确认你已经安装了它所依赖的包,没装的话装上。 只是它依赖的像什么python libusb-dev ppp python-usb这些都要装上,还可能有其它的没装上的,像我使用的过程中它提示缺少python-wxgtk2.8,装上就好了。 3. 关闭其它网卡端口,运行Berry4all sudo ifconfig eth0 down (如果你的是eth1等,eth0改成eth1就好了,可以用ifconfig查看) cd $Berry4all$> sudo ./berry4all.sh 顺利的话就可以看到gui界面了,如果看不到界面,请注意给出的提示。 4. 一般来说,直接“Modem”-->“Connect”就能拨号成功 在“File”-->“Preference”中可以选择运营商,我选的是默认的att; 5. 接下来上网的事就很容易了 在浏览器中设个代理10.0.0.172,端口80,就能上了。 [[category:CategoryBreezy]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
模板:Translation
(
查看源代码
)
返回至
UbuntuHelp:CableDialup/zh
。