Using HSDPA modem: Difference between revisions

From Alpine Linux
(Howto use HSDPA modem with Alpine)
 
m (→‎Requirements: Used canonical URL.)
 
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
= General notes =
[[Category:Networking]]
'''Note:''' Don't plug in the modem yet! (Wait until document suggest you to plug it in)<BR>
Notes are based on [http://gentoo-wiki.com/HARDWARE_HUAWEI_E220_HSDPA_USB_MODEM gentoo] wiki<BR>


== Requirements ==
== Requirements ==
At least Alpine-1.7.22 would work (but maybe some older releases too)
This doc is tested on Alpine-2.1.3.
* libusb-dev
* ppp
* usbutils


== Check kernel configuration ==
You will need a [https://en.wikipedia.org/wiki/High_Speed_Packet_Access#High_Speed_Downlink_Packet_Access_(HSDPA) HSDPA] USB-modem.<BR>
'''Note:''' Checking kernel config is proably not needed. I just add this note in case you need it in the future.<BR>
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)''.
These checks should result in '=m' values (except CONFIG_USB_SERIAL_GENERIC that should report '=y')
modprobe configs
zcat /proc/config.gz | grep "CONFIG_USB_SERIAL_GENERIC="
zcat /proc/config.gz | grep "CONFIG_USB_SERIAL_OPTION="
zcat /proc/config.gz | grep "CONFIG_PPP="
zcat /proc/config.gz | grep "CONFIG_PPP_ASYNC="


= Install modem =
== Install packages ==
== Install packages ==
Install required packages
Install the required packages
apk_add ppp
{{cmd|apk add ppp}}
apk_add libusb-dev
apk_add usbutils
 
== Prepare ==
Now you should ''''plugging in the modem''''
 
We need information about the modem
lsusb -v | grep id


The output of previous action could look something like this:<BR>
== Load modules ==
'''Note:''' You should take notes on the numbers presented in the output (you would need them soon)
Now let's load the driver ''(using the values you just discovered)'' and configure Alpine to load it automatically at boot-up.
idVendor  0x12d1 Huwei Technologies Co., Ltd.
{{cmd|modprobe ppp_generic
idProduct  0x1003 E220 HSDPA Modem
echo "ppp_generic" >> /etc/modules-load.d/ppp.conf}}


== Configure modem ==
== Config files ==
''<SPAN STYLE='color:red;'>'''FIXME:''' At this moment I don't know howto make the 'modprobe' action to be done automatically at next reboot.</SPAN>''


Now let's load the driver (using the values you just found out).
=== /etc/ppp/peers/E220 ===
modprobe usbserial vendor=0x12d1 product=0x1003
''(The filename 'E220' can be changed, but you will need to remember it when running pon/poff command)''
<pre>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'
</pre>


== Configure programs ==
=== /etc/ppp/chat-E220-pin ===
Seems we need to create a missing folder
''(The filename 'chat-E220-pin' can be changed, but you will need modify the config file shown above to reflect your decision)''
mkdir -p /etc/ppp/peers
<pre>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
</pre>


=== Create configfiles ===
=== /etc/ppp/chat-E220-nopin ===
'''''/etc/ppp/peers/E220'''''
''(The filename 'chat-E220-nopin' can be changed, but you will need modify the config file shown above to reflect your decision)''
/dev/ttyUSB0
<pre>ABORT "BUSY"
460800
ABORT "ERROR"
crtscts
ABORT "NO CARRIER"
modem
REPORT "CONNECT"
noauth
TIMEOUT "10"
usepeerdns
"" "ATZ"
defaultroute
OK AT+CGDCONT=1,"ip","{APN}"
noipdefault
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
debug
OK "AT+IPR=115200"
noccp
OK "ATE1"
nobsdcomp
TIMEOUT "60"
novj
"" "ATD*99***1#"
user "irrelevant"
CONNECT \c
password "irrelevant"
</pre>
connect '/usr/sbin/chat -f /etc/ppp/chat-E220-pin || /usr/sbin/chat -f /etc/ppp/chat-E220-nopin'
{{Note|Replace '''{PIN}''' with the "PIN" of your card ''(typically a 4 digit code)''}}
{{Note|Replace '''{APN}''' with the "Access Point Name" of the service you use ''(e.g. "web.omnitel.it")''. If you don't know the Internet APN, ask your service provider}}


'''''/etc/ppp/chat-E220-pin'''''
== Routes ==
ABORT BUSY
Create a default gw route to your 'ppp0' device.
ABORT ERROR
{{cmd|ip route add default dev ppp0}}
ABORT 'NO CARRIER'
REPORT CONNECT
TIMEOUT 10
"" "ATZ"
OK "AT+CPIN='''''pin'''''"
OK AT+CGDCONT=1,"ip","'''''internet'''''"
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'''''
== DNS ==
ABORT BUSY
Figure out what DNS-servers your provider has.
ABORT ERROR
{{cmd|egrep -i 'pppd.*dns' /var/log/messages}}
ABORT 'NO CARRIER'
This might give you some useful information.<BR>
REPORT CONNECT
Search for a IP-address that might be your providers DNS-server and add this IP-address into '/etc/resolv.conf'.
TIMEOUT 10
{{cmd|echo "nameserver {DNS-server-IP-address}" > /etc/resolv.conf}}
"" "ATZ"
OK AT+CGDCONT=1,"ip","'''''internet'''''"
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
OK "AT+IPR=115200"
OK "ATE1"
TIMEOUT 60
"" "ATD*99***1#"
CONNECT \c
'''Note:''' The above highlighted word(s) ''''''pin'''''' is the PIN of your card (typically a four digit code)<BR>
'''Note:''' The above highlighted word(s) ''''''internet'''''' is the Access Point Name (APN) of the service you use (for instance mine is "web.omnitel.it"). If you don't know the Internet APN, ask your service provider.<BR>


= Start/Stop=
= Start/Stop=
== Start connection ==
== Start connection ==
pon E220
{{cmd|pon E220}}
== Stop connection ==
== Stop connection ==
poff E220
{{cmd|poff E220}}
= Checks =
 
= If something goes wrong... =
Check if process is running
Check if process is running
ps | grep pppd
{{cmd|pidof pppd}}
Logfile would also give you information on what happened
Logfile might give you a clue on what went wrong
grep pppd /var/log/messages
{{cmd|egrep "pppd{{!}}chat" /var/log/messages}}
Check nic information
Check nic information
  ifconfig ppp0
{{cmd|ifconfig ppp0}}
pppd has a statusinformation function that could come in handy
{{cmd|pppstats}}
 
= Huawei E378 =
Tested on Alpine 2.3.3.
 
Add usb-modeswitch (currently only in testing repo):
{{cmd|apk add usb-modeswitch}}
 
/etc/modules:
<pre>
usbserial vendor=0x12d1 product=0x1446
</pre>
/etc/usb_modeswitch.conf:
<pre>
# 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
</pre>
/etc/network/interfaces
<pre>
auto ppp0
iface ppp0 inet ppp
        provider E378
        pre-up usb_modeswitch -c /etc/usb_modeswitch.conf
</pre>
/etc/ppp/peers/E378:
<pre>
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'
</pre>
/etc/ppp/peers/chat-E378-nopin:
<pre>
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
</pre>
 
 
= Novatel MC679 =
 
Tested on Alpine 2.4.5.
 
Add usb-modeswitch (currently only in testing repo):
{{cmd|apk add usb-modeswitch}}
 
/etc/modules:
<pre>
usbserial vendor=0x1410 product=0x7042
</pre>
/etc/usb_modeswitch.conf:
<pre>
# 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
</pre>
/etc/network/interfaces
<pre>
auto ppp0
iface ppp0 inet ppp
        provider MC679
        pre-up usb_modeswitch -c /etc/usb_modeswitch.conf || true
</pre>
/etc/ppp/peers/MC679:
<pre>
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'
</pre>
/etc/ppp/peers/chat-MC679-nopin:
<pre>
ABORT "BUSY"
ABORT "ERROR"
ABORT "NO CARRIER"
REPORT "CONNECT"
TIMEOUT "10"
"" "ATZ"
OK ATD*99#
CONNECT \c
</pre>

Latest revision as of 06:59, 29 July 2023


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

Config files

/etc/ppp/peers/E220

(The filename 'E220' can be changed, 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, but you will need modify the config file shown above to reflect your decision)

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, but you will need modify the config file shown above to reflect your decision)

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 {PIN} with the "PIN" of your card (typically a 4 digit code)
Note: Replace {APN} with the "Access Point Name" of the service you use (e.g. "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