How to use a USB 3G/4G modem with Linux
I own a USB 4G modem from T-Mobile Czech Republic, so as I do not use Windows at all, and all my machines are PCs, I needed it to work with Linux.
After following all official documentation and looking all over search engines through tens of tens of discussions in forums, none of them worked. Some almost worked, others did not work at all. There are some fancy graphical user interfaces for Gnome and KDE; I used the Gnome one and it refused to see my modem as mobile broadband, yet offered no parameters to manually input a device I plugged in, and of which I know its name.
So I spent quite some while to realize how to get it to work, and to save someone time, I will post them all below. I personally find it easier than try to get the GUI to work simply because it have buttons in it, and the script have not.
Parameters might change according to your provider (mine as I said previously is T-Mobile Czech Republic), there should be some documentation containing the parameters described here as %username%, %password% and %providerhost% available in their website.
First, plug the USB cable in. Look at the syslog (“tail /var/log/syslog”) for the device name it was registered under. Mine is at /dev/ttyUSB0. From now on, the device name in your syslog will be referenced as %devicename%.
Second, create a file named “/etc/ppp/peers/4ginternet” with the contents below
debug
connect “/usr/sbin/chat -v -f /etc/chatscripts/4ginternet”
user “%username%”
password “%password%”
noauth
usepeerdns
%devicename%
115200
local
nocrtscts
defaultroute
noipdefault
lcp-echo-interval 0
lcp-echo-failure 0
This file will start the script that initializes the modem, waits for the modem to give us a connection, and then negotiate all parameters that we will use on the internet.
And yes, no PAP. All official documentation say to use PAP, I used it, and the modem returned me message after message saying “no authentication is available”. So the user/password above did the trick. And yes, I am online through it right now writing this.
Third, create a file named “/etc/chatscripts/4ginternet” with the contents below
” ATZ1
” AT+CGDCONT=1,”PPP”,”%providerhost%”,”0,0″,0,0
OK “ATDT*99#”
CONNECT dc
This file initializes the modem and acquires an internet connection. For T-Mobile Czech Republic the host is “internet.t-mobile.cz”.
Now you can type in a terminal or console “pppd call 4ginternet” to start your internet connection – the progress or any errors will be in the syslog, so “tail /var/log/syslog” will give you a clear picture of whats going on. To finish the connection, you can type “kill -9 pppd” or simply stop pppd (the point-to-point protocol daemon) however you may like.
Pingback: Buyinformationonline Blog - What is the best software for speeding up my internet connection?
Which 3g/4g modem does tmobile provide? I’d be curious to learn the model info and which driver its based on.
Do you know what the chipset for your modem is? Which driver does it use?
Hi,
They all go as IPWireless, drivers/usb/serial/ipw.c, so it should be the same for all PCMCIA and USB modems.
Mine is recognized as,
usb 2-2: new full speed USB device using uhci_hcd and address 4
usb 2-2: configuration #1 chosen from 2 choices
ipwtty 2-2:1.0: IPWireless converter converter detected
usb 2-2: IPWireless converter converter now attached to ttyUSB0
As long as your kernel have the support for ipwireless (which most if not all modern distributions have), it should be just a matter of plugging the card/USB in and doing a dmesg to get the device name (mine, as above, is ttyUSB0).