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 itsESN. 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,