HowTo: Huawei E272/Vodacom/Ubuntu Hardy

Posted on June 21st, 2008 by raoul and tagged , , , , .

So I did say I was going to both blog about my installation of the Huawei E272 and then post it on the CLUG wiki. My apologies for not having done this sooner, I've had a few other things on my plate.

My setup looks like this:

  • Main server serving DNS, DHCP, etc on the network (see my other HowTo)
  • Second server with Ubuntu 8.04 (Hardy Heron)
  • Huawei E272 HSDPA modem

You'll also need:

  • SIM card (Contract or prepaid, it doesn't really matter)
  • About 20 minutes to spare

Preparation:

  1. Make sure your SIM card is activated: Plug it into your phone and try to make a phone call.
  2. Disable the SIM PIN while you've got the SIM card in your phone. It's a security measure, and since this SIM card is always going to be in your computer, there's no need for it.
  3. If, like in my case, you have other computers on your network needing to access the Internet through your computer, make sure your computer is on the network and the computers can ping your computer.

Installing the modem:

  1. The first thing you want to do is to put the SIM card into the modem. Make sure you've disabled that SIM PIN.
  2. Before plugging your modem into your computer, type in
    tail -f /var/log/syslog
    and watch your log. Then plug your modem in and watch the logs
  3. Your computer should create 3 new devices: /dev/ttyUSB0/1/2
  4. If you don't see these devices, you won't be able to do anything further. Google and see if you can find a solution.
  5. Once the modem is plugged in, the little light on the side should flash green (twice per "flash"). Once the SIM is logged into the network the light should flash blue to indicate that you have 3G/HSDPA reception. If it flashes a single flash of green, it means that you only have GPRS reception.

Setting up your connection:

Note: A number of tutorials use wvdial. I prefer to use pppd directly. I find that while pppd is a little more technical, there's a lot less to do.

  1.  Move to the /etc/ppp/peers directory:
    cd /etc/ppp/peers
  2. Create and edit a new file called "hsdpa":
    sudo vi hsdpa
  3. Put the following into that file:
    /dev/ttyUSB0 115200
    connect '/usr/sbin/chat -v -f /etc/chatscripts/hsdpa'
    crtscts
    modem -detach
    noccp
    nopcomp
    defaultroute
    usepeerdns
    noauth
    ipcp-accept-remote
    ipcp-accept-local
    :192.168.100.101 # For some reason, I never get the remote server's IP address. So I'm manually setting it to the actual IP address.
  4. Now go to the /etc/chatscripts directory:
    cd /etc/chatscripts
  5. Create and edit another new file called "hsdpa":
    sudo vi hsdpa
  6. Put the following into that file:
    "" ATZ OK AT+CGDCONT=1,"IP","internet"
    OK "ATD*99***1#"
    CONNECT
  7. If your APN is not "internet", change the above to reflect your real APN.

Test your connection:

If all went well, you should be able to connect to the Internet now. Simply type

pon hsdpa

and watch the output for errors.

Install a firewall:

Once you've got a connection, you'll want to install a firewall. This both keeps unwanted elements out and allows your internal traffic to get out. I like Arno's IPTables Firewall as it is both simple and flexible.

sudo apt-get install arno-iptables-firewall

After it has installed, you will be asked a few questions, such as internal and external network connections. Remember that your external network device is "ppp+" not "ppp0" - Arno's IPTables Firewall will automatically detect your connection.

A few advanced things:

I found that my connection would drop about once a day. In order to make my connection redial automatically, I had to uncomment 2 things in the /etc/ppp/options file.

Look for the lines that say

# demand

and

# persistent

Remove the "# " from in front of both of those. "demand" makes the connection dial whenever there's a demand for traffic, and "persistent" makes pppd redial if the connection is dropped.

Conclusion:

Well, that's all that's really needed for the Huawei E272. It's a decent modem and it works well out the box. Enjoy your connection!