Downloading an eSIM profile through a USB Modem without a second network device

Ironically, activating an eSIM requires an internet connection. Usually a USB modem is used in cases where another internet access isn't available. So if you need to get a new eSIM, how can you download it? Let's see how to download an eSIM profile on a USB modem without another network device. This requires having a working eSIM profile, but can help to download a new eSIM before an old eSIM expires. (A JMP eSIM is a great choice for a fallback eSIM because it doesn't expire.)

Overview

  1. Stop ModemManager from accessing the USB modem

  2. Use qmicli to establish a temporary network connection via the USB modem
  3. Configure the temporary network connection
  4. Download the eSIM profile
  5. Restart ModemManager

Instructions

  1. On a system with a functioning eSIM, stop the ModemManager from accessing the USB modem:

    •    sudo systemctl stop ModemManager
      The system will loose internet connectivity.
  2. Find the USB modem's interface name:
    •    sudo qmicli --device=/dev/cdc-wdm0 --device-open-proxy --get-wwan-iface

      Keep this interface name handy and use it in place of wwp0 below.

  3. The following steps are only necessary if the file /sys/class/net/wwp0s20u1u4u2i4/qmi/raw_ip doesn't already contain "Y"

    •    sudo ip link set dev wwp0 down
         sudo sh -c "echo Y > /sys/class/net/wwp0/qmi/raw_ip"
  4. Bring up the interface
    •    sudo ip link set dev wwp0 up
  5. Next we'll use qmicli to tell the modem to start a network connection using the example APN "myoldapn". Substitute it with the APN for your existing eSIM.
    •    sudo qmicli --device=/dev/cdc-wdm0 --device-open-proxy --wds-start-network="ip-type=4,apn=myoldapn" --client-no-release-cid
  6. Check the modem's network configuration
    •    sudo qmicli --device=/dev/cdc-wdm0 --device-open-proxy --wds-get-current-settings
      Record the IP address, gateway and DNS address
  7. Manually set the IP address of the interface. Substitute the IP address from above for 777.777.777.777
    •    sudo ip address add 777.777.777.777 dev wwp0
  8. Add a default route so network traffic is routed to the USB modem's network interface
    •    sudo ip route add default dev wwp0
  9. Test the network by pinging the gateway's IP address. Substitute the gateway address from above for 888.888.888.888
    •    ping -I wwp0 888.888.888.888
  10. Check whether DNS is working.
    •    curl wiki.soprani.ca
      This should output "301 Moved Permanently" or some HTML.
  11. If DNS isn't working, first test the DNS address found above. Substitute the DNS address from above (i.e. --wds-current-settings) for 999.999.999.999
    •    dig @999.999.999.999 wiki.soprani.ca

      If this works but curl wiki.soprani.ca gives a name server error, we'll need to configure DNS.

  12. Different linux distributions use different mechanisms for DNS (e.g. resolv.conf resolvectl and systemd-resolved). If your system uses systemd-resolved,
    1. edit the file /etc/systemd/resolved.conf

    2. find the line starting with DNS= or #DNS=
    3. remove the # and add the DNS address from above, for example
      •     DNS=999.999.999.999
    4. restart systemd-resolved
      •     sudo systemctl restart systemd-resolved
    5. verify DNS works
      •     curl wiki.soprani.ca
  13. Test that lpac can still access the modem via serial port
    •    LPAC_APDU=at AT_DEVICE=/dev/ttyUSB2 output/lpac profile list
  14. Now return to the instructions for using lpac with a USB modem to download an eSIM profile using this network you just set up. After downloading the eSIM profile, restart ModemManager with

    •    sudo systemctl start ModemManager

See also https://www.thinkpenguin.com/gnu-linux/using-your-usb-4g-lte-modem-terminal-tpe-usb4g2us

eSIM Adapter/lpac via USB modem/eSIM Adapter/lpac via USB modem without internet (last edited 2024-322 04:47:27 by unn-169-150-203-10)