Help mmcli - I don't know how to use a context other than the default CID 1

Aleksander Morgado aleksander at aleksander.es
Tue Feb 9 08:32:51 UTC 2021


Hey John,

>
> This started as an nmci question but I realised I don't understand how to configure bearer contexts with mmcli either.
>
> My starting point was creating a connection using nmcli  (I wanted to really use ipv6.method "disabled" but that's another story.)
>
> sudo nmcli connection add connection.id "eeno6" connection.type gsm connection.interface-name "" gsm.apn "everywhere" gsm.username "eesecure" gsm.password "secure" ipv6.method ignore
>
>
> After this the modem has a context 1 setting like this
>
> ```
> at+cgdcont?
> +CGDCONT: 1,"IP","everywhere","0.0.0.0",0,0,0,0
> OK
> ```
>
> But this is a bad idea - far better to use something other than context 1 maybe context 3 instead.
>
> Any ideas how I create a connection profile that uses context 3?
>

At the moment there is no way to select the CID in ModemManager. MM
selects an empty CID to use if the new APN settings don't exist
already; and if they exist they will re-use the existing CID.

It is true that playing around with CID=1 may not be a good idea in
some modems, as that is the default context for the initial EPS bearer
settings in some chipsets (IIRC the 3GPP default should have been
CID=0). To try to solve this, we're working on giving the user the
ability to manage connection profiles themselves, see
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/179

> I am also interested in how modem manager creates and manages the modem context ?
>

This is just done during the connection attempt, based on the APN
settings given by the user. MM just looks for them, and reuses them if
found, or updates the next free CID with the new ones otherwise. What
CID is in use has been hidden to the user of the MM API on purpose in
the past; but since different modems treat specific CIDs in a special
way, we're working on changing that, as said before.


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list