Tethering on SaskTel

From BangWiki

Jump to: navigation, search

Contents

Prerequisites

I created my tethering on a Mandriva laptop running:

Mandriva Linux release 2008.1 (Official) for i586

Although YMMV the setup, config, and packages/apps required should be pretty similar.

Packages Used

  • wvdial-1.60
  • ppp-2.4.4
  • all required applications for Bluetooth binding and setup
  1. bluez-utils-3.28
  2. libbluez2-3.28
  3. libkdebluetooth0-1.0-0
  4. kdebluetooth-1.0-0
  5. bluez-firmware-1.2

Getting started

First grab all the packages and also verify you have the 'cdc_acm' kernel module. I'm assuming that on most systems this module will already be compiled or part of the build. Next is to make sure your phone is capable of a data connection or to act as a modem. In order to tether on SaskTel's network you MUST have a data plan. See their site for available plans or call them to verify your device is capable of tethering and have them activate a data plan for you.

The first method we'll look at is tethering over USB.

USB

Setting up your phone

Typically your device needs to be set in a mode allowing it to be used as a modem. Specifics for your phone will be found in its' documentation but as an example (I'm using a 'Motorola Q') the 'Q' has a Modem Link Application for setting up my device to tether over USB.

Start -> Accessories -> Modem Link -> Activate

Once the device has been set up, plug it in to your computer and verify it is seen as a usb modem (I'll add debugging eventually on how to correct issues if it does not show up but for now we'll assume it's all good).

On plugging in the phone you should see something similar to this:

# tail -f /var/log/messages
Jun 20 07:36:17 localhost kernel: usb 3-2: new full speed USB device using uhci_hcd and address 14
Jun 20 07:36:17 localhost kernel: usb 3-2: configuration #1 chosen from 1 choice
Jun 20 07:36:17 localhost kernel: cdc_acm 3-2:1.0: ttyACM0: USB ACM device

wvdial

This is probably the easiest part. wvdial includes a config app that probes existing serial interfaces and tries to configure/read appropriate baud and AT commands for your device. Simply run the wvdialconfig:

Here's my full output:

# wvdialconf
Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
ttyS1<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS1<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS1<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Modem Port Scan<*1>: S2   S3
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 -- ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ttyACM0<*1>: Speed 4800: AT -- OK
ttyACM0<*1>: Modem Identifier: ATI -- Microsoft Corporation AT Command Interpreter Settings...
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 -- OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found an USB modem on /dev/ttyACM0.
/etc/wvdial.conf<Warn>: Can't open '/etc/wvdial.conf' for reading: No such file or directory
/etc/wvdial.conf<Warn>: ...starting with blank configuration.
Modem configuration written to /etc/wvdial.conf.
ttyACM0<Info>: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

And the resulting config file created:

# cat /etc/wvdial.conf

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
; Phone = <Target Phone Number>
ISDN = 0
; Username = <Your Login Name>
Init1 = ATZ
; Password = <Your Password>
Modem = /dev/ttyACM0
Baud = 460800

Specifics to SaskTel

Obviously we aren't going to be dialing a phone number to get on to a 1x or EVDO network, nor do we 'need' to provide a username or password. On the existing infrastructure your device will provide an encrypted uname and pass for you when you try to access the network to it negates the options passed to it via your dialer. What I've found was it was just as easy to provide the username and pass to make wvdialer happy. The format for the user and pass are:

User: <your 10 digit cell number>@1x.stm.sk.ca

3065551212@1x.stm.sk.ca

Pass: <your 7 digit cell number>

5551212

Also we need to pass a number to dial to get on the network. For SaskTel (and for many if not all other 1x/EVDO access carriers), the number is:

#777

So now we can edit our /etc/wvdial.conf file like this:

# cat /etc/.wvdial.conf

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Phone = #777
ISDN = 0
Username = 3065551212@1x.stm.sk.ca
Init1 = ATZ
Password = 5551212
Modem = /dev/ttyACM0
Baud = 460800


Soooooooo now that we have a device we can communicate through, and a valid data plan we can try connecting:

# wvdial
--> WvDial: Internet dialer version 1.60
--> 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
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT
--> Carrier detected.  Waiting for prompt.
--> Don't know what to do!  Starting pppd and hoping for the best.
--> Starting pppd at Fri Jun 20 07:57:32 2008
--> Pid of pppd: 24414
--> Using interface ppp0
--> pppd: Connect: ppp0 <--> /dev/ttyACM0
--> pppd: not replacing existing default route via 192.168.100.254
--> local  IP address 207.195.111.185
--> remote IP address 207.195.70.1
--> primary   DNS address 142.165.21.5
--> secondary DNS address 142.165.200.5

Verify the connection

There's a few things I've had to do and I'm pretty sure it's just because I need to tweak my config (IE: usepeerdns)

  • add a route
# ip route add default dev ppp0
  • ping a gateway (I hit my access gateway)
# ping 24.89.80.1
PING 24.89.80.1 (24.89.80.1) 56(84) bytes of data.
64 bytes from 24.89.80.1: icmp_seq=1 ttl=236 time=247 ms
64 bytes from 24.89.80.1: icmp_seq=2 ttl=236 time=269 ms

Yay ... we have a connection ... now for DNS. Although it shows the DNS servers my resolv.conf file was empty so I manually added the ones thet pppd reported (I'll automate this later). Then test a DNS lookup:

# nslookup www.google.ca
Server:         142.165.21.5
Address:        142.165.21.5#53

Non-authoritative answer:
www.google.ca   canonical name = www.google.com.
www.google.com  canonical name = www.l.google.com.
Name:   www.l.google.com
Address: 72.14.205.104
Name:   www.l.google.com
Address: 72.14.205.103
Name:   www.l.google.com
Address: 72.14.205.99
Name:   www.l.google.com
Address: 72.14.205.147

Carry on and browse the InterWeb. For kicks I tested the connection speed using one of many online speed test utilities:

Here's the results from Speed Test using Seattle, WA:

Download Speed:4242.4 kbps (530.3 KB/sec transfer rate)
Upload Speed: 1014.4 kbps (126.8 KB/sec transfer rate)

Not bad for a cell phone :-P

BlueTooth

Set up device

The first thing we need to do is make sure we can bind to the device. Put your phone in discovery mode and search for it on your computer. There's a few or more different ways to do this but for now we can use hcitool

# hcitool scan
Scanning ...
        00:AA:BB:CC:DD:EE       Motorola Q

Pairing

Now we need to make sure we can pair with the device. I used KDE's utilities for this which simplified the proccess greatly.

  1. Start Konqueror
  2. Press <F9> to launch navigation panel
  3. Highlight 'Bluetooth Browser'

Image:snapshot2.png

  1. Select Phone from list

Image:snapshot4.png

  1. Launch a service (I used OBEX File transfer)

Image:snapshot3.png

Once you try to launch a connection to the phone you should get a dialogue on your device requesting a PIN. Whatever PIN you select on your phone will be the one the PIN helper on your computer will require to negotiate the connection. For this example I used 0000. When the phone prompts you for a PIN, simply type in 0000. Upon successfully submitting the PIN your computer should launch a pin dialogue as well:

Image:snapshot1.png

Enter the same pin to complete the pairing.

Binding

To bind to the phone we'll use rfcomm. In order to bind we'll need to know what channel on our device is actually handling DUN functions.

# sdptool browse

Service Name: Dial-up Networking
Service RecHandle: 0x10007
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 6

You'll see a lot more info than this but all we need is the DUN stuff. Now we can create an rfcomm.conf file in /etc/bluetooth:

# cat /etc/bluetooth/rfcomm.conf
#
# RFCOMM configuration file.
#

rfcomm0 {
        # Automatically bind the device at startup
        bind no;

        # Bluetooth address of the device
        device 00:AA:BB:CC:DD:EE;

        # RFCOMM channel for the connection
        channel 6;

        # Description of the connection
        comment "Example Bluetooth device";
}

Now to bind to our device:

  1. Make sure we dont already have a binding/device
  2. Release and existing bindings
  3. Bind new connection

# ls -l /dev/rfcomm*
crw-rw---- 1 user group 216, 0 2008-06-19 09:46 /dev/rfcomm0
# rfcomm release rfcomm0
# rfcomm bind 00:AA:BB:CC:DD:EE

# rfcomm
rfcomm0: 00:AA:BB:CC:DD:EE channel 6 clean

Peer File (PPPD)

Although I'm sure this can be imporved upon (you might change the baudrate etc... here is my existing ppp file in /etc/ppp/peers:

# cat sasktel
rfcomm0
460800
debug
noauth
defaultroute
usepeerdns
connect-delay 10000
user 3065551212@1x.stm.sk.ca
show-password
crtscts
lock
connect '/usr/sbin/chat -v -s -f /etc/ppp/peers/sasktel-chat'

And the reference file /etc/ppp/peers/sasktel-chat:

'' ATDT#777

Connect!

Or at least give it a shot ;-)

# pppd call sasktel
# tail -f /var/log/messages
Jun 23 07:45:31 localhost pppd[11795]: pppd 2.4.4 started by root, uid 0
Jun 23 07:45:31 localhost bluetooth: Starting bluetooth service
Jun 23 07:45:31 localhost bluetooth: Starting hidd
Jun 23 07:45:32 localhost hcid[17787]: link_key_request (sba=00:16:41:8A:DE:43, dba=00:AA:BB:CC:DD:EE)
Jun 23 07:45:33 localhost chat[11836]: send (ATDT#777^M)
Jun 23 07:45:33 localhost pppd[11795]: Serial connection established.
Jun 23 07:45:33 localhost pppd[11795]: Using interface ppp0
Jun 23 07:45:33 localhost pppd[11795]: Connect: ppp0 <--> /dev/rfcomm0
Jun 23 07:45:44 localhost pppd[11795]: not replacing existing default route via 192.168.100.254
Jun 23 07:45:44 localhost pppd[11795]: local  IP address 198.230.120.90
Jun 23 07:45:44 localhost pppd[11795]: remote IP address 207.195.70.1
Jun 23 07:45:44 localhost pppd[11795]: primary   DNS address 142.165.21.5
Jun 23 07:45:44 localhost pppd[11795]: secondary DNS address 142.165.200.5

Add route and DNS servers

Ok same as above you'll probably have to add tghe DNS server manually and add the static route. If it's there you're golden, if not ... add them:

# ip route add default dev ppp0
Personal tools