<div dir="ltr"><div dir="ltr"><div dir="ltr">So here is where I am now. This is a very strange mobile network and unlike anything else I've seen!<br><br>The ipv4 on T-Mobile for me is indeed statically assigned. I was able to find through modemmanager.<br><br>Using a few well documented things you can find elsewher:<br><br> $ sudo mmcli -m 0 --simple-connect="apn=internet"<br> successfully connected the modem<br> $ sudo mmcli -b 0<br> Bearer '/org/freedesktop/ModemManager1/Bearer/0'<br> -------------------------<br> Status | connected: 'yes'<br> | suspended: 'no'<br> | interface: 'wwp0s29u1u1u4i4'<br> | IP timeout: '20'<br> -------------------------<br> Properties | apn: 'internet'<br> | roaming: 'allowed'<br> | IP type: 'none'<br> | user: 'none'<br> | password: 'none'<br> | number: 'none'<br> | Rm protocol: 'unknown'<br> -------------------------<br> IPv4 configuration | method: 'static'<br> | address: '26.27.221.170'<br> | prefix: '30'<br> | gateway: '26.27.221.169'<br> | DNS: '10.177.0.34', '10.177.0.210'<br> | MTU: '1500'<br> -------------------------<br> IPv6 configuration | method: 'unknown'<br> -------------------------<br> Stats | Duration: '0'<br> | Bytes received: 'N/A'<br> | Bytes transmitted: 'N/A'<br><br>----<br><br>Well alright, this looks within reason of what I got on windows, I'll just ignore those dns records and use googles for now, let's try it out:<br><br> $ sudo ip addr add <a href="http://26.27.221.170/30">26.27.221.170/30</a> dev wwp0s29u1u1u4i4<br> $ sudo ip add default via 26.27.221.169 dev wwp0s29u1u1u4i4<br><br>And bam, ipv4 is there!<br> <br>Conclusions:<br> <br>1. Some mobile providers will statically assign you an ipv4 address which you can discover<br>through mmcli -b 0. They will not respond to DHCP Discover requests on ipv4. You must <br>look this up and "manually" set it yourself.<br> <br>This particular mobile provider (Los Angeles, T-Mobile) will respond on DHCP discover for<br>ipv6, which is very deceptive.<br><br></div><div>2. git clone libmbim, ModemManager and libqmi. Use the latest-ish versions. Even in something like Debian/buster which is ostensibly testing, you may still have out of date versions. This is important!<br><br></div><div>3. Although there's an appearance of modemmanager being a managed version of qmi-network, and qmi-network being a managed version of qmi-cli, this is not 100% true. Although each one can do things which orchestrate the thing below it, they can also do things that the others cannot. You cannot, as I had assumed, use simply qmi-cli for an "Expert debug" mode and expect to have everything at your disposal. You need all 3 when troubleshooting.<br><br></div><div>4. Don't fear the source code for these, it's not that hard and pretty well laid out.<br></div><div dir="ltr"><br>Case Closed. This is magnificent. Thanks a lot for your help!<br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 4, 2018 at 5:15 AM, Aleksander Morgado <span dir="ltr"><<a href="mailto:aleksander@aleksander.es" target="_blank">aleksander@aleksander.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey,<br>
<span class=""><br>
> So we start. First we query our data format:<br>
><br>
> $ sudo qmicli -d /dev/cdc-wdm0 --wda-get-data-format<br>
> [03 Sep 2018, 16:44:34] -Warning ** [/dev/cdc-wdm0] requested auto mode<br>
> but no MBIM QMUX support available<br>
> [/dev/cdc-wdm0] Successfully got data format<br>
> QoS flow header: no<br>
> Link layer protocol: 'raw-ip'<br>
> Uplink data aggregation protocol: 'disabled'<br>
> Downlink data aggregation protocol: 'disabled'<br>
> NDP signature: '0'<br>
> Uplink data aggregation max size: '0'<br>
> Downlink data aggregation max size: '0'<br>
><br>
> We see the raw-ip there, which was the recommendation.<br>
><br>
<br>
</span>Ok.<br>
<div><div class="h5"><br>
> Before bringing up the network I further investigate:<br>
><br>
> $ sudo qmicli -d /dev/cdc-wdm0 --wds-get-default-settings=<wbr>3gpp<br>
> [03 Sep 2018, 16:48:16] -Warning ** [/dev/cdc-wdm0] requested auto mode<br>
> but no MBIM QMUX support available<br>
> Default settings retrieved:<br>
> APN: '<a href="http://fast.t-mobile.com" rel="noreferrer" target="_blank">fast.t-mobile.com</a>'<br>
> PDP type: 'ipv4-or-ipv6'<br>
> Username: ''<br>
> Password: ''<br>
> Auth: 'none'<br>
><br>
> Furthermore, scanning with --wds-get-profile-list=3gpp shows that all the<br>
> PDP's are "ipv4-or-ipv6" which looks good.<br>
><br>
> So we try the forcing of ipv4 again:<br>
><br>
> # qmicli -d /dev/cdc-wdm0 --wds-set-ip-family=4 --client-no-release-cid -v<br>
><br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] Opening device with<br>
> flags 'auto'...<br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] loaded driver of cdc-wdm<br>
> port: qmi_wwan<br>
> [03 Sep 2018, 16:52:16] -Warning ** [/dev/cdc-wdm0] requested auto mode<br>
> but no MBIM QMUX support available<br>
> [03 Sep 2018, 16:52:16] [Debug] QMI Device at '/dev/cdc-wdm0' ready<br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] Assuming service 'wds'<br>
> is supported...<br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] Allocating new client<br>
> ID...<br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] sent message...<br>
> <<<<<< RAW:<br>
> <<<<<< length = 16<br>
> <<<<<< data = 01:0F:00:00:00:00:00:01:22:00:<wbr>04:00:01:01:00:01<br>
><br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] sent generic request<br>
> (translated)...<br>
> <<<<<< QMUX:<br>
> <<<<<< length = 15<br>
> <<<<<< flags = 0x00<br>
> <<<<<< service = "ctl"<br>
> <<<<<< client = 0<br>
> <<<<<< QMI:<br>
> <<<<<< flags = "none"<br>
> <<<<<< transaction = 1<br>
> <<<<<< tlv_length = 4<br>
> <<<<<< message = "Allocate CID" (0x0022)<br>
> <<<<<< TLV:<br>
> <<<<<< type = "Service" (0x01)<br>
> <<<<<< length = 1<br>
> <<<<<< value = 01<br>
> <<<<<< translated = wds<br>
><br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] received message...<br>
> <<<<<< RAW:<br>
> <<<<<< length = 24<br>
> <<<<<< data =<br>
> 01:17:00:80:00:00:01:01:22:00:<wbr>0C:00:02:04:00:00:00:00:00:01:<wbr>02:00:01:16<br>
><br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] received generic<br>
> response (translated)...<br>
> <<<<<< QMUX:<br>
> <<<<<< length = 23<br>
> <<<<<< flags = 0x80<br>
> <<<<<< service = "ctl"<br>
> <<<<<< client = 0<br>
> <<<<<< QMI:<br>
> <<<<<< flags = "response"<br>
> <<<<<< transaction = 1<br>
> <<<<<< tlv_length = 12<br>
> <<<<<< message = "Allocate CID" (0x0022)<br>
> <<<<<< TLV:<br>
> <<<<<< type = "Result" (0x02)<br>
> <<<<<< length = 4<br>
> <<<<<< value = 00:00:00:00<br>
> <<<<<< translated = SUCCESS<br>
> <<<<<< TLV:<br>
> <<<<<< type = "Allocation Info" (0x01)<br>
> <<<<<< length = 2<br>
> <<<<<< value = 01:16<br>
> <<<<<< translated = [ service = 'wds' cid = '22' ]<br>
><br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] Registered 'wds'<br>
> (version unknown) client with ID '22'<br>
> [03 Sep 2018, 16:52:16] [Debug] Asynchronously set IP family...<br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] sent message...<br>
> <<<<<< RAW:<br>
> <<<<<< length = 17<br>
> <<<<<< data = 01:10:00:00:01:16:00:01:00:4D:<wbr>00:04:00:01:01:00:04<br>
><br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] sent generic request<br>
> (translated)...<br>
> <<<<<< QMUX:<br>
> <<<<<< length = 16<br>
> <<<<<< flags = 0x00<br>
> <<<<<< service = "wds"<br>
> <<<<<< client = 22<br>
> <<<<<< QMI:<br>
> <<<<<< flags = "none"<br>
> <<<<<< transaction = 1<br>
> <<<<<< tlv_length = 4<br>
> <<<<<< message = "Set IP Family" (0x004D)<br>
> <<<<<< TLV:<br>
> <<<<<< type = "Preference" (0x01)<br>
> <<<<<< length = 1<br>
> <<<<<< value = 04<br>
> <<<<<< translated = ipv4<br>
><br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] received message...<br>
> <<<<<< RAW:<br>
> <<<<<< length = 20<br>
> <<<<<< data =<br>
> 01:13:00:80:01:16:02:01:00:4D:<wbr>00:07:00:02:04:00:00:00:00:00<br>
><br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] received generic<br>
> response (translated)...<br>
> <<<<<< QMUX:<br>
> <<<<<< length = 19<br>
> <<<<<< flags = 0x80<br>
> <<<<<< service = "wds"<br>
> <<<<<< client = 22<br>
> <<<<<< QMI:<br>
> <<<<<< flags = "response"<br>
> <<<<<< transaction = 1<br>
> <<<<<< tlv_length = 7<br>
> <<<<<< message = "Set IP Family" (0x004D)<br>
> <<<<<< TLV:<br>
> <<<<<< type = "Result" (0x02)<br>
> <<<<<< length = 4<br>
> <<<<<< value = 00:00:00:00<br>
> <<<<<< translated = SUCCESS<br>
><br>
> [/dev/cdc-wdm0] Client ID not released:<br>
> Service: 'wds'<br>
> CID: '22'<br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] Releasing 'wds' client<br>
> with flags 'none'...<br>
> [03 Sep 2018, 16:52:16] [Debug] [/dev/cdc-wdm0] Unregistered 'wds'<br>
> client with ID '22'<br>
> [03 Sep 2018, 16:52:16] [Debug] Client released<br>
> [03 Sep 2018, 16:52:16] [Debug] Closed<br>
><br>
> Now I try to pull the network up:<br>
> $ sudo qmicli -d /dev/cdc-wdm0<br>
> --wds-start-network="APN=<a href="http://fast.t-mobile.com" rel="noreferrer" target="_blank">fast.<wbr>t-mobile.com</a>,ip-type=4"<br>
><br>
> Which succeeds<br>
><br>
<br>
</div></div>Yes, but it will be disconnected right after the command returns<br>
because the CID that was used for the command was released<br>
automatically. You can prevent this using --client-no-release-cid, and<br>
then you can re-use the CID in the next WDS commands you send with<br>
--client-cid=CID.<br>
<span class=""><br>
> $ sudo dhclient -4 -v wwp0s29u1u1u4i4<br>
><br>
> is the last step.<br>
><br>
> This now fails. No ipv6, no nothing.<br>
><br>
<br>
</span>In this case, it's just because of the above, the modem is already<br>
disconnected at this point as the CID was released.<br>
<div><div class="h5"><br>
> ------<br>
><br>
> Alright that failed. Let's try qmi-network instead, which relies on<br>
> /etc/qmi-network.conf, which I will start by leaving unmodified<br>
> from my last email, since it seemed to have worked.<br>
><br>
> $ sudo pkill dhclient<br>
> $ sudo qmi-network /dev/cdc-wdm0 start<br>
> Loading profile at /etc/qmi-network.conf...<br>
> /usr/local/bin/qmi-network: 2: /etc/qmi-network.conf: ip-type=4: not<br>
> found<br>
> APN: internet<br>
> APN user: unset<br>
> APN password: unset<br>
> qmi-proxy: no<br>
> Checking data format with 'qmicli -d /dev/cdc-wdm0<br>
> --wda-get-data-format '...<br>
> [03 Sep 2018, 17:03:53] -Warning ** [/dev/cdc-wdm0] requested auto<br>
> mode but no MBIM QMUX support available<br>
> Device link layer protocol retrieved: raw-ip<br>
> Getting expected data format with 'qmicli -d /dev/cdc-wdm0<br>
> --get-expected-data-format'...<br>
> [03 Sep 2018, 17:03:54] -Warning ** [/dev/cdc-wdm0] requested auto<br>
> mode but no MBIM QMUX support available<br>
> Expected link layer protocol retrieved: 802-3<br>
> Updating kernel link layer protocol with 'qmicli -d /dev/cdc-wdm0<br>
> --set-expected-data-format=<wbr>raw-ip'...<br>
> [03 Sep 2018, 17:03:54] -Warning ** [/dev/cdc-wdm0] requested auto<br>
> mode but no MBIM QMUX support available<br>
> error: cannot set expected data format: Expected data format not<br>
> updated properly to 'raw-ip': got '802-3' instead<br>
> Error updating kernel link layer protocol<br>
> Starting network with 'qmicli -d /dev/cdc-wdm0<br>
> --wds-start-network=apn='<wbr>internet' --client-no-release-cid '...<br>
> [03 Sep 2018, 17:03:54] -Warning ** [/dev/cdc-wdm0] requested auto<br>
> mode but no MBIM QMUX support available<br>
> Saving state at /tmp/qmi-network-state-cdc-<wbr>wdm0... (CID: 23)<br>
> Saving state at /tmp/qmi-network-state-cdc-<wbr>wdm0... (PDH: 2267620704)<br>
> Network started successfully<br>
><br>
> None of these things look good. Whatever, I'll try it anyway:<br>
><br>
<br>
</div></div>That's strange. If you're using a kernel >= 4.5 you shouldn't have had<br>
any issue running --set-expected-data-format=<wbr>raw-ip.<br>
<span class=""><br>
> $ sudo dhclient -4 wwp0s29u1u1u4i4<br>
> fails.<br>
> $ sudo dhclient wwp0s29u1u1u4i4<br>
> ... eventually gives me an ipv6 address again ...<br>
><br>
> This is where I was before.<br>
><br>
<br>
</span>I think you need to investigate a bit more why the kernel failed to<br>
set raw-ip for the WWAN interface.<br>
Also, please note that when an interface is in raw-ip mode, dhclient<br>
will NOT work as it doesn't know how to set the interface up. There<br>
are other DHCP clients out there that support that operation, just not<br>
all.<br>
Instead, you can run --wds-get-current-settings and manually apply the<br>
settings on the interface and set up the default routes as you wish.<br>
qmi-network only puts the modem in connected mode, it doesn't setup<br>
the network interface.<br>
<br>
If you need a solution that does all (modem connect, wwan iface setup<br>
and default route management) then libqmi+ModemManager+<wbr>NetworkManager<br>
is the best solution.<br>
<span class="HOEnZb"><font color="#888888"><br>
-- <br>
Aleksander<br>
<a href="https://aleksander.es" rel="noreferrer" target="_blank">https://aleksander.es</a><br>
</font></span></blockquote></div><br></div>