Connecting To The Internet Using PPP connection

A pppd connection is probably the most controllable method of connecting to the internet via the modem, there are various methods of achieving this (ideally using a pppd wrapper script -- see link at bottom for example) however for the sake of this demonstration we will use bundled command line utility called wvdial which does all the heavy lifting for us.

It's worth mentioning before we begin that on newer LTE modems the QMI interface is now the preferred method of attaching to the cellular network (rather than ppp over serial) as this provides a maximum data throughput link. It is usually possible to re-configure the modem to bring back the required AT & PPP com ports if desired though.

The default demo OS image has wvdial already installed and configured by default, installing this into the stock OS requires some fiddling as the wvdial's post-install sequence usually hangs when trying to probe serial ports looking for modems (this can be avoided by installing a sample wvdial.conf file into the /etc directory before installing it)

The key files to configure wvdial are :

/etc/ppp/peers/wvdial

MyPi Industrial Raspberry Pi 3G 4G Modem Internet Connection 1

The last three lines are important to add if they're not there already as these ensure the system changes the dns settings (/etc/resolv.conf) and the default route to suit the PPP connection whilst wvdial is active.


/etc/wvdial.conf

MyPi Industrial Raspberry Pi 3G 4G Modem Internet Connection  2

This file contains the bulk of wvdial's config, let's step through the most important lines you'll need to edit to suit your own config.

Init3 = AT+CGDCONT=1,"IP","pp.vodafone.co.uk"

This line defines the APN details for the SIM you're using, in this case pp.vodafone.co.uk suits "pay as you go" non-contract vodafone SIMs

Username = web
Password = web

These are the username/password details for the apn, not all providers use these details and so can be left as "web" or "user"

Modem = /dev/modemPPP

This specifies the serial port to be used for the PPP connection

Once you have the system configured you can make a test connection as shown below :

MyPi Industrial Raspberry Pi 3G 4G Modem Internet Connection 3

To exit the connection use Ctrl-C

MyPi Industrial Raspberry Pi 3G 4G Modem Internet Connection 4

 

As a starting point for a pppd script have a look at the example script set below :

PPP Dialout Script Set

APN details for world wide Cellular networks -- List #1

APN details for world wide Cellular networks -- List #2

 

 

 

 

Contact us now to discuss your project

Ready to order, contact us today for pricing or samples

Contact Us