The modem dial-up Internet __linux under Linux

Source: Internet
Author: User
Tags domain name server nameserver

Modem dial-up Internet in Linux

In the broadband access has not come into the tens of thousands of households, we have to connect to the Internet, or to drive the "cat", so for many netizens, modem is a very lovely thing. Windows provides a good support for modem, making it easy to install modems. But it's not so good to install this lovely thing under Linux.

First, recognize the modem
As we all know, the computer is dealing with digital information, while the telephone line is analog information, and modem is used to do the conversion between digital information and analog information.
When the computer is going to transmit the information, the modem will modulate it into an analog signal and transmit it through the telephone line.
When the information is transmitted over the telephone line to the computer, the modem transmits it from the analog signal to the digital information, so that it can be passed to the computer for recognition.
From here it should be easy to understand its scientific name: "Modem".
Modem is a variety of things, we together to clarify these "types":
1. According to the speed of the modem classification:
That is, the speed of modem modulation, we use unit bps to measure. The full name of BPS is the bit per second, which means how many bits a second.
The first 2400bps, later developed to 9600bps, 14.4Kbps, 28.8Kbps, 33.6Kbps, 56Kbps.
Do you remember, usually we use a 33.6Kbps modem download, the maximum transmission speed per second is about 4 K, perhaps we will have some doubts about this speed. In fact, the problem is very simple, this 4 K represents 4K Byte, and 33.6Kbps is 33.6K bit,1byte=8bit.
2. According to the shape of the classification:
1 external modem, also known as the outer cat
This modem's shape is a small box, which connects to the computer through a serial port.
2 built-in modem, also known as the inside of the cat
The modem is shaped like a video card, sound card, network card, and is used in the computer board's ISA slot or PCI slot.
3. According to the principle of implementation:
1 hard cat: As the name suggests, use the hardware circuit to realize the modem;
2 soft Cat: With the increase of CPU speed, using software to simulate the CPU into modem DSP. Using this modem, you need software support. This software support is provided in Windows, so soft cats are often called win cats, which are characterized by cheap but resource-intensive. I believe that the price of hard cats has been very low, the use of this soft cat does not make any sense.

second, Linux to the modem support
First, let's take a look at Linux's support for modems:
1. Linux support for soft cats is limited, my advice is you do not buy a soft cat such things. If you really need to drive this soft cat, see part eighth of this article: drive a soft cat.
2. For the external modem, can be described as the simplest configuration of equipment, just insert a serial port, and then the serial port for the corresponding configuration will be used.
3. For the built-in modem, but also through the serial port for use, but some of the built-in modem is not known by Linux (after all, is inserted in the motherboard, is a virtual way to use the serial port), we will be in the Part VII: drive inside the cat description.
4. In Linux, the speed of the modem does not affect Linux support.
In a word: Using the modem in Linux is done through a serial port. As long as the system can find this serial port, it can communicate through the serial port. Therefore, the idea of driving modem is:
1 The external modem and the built-in modem that can be identified by Linux system, simply use the serial port to operate on it;
2 for the built-in modem that Linux can't recognize, we have to find a way to get it to be recognized by the Linux system before we can use the 1th method.

third, the serial port under Linux
Under Linux, all devices are represented as a file form, and the operation of the device is the same as the operation of the file. All the files that represent the device are stored in the "/dev" directory.
Serial ports are no exception, but in particular, each serial port corresponds to not just one file but two. One is for the pull, and the other is for pull-out.
1 The device file name used to unplug is ttysx, where the last X is a number, numbered from 0, and the corresponding DOS serial port name is:
DOS under the name Linux under the name
Com1/dev/ttys0
Com2/dev/ttys1
Com3/dev/ttys2
Com4/dev/ttys3
...... ......
2 and the device used to unplug the file is Caux, where the last X is also a number, but also from the beginning of the 0 number, and the DOS serial port name of the corresponding relationship is:
DOS under the name Linux under the name
Com1/dev/cau0
Com2/dev/cau1
Com3/dev/cau2
Com4/dev/cau3
...... ......
However, many Linux distributions now seem to have no distinction between pull-and-pull, and are uniformly used by ttysx names. If you cannot find Ttysx in your system's/dev directory, you will need to create it yourself manually, such as:
# Cd/dev
#./makedev ttyS0
Each serial port needs to use IRQ and I/O address resources, generally COM1 and COM3 share IRQ3, and COM2 and COM4 are shared IRQ4 (as shown in the following table):
Serial Port IRQ I/O address
/dev/cau0,/DEV/TTYS0 4 0x3f8
/DEV/CAU1,/dev/ttys1 3 0x2f8
/DEV/CAU2,/dev/ttys2 4 0x3e8
/DEV/CAU3,/DEV/TTYS3 3 0x2e8
Typically, in a Linux system, each device needs to have a unique IRQ number, which means that if there are three serial devices, the idle IRQ interrupt must be taken over. For example:
/SBIN/SETSERIAL/DEV/TTYS0 IRQ 3 (followed by mouse on COM1 port, interrupt number 3)
/SBIN/SETSERIAL/DEV/TTYS1 IRQ 4 (followed by a modem on the COM2 port, interrupt number 4)
/SBIN/SETSERIAL/DEV/TTYS2 IRQ 5 (there is also a modem on the COM3 port, and IRQ3 is already occupied and therefore has to use the idle IRQ5)
All we need to do is put these commands in the/etc/rc.d/rc.local file, so that we can make sure that the settings are complete each time Linux is started.
We can use two simple commands to see if there is a conflict between an IRQ and an I/O address:
Cat/proc/interrupts View IRQ Interrupt number
Cat/proc/ioports View I/O address

Four, the use of the modem dial number online
Typically, we connect to the Internet by dialing the dialing service phone number provided by the ISP from the modem, and the entire process is:
1. Prepare the appropriate software
There are chat and PPPD for the client to dial the Internet, and if you do not have these two programs on your machine, install them, which are included in the PPP package (such as ppp-2.3.7-2.i386.rpm).
The purpose of the chat program is to dial and wait for the prompt to enter login information such as user name and password as prompted. The purpose of the PPPD is to establish and maintain a PPP connection to the server and transmit the data.
In addition, for the convenience of testing, we also need a software called minicom. However, these software are usually installed when installing Linux systems.
2. Use minicom test dial number
We can use minicom software to test whether the modem is working properly.
1 first log into the system as root, and then run the command: Minicom-s. This will start the configuration interface for a text dialog box. In this configuration interface, we can use the UP and DOWN ARROW keys to select from the menu, with the ENTER key to select the command.
2 The key to testing the modem is to set the serial port. We hereby select serial Prot Setup to enter the serial port configuration menu. If you need to modify the items here, just press the corresponding letter key.
3 First we should set the serial device (select a serial Device). At this point, change the location to the appropriate device file, for example, if the modem is connected to the 2nd serial port. You want to set it to/dev/ttys1 because minicom is used for the output connection. However, because the minicom defaults to use/dev/modem to identify the modem, you can then execute the command: Ln/dev/ttys1/dev/modem. This will save a lot of trouble.
4) Then we require the device modem parameter (select E bps/par/bits) according to the connected system, where the setting includes rate (BPS), parity bit (Par), data bit and stop bit (bits). The speed device is the highest connection speed of modem, which can usually be 4 times times faster than modem. For example, for a 1.44kbPs modem, you should choose 57.6kbps. For a 28.8kbps modem. 115.2kbps should be selected. For data bit settings, there is usually no parity, 8 data bits, and a stop bit. For example: 38400 8N1.
5) after completion. Press ENTER to return to the serial Port Setup menu and then to the ENTER key to return to the main menu. With this information, you can test your modem. Select the Save Setup as df1 to save the configuration as the default configuration. Then select Exit to exit the installation interface.
6 Open the Minicom program, if the OK prompts, the modem settings are correct to start working properly.
7) You can enter ' at ' and press ENTER to test. At this point, return to OK information. If all goes well, you can start dialing. See if the normal access. Enter "ATD163". At this point, you should hear the connected sound, and then see the connection information and the remote system Information prompt:
ATD163
CONNECT 115200
At this point, it means that your modem is ready to use.
8) Finally press Ctrl+a,q exit minicom.
3. Set DNS domain name resolution
In Linux, to set the DNS domain name, you need to edit the configuration file/etc/resolv.conf, and then add a line:
NameServer xxx.xxx.xxx.xxx (eg: nameserver 202.101.103.55)
Where the IP address is the IP address of the domain name server provided by the ISP.
4. Manually dial the number on the Internet
Below, we manually complete the dial-up online work on the command line:
1 First, run minicom, and then enter Ctrl-a, and then knock D, there will be a dial interface, select Manual (Manual), and enter the ISP's phone number, the modem after a burst of noise, there will be several music rang, and on the screen prompted to press any key to continue.
2 Then, the screen will appear your ISP information, according to the prompts to enter your username and password, (may also ask you to choose a PPP connection or a SLIP connection, etc.) if successful, there will be some junk characters.
3 At this time, enter CTRL + A and then press Q, Exit minicom.
Notice, not by X, that will disconnect the dial number
4) We then use PPPD to establish a PPP connection, which is to execute the command:
PPPD Debug Lock Modem crtscts defaultroute/dev/ttys1 115200&
Command Description:
DEUBG make it record the relevant debugging information in the/var/log/messages;
Lock lock serial Port device
Modem instruction uses modem's control signal
Crtscts instructions using hardware data flow control
Defaultroute adds a default route to the native routing table
/DEV/TTYS1 indicates the port where Modme is located
115200 description of the serial port rate
& indicates that it runs in the background.
After a while, the PPP connection is established, and you can try:
A. Run ifconfig, you will see Ppp0 network interface, this interface IP address is to the end of the server assigned to you IP address;
B. Run route, you will find the IP address of the End-to-end server is added to the routing table;
C.ping a remote host, should be able to connect.
You can also run on another Virtual console:
Tail-f/var/log/messages
At this point, you can observe the dynamic PPPD log information.
4 If you want to disconnect this connection, simply execute the command:
Killall PPPD
5. Through the script program automatically dial the number of Internet
After the PPP package is installed, the/ETC/PPP and/usr/doc/ppp-x.x.x (where x.x.x is the version number) are generated with two directories, PPPD configuration files are stored in the/ETC/PPP directory, and/usr/doc/ ppp-x.x.x contains documentation for the PPPD, which has a subdirectory named scripts, which has several useful files:
& #61607; Ppp-on-dialer: A script that is responsible for unplugging the phone and entering the required login information (the work we accomplished at that time through minicom);
& #61607; Ppp-on: Responsible for starting the local PPPD, and server-side PPPD dialogue to achieve end-to-end connection;
& #61607; Ppp-off: A script that is responsible for disconnecting the connection.
Below, we use them to simplify our dial-up Internet work:
1) First, copy them into the/ETC/PPP directory;
2 Edit ppp-on file, the following parts according to your actual situation to modify:
telephone=8163
account=8163

password=8163
Dialer_script=/etc/ppp/ppp-on-dialer
EXEC/USR/SBIN/PPPD Debug Lock Modem crtscts/dev/ttys0 38400
Note: These contents are in the Ppp-on file, not new, but modify its value.
3 Modify the Ppp-on-dialer file, the following parts according to the actual situation of your ISP to make the appropriate changes:
Username: $ACCOUNT
Assword: $PASSWORD
"Select (1~3):" 1
Note: ":" The content on the left is to dial the number will ask you, the right is the corresponding answer. That's what we'll see when we use minicom to do the test dial number.
4 give executable permission to three scripts, which is to execute the command:
chmod +x ppp-on Ppp-on-dialer Ppp-off
5 To this end, we can perform/etc/ppp-on to complete the dial-up Internet, perform/etc/ppp-off disconnect from the network.

v. Use KPPP software to complete the dial-up Internet
For Windows users who are accustomed to using graphical interfaces, these obscure command-line operations can scare away a whole bunch of people, don't worry, now we introduce a graphical dial-up software KPPP, as long as you install KDE, you can use this software. Use it to dial the Internet is very simple:
1 run KPPP: As shown in the following figure, first click the "K" button, select the Internet, and then select KPPP:

2) Click the Setup button on the KPPP panel and the following image will appear:

First, we click on the "New ..." button to set the accounts;

3) Next, we choose "Device" to make the appropriate settings:

4 after the setup is complete, press OK button to exit, return KPPP main screen:

5 fill in login ID and password, and then press the Connect button, you can start dialing, the number is successful, will appear on the taskbar a modem-like small icon, as in Windows network Connection diagram. Let's start surfing.

six, drive inside the cat
For most internal cats, the Linux system is able to identify itself, and that's all it takes to use it in the previous way. And if your Linux doesn't recognize it, it needs to be recognized by the Linux system. There are usually two ways to do this:
1. For some Plug and Play devices, we can use the Isapnptools tool to solve this problem:
1 First log in as root user, then run command/sbin/pnpdump >/etc/isapnp.conf, write all Plug and Play device information on your machine to file/etc/isapnp.conf.
2 Next you need to assign IRQ and I/O resources for this device:
A. View its resources in Windows based on the device, which, of course, will have Windows installed on your computer;
B. Or you can allocate resources for them, as long as there is no conflict. (Resources allocated can be found from/proc/interrupts,/proc/ioports,/PROC/DMA)
3 and then find the device you want to drive from the isapnp.conf, then remove the annotation number "#" in front of them, and fill in their int (IRQ), IO (IO address) and DMA.
4 after the setup is complete, we can then execute the following command to drive the device:
/sbin/isapnp/etc/isapnp.conf
5 If the command does not make a mistake, it will print out the relevant hardware information on the screen, you can only write the command written to/etc/rc.d/rc.local to make every time you start Linux, automatically drive the device.
2. If you can find the driver for this type of cat, you can also use the method of installing the driver. In this way, the approximate steps are as follows:
1 Download driver package;
2 Extract the driver package, and then run make, complete the compilation;
3) using Insmod to add the driver module to the kernel;
4) Then create a device in the/dev directory, which commands the following:
Cd/dev
Mknod Drive Module name C 127 1
5 Then create a symbolic link named modem that points to the device you just created;
6 In this way, we can use the previous method to operate the modem.
Because of different modem, driver is different, so can not be a fine solution, can only be installed ideas sorted out for your reference.

Seven, drive the soft cat
Because the manufacturers of soft cats are unwilling to disclose the technology of soft cats, they are unwilling to develop drivers other than win9x/nt. Linux is therefore very limited in its support.
If your modem box is marked "HCF", "Winmodem" or "soft MODEM" words, it is likely to be a soft cat. If you want to use it under Linux, you must go to www.linmodems.org to see it. There are some soft cat drivers in the Web site that currently support Cirrus Logic (CL-MD5620DT), Conexant (Rockwell) HSF, ESS Es56t-pi, Modems (PCI), Lucent LT Winmodem, Pc Tel and other chips for the soft cat driver.
Below I take CL-MD5620DT for example (other brand similar), explained the soft cat's drive method, hoped has some guidance and the reference to the soft cat user.
1. Download its driver Clmodem-0.3.0+gg.tar from www.linmodems.org;
2. Perform the following command to unlock the TAR package:
# TAR-XVF Clmodem-0.3.0+gg.tar
3. Because the driver does not support PNP (Plug and Play), the IRQ and I/O addresses need to be manually configured, and we can obtain their IRQ and I/O resource usage by executing the CAT/PROC/PCI |more command. From the output of this command you can see a section of information similar to the following:
Bus 0, device, function 0:
Communication Controller:cirrus Logic Unknown Device (Rev. 1).
Vendor id=1013. Device id=4000.
Medium Devsel. IRQ 10.
Non-prefetchable bit memory at 0xebffe000 [0xebffe000].
I/O at 0xe [0xe001].
From this, we can know that its resource occupancy: IRQ=10;I/O address =0xe0000.
4. Then we modify the Clm_config.h file in the driver to modify its first two lines according to its output:
#define Clm_base_io_address 0xe000
#define CLM_IRQ 10
5. Then execute the make command in the driver directory and compile the driver;
6. Then use the Insmod command to load the module into the kernel:
/sbin/insmod CLM.O
To load the module automatically each time you start Linux, add the sentence to the/etc/rc.d/rc.modules file.
7. To create a device using the Mknod command:
MKNOD/DEV/CLM C 121 0
8. Finally, link the/dev/modem to/DEV/CLM:
Ln/dev/modem/dev/clm
OK, Linux is already able to identify your soft cat, you can use the previous method to dial the Internet.

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.