Connecting to mobile broadband from a terminal

In Linux, connecting to internet using a mobile broadband connection (i.e., a dongle) is fairly easy. If your distro has nm-applet installed (like most modern distros do) all you need is to create a new network connection and choose your country and network provider.

But how do you connect with a dongle when you don’t have a GUI? azeemigi’s blog has the solution. I’m reproducing it here just for the sake of my own future reference.

First determine the name of your broadband connection using the command nmcli -p con You will get the list of network interfaces in your computer and among them might be a row corresponding to your dongle. It’s easily distinguishable. In my case it was,

~ » nmcli -p con
 =============================================================================
                                                   Connection list
==============================================================================
NAME                      UUID                                   TYPE         
------------------------------------------------------------------------------
Wired connection 1        cbd369e1-b2fa-46a6-83b1-fbfdc9d28e0f   802-3-ethernet
Dialog GSM Postpaid       bb06d9f7-772c-4b4b-851a-4564503c3798   gsm       

Obviously it’s the last row.

Now download the following gist and copy/paste the name and the UUID of the connection in the relevant lines.

It goes without saying that you need to make the script executable with chmod +x mbb and add to a location in your $PATH.

Now you can connect to the internet with mbb start, disconnect with mbb stop and check the status with mbb status.

Post a comment or leave a trackback: Trackback URL.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *