---
title: "Connect cellular module in QMI mode with libqmi"
description: "Start a data connection on a Quectel or Telit module in QMI mode with qmicli and the in-kernel qmi_wwan driver, get an IP address with udhcpc, test and stop it."
url: "https://docs.sixfab.com/guides/connect-cellular-module-qmi-mode-libqmi/"
last_updated: "2026-10-12"
---

# Connect cellular module in QMI mode with libqmi

Start a data connection on a Quectel or Telit module in QMI mode with qmicli and the in-kernel qmi_wwan driver, get an IP address with udhcpc, test and stop it.

**Works with:** [Base HAT](https://docs.sixfab.com/cellular/base-hat/), [Jetson Nano Cellular Modem Kit](https://docs.sixfab.com/cellular/jetson-nano-cellular-modem-kit/), [4G/LTE Cellular Modem Kit](https://docs.sixfab.com/cellular/4g-lte-cellular-modem-kit/)

Modules with a Qualcomm chipset have a QMI interface. `qmicli` from [libqmi](https://modemmanager.org/docs/libqmi/) starts the data connection through the in-kernel `qmi_wwan` driver, and `udhcpc` gives the interface its IP address.

## Requirements

Finish the quickstart of the board first: [Get started with Base HAT](https://docs.sixfab.com/cellular/base-hat/quickstart/), [Get started with 4G/LTE Cellular Modem Kit](https://docs.sixfab.com/cellular/4g-lte-cellular-modem-kit/quickstart/) or [Get started with Jetson Nano Cellular Modem Kit](https://docs.sixfab.com/cellular/jetson-nano-cellular-modem-kit/quickstart/).

**Required**

**Hardware**

- **Base HAT, 4G/LTE Cellular Modem Kit or Jetson Nano Cellular Modem Kit**: Assembled as in the quickstart of the [Base HAT](https://docs.sixfab.com/cellular/base-hat/quickstart/), the [4G/LTE kit](https://docs.sixfab.com/cellular/4g-lte-cellular-modem-kit/quickstart/) or the [Jetson Nano kit](https://docs.sixfab.com/cellular/jetson-nano-cellular-modem-kit/quickstart/), with the USB cable connected.
- **A module with a QMI interface**: For example Quectel EC25, EG25-G, EC21 or UC20-G, or Telit LE910C1 or LE910C4.

**SIM**

- **SIM card with data service**: Its APN, and a username and password if the operator uses them. The Sixfab SIM and the KORE Super SIM (formerly Twilio Super SIM) use the APN `super`, without username or password.

**Software**

- **Serial terminal**: To send AT commands: see [Send AT commands](https://docs.sixfab.com/guides/send-at-commands-cellular-module/).

## Stop ModemManager

1. **Stop and disable ModemManager**

   On Raspberry Pi OS Bookworm and later, ModemManager is installed by default and can take over the module. Stop and disable it, or remove it with `sudo apt purge modemmanager -y`:

   ```bash
   sudo systemctl stop ModemManager.service
   sudo systemctl disable ModemManager.service
   ```

## Check driver and module mode

1. **Check driver**

   ```bash
   lsusb -t
   ```

   One interface of the module uses the `qmi_wwan` driver. This page needs `qmi_wwan`; libqmi does not work with Qualcomm’s GobiNet driver.

   ```text
   |__ Port 4: Dev 6, If 4, Class=Vendor Specific Class, Driver=qmi_wwan, 480M
   ```

   If the module has no network driver, see the driver guide of the module manufacturer, linked in the [Base HAT troubleshooting](https://docs.sixfab.com/cellular/base-hat/troubleshooting/#usb).

2. **Check that module is in QMI mode**

   Send the AT commands of your module, as in [Send AT commands](https://docs.sixfab.com/guides/send-at-commands-cellular-module/):

   **Quectel**

   1. **Check USB network mode**

      ```text
      AT+QCFG="usbnet"
      ```

      QMI mode answers `+QCFG: "usbnet",0`.

   2. **Set QMI mode and restart module**

      If the answer is not `0`, set QMI mode:

      ```text
      AT+QCFG="usbnet",0
      ```

      Wait about 10 seconds, then restart the module:

      ```text
      AT+CFUN=1,1
      ```

   **Telit**

   1. **Check USB configuration**

      ```text
      AT#USBCFG?
      ```

      QMI (RmNet) mode answers `#USBCFG: 0`.

   2. **Set QMI mode**

      If the answer is not `0`, set QMI mode:

      ```text
      AT#USBCFG=0
      ```

      The module restarts by itself. If it does not, restart it with `AT#REBOOT`.

## Install libqmi

1. **Install libqmi-utils and udhcpc**

   ```bash
   sudo apt update && sudo apt install libqmi-utils udhcpc
   ```

   `libqmi-utils` installs `qmicli`, which talks to the module (`man qmicli`), and the `qmi-network` helper script; `udhcpc` sets the IP address. The commands below use the control device `/dev/cdc-wdm0` and the interface `wwan0`; with more than one modem, `sudo qmicli -d /dev/cdc-wdm0 --get-wwan-iface` prints the interface of a control device.

## Start data connection

1. **Check that module is online**

   ```bash
   sudo qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode
   ```

   The answer includes `Mode: 'online'`. If it does not, set it:

   ```bash
   sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode='online'
   ```

2. **Set interface to raw IP**

   ```bash
   sudo ip link set wwan0 down
   echo 'Y' | sudo tee /sys/class/net/wwan0/qmi/raw_ip
   sudo ip link set wwan0 up
   ```

   To check the data format of the module:

   ```bash
   sudo qmicli -d /dev/cdc-wdm0 --wda-get-data-format
   ```

3. **Connect to network**

   Replace the APN, username and password with those of your SIM and operator; without a username and password, delete those two parameters:

   ```bash
   sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='YOUR_APN',username='YOUR_USERNAME',password='YOUR_PASSWORD',ip-type=4" --client-no-release-cid
   ```

   With the Sixfab SIM or the KORE Super SIM:

   ```bash
   sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='super',ip-type=4" --client-no-release-cid
   ```

   The answer says `Network started` and gives the packet data handle and the client ID (CID) that `--client-no-release-cid` keeps open. Note both: they stop the connection.

4. **Get IP address and default route**

   ```bash
   sudo udhcpc -q -f -i wwan0
   ```

   The answer ends with the lease, for example `udhcpc: lease of 100.67.114.164 obtained, lease time 7200`. With `-q`, udhcpc exits once it has the lease.

## Verify

1. **Check interface address**

   ```bash
   ip addr show wwan0
   ```

   **Result:** `wwan0` has the address of the lease.

2. **Ping through cellular interface**

   ```bash
   ping -I wwan0 -c 5 sixfab.com
   ```

   ```text
   $ ping -I wwan0 -c 5 sixfab.com
   PING sixfab.com (172.67.75.126) from 100.67.114.164 wwan0: 56(84) bytes of data.
   64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=1 ttl=29 time=247 ms
   64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=2 ttl=29 time=205 ms
   64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=3 ttl=29 time=207 ms
   64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=4 ttl=29 time=204 ms
   64 bytes from 172.67.75.126 (172.67.75.126): icmp_seq=5 ttl=29 time=216 ms
   --- sixfab.com ping statistics ---
   5 packets transmitted, 5 received, 0% packet loss, time 8ms
   rtt min/avg/max/mdev = 204.050/215.839/247.004/16.201 ms
   ```

   Five replies and `0% packet loss` mean the connection works; addresses and times differ by network.

## Details

### Stop connection

Use the packet data handle and the CID from the start command:

```bash
sudo qmicli -p -d /dev/cdc-wdm0 --wds-stop-network=PACKET_DATA_HANDLE --client-cid=CID
```

## Troubleshooting

### The control device /dev/cdc-wdm0 or the interface wwan0 does not exist

The module is not in QMI mode, or `qmi_wwan` is not loaded: see [Check driver and module mode](https://docs.sixfab.com/guides/connect-cellular-module-qmi-mode-libqmi/#check-driver-and-module-mode).

### The start command fails

Check the SIM (`AT+CPIN?`), the registration (`AT+CREG?`) and the APN, username and password.

### udhcpc gets no lease

Check that `/sys/class/net/wwan0/qmi/raw_ip` is `Y`, and that ModemManager is stopped.

Power, SIM, antenna and USB checks are in the [Base HAT troubleshooting](https://docs.sixfab.com/cellular/base-hat/troubleshooting/).

## Next steps

- [Send AT commands to cellular module](https://docs.sixfab.com/guides/send-at-commands-cellular-module/): Find the AT port and send commands with Minicom or ATCom.
- [Connect cellular module to internet in ECM mode](https://docs.sixfab.com/guides/connect-cellular-module-internet-ecm-mode/): The module as a USB Ethernet interface, without extra software.
- [Connect Quectel module with quectel-CM](https://docs.sixfab.com/guides/connect-quectel-module-quectel-cm/): Quectel’s connection manager for QMI mode.
- [libqmi](https://modemmanager.org/docs/libqmi/): The project documentation and the qmicli manual.
- [Techship: data connection over QMI with qmicli](https://techship.com/support/faq/how-to-step-by-step-set-up-a-data-connection-over-qmi-interface-using-qmicli-and-in-kernel-driver-qmi-wwan-in-linux/): A step-by-step guide to the same method with the in-kernel qmi_wwan driver.
