Huawei E173

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.

=Requirements=

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.

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

Packages
Emerge the following packages:

net-dialup/ppp sys-apps/usb_modeswitch

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</tt>. 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</tt> and internet</tt>, if your ISP requires different information.

 dns_servers_ppp0=" '208.67.222.222' '208.67.220.220' " config_ppp0="ppp" link_ppp0="/dev/ttyUSB0" plugins_ppp0="" username_ppp0="nobody" password_ppp0="nothing" pppd_ppp0="lock defaultroute noipdefault noauth usepeerdns 460800" phone_number_ppp0="*99#" chat_ppp0=" 	'ABORT' 'BUSY' 	'ABORT' 'ERROR' 	'ABORT' 'NO ANSWER' 	'ABORT' 'NO CARRIER' 	'ABORT' 'NO DIALTONE' 	'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'  	'~--' '' " </tt>
 * 1) DNS servers line is only needed if your default servers are slow
 * 2) These servers below are from OpenDNS

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

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

You can now start and stop the USB stick with  and.

If you want to avoid typing the  commands and want to autostart the connection whenever the stick is plugged in, you have to tell the udev</tt> daemon that this USB stick should trigger net.ppp0</tt>. To achieve this, edit the file /etc/udev/rules.d/10-local.rules</tt> (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" </tt>

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