Revision 2 of 2026-11-25 20:31 UTC by tux, the current one. Current version - History
Mobile broadband
5.1
Getting online with a USB 3G, 4G or 5G stick, or through a phone. Many of them need no setup on SliTaz 5.1: they show up as a network card and get an address like a cable. Older sticks, and some recent ones, are modems: they connect with PPP, through wvdial.
What did you plug in?
Plug the device in, wait a few seconds, then look at what the kernel made of it:
$ lsusb
$ ip link
$ ls /dev/ttyUSB* /dev/ttyACM*
$ dmesg | tail -20
lsusb gives the ID of the device, two numbers like 12d1:1f01
(vendor and product). Then:
- a new network card (
usb0,eth1...): a phone in USB tethering mode, or a stick that works as a small router (Huawei calls them "HiLink"). See "As a network card". - serial ports,
/dev/ttyUSB0,/dev/ttyUSB1...: a modem. See "As a modem, with PPP". - only a CD-ROM or a USB disk: the stick starts in storage mode, to show its Windows driver. Switch it first, see "Switching from storage mode"; its ID changes when it switches.
As a network card
The drivers are in the kernel package: rndis_host and cdc_ncm for
Android phones in USB tethering mode, cdc_ether, rndis_host or
huawei_cdc_ncm for router sticks. Ask for an address on the new
interface, as root:
# udhcpc -i usb0
Use the name ip link gave. To use it at every boot instead of the
cable or the Wi-Fi:
# trame network config interface usb0
# trame network restart
A router stick has its own web page for the PIN of the SIM card, the
APN and the data settings: open its address in a browser. It is the
gateway that trame network status shows once connected.
Switching from storage mode
The usb-modeswitch package knows the switch message of several
hundred sticks. On other systems a udev rule switches the stick when
it is plugged in; on SliTaz 5.1 that rule does not run (see
Troubleshooting), so switch it by hand, as root:
# spk-add usb-modeswitch
# lsusb
Bus 001 Device 005: ID 12d1:1f01 Huawei Technologies Co., Ltd.
# usb_modeswitch -v 12d1 -p 1f01 -c /etc/usb_modeswitch.d/12d1:1f01
-v and -p are the vendor and product of the storage mode; the
file of the same name in /etc/usb_modeswitch.d/ holds the message
for this stick. Some files have a suffix after the ID, one per maker:
ls /etc/usb_modeswitch.d/ | grep 05c6:1000. After a few seconds,
lsusb shows a new ID and the network card or the serial ports appear.
The stick goes back to storage mode when it is unplugged. To switch it
at every boot, with the stick plugged in, put the command at the end of
/etc/init.d/local.sh.
As a modem, with PPP
The serial ports of a modem come from the option driver, in the
linux-lts-extra package, which the ISOs do not install. Install it
with wvdial, then load the driver, as root:
# spk-add linux-lts-extra wvdial
# modprobe option
A stick has several ports and only one or two of them take AT
commands. wvdialconf tries them all and writes the first modem it
finds into /etc/wvdial.conf:
# wvdialconf
Then edit /etc/wvdial.conf. Keep the lines wvdialconf wrote (Modem,
Baud, Init1, Init2...) and add the settings of your operator:
[Dialer Defaults]
Modem = /dev/ttyUSB0
Baud = 460800
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","internet.example"
Phone = *99#
Username = user
Password = pass
Stupid Mode = 1
[Dialer pin]
Init1 = AT+CPIN=1234
Init3: replaceinternet.examplewith the APN of your operator; search the web for its name and "APN" if it is not on its site.Phone:*99#on nearly every 3G and 4G network.Username,Password: most operators accept anything, but wvdial wants both lines.Stupid Mode = 1: start PPP right after the connection, without waiting for a login prompt that a mobile network never sends.[Dialer pin]: only if the SIM card has a PIN,1234here.
Connect. The first time after plugging the stick, send the PIN with
wvdial pin; it then dials as usual. Afterwards, and to reconnect, use
wvdial alone: a second PIN is refused and would stop the connection.
# wvdial pin
# wvdial
wvdial stays in the terminal and shows the connection; Ctrl+C hangs
up. The DNS servers of the operator are written into
/etc/resolv.conf when the link comes up, and the old file is put back
when it goes down (/etc/ppp/ip-up and ip-down do it).
QMI and MBIM sticks
Most 4G and 5G sticks also have a faster interface, wwan0, from the
qmi_wwan or cdc_mbim drivers (in linux-lts-net). Bringing it up
needs qmicli, mbimcli or ModemManager, which SliTaz does not
package. Use their serial port and PPP as above: slower, but it works.
Internal WWAN cards
M.2 cards inside laptops that sit on the USB bus behave like a stick: serial ports, and a QMI or MBIM interface. Cards on the PCIe bus, which includes most 5G cards, need the WWAN drivers of the kernel, which the SliTaz 5.1 kernel does not have.
On the live system
What you install is lost at shutdown, unless you keep your changes
(see Keeping your data).
usb-modeswitch, wvdial and linux-lts-extra need the network to
install: a phone in USB tethering mode does the job.
Troubleshooting
The stick stays a CD-ROM: switch it by hand, as above. The udev
rule of usb-modeswitch calls /lib/udev/usb_modeswitch, which the
5.1 package installs as a directory, and its helper is a Tcl script
while tcl is not a dependency: the automatic switch never happens.
wvdialconf finds no modem: check that the stick switched (lsusb)
and that the driver is loaded:
$ lsmod | grep option
$ ls /dev/ttyUSB*
NO CARRIER right after dialing: wrong APN, or a SIM card still
locked by its PIN (wvdial pin).
Connected, but no web page opens: another connection kept the
default route, and pppd does not replace it ("not replacing existing
default route" in the messages). Take the other interface down before
dialing, trame network down eth0 or wlan0. Then check
/etc/resolv.conf.
Read the messages of pppd and of the driver:
$ tail -f /var/log/messages
$ dmesg | tail -30
Links
- Dial-up: analog modems on the phone line, with pppd and chat.
- Wi-Fi chips: getting packages through a phone in USB tethering mode.
- Handbook: Network.
- USB_ModeSwitch, the project's site and its list of devices.