How to connect via qmi_wwan on Ubuntu?

Well, or, instead of just using always the second interface, you can switch the data format being used in the network interface before using it. E.g. you can run this unconditionally before running the WDS Start Network command (using qmicli+libqmi+qmi_wwan):

$ qmicli -d /dev/cdc-wdm0 --wda-set-data-format=802-3

Or for older devices which don’t support the WDA service:

$ qmicli -d /dev/cdc-wdm0 --wds-noop --device-open-net="net-802-3|net-no-qos-header"

The alignment is something that isn’t guaranteed by the kernel (although they usually are aligned). If you want a quick check of which WWAN interface corresponds to which cdc-wdm port you can use (only with libqmi git master):

$ qmicli -d /dev/cdc-wdm0 --get-wwan-iface

Or, otherwise looking at sysfs, but I just find that new command quicker.