Article title: achieve remote access to the LAN. 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.
When you are on a business trip at home or in another place, you often need to connect to the company's LAN to find information. This article introduces a method to build a dial-up server using two serial ports of a Linux server. remote users can connect to the LAN through dialing to facilitate information transfer and resource sharing.
The configuration environment for the author is the Red Hat 8.0 Linux operating system, the required hardware includes two external Modem (connected to the COM1 and COM2 ports respectively) and two telephone lines.
Steps
Initialize a serial device
Add the following two lines to the/etc/inittab file to Initialize two serial devices: ttyS0 and ttyS1:
S0: 345: respawn:/sbin/mgetty-D-x 3 ttyS0 S1: 345: respawn:/sbin/mgetty-D-x 3 ttyS1 |
Then, Run "/sbin/init
Q "command to make the change take effect.
Specify the authentication method
Create the ppplogin file in the/etc/ppp Directory. the content is as follows:
#! /Bin/sh /Usr/sbin/pppd auth-chap + pap login |
This file specifies that the user uses PAP authentication for logon. PAP and CHAP are two authentication protocols for the PPP service.
After saving the file, set the execution permission for the file:
| # Chmod a + x/etc/ppp/ppplogin |
Then, change the/etc/mgetty + sendfax/login. config file, remove the comment in front of "/AutoPPP/", and change it to the following content:
| /AutoPPP/--/etc/ppp/ppplogin |
Modify the options file
Modify the/etc/ppp/options file as follows:
Detach Modem Lock Crtscts Asyncmap 0 Netmask 255.255.255.0 Proxyarp Ms-dns 192.168.11.1 |
The "detach" option is very important. If this option is not specified, the dial-up program will enter the background, so that the Shell script will exit, followed The connection is terminated due to the suspension of the serial line. "Detach" prevents tty devices from being controlled by PPPD. The "Modem" option enables PPPD to monitor the DTR lead and check whether the peer is offline. The "Lock" option specifies that UUCP-style locking is used on the serial device. The crtscts option is used to enable the hardware handshake signal. Asyncmap 0 sets asynchronous character Ing. this ing specifies that control characters cannot be directly sent through connections and must be escaped first. "Netmask 255.255.255.0" sets the network mask of the PPP network interface. The "proxyarp" option enables the ARP proxy function. "Ms-dns 192.168.11.1" specifies the IP address of the DNS server in the LAN. If no IP address is available. |
Assign an IP address to the dial-in user
Create the/etc/ppp/options. ttyS0 and/etc/ppp/options. ttyS1 files with the following content:
# Vi options. ttyS0 192.168.11.3: 192.168.11.242 # Vi options. ttyS1 192.168.11.3: 192.168.11.243 |
"192.168.11.3" is the IP address of the Linux machine used as the dial-up server. "192.168.11.242" and "192.168.11.243" are the IP addresses assigned to the COM1 port and COM2 port respectively.
[1] [2] Next page