Wednesday, December 31, 2008

Using a Vodafone GPRS Connection as a Modem

I find that occasionally I am unable to find any other way of connecting to the Internet than using my P900 phone as a modem. It is very expensive but sometimes neccesary. I used various different sources on the Web to get the right set up and this page summarizes my experience in case it is helpful to others. I will amend the page to fill out details as people as for further details.

My set up is:

  • An AJP M3000N laptop (yes this is a rebadged Asus M3000N but it is still a very good machine) running Ubuntu 06.06 Dapper Drake with a D-Link DBT-120 Bluetooth ariel plugged into one of the USB sockets.
  • Sony Ericsson P900 phone. (NB ensure the phone is connected to mains power, actively using Bluetooth and GPRS connections drains the battery very rapidly.)
  • A Vodafone account with full Internet access (GRPS and Internet APN). You know you have correct account permissions if you can send email successfully from the phone itself – I have always been able to send email from the P900 but have never actually been able to use it as a mail reader. Make sure you terminate the phone's Internet connection once you have tried this, the GPRS connection can only connect the phone directly or use the phone as a modem not both at the same time.

Step 1: Make sure the Bluetooth connection between laptop and phone is set up correctly and works:

  • Run ‘hcitool scan’ on the laptop to ensure the Bluetooth system is up and running – it might be worth checking Bluetooth is enables on the phone :-) This should give you the Bluetooth address of the phone – the address is of the form xx:xx:xx:xx:xx:xx where each xx is a hexadecimak digit pair.
  • If the devices are not already bonded, then bond the phone to the computer. I had already done this at some stage in the past so I didn't have to do it at this time but if the devices are not bonded then they will need to be. The standard Ubuntu set up has the laptop PIN in /etc/bluetooth/pin. If I recollect correctly I bonded the phone to the laptop not vice versa by having Bluetooth up and running on the laptop then doing a search and bond from the phone giving the correct PIN.
  • Run ‘sdptool browse ’ to find out which channels are being used for each of the services. I find that the channel numbers for most services are fixed but that the channel number for the modem service can change from time to time (which is irritating). The important entry for using the phone as modem is the one labelled ‘Service Name: Dial-up Networking’. For me, just now, this is Channel 3.
  • Set up an RFCOMM device. I have decided to use /dev/rfcomm0 as the device to connect to the phone as a modem. So I set up /etc/bluetooth/rfcomm.conf to ensure /dev/rfcomm0 connects to Channel 3.
                rfcomm0 {
    bind yes ;
    device ;
    channel 3 ;
    comment "RLW-P900 Dial-up Networking Service -- for PPP" ;
    }
    As ever, whenever you change a configuration file restart the sub-system, in this case ‘/etc/init.d/bluez-utils restart’.

Step 2: Get the PPP (point-to-point protocol) sub-ystem in a fit state:

  • Create a peer specification. This means creating a file in /etc/ppp/peers. I have called mine rlw-p900-bluetooth-modem and gave it the contents:
                hide-password
    noauth
    connect "/usr/sbin/chat -v -f /etc/chatscripts/rlw-p900"
    debug
    /dev/rfcomm0
    460800
    defaultroute
    noipdefault
    remotename rlw-p900
    ipparam rlw-p900
    usepeerdns
    lcp-echo-interval 0
    I can't rmember where I got all the various options from but they work – though some may be redundant.
  • Create the chat script mentioned in the peer specification, in my case /etc/chatscripts/rlw-p900:
                # This chatfile was generated by pppconfig 2.3.10.
    # Please do not delete any of the comments. Pppconfig needs them.
    #
    # ispauth chat
    # abortstring
    ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED
    # modeminit
    '' ATZ
    # ispnumber
    OK-AT-OK "ATDT*99***1#"
    # ispconnect
    CONNECT ''
    # prelogin

    # ispname
    #login: xxxxxx
    # isppassword
    #password: yyyyyy
    # postlogin
    '' \d\c
    # end of pppconfig stuff
    The login details are handled by the account in the phone so there is no need to specify login id and password details in the chat script. More on this below.

Step 3: Try it out! I use the command ‘pon rlw-p900-bluetooth-modem’. It is almost certainly a wise move to monitor /var/log/syslog (I use ‘tail -f /var/log/syslog’ is a separate terminal) to check that all the right things are happening. I also have a network monitor applet on my status bar monitoring ppp0.

Step 4: Do stuff with the Internet connection. I ran a traceroute to ensure that packets actually went where they were supposed to.

Step 5: Terminate the connection using poff. Remember not to get too upset about the amount of money you just paid to Vodafone. They charge by the amunt of data transferred not by the connection time which does ameliorate some of the pain.

The biggest problem I had was getting the right number for the phone to dial. I have *99***1#. The 1 is a critical number as it identifies the account on the phone that is used make the connection – there are a number of different accounts on my phone for GSM or GPRS connections and MMS, WAP or Web activity. For me account number 1 is GPRS Web activity which is the account neded to get access to the Internet. I am told on newer phones this account is called ‘Contract Internet’.

If you use the wrong account or your account is not permitted to use Internet conenctions then you can still connect but all your packets get routed to a black hole rather than out onto the Internet. I had a lot of trouble sorting this problem out. When I first started trying to get this working, back in January 2006, I was originally using *99***3# as the phone number which uses the wrong phone account for Internet access. I was connecting fine but all my packets were routed to a black hole. When I phoned technical support, they were very nice and tried to find things out but couldn't. In the end they decided ‘Linux is not a supported operating system, you should switch to Windows or Mac.’ A totally unacceptable response in my view. I was angry. I seethed for a while (4 months) and then went into my local Vodafone store to have a rant. They told me that Vodafone had changed all its technical support so I should try again. I did. They were right, I got a whole new set of people, with a whole new set of ideas about technical support. They still had a problem with Linux not being officially supported but instead of closing the issue, they gave me the number of the people who write the sofware. This was a break through. The breakthrough is that the position in the list of accounts is not the account number as all the documentation says, the account number is determined by the order in which accounts are entered into the phone. Obvious in hindsight but... So I changed 3 to 1 and everything worked.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.