Connecting GSM modem via CLI using NetworkManager

After getting my new HDD couple of days back, I decided to install Arch Linux on it. The idea with Arch is to sufficiently control what goes into my system but without too much management overhead unlike in Gentoo. Thus, I installed stated with Core install of Arch and added fluxbox over it as my default WM(I am not running any DM as of now, but might go with qingy). Thus, I have tried to avoid any GNOME or KDE libraries and do as much via minimal system as possible.

Since I disconnected my broadband a few months back, I have been living on Mobile Internet connectivity. So far I had been tethering my phone to the wifi router and then using LAN cable to connect to the PC. Horrible way to go, I agree! To simplify matters I got a USB GSM modem. It was as easy as pie to set up the connection on Ubuntu using Network Manager but with Arch, I decided not to go for nm-applet but manage it via CLI.

First I setup NetworkManager as instructed on the Arch Wiki and I got Wired Connection working in no time. The most important tool at this juncture was nmcli. I checked

nmcli dev

and it showed that gsm modem is being detected. But, on checking

nmcli con

It only showed the wired ethernet connection. Going through the man pages and googling for hints didn’t help at all. I finally turned to #nm IRC channel on Freenode.

Thanks to some excellent support, I was connected using the GSM Modem in no time.

Here’s the quick rundown

  1. Create a new file in /etc/NetworkManager/system-connections and as per the sample file. PS: You can generate uuid using uuidgen or input any random UUID as long it isn’t in use elsewhere in your system.
  2. Now, chmod the file to 0600.
  3. Restart NetworkManager
  4. Voila! What have we here. I could now see the new connection in the list.

Now to get connected to the new connection. First we disconnect the Wired connection

nmcli dev disconnect iface <iface name>

And then connect to the new interface

nmcli con up id <connection id>

For those using MTNL Mumbai, you can use my settings

[connection]
id=MTNL
uuid=15d742f1-2b5a-421e-9f27-fcb1fc26d72c
type=gsm
autoconnect=true

[ipv4]
method=auto

[gsm]
number=*99#
username=mtnl
password=mtnl123
apn=gprsppsmum

[serial]
baud=115200

 

 

 

Leave a Reply

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