Linux as a PPP Access Server (2)

Source: Internet
Author: User
Linux as a PPP Access Server (2) -- Linux Enterprise Application-Linux server application information. The following is a detailed description. When you think that all necessary functions are added or made into modules as needed, you can try to run the following command:

# Make dev; make clean; make zlmage;

If the system finally prompts that the new kernel exists in/usr/src/linux/arch/i386/boot, the kernel is compiled successfully.

If the prompt is "the kernel is too big", enter

# Make bzlmage to generate a compressed core. This is usually done.

Then the module is installed.

Make modules

Make modules_install

# Depmod-a (build correct dependencies for the module)

Check/etc/lilo. conf to find out which directory your Linux uses as the image directory.

Example: image =/boot/vmlinuz

Copy/usr/src/linux/System. map to the/boot directory.

Convert/usr/src/linux/arch/i386/boot/zImage (or bzImage) to the/boot directory,

Run Lilo and restart your computer with the new core.

Tip: keep the old Core
It is a good idea to retain the old core before it is confirmed that the new core can run stably. The Recommended Practice is:

Rename linux under/usr/src before extracting the new core. (For example, change to linux. old), and then create a new empty directory,
For example, linux2.2.14

Then, use ln-s linux2.2.14 linux to create a linux Symbolic Link.

Then decompress the original code package. The advantage of doing so is that you can simply update the symbolic link in your future core updates, it is always a valid/usr/src/linux directory name.

Obtain a representative and memorable New Core name before copying a new core to/boot, for example, vmlinuz. ppp.2.2.14.
Then edit/etc/lilo. conf. The modified lilo. conf is as follows:

Boot =/dev/hda
Map =/boot/map
Install =/boot. B
Prompt timeout = 50
Default = linux
Image =/boot/vmlinuz
Label = linux
Root =/dev/hda1 read-only
Image =/boot/vmlinuz-2.2.14
Label = linux214
Root =/dev/hda1 read-only
Other =/dev/hda2
Label = dos
Table =/dev/hda
Do not forget to execute # lilo, and then the system prompts the following information:

Added linux * Added linux214 Added dos

# Reboot

When executing the lilo command, the system will add a new bootable core. If you forget the name of the new core during system boot (that is, when lilo appears, you can press the tab key to display all the items that can be started, which is defined by the Label.

OK. Now you have another option, so that you can use the old core whenever the new core cannot be guided or abnormal.

We recommend that you use the original English version of the Rad Hat6.2 release kit, because it is very effective to knock on my core. However, the so-called Chinese linux Suite, which is the world's No. 1 core in Chinese technology, will encounter more or less troubles when re-compiling the core. For them, I only take their merits, such as an independent Chinese Processing Package.

(For more information about the core, see the relevant documentation in section 6th)


Install, configure, and start the pppd package

The current linux release usually includes the pppd package. If you do not have these packages or want to use another type of pppd toolkit, we recommend that you download and use the mgetty package, the software supports data and fax functions. The getty in Linux does not support the fax function. It can be obtained on freesoft.cei.gov.cn. The following uses mgetty as an example to describe it.

Note: There are some differences in the specific configurations of different PPP software packages. The common practice is to check the corresponding manual page or Readme document.

Verify the mgetty software package:

If you cannot find files such as/sbin/mgetty,/etc/mgetty + sendfax/login. config in the directory, you need to install the mgetty RPM package.



Configure the mgetty software package:

Assume that you use COM1 and COM2 to receive external dial numbers. Each plug-in has an Acer 56 Surf Modem. For details about Modem configuration, refer to "Tips: how to configure MODEM in LINUX ". It is also assumed that it is now set to automatically intercept external calls.

1. Add the following two lines to the/etc/inittab file:

S0: 345: respawn:/sbin/mgetty-a-m "" ATS0 = 1 OK-D-x 3 ttyS0 vt100

S1: 345: respawn:/sbin/mgetty-a-m "" ATS0 = 1 OK-D-x 3 ttyS1 vt100

Parameter description:

Id: runlevel: action:/sbin/mgetty [options] line [speed [term [lined].

Parameters in the preceding sentence are separated. The specific meanings of parameters are as follows:

345: indicates the runlevel in which the row is called. Generally, 23 is enough. You can also write it as 2345.
Runlevel 2: multi-user mode without NFS support
Runlevel 3: common multi-user mode
Option-a: automatically adapt to the baud rate.
-M: The initialization string sent to the serial port device/dev/ttyS0. Here the AT command is used to set the modem to be connected after an alarm is triggered. mgetty waits for the OK string returned by the device/dev/ttyS0 to go to the next step.
TtyS0: name of the device file defined in the serial port in linux:/dev/ttyS0 corresponds to COM1;/dev/ttyS1 corresponds to COM2;
Vt100 sets the terminal type
Then run/sbin/init q to make the change take effect.

2. Configure the configuration file of mgetty:

In the/etc/mgetty + sendfax/login. config file, remove the line header comment containing the AutoPPP line./AutoPPP/-a_ppp/etc/ppp/ppplogin

Specifically:/AutoPPP/is the terminal name of the terminal user generated by logging on to mgetty connected to/dev/ttyS0, a_ppp is the name of the PPP connection on the physical connection based on/dev/ttyS0.

3. Modify the/etc/ppp/ppplogin file:

/Etc/ppp/ppplogin is a script file automatically run after login, for example:

#! /Bin/sh
If [-f/etc/ppp/options. $ TTY];
Then exec/usr/sbin/pppd
Else
Exec/usr/sbin/ppd-detach
Fi
Or simply add the following rows to/etc/ppp/ppplogin:

#! /Bin/sh

/Usr/sbin/pppd auth-chap + pap login

Note: The login parameter indicates that the user name and password in/etc/passwd are used for PAP authentication.

If you do not need to verify the user name and password after dial-in, you only need to remove the auth parameter.

Save the file and grant it the following permissions:

Chmod + x/etc/ppp/ppplogin



4. Modify the/etc/ppp/options file as follows:

-Detach

Modem

Lock

Crtscts

Asyncmap 0

Netmask 255.255.255.0

Proxyarp

Mtu 296

Mru 296

Ms-dns 192.168.10.25

Note: 192.168.10.25 is a DNS server on my LAN, and 192.168 is a common LAN setting. If 10.25 is used, instead of 0.1, it is because 10.25 is my birthday, this is a good way for me to remember and have their own personality signs. If you do not have one, you can automatically allocate DNS to the dial-in user.

Note: the size of the packet to be transmitted after the PPP connection is established in the mtu/mru lines. 296 (256 + 40) or 552 (512 + 40) can be used here ), 40 represents the empty package size without any data. It is set to a relatively small value to reduce the size of each package if a PPPD process needs to transmit large files after creation, to prevent other processes from slowing down, although the size of each packet is reduced, the overall transmission speed is not affected. You can also skip these two lines.



5. Create two other files:/etc/ppp/options. ttyS0 and/etc/ppp/options. ttyS1.

(The suffix corresponds to the corresponding serial port and defines different PPP connection parameters for each serial port ):

You can add the following lines to each file at the beginning, and comment out other lines. After debugging is successful, add the corresponding parameters as needed.

# More options. ttyS0

192.168.10.3: 192.168.10.242

# More options. ttyS1

192.168.10.3: 192.168.10.243

Note: 192.168.10.3 is the IP address of my Linux server,

192.168.10.242 and 192.168.10.243 are the two PPP addresses that I specified for the dial-in user.



A configuration file is provided for reference only:

# More options. ttyS0

Asyncmap 0 netmask 255.255.255.0 # Local IP: Remote IP 192.168.1.100: 192.168.1.101 lock noauth crtscts modem-detach debug proxyarp



6. for/etc/ppp/pap-secrets, you can add the following lines:

** "" 192.168.10.242 ** "192.168.10.243

So far, the settings are complete.

It seems annoying to splash so much foam. In fact, in actual operations, it takes only three times, five times, and two times to complete.

Good luck.

Start the pppd package

After you have successfully installed and configured the PPP package, you only need to enter PPPD at any time to start pppd. I usually start a machine when it starts.

Here is a brief description of TurboLinux Chinese Version 4.0:

# Turboservice

You only need to select one pppd item so that the machine can automatically run the pppd service at the next startup.

For rh and its compatible Release versions, this command is to use setup and then select "system service.

I don't know why different command names are used! :-(

Summary:

Important related files in mgetty:

/Sbin/mgetty
/Etc/mgetty + sendfax/login. config
/Etc/inittab
/Etc/ppp/ppplogin
/Etc/ppp/options
/Etc/ppp/options. $ TTY (where the value of $ TTY is the serial port number used by you)
/Etc/ppp/pap-secrets
After a user successfully establishes a PPP connection, if you need to access other servers on the LAN, you must enable the IP forwarding function of the PPP server, echo 1/proc/sys/net/ipv4/ip_forward.

If you need to automatically remove the connection after a period of free time, for example, 20 minutes, add idle 1200 to/etc/ppp/options.

Advanced construction: the type and features of PPP link configuration
There are four types of Link Configuration:

Dedicated link.
Dynamic Input link.
Dynamic Output link for transparent start.
Dynamic Output link, manual start.
Various links have different characteristics and have their best application environment. The number and content of PPP links in the system depend on the expected PPP communication type of the system. These files can be edited manually or configured using corresponding tools.

Special link features.

This configuration requires that a dedicated serial line be used to link a remote host, including a lease line between two buildings and a serial cable connecting two PCs.

A serial line is required to be dedicated to a PPP link.
Allow local or remote hosts to initiate links.
The IP addresses of local and remote hosts must be specified by the local host. The remote host must accept these IP addresses.
Note:
If the remote host must be assigned an IP address, use dynamic link configuration.
Use non-modem-controlled serial lines for dedicated links.
Dynamic Input link.

This type can be used when you need to dynamically receive connection requests from remote hosts on a serial line.

The serial line must be dynamically obtained and can be shared.
The remote host must initiate a link through the registration program.
The IP addresses used to identify local and remote hosts can be specified by the local host or remote host.
Dynamic Output link for transparent start.

If the local host initiates a PPP connection to the remote host through a dynamically obtained serial line, and the local host can allocate IP addresses of the local host and remote host in the connection, this type can be used.

The serial line must be dynamically obtained and can be shared.
The local host must initiate a link. When an IP packet is sent to the remote host IP address, this link is automatically started.
The IP addresses of local and remote hosts must be specified by the local host and accepted by the remote host.
Dynamic Output link, manual start.

If the local host initiates a PPP connection with the remote host through a dynamically obtained serial line and the remote host can be assigned an IP address of either the local host or the remote host in the connection, this type can be used.


The serial line must be dynamically obtained and can be shared.
The local host must initiate a link. This link is started only after the corresponding commands are manually executed.
The IP addresses of local and remote hosts can be specified by the local host or remote host.
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.