How To Get Telstra 4G Mobile Broadband Working With Linux

I’m procrastinating finishing an MBA assignment, so here’s how to get your shiny new Telstra 4G dongle working under Linux.

I use Ubuntu, but these instructions should help you on other Linux variants as well. This process worked for Ubuntu 11.04, but I haven’t tested anything else. Let us know in the comments if this works for you too, or if you have any updates for other distros.

What Is It?

First up, let’s discover some information about the device itself:

> lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 003: ID 08ff:1600 AuthenTec, Inc. AES1600
Bus 005 Device 002: ID 0b05:1751 ASUSTek Computer, Inc. BT-253 Bluetooth Adapter
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 017: ID 19d2:0166 ONDA Communication S.p.A. 
Bus 002 Device 002: ID 04f2:b033 Chicony Electronics Co., Ltd
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 1164:1f08 YUAN High-Tech Development Co., Ltd
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

The device itself is a ZTE product, an MF821 LTE modem, which for some reason shows up in the lsusb output as ONDA Communication. Take note of the ID code there, because we’ll need it in a minute.

USB Mode Change

This device is one of those tricky ones that pretends to be a storage devices before the modem driver is loaded. When it detects that it’s driver is loaded, it switches mode to become a modem. Under Windows and MacOS it does, anyway. Under Linux, we have to force this to happen (of course).

The utility that does this is called usb_modeswitch. Surprise, surprise. Grab it and its data module:

sudo apt-get install usb-modeswitch usb-modeswitch-data

Depending on how recent your distribution is, you might already have the appropriate configuration in the usb_modeswitch files. I didn’t so I had to add it myself.

Create a file in /etc/usb_modeswitch.d called 19d2:0166, the same as the ID from lsusb output above. That’s how usb_modeswitch knows which set of config to use. Put the following content in the file:

# Telstra ZTE LTE 4g modem
#
DefaultVendor=  0x19d2
DefaultProduct= 0x0166

TargetVendor=  0x19d2
TargetProduct= 0x0257

MessageContent="55534243123456782400000080000685000000240000000000000000000000"

CheckSuccess=20

Some brief explanation: The DefaultVendor and DefaultProduct are used by usb_modeswitch to find the USB address for the modem, so it knows which device to talk to. The MessageContent is a string that gets sent to the device to make it switch mode. I have no idea what that string means, I just copied it from a more recent version of usb-modeswitch-data for the MF820 product. It seems to work fine.

The TargetVendor and TargetProduct are used to check that the mode-switch worked, because we set CheckSuccess=20, which means check for 20 seconds to see if it worked. When the device switches mode, it actually changes its USB ID to a different product ID. Not all devices do that, but this one does, so we need to let usb_modeswitch know.

We want this to happen automatically, which we can do using the magic of udev. Add the following lines to /lib/udev/rules.d/40-usb_modeswitch.rules:

# Telstra 4G/LTE ZTE MF821
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0166", RUN+="usb_modeswitch '%b/%k'"

Restart udevd and your modem should automatically mode-switch when you insert it.

Driver Support

You now need to make sure you have a kernel driver for the device. The usbserial kernel module already supports it (in 11.04, kernel 2.6.38-8-generic-pae), but it doesn’t detect it automatically, so we give it some help using modprobe configuration.

Add a file into /etc/modprobe.d, such as /etc/modprobe.d/telstra-4g.conf with the following content:

# Set up options for Telsta 4G connectivity under linux
options usbserial vendor=0x19d2 product=0x0257

Now you’ll need to remove the module from the running kernel using:

rmmod usbserial

(and any dependent modules) and then re-insert, it with:

modprobe usbserial

And the modem device should now be automatically detected.

Add to NetworkManager

Click on NetworkManager and Edit Connections, go to the Wireless Broadband tab, and add a connection. You should see a selector in the middle of the window called “ZTE LTE Technologies MSM” or something similar. If not, something hasn’t worked above and you’ll need to muck about with it a bit.

Click forward, forward, etc. until the connection is added. In my setup, the APN was set to “telstra.wap” for some reason, which is wrong. Change it to “telstra.internet”.

You should now be able to click on the newly added connection in NetworkManager and connect to 4G.

You can active your device by browsing to www.telstra.com.au and following the instructions in the little booklet that comes with the device. Or, if you’re me, the website will be broken and you’ll have to ring them and talk to a helpdesk person somewhere in Asia.

Forcing 4G Mode

For some reason, my dongle kept connecting in 3G mode, so I wasn’t getting the added speed and other benefits of 4G/LTE mode.

It looks like the version of modemmanager I’m using (0.4+git.20110124t203624.00b6cce-2ubuntu1) doesn’t know how to switch ZTE modems into 4G mode. I’m not sure, because my C is rusty.

Never fear! You can force the modem into 4G mode, and it appears to remember this from that point on, even if you unplug it and plug it back in the next day (as I just did).

Here’s how.

First, click on NetworkManager and unselect “Enable Mobile Broadband”. This will disconnect NetworkManager from the modem so we can talk to it directly.

Fire up minicom (sudo apt-get install minicom if you don’t have it) and hit CTRL-Z followed by O. Select “Serial port setup” and hit Enter. Now hit A to choose edit the serial device to use, and make it /dev/ttyUSB2. Hit Enter to save the setting, then Enter again to get back to the menu. Select Exit and hit Enter to get back to the minicom session.

Enable “local echo” so you can see what you type by hitting CTRL-Z followed by E.

Now we talk to the modem using Hayes AT commands. The first command is to make sure you’re connected to the modem:

AT

The modem should respond:

OK

Now we force the modem into 4G mode:

AT+ZSNT=6,0,0

Again, the modem should respond OK, and we’re done! Exit minicom.

Re-enable mobile broadband in NetworkManager, and connect. The little light on the modem should be green instead of blue, indicating you’re connected to the 4G network.

Update: You can also use the following code setting to put the modem into auto-negotiate mode:

AT+ZSNT=0,0,0

This should detect 4G if it’s available, and fall back to 3G if you’re outside a 4G zone.

That’s It!

Happy internetting.

Thanks to FreeGeek for the instructions on how to set up usb_modeswitch and udev.

Thanks to the Linux kernel documentation crew for how to pass options to the usbserial device driver.

And thanks to everyone who builds this software for free.

Bookmark the permalink.

56 Comments

  1. Has anyone been able to find a way to use a sierra wireless aircard 320u

  2. Has anyone been able to connect a Sierra wireless aircard 320u?
    If so could you please comment what you had to do to achieve this.

  3. Silly me – I got stuck at “Create a file”.

    Though this page’s information is very helpful, it would be better if it was written for Newbies to be able to follow it step by step without having to go off and do a 12 month course on the basics before reading this page.

    Back to Googling “How to Create a file”.

  4. I can report that the Telstra 4G USB modem works perfectly under Ubuntu 14.04 without any modifications or “geek” tweaking needed. It is reported as a “Wired Connection”.

  5. Anybody have a clue where the 0x0257 for target product came from? I’m trying to do this with a Huawei E5372T. Thanks…

  6. I just grabbed it from the output in syslog after doing the modeswitch manually.

    When the device switches mode, the product ID changes. You tell modeswitch what the TargetProduct is going to be so that it knows what to look for when checking that the modeswitch worked correctly.

    If yours works differently, run the modeswitch command manually and watch the logs for what your device changes to. Then use that in your config file instead of 0x0257.

Comments are closed