<div dir="ltr"><p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">I have created a new Ubuntu system to try out the
suggestions made by Aleksander in attempts to obtain multiple simultaneous
connections to different APNs. My new Ubuntu installation is based on a
development release of Ubuntu 22.04 (Jammy Jellyfish). The mmcli reports it is
version 1.18.6 and the nmcli says version 1.36.0.  The mbimcli is not installed.</p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">I edited the file /lib/system/system/ModemManager.service
file so that the ExecStart line was as follows:</p>

<pre style="margin:0in 0in 0.0001pt 0.5in;font-size:10pt;font-family:"Courier New"">ExecStart=/usr/sbin/ModemManager --debug --<span style="color:black">test-multiplex-requested</span></pre><pre style="margin:0in 0in 0.0001pt;font-size:10pt;font-family:"Courier New""><span style="color:black"> </span></pre>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">I rebooted the Ubuntu system and tried two of the three approaches
detailed in my prior email in this thread:</p>

<p class="gmail-MsoNoSpacing" style="margin:0in 0in 0in 0.5in;font-size:11pt;font-family:Calibri,sans-serif">(a) Using the create/connect bearer
features of mmcli</p>

<p class="gmail-MsoNoSpacing" style="margin:0in 0in 0in 0.5in;font-size:11pt;font-family:Calibri,sans-serif">(b) Rebooting and then trying multiple
connection keyfiles with nmcli</p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"> </p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">Neither one of these approaches gave me satisfaction. In
short, here are the results:</p>

<p class="MsoNormal" style="margin:0in 0in 8pt 0.5in;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">(a) A sequence of mmcli commands to
create a bearer, connect the bearer, create a second bearer, then connect the
second bearer did result in multiple simultaneous packet data network
connections. Some subsequent configuration with ip and route commands were
necessary to make it work, but the second connection failed after a few minutes
with error org.freedesktop.ModemManager1.Error.MobileEquipment.Unknown.</p>

<p class="gmail-MsoNoSpacing" style="margin:0in 0in 0in 0.5in;font-size:11pt;font-family:Calibri,sans-serif">(b) This sequence of commands (sudo
nmcli con reload, sudo nmcli --wait 300 con up id conn1,  sudo nmcli --wait 300 con up id conn2) did
not produce multiple simultaneous packet data network connections, but rather
the second connection displaced the first. </p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif"> </p>

<p class="MsoNormal" style="margin:0in 0in 8pt;line-height:107%;font-size:11pt;font-family:Calibri,sans-serif">I would like to provide plenty of details about the
experiences, so I’m going to make follow-on postings to this one. This will
allow others to give me further suggestions on the specific steps in the approaches.</p></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 4, 2022 at 9:43 AM Aleksander Morgado <<a href="mailto:aleksander@aleksander.es">aleksander@aleksander.es</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey,<br>
<br>
> I need some help in establishing simultaneous interfaces to multiple APNs.<br>
><br>
> I have an Ubuntu 20.04 system with a single cellular modem attached via USB in an IoT application. My problem is that I need to drive traffic through two different APNs when registered to the same cellular network. Each APN serves a different purpose -- different services with different billing are to occur on each.<br>
><br>
> I've tried multiple ways to do this. While I can get connected with two APNs, I can only get an interface name for one of the connections. I need a separate interface name for each so that I can place the respective flow of traffic through the appropriate interface and onto the correct APN. My application needs both to be available simultaneously. Going back and forth between building up and tearing down each of them is not an acceptable solution.<br>
><br>
> I tried three different things and none have brought happiness:<br>
><br>
> (1) Using mmcli in debug mode with a set of AT commands for each APN: using the sequence AT+GDCONT, AT+XGAUTH, and AT+CGACT with parameters relevant for the first APN and then again with the sequence AT+GDCONT, AT+XGAUTH, and AT+CGACT for the second APN. This is successful, and I obtain assigned IP addresses for each APN. However, neither of the APNs are assigned to an interface and I don't know how to funnel traffic to each.<br>
><br>
> (2) I have used the bearer features of mmcli. I have run "mmcli -m <modem-number> --create-bearer=<key-value pairs>" two times, each with the proper key-value pairs for the respective APNs. When I later run "mmcli -m <modem_number>", I see both bearers. I then run "mmcli -m <modem-number> --bearer <bearer-number> --connect". This works the first time for the first APN/bearer, and I have an interface assigned. But I get the following error when next running " mmcli -m <modem-number> --bearer <bearer-number> --connect" for the second APN/bearer:<br>
> error: couldn't connect the bearer: 'GDBusError: org.freedesktop.ModemManager1.Error.Core.NotFound: No valid data port to launch connection'<br>
><br>
> (3) I've put multiple connection keyfiles in the /etc/NetworkManager/system-connections directory. I run "nmcli con reload" and then "nmcli --wait 120 con up id <name_of_first_connection>". This works as I get connected to the first APN, get assigned an IP address, and get an interface association (wwan0). However, when I run "nmcli --wait 120 con up id <name_of_second_connection>", this works, but it displaces the first connection, so I am only left with the second connection on interface wwan0. The first connection is no longer available.<br>
><br>
> My Ubuntu 20.04 system has mmcli 1.16.6 and nmcli 1.22.10. I could also install mbimcli 1.24.8, although it is not currently part of the system image.<br>
><br>
> Ideas on how to accomplish what I am after?<br>
<br>
Your modem needs to be QMI or MBIM based, and you need to install<br>
ModemManager 1.18, which is the first version supporting multiplexing.<br>
Once you have that, you can:<br>
 *  run Modem.SimpleConnect() with"multiplex=required"<br>
Or:<br>
 * start the ModemManager daemon with the additional<br>
--test-multiplex-requested option.<br>
<br>
My suggestion is to use the 2nd option, just start MM with<br>
--test-multiplex-requested so that any attempt to start a connection<br>
(e.g. via NetworkManager) will trigger the multiplex setup. When<br>
running with multiplex enabled, ModemManager will create a new virtual<br>
network interface for each APN connection, and then you can handle<br>
custom routing rules in the host for each of them.<br>
<br>
I talked a bit about this feature in the FOSDEM2022 talk earlier this<br>
year, if you're interested:<br>
<a href="https://fosdem.org/2022/schedule/event/mobile_modemmanager/" rel="noreferrer" target="_blank">https://fosdem.org/2022/schedule/event/mobile_modemmanager/</a><br>
<br>
-- <br>
Aleksander<br>
<a href="https://aleksander.es" rel="noreferrer" target="_blank">https://aleksander.es</a><br>
</blockquote></div>