Connecting GPRS From Ubuntu Gutsy
Connecting GPRS From Ubuntu Gutsy
Connecting to GPRS using a Nokia Phone is not too tough in Ubuntu Gutsy. This is because the default udev rules does install the required drivers and map most of the Nokia devices to /dev/ttyACM0. But it can become tough if you need to retain the resolv.conf or making the pppd to add a default route to the connected device. We will see how it was done properly in the Saturn Labs.
First of all the gnome-ppp which the experts at Saturn Labs installed was found to be buggy, as per the bug stated here. This bug is related to the change in logging by wvdial. Though it frustrated the people at Saturn Labs, once the patched version is installed, gnome-ppp will start working.
If you do not have another networking configuration, then this should be okay and GPRS should be working properly refer to the config file attached. If by any chance you have another network, and a default route attached you might find that the pppd refuses to change the default route to this device which is now connected. For this you add one line to /etc/ppp/ip-up, just after the parameters are assigned to human readable variables:
route add default gw $PPP_IFACE
route del default gw $PPP_IFACE
If you have multiple dialup configurations, then invoking gnome-ppp with --conf [configfile] would be better, this will create a hidden file (automatically prefixes the config file with a '.' dot), for instance the following command will create a hidden file .gprs.conf in the user's home folder, and use this for the later sessions.
gnome-ppp --conf gprs.conf
This way create different launchers for different dial out connections.
Before we conclude, at Saturn Labs, there was one more fixup, ie the resolv.conf should not be changed when the pppd was starting, so a file /etc/ppp/ip-up.d/99-localdns was created with the following contents, actually copied the usepeerdns in the folder and modified as and where needed.
#!/bin/sh -e # this variable is only set if the usepeerdns pppd option is being used [ "$USEPEERDNS" ] || exit 0 # exit if the resolvconf package is installed [ -x /sbin/resolvconf ] && exit 0 # create the file if it does not exist if [ ! -e /etc/resolv.conf ]; then : > /etc/resolv.conf fi # follow any symlink to find the real file REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf) cat /etc/ppp/resolv.conf.local > /etc/resolv.conf # restart nscd because resolv.conf has changed if [ -e /var/run/nscd.pid ]; then /etc/init.d/nscd restart || true fi exit 0
chmod +x /etc/ppp/ip-up.d/99-localdns
to make this file active. A /etc/ppp/resolv.conf.local was added with static nameserver entries one for the internal lan at the top followed by two dns servers from opendns.com pool. This makes sure that the first DNS query will be tried to the lan DNS server, and if it fails (the machine is out of office), the other servers will be used
search * nameserver 192.168.0.1 nameserver 188.8.131.52 nameserver 184.108.40.206
The device used at Saturn Labs was Nokia e65 and Nokia e61i connected over the usb cable with pc suite mode on the phone. GPRS connection was that of BSNL India. The gnome-ppp config file follows, this was hand edited after a basic one prepared with the help of gnome-ppp.
[Dialer Defaults] Modem = /dev/ttyACM0 ISDN = off Modem Type = Analog Modem Baud = 460800 Init = ATX3 Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 Init3 = AT+CGDCONT=1,"IP","gprssouth.cellone.in" Init4 = Init5 = Init6 = Init7 = Init8 = Init9 = Phone = *99# Phone1 = Phone2 = Phone3 = Phone4 = Dial Prefix = Dial Attempts = 3 Dial Command = ATM0L0DT Ask Password = off Password = ppp123 Username = ppp Auto Reconnect = on Abort on Busy = off Carrier Check = on Check Def Route = on Abort on No Dialtone = off Stupid Mode = off Idle Seconds = 0 Auto DNS = off ;Domain = ;Nameserver = 220.127.116.11 ;Nameserver2 = 18.104.22.168 ;Minimize = on ;Dock = on ;Do NOT edit this file by hand!