Linux under 3G script Dial-up Internet (RPM)

Source: Internet
Author: User
Tags domain name server nameserver

Linux under 3G script dial-up Internet(2010-7-5 13:08)Since it is a dial-up connection, it is impossible to mention the PPP (Point-to-Point Protocol) protocol. The PPP protocol provides a way to transmit datagrams over a serial point-to-point join. It consists of three parts: a serial encapsulated datagram, extending the join control protocol LCP, and a Family network control protocol NCP that is used to establish and configure different network layer protocols. The package scheme is provided by the kernel driver code. PPPD (PPP daemon) provides basic LCP, authentication support, and network control Protocol NCP to establish and configure IP. A PPP session is divided into four steps: Connection creation, Connection quality control, Network layer protocol configuration, connection termination, Password Authentication Protocol (PAP) or Invitation Handshake Authentication Protocol (CHAP) is provided to secure the connection. Use PPP you can put your Linux The PC connects to a PPP server and takes the network resources attached to the server as if you were directly connected to the network. You can also set up your Linux PC as a PPP server so that other computers can dial into your computer and access resources in your area network.

Of course, for our end users, it is an application of the Server/client model. This article mainly discusses how the client dial-up Internet, after all, for desktop users, PPP is an important part of daily life. Here I think everyone may be very easy to use the dial-Up adapter under Windows "Admire", here I do not want to discuss it specifically, Microsoft provided by the TAPI can let every programmer under windows to write a dialer is not a difficult thing, and under Linux? Whether it's wvdial under GNOME or KDE kppp, they're more straightforward and easier to manipulate than pure scripting ppp-on, calling them graphical dial-up scripts, because they end up calling PPPD, a powerful, but poorly-steered program. I've been told that KPPP is similar to the dial-up adapter in Windows, but I'm going to tell you that KPPP's dependence on PPPD programs is greater than KPPP as a standalone dialer, and even the effect of/etc/ppp/options option values on KPPP is negligible.

About the Linux script dialing process: (in fact, can be applied to all the dialing process under Linux, of course, the actual process is not so simple, if interested, please read the source code)

1. Call the chat session program by the PPPD program
2.chat Session Program is responsible for dialing, starting the server-side PPPD program, verifying identity, and then chat session program end
3. The PPPD program continues the work of the chat session program, with the server-side PPPD program to shake hands and establish a PPP connection

The ppp-on script contains the PPPD program, and the Ppp-on-dialer script contains the chat session program, if the PPPD program completes the connection establishment, the connection quality control, the Network layer protocol configuration, the connection terminates, then the chat program completes the Clear text (Textword) verification , you must also configure the Pap-secrets or chap-secrets file in the/ETC/PPP directory if the server side of the dial-in requires Password Authentication Protocol (PAP) or Invitation Handshake Authentication Protocol (CHAP) to secure the connection.

About the configuration of Ppp-on,ppp-on-dialer pure script dialing

A complete ppp-on file is as follows: (the example here and the Ppp-on-dialer file are all based on the 163 train for example)

telephone=163 # Internet phone number provided by ISP
account=163 # account Name
password=163 # Login Password
local_ip=0.0.0.0 # Local IP address, 0.0.0.0 means dynamically assigned by ISP
remote_ip=0.0.0.0 # remote IP address, typically 0.0.0.0
netmask=255.255.255.0 # Subnet Mask
Export Telephone account PASSWORD \
Dialer_script=/etc/ppp/ppp-on-dialer \
EXEC/USR/SBIN/PPPD Lock modem crtscts/dev/ttys0 115200 \
Asyncmap 0 Kdebug 4 \
$LOCAL _ip: $REMOTE _ip noipdefault netmask $NETMASK defaultroute \
Connect $DIALER _script&

This file should be noted in the following areas:
A. Note that "\" indicates the complete end of a line.
B. Try to set the Kdebug level higher, as the level of Kdebug determines the verbosity of the file/var/log/messages.

A complete Ppp-on-dialer file is as follows:

EXEC chat-v \
TIMEOUT 3 \
ABORT ' \nbusy\r ' \
ABORT ' \nno answer\r ' \
ABORT ' \nringing\r\n\r\nringing\r ' \
ABORT ' \nusername/password incorrect\r ' \ This line shortens the authentication time due to incorrect account password
"\rat \"
' Ok-+++\c-ok ' ATH0 \
TIMEOUT 30 \
OK ATDT163 \
sername:--sername:163 \
assword:163 \

Everybody say the above configuration is right? The file configuration is right, but there are a few problems. I would like to do a concrete analysis of the actual problem (premise: Regardless of the outside cat has been installed, check command: echo "echo ATDT 163" >/dev/modem), in the/ETC/PPP directory after typing the./ppp-on command, the following error occurs:

1.TR light, no dial tone.

Workaround:

First check the permissions of the Ppp-on-dialer file, set to chmod 7 Ppp-on-dialer
Then look at the Ppp-on-dialer file, "\" after each line exists
Finally check the last line of the third row OK Atdt$telephone The phone number is set correctly, note that this should be set as the actual phone number, not the variable

2. The following prompt appears in the/var/log/messages file:
21:13:32 Ken pppd[657]: CCP terminated by peer
21:13:32 Ken pppd[657]: Compression disabled by peer.
Or the Connect scripts fail prompt appears (repeated n times are the following tips)

Note: The chat-v representation of the Ppp-on-dialer file is written to the/var/log/messages file through SYSLOGD session information that connects the client to the server side, and if you want to view this session information, type Tail-f/var/log/ Messages or tailf/var/log/messages, this information is useful for correctly configuring a dial-up script file.

Workaround:

First check the account password is correct
Then it may be the chat session itself problem, we look at an example:

Chengdu Tianfu Hotline 163 tips under Minicom:
***********************************************
*quidway A8010 Internet Server
*welcome!!
***********************************************
Please input username:

Please input password:

Chengdu TIANFU Hotline 169 tips under Minicom:
Welcome to Tianfu Online eeying01-11! ***
Login
Password

You may notice that there is something different about it! That is, different dial-up server for account password input different prompts, using the Windows dial-up friends may know, then Windows dial Why does not have this problem, Because this is the chat program itself problem: can not be based on the dial-up server for account password prompt different and send account and password, solution: With minicom to get the correct hint, root hints to modify the last two lines of Ppp-on-dialer file configuration, here to Chengdu Tianfu Hotline 163 , 169 tips under Minicom for example:

163:
sername:--sername:163 \
assword:163 \

169:
Ogin:--ogin:liujien \
Assword:liujien \

That's it, no, here's the configuration also according to your ISP requirements (hint), with minicom n times to get the correct hint, but you also risked your ISP to change the account password hint risk, so I advise you to abandon chat session program it. Because Kppp,wvdial does not have this problem. Chat session program is force, and wvdial, KPPP is guess. With this problem I read the ppp-2.4.1 source documentation, in fact, the author has been in the ppp-2.3.11 version has provided plugins passprompt ( Note: ppp-2.3.10 version has been provided plug-in support, everyone with redhat6.2 own ppp-2.3.11 RPM package, as for the plug-in general of the domestic Linux Web site provided by the PPP source code package is attached with), This plugin provides a call to a third-party program to send an account password to your ISP. The English language of the relevant content is as follows:

A new ' passprompt ' plugin is included, thanks to Alan Curry, which makes it possible in PPPD to call an external program To get the PAP password to send to the peer.

So how do you use this plugin? Compile the passprompt.c file in the directory containing the pppd.h header file
Gcc-c-O passprompt.c
Gcc-shared-o PASSPROMPT.O
You can get a passprompt.so shared link file, copy it to the/etc/ppp/plugins directory, modify the/etc/ppp/options file, add a row plugin/etc/ppp/plugins/ Passprompt.so, then you can modify the ppp-on file will dialer_script point to the script file you want to specify, can be programmed or online to download a third-party program.
I give you a simple way, you can install the wvdial dialer, and then under Gnome to configure the/etc/wvdial.conf file, under the/ETC/PPP directory to create a new script, named Wvdial, the content is as follows Wvdial 163 ( 163 is the phone number you want to dial), then chmod 7 wvdial, modify the ppp-on file, such as: dialer_script=/etc/ppp/wvdial \

3. The client has been given an IP address (to be seen with the ifconfig command), the Web page can not be browsed through the domain name, through the IP address.

Workaround:
General method: To check the ISP to provide you with the manual, get the IP address of the domain name server, modify the/etc/resolv.conf file as follows: NameServer 61.139.2.69 (I take Chengdu 163 as an example), you can also use the ipconfig under Windows The all command also gets the DNS server address because the Windows dialer is set by default to automatically obtain the DNS server address.

The way the software authors provide us:
What is new in ppp-2.3.6.
**************************
Added new option ' Usepeerdns ', thanks to Nick Walker <[email protected]>. If the peer supplies DNS addresses, these'll be written to/etc/ppp/resolv.conf. The ip-up script can then is used to add these addresses to/etc/resolv.conf if desired (see the Ip-up.local.add and ip-do Wn.local.add files in the scripts directory).

The software author provides an option similar to Windows dialer in version ppp-2.3.6: Usepeerdns, if your ISP provides a DNS server address, it will be in the/etc/ppp/resolv.conf file and/etc/ The primary name server address and secondary name server address are written in the resolv.conf file as follows:
NameServer 61.139.2.69
NameServer 202.103.4.5
How to: Modify the/etc/ppp/options file to add a line of "Usepeerdns"

Postscript:
In the author's opinion here, the Linux script dial-up Internet does not make much in-depth discussion, It just revolves around a few common issues and provides a relatively simple solution. I hope you can read some of the software authors to provide us with the English documentation, because some of the domestic information is too old, do not have the patience to read the man pages, they are very useful, But it's a good idea to read some of the website's articles. If you have a different view of my article, please write to me, thank you.

Linux under 3G script Dial-up Internet (RPM)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.