Using HSDPA modem

From Alpine Linux


Requirements

This doc is tested on Alpine-2.1.3.

You will need a HSDPA USB-modem.
Use 'dmesg | less' to figure out which /dev/ttyUSB? it uses (you'll need to edit the configuration shown below to reflect the correct port number).

Install packages

Install the required packages

apk add ppp

Load modules

Now let's load the driver (using the values you just discovered) and configure Alpine to load it automatically at boot-up.

modprobe ppp_generic echo "ppp_generic" >> /etc/modules-load.d/ppp.conf

Configfiles

/etc/ppp/peers/E220

(The filename 'E220' can be changed to whatever is appropreate for you, but you will need to remember it when running pon/poff command)

debug
/dev/ttyUSB0
460800
crtscts
modem
noauth
usepeerdns
defaultroute
noipdefault
noccp
nobsdcomp
novj
connect '/usr/sbin/chat -v -f /etc/ppp/chat-E220-pin || /usr/sbin/chat -f /etc/ppp/chat-E220-nopin'

/etc/ppp/chat-E220-pin

(The filename 'chat-E220-pin' can be changed to whatever is appropreate for you, but you will need modify above configfile to reflect your decition)

ABORT "BUSY"
ABORT "ERROR"
ABORT "NO CARRIER"
REPORT "CONNECT"
TIMEOUT "10"
"" "ATZ"
OK "AT+CPIN={PIN}"
OK AT+CGDCONT=1,"ip","{APN}"
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
OK "AT+IPR=115200"
OK "ATE1"
TIMEOUT "60"
"" "ATD*99***1#"
CONNECT \c

/etc/ppp/chat-E220-nopin

(The filename 'chat-E220-nopin' can be changed to whatever is appropreate for you, but you will need modify above configfile to reflect your decition)

ABORT "BUSY"
ABORT "ERROR"
ABORT "NO CARRIER"
REPORT "CONNECT"
TIMEOUT "10"
"" "ATZ"
OK AT+CGDCONT=1,"ip","{APN}"
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
OK "AT+IPR=115200"
OK "ATE1"
TIMEOUT "60"
"" "ATD*99***1#"
CONNECT \c
Note: Replace above word {PIN} with the "PIN" of your card (typically a 4 digit code)
Note: Replace above word {APN} with the "Access Point Name" of the service you use (for instance mine is "web.omnitel.it"). If you don't know the Internet APN, ask your service provider

Routes

Create a default gw route to your 'ppp0' device.

ip route add default dev ppp0

DNS

Figure out what DNS-servers your provider has.

egrep -i 'pppd.*dns' /var/log/messages

This might give you some useful information.
Search for a IP-address that might be your providers DNS-server and add this IP-address into '/etc/resolv.conf'.

echo "nameserver {DNS-server-IP-address}" > /etc/resolv.conf

Start/Stop

Start connection

pon E220

Stop connection

poff E220

If something goes wrong...

Check if process is running

pidof pppd

Logfile might give you a clue on what went wrong

egrep "pppd|chat" /var/log/messages

Check nic information

ifconfig ppp0

pppd has a statusinformation function that could come in handy

pppstats

Huawei E378

Tested on Alpine 2.3.3.

Add usb-modeswitch (currently only in testing repo):

apk add usb-modeswitch

/etc/modules:

usbserial vendor=0x12d1 product=0x1446

/etc/usb_modeswitch.conf:

# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# This file is evaluated by the wrapper script "usb_modeswitch_dispatcher"
# in /usr/sbin
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"

# Disable automatic mode switching globally (e.g. to access the original
# install storage)
DisableSwitching=0

# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" (and probably others)
EnableLogging=1

DefaultVendor=0x12d1
DefaultProduct=0x1446

TargetVendor=0x12d1
TargetProduct=0x14ac

MessageContent="55534243000000000000000000000011060000000000000000000000000000"

CheckSuccess=5

/etc/network/interfaces

auto ppp0
iface ppp0 inet ppp
        provider E378
        pre-up usb_modeswitch -c /etc/usb_modeswitch.conf

/etc/ppp/peers/E378:

debug
/dev/ttyUSB0
460800
crtscts
modem
noauth
usepeerdns
defaultroute
noipdefault
noccp
nobsdcomp
novj
connect '/usr/sbin/chat -v -f /etc/ppp/peers/chat-E378-nopin'

/etc/ppp/peers/chat-E378-nopin:

ABORT "BUSY"
ABORT "ERROR"
ABORT "NO CARRIER"
REPORT "CONNECT"
TIMEOUT "10"
"" "ATZ"
OK AT+CGDCONT=1,"ip","isp.telus.com"
OK AT+CGQREQ=1,2,4,3,6,31
OK AT+CGQMIN=1,2,4,3,6,31
OK AT+CGATT=1
OK ATD*99#
CONNECT \c


Novatel MC679

Tested on Alpine 2.4.5.

Add usb-modeswitch (currently only in testing repo):

apk add usb-modeswitch

/etc/modules:

usbserial vendor=0x1410 product=0x7042

/etc/usb_modeswitch.conf:

# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# This file is evaluated by the wrapper script "usb_modeswitch_dispatcher"
# in /usr/sbin
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"

# Disable automatic mode switching globally (e.g. to access the original
# install storage)
DisableSwitching=0

# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" (and probably others)
EnableLogging=1

DefaultVendor= 0x1410
DefaultProduct=0x5059

TargetVendor=  0x1410
TargetProduct= 0x7042

MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
NeedResponse=1

/etc/network/interfaces

auto ppp0
iface ppp0 inet ppp
        provider MC679
        pre-up usb_modeswitch -c /etc/usb_modeswitch.conf || true

/etc/ppp/peers/MC679:

debug
/dev/ttyUSB0
460800
crtscts
modem
noauth
usepeerdns
defaultroute
noipdefault
noccp
nobsdcomp
novj
connect '/usr/sbin/chat -v -f /etc/ppp/peers/chat-MC679-nopin'

/etc/ppp/peers/chat-MC679-nopin:

ABORT "BUSY"
ABORT "ERROR"
ABORT "NO CARRIER"
REPORT "CONNECT"
TIMEOUT "10"
"" "ATZ"
OK ATD*99#
CONNECT \c