Connect to the Internet through USB and dial-up using a mobile phone in Linux

Source: Internet
Author: User
Tags nameserver
How to connect a cell phone via USB to a Linux laptop and dial-up an Internet connection

From: http://markus.wernig.net/en/it/usb-serial-handy-ppp.phtml

Note:I have a Siemens m65 cell phone, but I suppose the methods won't differ too much for other models.
For hints about Linux on my laptop model see: Linux on the HP pavilion ze4300.

Hardware involved:
HP pavilion ze4300
Siemens m65
Siemens data cable USB DCA-540

Software:
Linux Gentoo, kernel 2.6.10
Siemens firmware:
Product: m65
P-Date: 2004-12-01
Sw-Version: 16
Baseline: kzdb4 # main_1.0_v119.8
FFS-version: M65_2_xx-FFS-LG01_16_0259
Variant: A 115

Protocols
CSD (GSM)
GPRS

1) Get a cell phone with an internal modem (most have one today, because of GPRS, I think). Mine. Was the Siemens m65, as described above.

2) first, before purchasing the USB cable, I took my laptop to the shop and asked if I cocould connect my cellphone to my laptop with the cable before actually bying it.
The relevant output from "lsmod" regarding the USB subsystem at that point was:

# lsmod
[...]
usb_storage 101264 0
uhci_hcd 33420 0
ohci_hcd 34952 0
usbcore 129784 4 usb_storage,uhci_hcd,ohci_hcd
[...]

When I attached the phone, the device was recognized:

Feb  9 17:29:31 blue kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2
Feb 9 17:29:31 blue kernel: usb 1-2: Product: Siemens USB Connectivity
Feb 9 17:29:31 blue kernel: usb 1-2: Manufacturer: Siemens AG
Feb 9 17:29:31 blue kernel: usb 1-2: SerialNumber: 353669000550637

I then decided, that it's worth the risk, and bought the cable.

3) Then came Google time.

The two pages that helped me most were:

Http://www.peerfear.org/rss/permalink/2004/11/30/WirelessIPWithSprintUSBAndKernel26/

And

Http://www.linuxformat.co.uk/modules.php? OP = modload & name = phpbb_14 & file = index & Action = Viewtopic & topic = 9210 & Forum = 1 & 6

For the GPRS connection I found the following discussion very helpful (Long live public mailing list archives !) :
Http://www.webservertalk.com/archive216-2004-4-189602.html

4) what it all boils down to, is:

Prepare your kernel carefully. as I always do, I compiled all the necessary options as modules (for better control and adaptability ). you can probably as well just compile it into the kernel, if you like.
Besides the standard, I needed the following options:

Device Drivers-> networking support-> network device support

CONFIG_PPP=m
# CONFIG_PPP_MULTILINK is not set
CONFIG_PPP_FILTER=y
CONFIG_PPP_ASYNC=m
CONFIG_PPP_SYNC_TTY=m
CONFIG_PPP_DEFLATE=m
CONFIG_PPP_BSDCOMP=m
# CONFIG_PPPOE is not set

Device Drivers-> USB support
You definitely don't need all of those, but not knowing what your hardware is (as is likely with a cell phone internal usb modem ;-), you might first try to build all modules and let the autoloader figure out which one to use, then disable the rest in a second kernel build.

You will definitely need at least (well, if you have my hardware, anyway ):

CONFIG_USB=m
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_OHCI_HCD=m
CONFIG_USB_UHCI_HCD=m
(depending on your usb hardware)
CONFIG_USB_ACM=m (I didn't need it, but that's likely to be an exception)
CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_GENERIC=y
CONFIG_USB_SERIAL_PL2303=m
(remember that your modem/cable combination could require another option!)

I'm not sure about the following
# USB Host-to-Host Cables
CONFIG_USB_ALI_M5632=y
CONFIG_USB_AN2720=y
CONFIG_USB_BELKIN=y
CONFIG_USB_GENESYS=y
CONFIG_USB_NET1080=y
CONFIG_USB_PL2301=y
CONFIG_USB_KC2190=y

You also need a module called "slhc", for which I can't find the config option at the moment.

Compile, install and reboot if necessary.

5) Now what remains is to load the modules and configure a dialer.
Note: Since I couldn't get it to work properly with wvdial, I used kppp, which works fine, although I don't see the difference in the configuration.

modprobe cdc-acm
modprobe usbserial
modprobe pl2303

Now attach the phone with the USB cable to your computer.
You shoshould see the kernel registering the necessary devices.

Feb  9 21:03:25 blue kernel: drivers/usb/serial/usb-serial.c: USB Serial support registered for Generic
Feb 9 21:03:25 blue kernel: usbcore: registered new driver usbserial_generic
Feb 9 21:03:25 blue kernel: usbcore: registered new driver usbserial
Feb 9 21:03:25 blue kernel: drivers/usb/serial/usb-serial.c: USB Serial Driver core v2.0
Feb 9 21:03:44 blue kernel: usb 1-2: new full speed USB device using ohci_hcd and address 2
Feb 9 21:03:44 blue kernel: usb 1-2: Product: Siemens USB Connectivity
Feb 9 21:03:44 blue kernel: usb 1-2: Manufacturer: Siemens AG
Feb 9 21:03:44 blue kernel: usb 1-2: SerialNumber: 353669000550637
Feb 9 21:03:45 blue kernel: drivers/usb/serial/usb-serial.c: USB Serial support registered for PL-2303
Feb 9 21:03:45 blue kernel: pl2303 1-2:1.0: PL-2303 converter detected
Feb 9 21:03:45 blue kernel: usb 1-2: PL-2303 converter now attached to ttyUSB0
Feb 9 21:03:45 blue kernel: usbcore: registered new driver pl2303
Feb 9 21:03:45 blue kernel: drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver v0.12

You shoshould now have/dev/ttyusb0 (or/dev/USB/TTS/0 under devfs). This is your serial line modem. Use any dialer on it you want.

Add "noauth" to/etc/PPP/options, as your provider will most likely not authenticate to you. if you are a pppd expert, besides probably not needing this tutorial, you can configure pppd in/etc/PPP to your heart's content. in my case kppp does all that magic for me on the fly when dialling. you wowould probably want to add "defaultroute" and "usepeerdns" to the options file.

Note for GPRS
In order to use the faster (and sometimes cheaper) GPRS, you will need to change a few settings in your dialer configuration. the basic modules and stuff remain the same. I still didn't get wvdial to play along, but in the meantime added pppd itself to the list of working Dialers. here's how:

First (for convenience only) I made a link from/dev/USB/TTS/0 to/dev/GPRS:

# ln -s /dev/usb/tts/0 /dev/gprsmodem

Then created the file/etc/PPP/peers/GPRS with the following content:

user USER
password PASSWORD
defaultroute
/dev/gprsmodem
connect "/usr/sbin/chat -v -f /etc/ppp/gprsmodem.chat"
debug
kdebug 4
ipcp-no-addresses
noipdefault
noauth
novj
noccp

Please note that the option "usepeerdns" must not be set. you need to create a file "/etc/PPP/resolv. conf "instead with a set of valid nameservers. in my case it reads:

nameserver 213.55.128.1
nameserver 213.55.128.2

The "ipcp-no-addresses" and "noipdefault" Options tell pppd not to consider the local machine's IP configuration when negotiating with the other side. orange's dial-up PPP server is very picky when it comes to what it expects you to send after authenticating. anything else than "[ipcp confreq id = 0x1 <ADDR 0.0.0.0>]" will result in a negotiation timeout.

In/etc/PPP/uplsmodem. chat there's:

'ABORT' 'BUSY'
'ABORT' 'ERROR'
'ABORT' 'NO ANSWER'
'ABORT' 'NO CARRIER'
'ABORT' 'NO DIALTONE'
'ABORT' 'Invalid Login'
'ABORT' 'Login incorrect'
'' 'ATZ'
'TIMEOUT' '10'
'OK' 'ATM1L1'
'OK' 'AT&f+cgdcont=1,"IP","internet","",0,0'
'OK' 'ATDT*99***1#'
'CONNECT' ''

(The parameters are quite public, part of it is on the homepage, part of it you get from customer support. those settings are for orange, I don't know if they work with other providers. I think you need a special contract ("Express") to use GPRS .)

When using pppd as a dialer, you can now call

# pppd call gprs

Watch/var/log/messages (and on Gentoo/var/log/daemon. Log) for progress.

The configuration for kppp is similar.
Create a new account. Add the pppd options from/etc/PPP/peers/GPRS under "mimize pppd arguments". Authentication PAP/chap, number*99***1#. Set DNS configuration to "Manual" and add your namesevers.
Add a new modem on/dev/USB/TTS/0. In the "modem commands" section, set the "initialization string 2"AT&f+cgdcont=1,"IP","internet","",0,0.

This shoshould do, you're set. Your System Log shoshould tell you more:

Feb  9 22:23:50 blue net.agent[11720]: add called for ppp0
Feb 9 22:23:51 blue kernel: PPP BSD Compression module registered
Feb 9 22:23:52 blue kernel: PPP Deflate Compression module registered

Starting pppd (either by hand or automatically from your dialler) will load some more modules.

# lsmod
[...]
pl2303 20356 0
usbserial 30312 1 pl2303
ppp_deflate 6272 0
zlib_deflate 22808 1 ppp_deflate
zlib_inflate 18304 1 ppp_deflate
bsd_comp 6144 0
ppp_async 11776 0
ppp_generic 27284 3 ppp_deflate,bsd_comp,ppp_async
slhc 7680 1 ppp_generic
[...]
usb_storage 101264 0
uhci_hcd 33420 0
ohci_hcd 34952 0
usbcore 129784 6 pl2303,usbserial,usb_storage,uhci_hcd,ohci_hcd

Note on CSD (GSM)
Now all you need is a provider that will accept your data call. I use orange here in Switzerland (see http://www.orange.ch/pricesservices/services/dataAccess/webOrange? TS = 1107956611879), and no registration is needed. Dial-up numbers, username and password are also on the above website.Beware!The fees on the site are chargedIn additionTo normal connection fees!

Markus wernig

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.