Huawei E173

From Gentoo-en
Jump to: navigation, search
Please format this article according to the Style Guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article.


  • Template Usage.
  • Narrative mode(I foo, my bar, etc.)

This guide is written for people who want to use their Huawei E173 (UMTS/HSPA) USB stick with Gentoo Linux. The first part of this guide will tell you what kernel options you will need to get the hardware working. The next part will be the configuration for the USB stick to establish a ppp connection to your provider. A couple of configuration examples are given for different providers.

These instructions were written in May 2011. I'm using kernel 2.6.36-gentoo-r5 with baselayout-2.0.1-r1 and OpenRC 0.6.8.


Kernel configuration

USB to Serial converter for the Modem is necessary. To establish the PPP connection to the provider, ppp support also has to be enabled in the kernel.

Linux Kernel Configuration: 2.6.36-gentoo-r5 - USB and PPP setup
Device Drivers ->
    USB support  --->
        <M> OHCI HCD support (If not use Intel or VIA chipset)
        <M> UHCI HCD (most Intel and VIA) support (If use Intel or VIA chipset)
        <M> USB Serial Converter support  --->
            [*] USB Generic Serial Driver
            <M> USB driver for GSM and CDMA modems
    Network device support  --->
        <*> PPP (point-to-point protocol) support
        <*> PPP support for async serial ports

Recompile the kernel and reboot or/and load the newly enabled modules.


Emerge the following packages:


Necessary information

Plug in the device and wait a while. Check that the node /dev/ttyUSB0 appears. If your device node is different, you have to modify the instructions below accordingly.

If you are already using ppp0 for something, find the next free number and use that in the instructions below, for example ppp2

Information from your ISP

You need the following information from your ISP:

  • Telephone number (for me it is *99#).
  • PIN code for the SIM card in the USB stick (in the example below, 1234).
  • Name of access point. In the example below, "IP","internet"

You may have to modify the instructions below so that they work with your ISP.

Configuring the setup files

This process depends on which method you want to use.

Edit: /etc/conf.d/net script

For this method, you add the information about the USB 3G stick to the script in /etc/conf.d/net. If the file does not exist, you can create it. Open this file and add the following (somewhere, say at the bottom of the file). Make sure to change the phone number, PIN code and where it says IP and internet, if your ISP requires different information.

 # DNS servers line is only needed if your default servers are slow
 # These servers below are from OpenDNS
 dns_servers_ppp0=" '' '' "
 pppd_ppp0="lock defaultroute noipdefault noauth usepeerdns 460800"
 	'ABORT' 'Invalid Login'
 	'ABORT' 'Login incorrect'
 	'TIMEOUT' '10'
 	'' 'ATZ'
 	'OK' 'AT+CPIN?'
 	'READY-AT+CPIN=1234\r\n\d\d\d\d\d-OK' 'ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0'
 	'OK' 'AT+CGDCONT=1,\\\"IP\\\",\\\"internet\\\"'
 	'OK' 'ATDT\T'
 	'CONNECT' ''
 	'~--' ''

If you do not need a PIN code, then delete the first line that contain CPIN and change the READY-AT+CPIN... phrase below it to OK.

Save the file. Next, create a symlink as follows.

cd /etc/init.d
ln -s net.lo net.ppp0

You can now start and stop the USB stick with rc-config start net.ppp0 and rc-config stop net.ppp0.

If you want to avoid typing the rc-config commands and want to autostart the connection whenever the stick is plugged in, you have to tell the udev daemon that this USB stick should trigger net.ppp0. To achieve this, edit the file /etc/udev/rules.d/10-local.rules (or create a new file if it does not exist yet). Add the following lines to the file:

KERNEL=="ttyUSB0", ACTION=="add|change", RUN+="/usr/bin/rc-config start net.ppp0"
KERNEL=="ttyUSB0", ACTION=="remove", RUN+="/usr/bin/rc-config stop net.ppp0"

Save the file. These changes will take effect when the udev daemon is restarted. You can do this manually by rc-config restart udev, but I recommend that you reboot instead, because many programs rely on a running udev.