#
# If the ppp0 PID file is present then the program is running. Stop it.
If [-r/var/run/$ device. pid]; then
Kill-int 'cat/var/run/$ device. Pi'
#
# If the kill did not work then there is no process running for this
# PID. It may also mean that the lock file will be left. You may wish
# To delete the lock file at the same time.
If [! "$? "=" 0 "]; then
Rm-F/var/run/$ device. PID
Echo "error: removed stale PID file"
Exit 1
Fi
#
# Success. Let pppd clean up its own junk.
Echo "PPP link to $ device terminated ."
Exit 0
Fi
#
# The PPP process is not running for ppp0
Echo "error: PPP link is not active on $ device"
Exit 1
After completing the preceding configuration, enter the pppd call GPRS command. Note that if your GPRS file is not in the/etc/PPP/peers/directory, give the annotation path to pppd [root @ localhost ppp_scripts] # pppd call GPRS
Timeout set to 15 seconds
Abort on (/nbusy/R)
Abort on (/Nno answer/R)
Abort on (/nringing/R/n/R/nringing/R)
Timeout set to 40 seconds
Send (^ mat ^ m)
CT (OK)
^ M
OK
-- Got itsend (ats0 = 0 ^ m)
CT (OK)
^ M
At ^ m
OK
-- Got itsend (ate0v1 ^ m)
CT (OK)
^ M
^ M
OK
-- Got itsend (at + cgdcont = 1, "ip", "cmnet" ^ m)
CT (OK)
^ M
Ats0 = 0 ^ m
OK
-- Got itsend (atdt * 99 *** 1 # ^ m)
Secondary CT (CONNECT)
^ M
^ M
OK ^ m
Ate0v1 ^ m
OK ^ m
^ M
OK ^ m
^ M
OK ^ m
^ M
OK ^ m
^ M
Connect
-- Got itsend (^ m)
Serial Connection established.
Using Channel 20
Using interface ppp0
Connect: ppp0 <-->/dev/ttys0
Warning-secret file/etc/PPP/PAP-secrets has world and/or group access
Sent [LCP confreq id = 0x1 <asyncmap 0x0> <magic 0x60eeae90> <pcomp> <accomp>]
Rcvd [LCP confrej id = 0x1 <magic 0x60eeae90>]
Sent [LCP confreq id = 0x2 <asyncmap 0x0> <pcomp> <accomp>]
Rcvd [LCP confack id = 0x2 <asyncmap 0x0> <pcomp> <accomp>]
Rcvd [LCP confreq id = 0x1 <asyncmap 0x0> <auth chap MD5> <pcomp> <accomp>]
Sent [LCP confack id = 0x1 <asyncmap 0x0> <auth chap MD5> <pcomp> <accomp>]
Rcvd [chap challenge id = 0x1 <strong>, name = ""]
Warning-secret file/etc/PPP/chap-secrets has world and/or group access
Sent [chap response id = 0x1 <da093b418f6931ac976e9481ce6f49c4>, name = "smsong"]
Rcvd [chap success id = 0x1 ""]
CHAP authentication succeeded
CHAP authentication succeeded
Sent [CCP confreq id = 0x1 <deflate 15> <deflate (old #) 15>]
Sent [ipcp confreq id = 0x1 <compress VJ 0f 01> <ADDR 0.0.0.0> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
Rcvd [LCP protrej id = 0x1 80 FD 01 01 00 0C 1A 04 78 00 18 04 78 00]
Protocol-reject for 'Compression control Protocol' (0x80fd) unbound ed
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-dns3 0.0.0.0>]
Rcvd [ipcp confreq id = 0x2]
Sent [ipcp confack id = 0x2]
Rcvd [ipcp confnak id = 0x2 <ADDR 10.144.202.159> <ms-dns1 211.138.200.69> <ms-dns3 211.103.13.101>]
Sent [ipcp confreq id = 0x3 <ADDR 10.144.202.159> <ms-dns1 211.138.200.69> <ms-dns3 211.103.13.101>]
Rcvd [ipcp confack id = 0x3 <ADDR 10.144.202.159> <ms-dns1 211.138.200.69> <ms-dns3 211.103.13.101>]
Cocould not determine remote IP Address: defaulting to 10.64.64.64
Local IP address 10.144.202.159
Remote IP address 10.64.64.64
Primary DNS address 211.138.200.69
Secondary DNS address 211.103.13.101
Script/etc/PPP/IP-up started (PID 4578)
Script/etc/PPP/IP-up finished (PID 4578), status = 0x0 use Ctrl + C to disconnect, in this case, it is generally not good to test whether the connection is established (there is only one reason why the console cannot be developed). You can remove the nodetach parameter from the/etc/PPP/peers/GPRS file and use Ping, you need to disable eth0, which is the network port, so that Ping can use the ppp0 port to find a route to connect to the Internet.
++ ++ ++
Run the tail-F/var/log/messages command to view the log: Mar 20 20:55:55 localhost pppd [4557]: pppd 2.4.4 started by root, UID 0
Mar 20 20:55:56 localhost chat [4558]: timeout set to 15 seconds
Mar 20 20:55:56 localhost chat [4558]: Abort on (/nbusy/R)
Mar 20 20:55:56 localhost chat [4558]: Abort on (/Nno answer/R)
Mar 20 20:55:56 localhost chat [4558]: Abort on (/nringing/R/n/R/nringing/R)
Mar 20 20:55:56 localhost chat [4558]: timeout set to 40 seconds
Mar 20 20:55:56 localhost chat [4558]: Send (^ mat ^ m)
Mar 20 20:55:56 localhost chat [4558]: Wrong CT (OK)
Mar 20 20:55:56 localhost chat [4558]: ^ m
Mar 20 20:55:56 localhost chat [4558]: OK
Mar 20 20:55:56 localhost chat [4558]: -- Got it
Mar 20 20:55:56 localhost chat [4558]: Send (ats0 = 0 ^ m)
Mar 20 20:55:56 localhost chat [4558]: Wrong CT (OK)
Mar 20 20:55:56 localhost chat [4558]: ^ m
Mar 20 20:55:56 localhost chat [4558]: At ^ m
Mar 20 20:55:56 localhost chat [4558]: OK
Mar 20 20:55:56 localhost chat [4558]: -- Got it
Mar 20 20:55:56 localhost chat [4558]: Send (ate0v1 ^ m)
Mar 20 20:55:56 localhost chat [4558]: Wrong CT (OK)
Mar 20 20:55:56 localhost chat [4558]: ^ m
Mar 20 20:55:56 localhost chat [4558]: ^ m
Mar 20 20:55:56 localhost chat [4558]: OK
Mar 20 20:55:56 localhost chat [4558]: -- Got it
Mar 20 20:55:56 localhost chat [4558]: Send (at + cgdcont = 1, "ip", "cmnet" ^ m)
Mar 20 20:55:57 localhost chat [4558]: Wrong CT (OK)
Mar 20 20:55:57 localhost chat [4558]: ^ m
Mar 20 20:55:57 localhost chat [4558]: ats0 = 0 ^ m
Mar 20 20:55:57 localhost chat [4558]: OK
Mar 20 20:55:57 localhost chat [4558]: -- Got it
Mar 20 20:55:57 localhost chat [4558]: Send (atdt * 99 *** 1 # ^ m)
Mar 20 20:55:57 localhost chat [4558]: Round CT (CONNECT)
Mar 20 20:55:57 localhost chat [4558]: ^ m
Mar 20 20:55:57 localhost chat [4558]: ^ m
Mar 20 20:55:57 localhost chat [4558]: OK ^ m
Mar 20 20:55:57 localhost chat [4558]: ate0v1 ^ m
Mar 20 20:55:57 localhost chat [4558]: OK ^ m
Mar 20 20:55:57 localhost chat [4558]: ^ m
Mar 20 20:55:57 localhost chat [4558]: OK ^ m
Mar 20 20:55:57 localhost chat [4558]: ^ m
Mar 20 20:55:57 localhost chat [4558]: OK ^ m
Mar 20 20:55:57 localhost chat [4558]: ^ m
Mar 20 20:55:57 localhost chat [4558]: OK ^ m
Mar 20 20:55:57 localhost chat [4558]: ^ m
Mar 20 20:55:57 localhost chat [4558]: connect
Mar 20 20:55:57 localhost chat [4558]: -- Got it
Mar 20 20:55:57 localhost chat [4558]: Send (^ m)
Mar 20 20:55:57 localhost pppd [4557]: Serial Connection established.
Mar 20 20:55:57 localhost pppd [4557]: Using interface ppp0
Mar 20 20:55:57 localhost pppd [4557]: CONNECT: ppp0 <-->/dev/ttys0
Mar 20 20:55:58 localhost pppd [4557]: Warning-secret file/etc/PPP/PAP-secrets has world and/or group access
Mar 20 20:56:00 localhost pppd [4557]: Warning-secret file/etc/PPP/chap-secrets has world and/or group access
Mar 20 20:56:00 localhost pppd [4557]: CHAP authentication succeeded
Mar 20 20:56:00 localhost pppd [4557]: CHAP authentication succeeded
Mar 20 20:56:01 localhost kernel: PPP deflate compression module registered
Mar 20 20:56:02 localhost pppd [4557]: cocould not determine remote IP Address: defaulting to 10.64.64.64
Mar 20 20:56:02 localhost pppd [4557]: local IP address 10.144.202.159
Mar 20 20:56:02 localhost pppd [4557]: remote IP address 10.64.64.64
Mar 20 20:56:02 localhost pppd [4557]: primary DNS address 211.138.200.69
Mar 20 20:56:02 localhost pppd [4557]: secondary DNS address 211.103.13.101 ++ ++ ++
[Root @ localhost ~] # Ifconfig
Eth0 link encap: Ethernet hwaddr 00: 0a: EB: 91: 3B: C4
Up broadcast multicast MTU: 1500 Metric: 1
RX packets: 0 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 0 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 1000
RX Bytes: 0 (0.0 B) TX Bytes: 0 (0.0 B)
Interrupt: 209 base address: 0x4000lo link encap: local loopback
Inet ADDR: 127.0.0.1 mask: 255.0.0.0
Inet6 ADDR: 1/128 scope: Host
Up loopback running MTU: 16436 Metric: 1
RX packets: 1240 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 1240 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX Bytes: 2039094 (1.9 MIB) TX Bytes: 2039094 (1.9 MIB) ppp0 link encap: Point-to-Point Protocol
Inet ADDR: 10.144.202.159 p-t-P: 10.64.64.64 mask: 255.255.255.255
Up pointopoint running noarp multicast MTU: 1500 Metric: 1
RX packets: 5 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 6 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 3
RX Bytes: 62 (62.0 B) TX Bytes: 98 (98.0 B) [root @ localhost ~] # Ifconfig eth0 down
Disable the Ethernet interface eth0 so that it does not conflict with the route used by the ppp0 Interface
[Root @ localhost ~] # Ping 211.136.0000203
Ping 211.136.0000203 (211.136.0000203) 56 (84) bytes of data.
64 bytes from 211.136.0000203: icmp_seq = 1 TTL = 247 time = 3379 MS
64 bytes from 211.136.0000203: icmp_seq = 2 TTL = 247 time = 2388 MS
64 bytes from 211.136.0000203: icmp_seq = 3 TTL = 247 time = 2892 MS
64 bytes from 211.136.0000203: icmp_seq = 4 TTL = 247 time = 1952 MS
64 bytes from 211.136.0000203: icmp_seq = 5 TTL = 247 time = 1692 MS
64 bytes from 211.136.0000203: icmp_seq = 6 TTL = 247 time = 2112 MS
64 bytes from 211.136.0000203: icmp_seq = 7 TTL = 247 time = 1492 MS
64 bytes from 211.136.20.203: icmp_seq = 8 TTL = 247 time = 1472 Ms --- 211.136.20.203 Ping statistics ---
9 packets transmitted, 8 received, 11% packet loss, time 7999 Ms
RTT min/AVG/max/mdev = 1472.094/2172.525/3379.568/638.150 MS, pipe 4 at this time if you can only ping pure IP addresses, rather than domain name resolution, in this case, you may need to set/etc/PPP/resolv. conf (the content is replaced by the new DNS). Copy the content to/etc/resolv. to/etc/resolv. conf. In this way, you can ping the domain name and open the webpage in the browser. [Root @ localhost ~] # Ping www.linuxidc.net
Ping www.6688.cc (202.108.22.5) 56 (84) bytes of data.
64 bytes from 202.108.22.5: icmp_seq = 1 TTL = 50 time = 3142 MS
64 bytes from 202.108.22.5: icmp_seq = 2 TTL = 50 time = 3348 MS
64 bytes from 202.108.22.5: icmp_seq = 3 TTL = 50 time = 2796 MS
64 bytes from 202.108.22.5: icmp_seq = 4 TTL = 50 time = 3632 MS
64 bytes from 202.108.22.5: icmp_seq = 5 TTL = 50 time = 1936 MS
64 bytes from 202.108.22.5: icmp_seq = 7 TTL = 50 time = 909 MS
64 bytes from 202.108.22.5: icmp_seq = 6 TTL = 50 time = 1951 MS
64 bytes from 202.108.22.5: icmp_seq = 8 TTL = 50 time = 2839 MS
64 bytes from 202.108.22.5: icmp_seq = 9 TTL = 50 time = 1984 MS
64 bytes from 202.108.22.5: icmp_seq = 10 TTL = 50 time = 2404 MS
64 bytes from 202.108.22.5: icmp_seq = 11 TTL = 50 time = 1417 Ms --- www.6688.cc Ping statistics ---
12 packets transmitted, 11 received, 8% packet loss, time 13806 Ms
RTT min/AVG/max/mdev = 909.082/2396.720/3632.981/803.194 MS, pipe 4
++ ++
In addition, if you want to enable automatic dial-up on the Internet when you are on the machine, you only need to start the script on your own boot (My Development Board is/etc/init. d/RC, which has several types in the PC, such as:/etc/rc. local file to link to CD/etc/rcN. d, n select to see the running level), add the following statement, note that the executable program in this script must provide the correct path, because it is just starting, the environment variables of the entire machine have not been set. Also, do not add the new command after it becomes a background process. It will be executed cyclically and will cause errors! The following shell statements are added:
/Etc/PPP/rmlock # simply identify and delete the lock file of an invalid serial port to ensure successful dialing
/Usr/bin/pppd call GPRS # automatic dialing
/Usr/bin/sleep 20 # Set the dialing time for 20 s to check whether your module is successfully dialed.
/Bin/qtopia & # This is in the original script, and it is arranged in this order to enable the QT interface # after it is activated, it is nice that GPRS dialing has already created a number, then you can access the Internet.
/Sbin/ifconfig eth0 down # disable eth0 network port by default when starting the instance. Note: rmlock File
#/Etc/PPP/rmlock File
#! /Bin/sh
If [-F/var/lock/LCK .. s3c2410_serial1]; then
/Bin/Rm-F/var/lock/LCK .. s3c2410_serial1
Fi
How to solve pppd running segment errors:
When you manually interrupt the PPP link too many times, a segment error may occur during pppd operation, the suggestion from Debian bug report solves this problem. it is pretty straightforward: simply delete/var/run/pppd. TDB file (in my system, it is/var/run/pppd2.tdb ). conclusion: One of the dial-up methods is selected based on your environment and preferences. When the wvdial method is transplanted to the arm Development Board, there are many errors during cross-compilation. You can try it and it is relatively troublesome, other operations require the support of the wvstreams library, which occupies a large space. In 2nd, the method is the most commonly used, but the error is more likely because it is more flexible. In 3rd, the method is similar to in 2nd. When an error occurs, you can search for the same error on Google. Refer to and modify your own parameters, and try again. You only need to stick to the problem! At that time, you had no time to learn about the internal dialing mechanism of PPP. We recommend that you use Windows to encapsulate it well. Stable and reliable! Good luck to PPP & Linux dialing friends!