Static vs DHCP setups from ModemManager in OpenWrt

Aleksander Morgado aleksander at
Mon Jul 12 20:50:13 UTC 2021


> I'm using ModemManger 1.16.6 on OpenWrt along with its scripts (and slight
> modifications so it doesn't just give up in the end).
> After a lot of testing and loss of connectivity, it seems that although
> our provider is offering DHCP, the connection via ModemManager is configured
> statically. This leads to loss of connection after several hours unless
> intervention is taken such as manual DHCP or re-configuring the interface.
> We can see here:
> # mmcli --modem 0 --bearer=1 --output-keyvalue | grep ipv4
>       : ipv4v6
> bearer.ipv4-config.method       : static
> bearer.ipv4-config.address      :
> bearer.ipv4-config.prefix       : 29
> bearer.ipv4-config.gateway      :
> bearer.ipv4-config.dns.length   : 1
> bearer.ipv4-config.dns.value[1] :
> bearer.ipv4-config.mtu          : 1430
> So the question is, is this a ModemManager bug? Or is it misreporting
> from the carrier, or something else?  What can I do to debug this?

The type of IP setup is decided by ModemManager; for some
plugins/protocols DHCP will be used, for some others static IP
addressing. E.g. if you're running with a QMI modem and the network
interface is configured in raw-ip, static IP addressing will be used
(as most DHCP clients don't know how to handle this type of
interfacce); while if the network interface is configured in 802-3,
DHCP addressing will be used (as all DHCP clients know how to handle
ethernet interfaces).

Beware though, the DHCP setup is between the host system and the modem
exclusively, with a DHCP server running inside the modem. For those
modems where there is no DHCP server support, we default to static IP
addressing. So, in both cases, the modem will serve at connection
time, the IP settings required at that specific time, and these
settings may really come from the network itself (e.g. the IP settings
are provided by the network itself and the modem passes them down to
the host, acting as a bridge) or it may even be some settings that are
exclusively used in the host<->modem interface only (e.g. the TOBY-L4
always returns the same IP settings to use, because it acts as a

Now, I'm not completely sure the network can change the IP settings of
a UE while "keeping" the corresponding bearer connected; if you ask
me, the modem should have reported a network-initiated disconnection
to the host, which ModemManager would receive, and we would have
flagged the modem as disconnected in MM.

If that's what's happening, remember that in openwrt there is no
"autoconnection" logic triggered by netifd :/ That's a big missing
piece of logic that I never got around to implement. In other words,
if the modem gets disconnected by the network, and MM flags the modem
as disconnected, netifd would not attempt to re-connect it, and at
netifd's eyes, the modem would still be connected while it isn't (as
MM would report). You can debug this easily, just wait for the state
where the connection is halted and see what netifd and MM both say
regarding the state of the connection. If the state reported by both
is different, you should ifdown & ifup the network interface
configured in netifd in order to reconnect.


More information about the ModemManager-devel mailing list