Configuring Linux 'pppd' For Ublox GPRS Modem
pppd(8)
PPP is the protocol used for establishing internet links over dial-up modems, DSL connections, and many other types of point-to-point links. The pppd daemon works together with the kernel PPP driver to establish and maintain a PPP link with another system (called the peer) and to negotiate Internet Protocol (IP) addresses for each end of the link. Pppd can also authenticate the peer and/or supply authentication information to the peer. PPP can be used with other network protocols besides IP, but such use is becoming increasingly rare.For more detailed explanation: man pppd or ( https://linux.die.net/man/8/pppd )
LETS STARTS
- Connect GPRS Modem with your system using USB.
Launch Terminal.
- Check Your Modem is connected or not.
- Type the command: lsusb
- You will see 8 character hex code
Bus 003 Device 002: ID 1546:110a U-Blox AG
copy id -> 1546:110a
**ID may differ ** - In my case am using U-Blox LARA-R2 series module.
- If you didn't get check connection properly.
- Type the command: dmesg
- You will find this like if USB is connected properly -> [90532.027006] usb 3-2: new high-speed USB device number 42 using xhci_hcd
[90537.410706] usb 3-2: device descriptor read/64, error -110
[90537.681872] usb 3-2: New USB device found, idVendor=1546, idProduct=110a
[90537.681877] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[90537.681880] usb 3-2: Product: u-blox Cellular Module
[90537.681882] usb 3-2: Manufacturer: u-blox
[90537.681884] usb 3-2: SerialNumber: ...................
[90537.713473] cdc_acm 3-2:1.0: ttyACM0: USB ACM device
[90537.715670] cdc_acm 3-2:1.2: ttyACM1: USB ACM device
[90537.717045] cdc_acm 3-2:1.4: ttyACM2: USB ACM device
[90537.718583] cdc_acm 3-2:1.6: ttyACM3: USB ACM device
[90537.719927] cdc_acm 3-2:1.8: ttyACM4: USB ACM device
[90537.721439] cdc_acm 3-2:1.10: ttyACM5: USB ACM device - Type the command: modprobe option
- Type the command:echo ID > /sys/bus/usb-serial/drivers/option1/new_id In my case it is echo 1546 110a > /sys/bus/usb-serial/drivers/option1/new_id
- Now we need to write a PPP script (create a file)
- sudo vi /etc/ppp/peers/anyName
- ** copy below lines** /dev/ttyACM0
115200
connect "/usr/sbin/chat -v -f /etc/ppp/peers/my-chat"
noauth
defaultroute
usepeerdns
local
debug
updetach - In my case port is /dev/ttyACM0 change according to yours.
- Type command: sudo chmod + x /etc/ppp/peers/anyName
- Create a file in which you can write AT cmds
- sudo vi /etc/ppp/peers/my-chat
- **copy below lines ** ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'VOICE'
ABORT 'NO DIALTONE'
ABORT 'NO DIAL TONE'
ABORT 'NO ANSWER'
ABORT 'DELAYED'
REPORT CONNECT
ECHO ON
TIMEOUT 6
'' \rATZ
OK ATD*99#
TIMEOUT 30
CONNECT '' - save and exit ** chmod +x NOT NEEDED for this file **
You can also add you AT cmds, for me this much sufficient. - Now to Run pppd Type command: pon anyName
- you will see this like
OK
CONNECT
chat: Dec 26 12:04:32 CONNECT
Script /usr/sbin/chat -v -f /etc/ppp/peers/my-chat finished (pid 20850), status = 0x0
Serial connection established.
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/ttyACM0
sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x8b75f2d7> <pcomp> <accomp>]
rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x52181044> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x52181044> <pcomp> <accomp>]
rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x8b75f2d7> <pcomp> <accomp>]
sent [LCP EchoReq id=0x0 magic=0x8b75f2d7]
sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15> <bsd v1 15>]
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [LCP EchoRep id=0x0 magic=0x52181044]
rcvd [LCP ProtRej id=0x2 80 fd 01 01 00 0f 1a 04 78 00 18 04 78 00 15]
Protocol-Reject for 'Compression Control Protocol' (0x80fd) received
sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [IPCP ConfReq id=0x1]
sent [IPCP ConfNak id=0x1 <addr 0.0.0.0>]
rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>]
sent [IPCP ConfReq id=0x2 <addr 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns2 0.0.0.0>]
rcvd [IPCP ConfReq id=0x2 <addr 25.189.43.240>]
sent [IPCP ConfAck id=0x2 <addr 25.189.43.240>]
rcvd [IPCP ConfNak id=0x2 <addr 25.189.43.240> <ms-dns1 49.45.0.1> <ms-dns2 49.45.0.1>]
sent [IPCP ConfReq id=0x3 <addr 25.189.43.240> <ms-dns1 49.45.0.1> <ms-dns2 49.45.0.1>]
rcvd [IPCP ConfAck id=0x3 <addr 25.189.43.240> <ms-dns1 49.45.0.1> <ms-dns2 49.45.0.1>]
local IP address xx.xxx.xx.xxx
remote IP address xx.xxx.xx.xxx
primary DNS address x.x.x.x
secondary DNS address x.x.x.x - now we are connected
using channel 1
Using interface ppp0
Connect: ppp0 <--> /dev/ttyACM0 - now we can see ppp0 by
ifconfig
ppp0 Link encap:Point-to-Point Protocol
inet addr:xx.xx.xx.xxx P-t-P:25.12.49.253 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:63 errors:0 dropped:0 overruns:0 frame:0
TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3RX bytes:14760 (14.7 KB) TX bytes:9275 (9.2 KB)Now you can ping www.google.com or browse Internet.IMPORTANT
-> CONNECTION IS NOT AUTO-CONNECT <-
-> IF DISCONNECT WE HAVE TO RUN script AGAIN <-
-> sudo apt-get install ppp <-
Thanks for reading Guys. If you have any doubt, please write in the comment below. Keep Learning. Happy codingcheckout more interesting blogs :