How to configure Huawei E220 in Linux

A Huawei E220 USB modem can still provide a useful fallback WAN link, field uplink, or recovery connection, but the device usually does not appear as a modem immediately after it is plugged in. Many Linux systems first see it as a small USB storage device that exposes bundled carrier software instead of the radio interface that carries the data session.

Current Linux distributions handle older Huawei sticks with three layers: usb_modeswitch moves the modem out of its initial storage-mode USB ID, the kernel option driver exposes one or more ttyUSB ports, and ModemManager plus NetworkManager create and activate the mobile broadband session. For the Huawei E220 family, current usb-modeswitch-data packages still ship a dedicated switch profile for the initial 12d1:1003 device ID.

The values that usually matter are the mobile provider APN, an optional SIM PIN, and any username or password required by the carrier. The steps below assume a Linux host that uses ModemManager and NetworkManager; if the modem never leaves storage mode or mmcli -L never lists it, fix USB detection first before changing APN or authentication settings.

Steps to configure Huawei E220 in Linux:

  1. Plug the modem in and check which Huawei USB ID the system currently sees.
    $ lsusb | grep -i 12d1
    Bus 001 Device 004: ID 12d1:1003 Huawei Technologies Co., Ltd.

    The Huawei E220 commonly appears as 12d1:1003 before switching to modem mode. After a successful switch it usually re-enumerates with a different Huawei modem ID such as 12d1:1001.

  2. If the modem stays at 12d1:1003, install or update the packages that provide usb_modeswitch, usb-modeswitch-data, ModemManager, NetworkManager, mmcli, nmcli, and lsusb, then reconnect the modem.

    Current Debian or Ubuntu package names are usb-modeswitch, usb-modeswitch-data, modemmanager, network-manager, and usbutils. Other current Linux distributions ship the same components under the same or closely related package names.

    The current usb-modeswitch-data set still includes a dedicated Huawei E220 switch profile for USB ID 12d1:1003.

  3. Reconnect the modem and verify that it no longer shows the storage-mode USB ID.
    $ lsusb | grep -i 12d1
    Bus 001 Device 005: ID 12d1:1001 Huawei Technologies Co., Ltd.

    If the modem still returns only 12d1:1003, the host is not switching it into modem mode yet, so APN or authentication settings will not help.

  4. Inspect the kernel log for the serial modem ports created by the option driver.
    $ dmesg | grep -Ei '12d1|ttyUSB|option'
    [  214.361367] option 1-1:1.0: GSM modem (1-port) converter detected
    [  214.361772] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
    [  214.362115] option 1-1:1.1: GSM modem (1-port) converter detected
    [  214.362430] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1

    The exact ttyUSB numbers vary by system. What matters is that the kernel binds the modem to the option driver instead of leaving it only as USB storage.

  5. Ask ModemManager to confirm that the modem is available to user space.
    $ mmcli -L
    Found 1 modems:
      /org/freedesktop/ModemManager1/Modem/0 [Huawei Technologies Co., Ltd.] E220

    If no modem is listed, verify that the ModemManager and NetworkManager services are running and recheck the kernel log for USB or driver errors.

  6. Create a NetworkManager GSM connection profile using the carrier APN.
    $ sudo nmcli connection add type gsm ifname "*" con-name huawei-e220 apn internet

    Replace internet with the APN required by the mobile provider. Keeping an explicit APN in the profile is more predictable than relying on auto-detection.

  7. Add a SIM PIN or PPP credentials only if the carrier requires them.
    $ sudo nmcli connection modify huawei-e220 gsm.pin 1234
    $ sudo nmcli connection modify huawei-e220 gsm.username user gsm.password pass

    Skip the SIM PIN line if the card is already unlocked, and skip the username or password line when the provider authenticates only by SIM and APN.

  8. Bring the new mobile broadband connection up.
    $ sudo nmcli connection up huawei-e220

    NetworkManager uses the matching GSM profile and asks ModemManager to establish the data session.

  9. Verify that the GSM profile is active on the modem device.
    $ nmcli -f NAME,TYPE,DEVICE connection show --active
    NAME         TYPE  DEVICE
    huawei-e220  gsm   ttyUSB0

    The active device may appear as a different ttyUSB port, depending on which serial interface the modem exposes as its primary control port.

  10. Confirm that the mobile link also installed a default route and working IP connectivity.
    $ ip route show default
    default via 10.64.64.64 dev ppp0 proto static
    
    $ ping -c 4 1.1.1.1
    PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
    64 bytes from 1.1.1.1: icmp_seq=1 ttl=57 time=41.8 ms
    64 bytes from 1.1.1.1: icmp_seq=2 ttl=57 time=39.7 ms
    64 bytes from 1.1.1.1: icmp_seq=3 ttl=57 time=40.5 ms
    64 bytes from 1.1.1.1: icmp_seq=4 ttl=57 time=42.1 ms
    
    --- 1.1.1.1 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3005ms
    rtt min/avg/max/mdev = 39.744/41.031/42.152/0.935 ms

    The Huawei E220 often creates a ppp0 data interface rather than a wwan0 interface because it is an older serial 3G modem.