How to do mobile broadband from command line

Aleksander Morgado aleksander at aleksander.es
Thu Mar 13 15:31:41 PDT 2014


Hey!

On Thu, Mar 13, 2014 at 6:28 PM, Eric Johnson <eric at minutekey.com> wrote:
> [eric at linux-vn1z ~]$ mmcli -b 0
> Bearer '/org/freedesktop/ModemManager1/Bearer/0'
>   -------------------------
>   Status             |   connected: 'yes'
>                      |   suspended: 'no'
>                      |   interface: 'ttyUSB0'
>                      |  IP timeout: '20'
>   -------------------------
>   Properties         |         apn: 'none'
>                      |     roaming: 'allowed'
>                      |     IP type: 'none'
>                      |        user: 'none'
>                      |    password: 'none'
>                      |      number: '#777'
>                      | Rm protocol: 'unknown'
>   -------------------------
>   IPv4 configuration |   method: 'ppp'
>   -------------------------
>   IPv6 configuration |   method: 'unknown'
>
> [eric at linux-vn1z ~]$ mmcli -m 0 --list-bearers
>
> Found 1 bearers:
>
>     /org/freedesktop/ModemManager1/Bearer/0
>
> [eric at linux-vn1z ~]$ wvdialconf
> Editing `/etc/wvdial.conf'.
>
> Scanning your serial ports for a modem.

Everything went ok until this point. So, mmcli lets you get the port
in connected state; that's how far ModemManager goes. Still, there is
another step that needs to be done, which is the IP setup in the data
port (which would usually be done by e.g. NetworkManager). There
currently are three main cases, and what you need to look at is the
Bearer properties that you get when MM tells you you're connected
(i.e. the "mmcli -b 0" output):

Case 1) tty port
If the bearer tells you to use a tty as data port and use PPP, you
need to launch pppd on that tty, passing APN auth details among other
things.

Case 2) net port, dhcp
If the bearer tells you to use a net port as data port and use DHCP,
you need to bring the interface up and launch a DHCP client in that
interface.

Case 3) net port, static
If the bearer tells you to use a net port as data port and 'static'
config, it will also give you what IP address configuration (IP,
netmask..) you need to configure in the net port. So you'll need to
bring the interface up, and then setup those details in the interface.

Interestingly, I was bored last Monday and started to write a python
app (called it 'mm-online', I'm no good inventing new names) which
will do exactly all that (just not using mmcli); it will use
libmm-glib via GObject-introspection to call SimpleConnect() and then
(this not yet done) prepare the connection following the steps I said
earlier. This would allow a 'standalone' operation of ModemManager
(i.e. without a higher level connection manager like NetworkManager).


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list