Linux 3G MobileBroadband Card Novatel Merlin XU870
Linux 3G MobileBroadband Card Novatel Merlin XU870
I finally got my Linux 3G "NetConnect" card working under Linux. I had to read a lot, and nothing would work, then finally I stumbled over something simple that made it all work, and I played around, and finally have it working well!
First, make sure you have the airprime module built, and loaded. When you insert the Novatel card, you should get the following in your syslog.
May 10 08:58:23 brom kernel: [ 398.446636] usb 1-2: new full speed USB device using ohci_hcd and address 5 May 10 08:58:23 brom kernel: [ 398.552496] usb 1-2: configuration #1 chosen from 1 choice May 10 08:58:23 brom kernel: [ 398.553886] airprime 1-2:1.0: airprime converter detected May 10 08:58:23 brom kernel: [ 398.554120] usb 1-2: airprime converter now attached to ttyUSB0 May 10 08:58:23 brom kernel: [ 398.554283] usb 1-2: airprime converter now attached to ttyUSB1 May 10 08:58:23 brom kernel: [ 398.554438] usb 1-2: airprime converter now attached to ttyUSB2 May 10 08:58:23 brom kernel: [ 398.555515] airprime 1-2:1.1: airprime converter detected May 10 08:58:23 brom kernel: [ 398.555788] usb 1-2: airprime converter now attached to ttyUSB3 May 10 08:58:23 brom kernel: [ 398.555965] usb 1-2: airprime converter now attached to ttyUSB4 May 10 08:58:23 brom kernel: [ 398.556124] usb 1-2: airprime converter now attached to ttyUSB5
Followed by lots of NetworkManager/HAL debug information on my machine.
If you get all that, then the device is working, and you now can talk to it like any normal modem, on ttyUSB0. I believe the other 5 tty's it creates are for other functions, like SIM access, but no one yet knows how to use them, and I intend to contact Novatel about them.
Now to get it online to the 3 mobile network. When you plug your device in, the light should go white for a few seconds, then maybe red for a few seconds, then should eventually start blinking. If it's blue, then you are in a UMTS or faster 3 Broadband area, and everything is going to be splendid. Other colours, and you're probably in a lower speed area, or worst case, telstra roaming area. Under Windows I used the included software to set the card to UMTS network only, instead of automatic, as I don't wish to use roaming. No idea how to do this under Linux yet.
Create the following files
/etc/ppp/peers/3
connect "/usr/sbin/chat -v -f /etc/chatscripts/3" usepeerdns defaultroute /dev/ttyUSB0 230400 user "a"
You'll notice that username and password don't matter, but I believe you need something in there. Also, you may have default route problems, for example if you normally have a wired gateway, if that is the case, disable the network interfaces before starting up the wireless, then bring them up after.
/etc/chatscripts/3
TIMEOUT 60 ABORT ERROR ABORT BUSY ABORT VOICE ABORT "NO CARRIER" ABORT "NO DIALTONE" ABORT "NO DIAL TONE" ABORT "NO ANSWER" "" "ATZ" "" "AT&FH0L3" "" 'at+cgdcont=1,"IP","3netaccess","",0,0' OK-AT-OK "ATDP*99#" TIMEOUT 75 CONNECT
You'll notice this is almost the default script created by the Gnome Network Manager. That is because it basically is! The last TIMEOUT you can probably change to 5 or something, because this "dialup" connection is almost instantaneous! The important bit is the line with 3netacccess in it, and of course the dialing line. The number to dial is *99# and 3netaccess is the "APN" or Access Point you are going through. 3service (or 3services, can't remember) will give you proper access to Planet3 for example. So if you are putting a normal 3 SIM in your netcard, e.g. you mates prepaid service, you can access what ever they can normally access, by using 3service instead of 3netaccess.
After doing all that, you should be read to connect. A simple "pon 3″ command will start pppd and connect to 3. Watch the light on your card, as well as your syslogs. If the light stops flashing, and goes solid yellow or blue, then your connected. Check your logs that pppd got a DNS server, and ip address.
The "poff" command should disconnect it.
A complete syslog entry for pppd connecting and disconnecting.
May 10 11:19:24 brom pppd[32177]: pppd 2.4.4 started by tim, uid 1000 May 10 11:19:25 brom chat[32181]: timeout set to 60 seconds May 10 11:19:25 brom chat[32181]: abort on (ERROR) May 10 11:19:25 brom chat[32181]: abort on (BUSY) May 10 11:19:25 brom chat[32181]: abort on (VOICE) May 10 11:19:25 brom chat[32181]: abort on (NO CARRIER) May 10 11:19:25 brom chat[32181]: abort on (NO DIALTONE) May 10 11:19:25 brom chat[32181]: abort on (NO DIAL TONE) May 10 11:19:25 brom chat[32181]: abort on (NO ANSWER) May 10 11:19:25 brom chat[32181]: send (ATZ^M) May 10 11:19:25 brom chat[32181]: send (AT&FH0L3^M) May 10 11:19:25 brom chat[32181]: send (at+cgdcont=1,"IP","3netaccess","",0,0^M) May 10 11:19:26 brom chat[32181]: expect (OK) May 10 11:19:26 brom chat[32181]: ATZ^M^M May 10 11:19:26 brom chat[32181]: OK May 10 11:19:26 brom chat[32181]: -- got it May 10 11:19:26 brom chat[32181]: send (ATDP*99#^M) May 10 11:19:26 brom chat[32181]: timeout set to 75 seconds May 10 11:19:26 brom chat[32181]: expect (CONNECT) May 10 11:19:26 brom chat[32181]: ^M May 10 11:19:26 brom chat[32181]: AT&FH0L3^M^M May 10 11:19:26 brom chat[32181]: OK^M May 10 11:19:26 brom chat[32181]: at+cgdcont=1,"IP","3netaccess","",0,0^M^M May 10 11:19:26 brom chat[32181]: OK^M May 10 11:19:26 brom chat[32181]: ATDP*99#^M^M May 10 11:19:26 brom chat[32181]: CONNECT May 10 11:19:26 brom chat[32181]: -- got it May 10 11:19:26 brom pppd[32177]: Serial connection established. May 10 11:19:26 brom pppd[32177]: Using interface ppp0 May 10 11:19:26 brom pppd[32177]: Connect: ppp0 <--> /dev/ttyUSB0 May 10 11:19:27 brom pppd[32177]: PAP authentication succeeded May 10 11:19:30 brom pppd[32177]: Cannot determine ethernet address for proxy ARP May 10 11:19:30 brom pppd[32177]: local IP address 202.124.94.117 May 10 11:19:30 brom pppd[32177]: remote IP address 202.124.80.34 May 10 11:19:30 brom pppd[32177]: primary DNS address 202.124.81.2 May 10 11:19:30 brom pppd[32177]: secondary DNS address 202.124.68.130 May 10 11:19:31 brom pppd[32177]: Connect time 0.1 minutes. May 10 11:19:31 brom pppd[32177]: Sent 0 bytes, received 10 bytes. May 10 11:19:31 brom pppd[32177]: Cannot determine ethernet address for proxy ARP May 10 11:19:31 brom pppd[32177]: local IP address 202.124.94.117 May 10 11:19:31 brom pppd[32177]: remote IP address 202.124.80.34 May 10 11:19:31 brom pppd[32177]: primary DNS address 202.124.81.2 May 10 11:19:31 brom pppd[32177]: secondary DNS address 202.124.68.130 May 10 11:28:32 brom pppd[32697]: pppd 2.4.4 started by tim, uid 1000 May 10 11:28:32 brom pppd[32697]: Device ttyUSB0 is locked by pid 32177 May 10 11:28:32 brom pppd[32697]: Exit. May 10 11:38:51 brom pppd[32177]: Terminating on signal 15 May 10 11:38:51 brom pppd[32177]: Connect time 19.4 minutes. May 10 11:38:51 brom pppd[32177]: Sent 241286 bytes, received 1034888 bytes. May 10 11:38:51 brom pppd[32177]: Connection terminated. May 10 11:38:52 brom pppd[32177]: Exit.
Now, if you can't get it working from there, it's probably a route or dns problem.
Further things to do.
Install a proxy, to reduce your traffic. I'm trying Polipo which seems to be making a difference.
Monitor your traffic. There seem to be a few ways to do this, including "ipac" (ipac-ng package in Ubuntu) which is IP Accounting with iptables rules. Not sure how well that works. The other method is log monitoring which is what I'm currently doing.
First, get pppd to log to it's own file. Under Ubuntu/Debian you should be able to add a line as follows to your syslog.conf file.
local2.* /var/log/ppplog
Failing that, for other distros, if you don't wish to recompile pppd, the LOG_DAEMON level should get you pppd and all other daemon logging into a file. I've personally got it logging to its own file, not being rotated atm. Eventually, I'll have a rotate script that filters out all the lines I don't need, and saves them in months.
Create the following file, I have it called calc_usage.sh
#!/bin/bash
logfile="/var/log/ppplog"
tempfile="/tmp/logs"
datafile=$HOME"/.data_usage"
function human {
perl -MNumber::Bytes::Human=format_bytes -e 'printf "%5s %s\n", format_bytes($ARGV[0])' $1
}
cat $logfile | grep pppd | grep Sent > $tempfile
cat $datafile >> $tempfile
cat $tempfile | grep pppd | grep Sent | sort | uniq > $datafile
cat $datafile | gawk -F\ '{print $7"+"}' | xargs > /tmp/sent
echo "0" >> /tmp/sent
echo -n "Sent Total : " && human `cat /tmp/sent | xargs | bc`
cat $datafile | gawk -F\ '{print $10"+"}' | xargs > /tmp/recv
echo "0" >> /tmp/recv
echo -n "Recv Total : " && human `cat /tmp/recv | xargs | bc`
echo -n "Total: " && human $(echo `cat /tmp/recv | xargs | bc` + `cat /tmp/sent | xargs | bc` | bc)
rm -rf /tmp/sent
rm -rf /tmp/recv
rm -rf $tempfile
This will tally up all the lines from the log generated when pppd disconnects, and reports the session data usage. It will store all data in ~/.data_usage so when the log is rotated, it still has all the information. As 3 counts both uploads and downloads, this script gives you the total. (It's modified from a script on the net, if I find the page again, I'll link to it). What you do from now is up to you, you'll probably want a method at the end of the month to rotate the log and report the months usage to you. You may also want to use the script daily in a cron job to report your usage (or anacron if you are a laptop user who turns their baby off).
If you are having a problem with any of this, feel free to drop me a line, I'll try and help how ever I can!