How do I establish a mobile broadband connection from the command line?

I run Ubuntu 12.04 on an old iMac G3. Since the GUI is too resource heavy I have disabled the display manager (lightdm) and am currently running the computer in console mode. How do I establish a mobile broadband connection from the command line?

When I connect the modem it shows up as ttyUSB0 in the Network Manager device list:

$ nmcli dev
DEVICE     TYPE              STATE        
ttyUSB0    gsm               disconnected    
eth0       802-3-ethernet    unavailable

I have also copied a working connection configuration file from another computer to /etc/NetworkManager/system-connections/Com\ Hem\ Default\ 1. Still, when I try to connect I get an "unknown connection" error:

$ nmcli con up id "Com Hem Default 1"
Error: Unknown connection: Com Hem Default 1.

Any clues?


Solution 1:

wvdial is the tool you need. Install it with sudo apt-get install wvdial if needed. You can configure the connection by editing /etc/wvdial.conf:

[Dialer Defaults]
Phone = <dial-out number here>
Username = 
Password = 
New PPPD = yes

Their man-pages will be really helpful I think. man wvdial and man wvdial.conf for details.