So, you’ve gotten your shiny new EVDO datacard working under Linux (if not, see High-speed cellular wireless modems (e.g. EVDO, HSPDA) in Ubuntu GNU/Linux 6.10) and you want to now setup the actual Internet connection?
In this article I document how I setup Sprint’s Mobile Broadband service with ppp in Ubuntu GNU/Linux 6.10.
Setting up ppp
There are some great GUI tools for setting up PPP on Linux, but I don’t care to use them. I like editing text files and working on the CLI.
To get things working, we only need to create several different files (as superuser). The first, /etc/ppp/peers/sprint:
/dev/ttyUSB0 # modem
921600 # faster than this has no effect, and actually can be detrimental
defaultroute # use cellular network for default route
usepeerdns # use the DNS servers from the remote network
#nodetach # keep pppd in the foreground
#debug
crtscts # hardware flow control
lock # lock the serial port
noauth # don't expect the modem to authenticate itself
local # don't use Carrier Detect or Data Terminal Ready
persist # Redial if connection lost
user
ppp
holdoff 5 # Reconnect after 5s on connection loss
lcp-echo-failure 4 # prevent timeouts
lcp-echo-interval 65535 # prevent timeouts
connect "/usr/sbin/chat -v -f /etc/chatscripts/sprint-connect"
disconnect "/usr/sbin/chat -v -f /etc/chatscripts/sprint-disconnect"
Notice that you do not need your Sprint PCS username or password. The modem authenticates itself to Sprint in hardware via its ESN. Next is /etc/chatscripts/sprint-connect:
TIMEOUT 10
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'ERROR'
SAY 'Starting Sprint...\n'
# Get the modem's attention and reset it.
"" 'ATZ'
# E0=No echo, V1=English result codes
OK 'ATE0V1'
# List signal quality
'OK' 'AT+CSQ'
'OK' 'ATDT#777'
CONNECT
and your connection will work
And then the optional /etc/chatscripts/sprint-disconnect:
"" "\K"
"" "+++ATH0"
SAY "Disconnected from Sprint."
You can also setup this connecton in /etc/network/interfaces, adding the stanza (assuming you want to use ppp0):
iface ppp0 inet ppp
provider sprint
And that’s basically it! If you setup your interfaces file, you can simply run:
sudo ifup ppp0
to bring up the connection. Remember to ifdown the interface to disconnect. If not using interfaces, you can use the pon/poff pair of commands:
sudo pon sprint # Start connection
sudo poff sprint # Stop connection
Problem: default route does not get set
For some reason, my default route is not set properly. If not set properly, you look as if you’ve been connected to Sprint, but you will not actually be able to connect to any site on the Internet. To check if this is happening to you, look at the last line of “route -n” and see if it reads the nonsense:
0.0.0.0 0.0.0.0 0.0.0.0 UG 0 0 0 ppp0
To fix this, I created script into /etc/ppp/ip-up.d/zzz-fix-route:
#!/bin/sh
/sbin/route del default gw 0.0.0.0 # Remove nonsense route
/sbin/route add default gw $PPP_REMOTE # Add correct route
Remember to make the file executable. The “zzz-” prefix insures that it is the last script run, just to prevent a script after it from misconfiguring the route again,
Comments
chat unrecognized option
Everything works fine up to the ifup. I get:
/usr/sbin/pppd: In file /etc/ppp/peers/sprint: unrecognized option ’-v’
Removing the ‘-v’ only moves the error to the ‘-f’ Anyone know why?
Novatel U720
Ubuntu 7.04
pppd unrecognized option
Everything works up to ifup. I get the error: /usr/sbin/pppd: In file /etc/ppp/peers/sprint: unrecognized option -v
If I remove the “-v” it errors on the ”-f”.
Novatel U720 Ubuntu 7.0
Any body tried PPTP or other secure connection
Have you tried to connect to a VPN system or other secure connection system? I have not bought the card yet but I need to be able to have a VPN connection also.
Figured it out
On my system, the DNS servers were not automatically updated. I had to manually edit my /etc/resolv.conf file to get it to work. I’m sure there’s a way to get PPP to do it but I’ve already spent enough time on this.
Thanks again …
jon
Still having problems
Hello,
0.0.0.0 MY_GATEWAY_ADDRESS 0.0.0.0 UG 0 0 0 ppp0
-jon
Updated zzz-fix-route script
I modified the original author’s script to look like this:
#!/bin/shecho `route -n | grep ^0.0.0.0 | tail -1 | cut -c 17-40 | cut -f 1 -d ' '` > /tmp/defaultroute
/sbin/route del default # Remove old route
/sbin/route del default # Remove old route
PPP_REMOTE=`route -n | grep ppp0 | head -1 | cut -f 1 -d ' '`
/sbin/route add default gw $PPP_REMOTE # Add correct route
exit 0
I also created /etc/ppp/ip-down.d/zzz-fix-route as shown below and did a chmod a+x on it as well.
#!/bin/sh/sbin/route del default # Remove old route
/sbin/route del default # Remove old route
/sbin/route add default gw `cat /tmp/defaultroute` # Add correct route
exit 0
Thanks so much for the tutorial. It made setting up my aircard a 10 minute process. With these adjustments, all I do now is ‘pon sprint’, ‘poff sprint’ and things just work.
Does anyone have a list of
Does anyone have a list of AT commands?
Airprime finds a number of ports. writing data to these ports may trigger mode switching.
Something that is interesting: You can’t switch to automatic and non-roam when connected so it must be an AT command. Just a guess.
PX500 Card
In this card the airprime module detects 9 ports instead of 6.
from dmesg output:
airprime 6-1:1.0: airprime converter detected
usb 6-1: airprime converter now attached to ttyUSB0
usb 6-1: airprime converter now attached to ttyUSB1
usb 6-1: airprime converter now attached to ttyUSB2
airprime 6-1:1.1: airprime converter detected
usb 6-1: airprime converter now attached to ttyUSB3
usb 6-1: airprime converter now attached to ttyUSB4
usb 6-1: airprime converter now attached to ttyUSB5
airprime 6-1:1.2: airprime converter detected
usb 6-1: airprime converter now attached to ttyUSB6
usb 6-1: airprime converter now attached to ttyUSB7
usb 6-1: airprime converter now attached to ttyUSB8
The ports that works is ttyUSB3.
So it is just a matter of changing that port in the /etc/ppp/peers/sprint script.
Everything else works great! (I am getting 100k peaks in downloads, a lot faster than Windows)
Thank you very much for this excellent howto!
Nothing happening means it worked
Have you tried using pon/poff directly? If it exits within a few seconds without error, it’s probably connected. To make sure, check the contents of /var/log/syslog and /var/log/messages and see if pppd has successfully connected.
If it has connected and the Internet still works, you may have the same problem I had, as described above. A default route does not get set, and I had to write a script to set the default route.
Also, make sure you’re not connected via Ethernet or WiFi.
Well ... Nothing happens but it still doesn't work
when I issue the “ifup ppp0” or “pppd call sprint” command /var/log/messages gets two new lines. I don’t have it right in front of me now, but the first line basically seems to document the command being given and the second says something to the effect of pppd: Exit.
I bring up a browser or try to ping a remote host and no dice, when I tried the default route trick: still no go. I have a feeling I’m really close—yesterday when I tried I even noticed the green light on the EVDO card flashing (which indicates data is being transered) but I still can’t seem to get it.
I have a Kyocera KR1 router and that’s OK, but I really want to be able to set up a iptables-based router for greater load-handling and customization. If it never works I guess that’s OK, but now it’s just really bugging me and I want to beat this thing.
Unsure if the lights are important
The lines in the log may be important… if you’re having trouble, make sure you’ve the line “debug” in your ppp script (it’s commented out in what I provide above).
I’m not sure if the lights on the device mean anything at all…
So ... how do I know if it works?
I tried this and I was quite surprised when everything worked exactly as you said is would (for in Linux things rarely work for me as they are suppoesd to). When I insert the card, the red light flashes once or twice, then quick green flashes, then a solid green light.
However, when it came time to start it up, I issue the ifup ppp0 command and nothing at all appears to happen. If I issue the same command again, it will say that interface ppp0 is already configured. I can’t get the the Internet though. – Is there some other step I should take?
Thanks for the great tutorial – like I said, one of the best and clearest I’ve yet seen and it was a breeze to follow.
S720 GPS on Linux
I’ve been able to get the S720 working under Fedora Core 6 as well, but am trying to access the free gps (NMEA) data from the card. Have you attempted this or know of links to how to get the info. The card can be used as a gps tracker as well (works under windows..just trying to get it to work under linux). Good guide…nice clear instructions.
Not figured out GPS use in Linux
I’ve not yet figured out how to use the S720/U720 as a GPS tracker in Linux.
It’s going to require some reverse-engineering of what’s done in Windows… some command of some sort is sent by the Connection Manager software in Windows that enables the GPS tracker on a COM port. I’ve not had time to track stuff myself.
Let me know if you get anywhere!