特殊:Badtitle/NS100:CableDialup
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/CableDialup }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/af | • {{#if: UbuntuHelp:CableDialup|Afrikaans| [[::CableDialup/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/ar | • {{#if: UbuntuHelp:CableDialup|العربية| [[::CableDialup/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/az | • {{#if: UbuntuHelp:CableDialup|azərbaycanca| [[::CableDialup/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/bcc | • {{#if: UbuntuHelp:CableDialup|جهلسری بلوچی| [[::CableDialup/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/bg | • {{#if: UbuntuHelp:CableDialup|български| [[::CableDialup/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/br | • {{#if: UbuntuHelp:CableDialup|brezhoneg| [[::CableDialup/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/ca | • {{#if: UbuntuHelp:CableDialup|català| [[::CableDialup/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/cs | • {{#if: UbuntuHelp:CableDialup|čeština| [[::CableDialup/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/de | • {{#if: UbuntuHelp:CableDialup|Deutsch| [[::CableDialup/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/el | • {{#if: UbuntuHelp:CableDialup|Ελληνικά| [[::CableDialup/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/es | • {{#if: UbuntuHelp:CableDialup|español| [[::CableDialup/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/fa | • {{#if: UbuntuHelp:CableDialup|فارسی| [[::CableDialup/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/fi | • {{#if: UbuntuHelp:CableDialup|suomi| [[::CableDialup/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/fr | • {{#if: UbuntuHelp:CableDialup|français| [[::CableDialup/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/gu | • {{#if: UbuntuHelp:CableDialup|ગુજરાતી| [[::CableDialup/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/he | • {{#if: UbuntuHelp:CableDialup|עברית| [[::CableDialup/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/hu | • {{#if: UbuntuHelp:CableDialup|magyar| [[::CableDialup/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/id | • {{#if: UbuntuHelp:CableDialup|Bahasa Indonesia| [[::CableDialup/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/it | • {{#if: UbuntuHelp:CableDialup|italiano| [[::CableDialup/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/ja | • {{#if: UbuntuHelp:CableDialup|日本語| [[::CableDialup/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/ko | • {{#if: UbuntuHelp:CableDialup|한국어| [[::CableDialup/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/ksh | • {{#if: UbuntuHelp:CableDialup|Ripoarisch| [[::CableDialup/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/mr | • {{#if: UbuntuHelp:CableDialup|मराठी| [[::CableDialup/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/ms | • {{#if: UbuntuHelp:CableDialup|Bahasa Melayu| [[::CableDialup/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/nl | • {{#if: UbuntuHelp:CableDialup|Nederlands| [[::CableDialup/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/no | • {{#if: UbuntuHelp:CableDialup|norsk| [[::CableDialup/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/oc | • {{#if: UbuntuHelp:CableDialup|occitan| [[::CableDialup/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/pl | • {{#if: UbuntuHelp:CableDialup|polski| [[::CableDialup/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/pt | • {{#if: UbuntuHelp:CableDialup|português| [[::CableDialup/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/ro | • {{#if: UbuntuHelp:CableDialup|română| [[::CableDialup/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/ru | • {{#if: UbuntuHelp:CableDialup|русский| [[::CableDialup/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/si | • {{#if: UbuntuHelp:CableDialup|සිංහල| [[::CableDialup/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/sq | • {{#if: UbuntuHelp:CableDialup|shqip| [[::CableDialup/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/sr | • {{#if: UbuntuHelp:CableDialup|српски / srpski| [[::CableDialup/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/sv | • {{#if: UbuntuHelp:CableDialup|svenska| [[::CableDialup/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/th | • {{#if: UbuntuHelp:CableDialup|ไทย| [[::CableDialup/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/tr | • {{#if: UbuntuHelp:CableDialup|Türkçe| [[::CableDialup/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/vi | • {{#if: UbuntuHelp:CableDialup|Tiếng Việt| [[::CableDialup/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/yue | • {{#if: UbuntuHelp:CableDialup|粵語| [[::CableDialup/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/zh | • {{#if: UbuntuHelp:CableDialup|中文| [[::CableDialup/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/zh-hans | • {{#if: UbuntuHelp:CableDialup|中文(简体)| [[::CableDialup/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:CableDialup | UbuntuHelp:CableDialup | {{#if: | :}}CableDialup}}/zh-hant | • {{#if: UbuntuHelp:CableDialup|中文(繁體)| [[::CableDialup/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:CableDialup|:CableDialup|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :CableDialup/zh | | {{#ifexist: CableDialup/zh | | {{#ifeq: {{#titleparts:CableDialup|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:CableDialup|1|-1|}} | zh | | }}
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:
- Ubuntu Breezy
- a Nokia 6021 cell phone
- a CA-42 cable
- an Italian Vodafone provider
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
sudo apt-get install wvdial sudo apt-get install netenv
1. 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).
2. 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:
$ 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
3. Finding the modem parameters
Using the command wvdialconf the cell phone modem is recognized and the relevant parameters are written in /etc/wvdial.conf:
$ 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"
4. 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:
$ 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 = ''
5. Modifying /etc/network/interfaces
The files /etc/network/interfaces and /etc/resolv.conf should be modified as follows:
$ cat /etc/network/interfaces # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ppp0 iface ppp0 inet wvdial
$ cat /etc/resolv.conf nameserver 83.224.66.134 nameserver 83.224.65.134
(modifying /etc/resolv.conf is probably unnecessary but I have not tried without it)
6. 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.
$ 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
$ 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
7. Interrupting the connection
The connection can be interrupted by a Ctrl-C. The result is shown in /var/log/syslog:
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
$ 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.
8. Connecting using /etc/init.d/networking
The connection can be established and interrupted also by the following commands (if point 5 has been followed):
$ sudo /etc/init.d/networking start * Configuring network interfaces... [ ok ] $ sudo /etc/init.d/networking stop * Deconfiguring network interfaces... [ ok ]
9. Connecting using 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).
$ 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
$ cat <localhost>-ppp netenv_id=ppp
Nokia 5500 Sport in Dapper Drake with USB
Getting it up and running was quite easy:
- plug in your phone with the USB cable
- select "PC Suite Mode" from you phone
- the phone is autodetected
- run the following commands:
# sudo apt-get install wvdial # sudo wvdial # sudo nano /etc/wvdial.conf
Note lines with
- Init3 = AT+CGDCONT=1,"IP","internet"
- Phone = *99#
- Username =
The name of the connection may vary according to your GPRS provider. I use DNA Finland. For Elisa in Finland the username should be 'rl'.
[Dialer Defaults] Init1 = ATZ Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1,"IP","internet" Modem Type = USB Modem #Baud = 460800 Baud = 230400 New PPPD = yes Modem = /dev/ttyACM0 ISDN = 0 Phone = *99# Username = '' Password = '' # sudo nano /etc/network/interfaces auto ppp0 iface ppp0 inet wvdial # sudo /etc/init.d/networking restart
Check that your connection works with ping www.ubuntu.fi