Use CDMAmodem for dial-up Internet access in Linux

Source: Internet
Author: User
Article title: use CDMAmodem to dial up the Internet in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

This article describes how to use a CDMA modem to implement dial-up Internet access in Linux. First, you need to have a preliminary understanding of the PPP protocol. for example, you should at least know what the LCP and NCP are and what the PAP and CHAP are. second, you may need to install pppd and chat tools. These two tools are installed by default in the system. If pppd is not installed, download the latest version at http://ppp.samba.org. The pppd version used by the author in this article is 2.4.1, and the chat version is 1.22.

This article uses the China Unicom mobile broadband subscription 2G traffic CDMA network card. The dialing number required for the connection is #777, the user name is card, and the password is also card. The connection server name is pdsn.

In Linux, all ppp-related configuration files are in the/etc/ppp/directory. The/etc/ppp/pap-secrets file stores the user name and password required for the PAP authentication protocol, the/etc/ppp/chap-secrets file stores the username and password required by the CHAP authentication protocol. According to the preceding instructions, the content of the two files is as follows:

File/etc/ppp/pap-secrets (the last line is manually added by the author ):

#/Etc/ppp/pap-secrets

# Secrets for authentication using PAP

# Client server secret IP addresses

####### Redhat-config-network will overwrite this part !!! (Begin )##########

####### Redhat-config-network will overwrite this part !!! (End )############

Card pdsn card

File/etc/ppp/chap-secrets (the last line is manually added by the author ):

#/Etc/ppp/chap-secrets

# Secrets for authentication using CHAP

# Client server secret IP addresses

####### Redhat-config-network will overwrite this part !!! (Begin )##########

####### Redhat-config-network will overwrite this part !!! (End )############

Card pdsn card

When the server requires pppd to provide user authentication information, if the negotiation adopts the PAP authentication method, pppd will obtain the user password in the/etc/ppp/pap-secrets file; if CHAP authentication is adopted, pppd obtains the user password in the/etc/ppp/chap-secrets file.

In the/etc/ppp/peers/directory, it is the option file required for each pppd connection. each file corresponds to a connection and does not interfere with each other. In this article, a unicom file is created under the/etc/ppp/peers/directory, and its content is as follows:

#/Etc/ppp/peers/unicom

# This is ppp script for use chinaunicom's CDMA data service

#

TtyS0

115200

Crtscts

Connect '/usr/sbin/chat-v-f/etc/ppp/chat/unicom'

Debug

Nodetach

Ipcp-accept-local

Ipcp-accept-remote

Defaultroute

User card

Here, we will explain the pppd options:

L ttyS0 indicates that the CDMA modem is connected to the serial port/dev/ttyS0;

L 115200 indicates the serial port baud rate;

L crtscts indicates the use of modem's rts and cts signal lines for traffic control;

L connect '/usr/sbin/chat-v-f/etc/ppp/chat/unicom' indicates that the chat program is used to complete the session creation process, the session is controlled through the/etc/ppp/chat/unicom file.

L debug indicates that pppd works in debugging mode

L nodetach: do not convert pppd to background process after startup

L ipcp-accept-local indicates that the local IP address assigned by the server is accepted.

L ipcp-accept-remote indicates accepting the server IP address specified by the server

L defaultroute indicates that the server IP address specified by the server is used as the default route

L user card indicates that the user during authentication is card. pppd then obtains the password of the card user from the/etc/ppp/pap-secrets or/etc/ppp/chap-secrets file.

The above is the description of/etc/ppp/peers/unicom. In addition, the last file required is/etc/ppp/chat/unicom, which is used to tell the chat program how to complete the connection establishment process. The file content is as follows:

#/Etc/ppp/chat/unicom

# This is the chat script for unicom

ABORT "no carrier"

ABORT "no dialtone"

ABORT "ERROR"

ABORT "no answer"

ABORT "BUSY"

TIMEOUT 120

""

Okay atdt #777

CONNECT

Several ABORT lines mean that if the modem returns information such as BUSY, the chat process is canceled and the connection fails. TIMEOUT 120 indicates that the connection TIMEOUT value is 120 seconds. Issue an at command first, expect the modem to return an OK, then dial #777, expect the modem to return CONNECT. if the modem returns CONNECT, the connection is established successfully.

The preceding figure shows the four files required for dialing. Use the following command to dial:

# Pppd call unicom

If the dial is successful, a new network interface ppp0 is generated. The server will automatically assign an IP address to ppp0. Then, you can access the Internet through this connection.

Note: The author tries to obtain larger bandwidth through Multilink PPP, but it seems that China Unicom does not support this function.

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.