Linux, LAN remote access



This paper presents a Linux server build two serial dial-up server method, remote users can dial-up connection to the LAN, for easy messaging and resource sharing.

The author of the configuration environment is Red Hat 8.0 Linux operating system, the necessary hardware, including two external Modem (COM1 and COM2 are connected to the port) and two phone lines. Implementation steps are as follows:

1. Initialized serial devices

In / etc / inittab file to add the following two lines, used to initialize the two serial ports ttyS0 and ttyS1 devices:

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 change to take effect.

2. Specified authentication method

In / etc / PPP directory create a file ppplogin, reads as follows:

#! / Bin / sh

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

The document specified using PAP authentication when users log on. PAP and CHAP are the two PPP authentication protocol services.

Save the file, set the execute permissions to the file:

# Chmod a + x / etc / ppp / ppplogin

Then, change the / etc / mgetty + sendfax / login.config file, remove the "/ AutoPPP /" line in front of the note, and read the following:

/ AutoPPP / - - / etc / PPP / ppplogin

3. Modify the options file

Modify / etc / PPP / Options file contents as follows;

detach

Modem

Lock

crtscts

asyncmap 0

netmask 255.255.255.0

proxyarp

ms-dns 192.168.11.1

"Detach" option is very important. If you do not specify this option, dial-up program will enter the background, making Shell script exit, followed by a serial line being hung up, leading to connection termination. "Detach" from PPPD to prevent the tty device control.

"Modem" option makes PPPD monitor DTR lead, can be observed peer has dropped.

"Lock" option specifies the serial device to use UUCP-style lock.

"Crtscts" option to open the hardware handshake signals.

"Asyncmap 0" set asynchronous character map, this map can not specify the control character sent directly connected, need to be escaped.

"Netmask 255.255.255.0" set the PPP network interface network mask.

"Proxyarp" option to open the ARP proxy feature.

"Ms-dns" 2.168.11.1 "specifies the DNS server addresses within the LAN, if there is no can do.

4. To assign IP Dial-In User

Create / etc/ppp/Options.ttyS0 and / etc / ppp /

options.ttyS1 two files as follows:

# Vi options.ttyS0

192.168.11.3:192.168.11.242

# Vi options.ttys1

192.168.11.3:192.168.11.243

One, "192.168.11.3" is used as a dial-up server that sets the IP address of Linux machine, "192.168.

11.242 "and" 192.168.11.243 "are respectively assigned to COM1 and COM2 port dial the user's IP address port.

5. Password authentication

Edit the file / etc / PPP / pap-secrets, as follows:

* Backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp "secret" 192.168.11.242

* Backup bin conf config data eshow_sitemap.html generate.sh log maint sitemap.html svn tmp "password" 192.168.11.243

As indicated above, each line of code contains four columns, representing the user name, server address, password value and IP address list. "*" Indicates that the content can be matched with any.

The user dials in, if you need to access other servers within the LAN, you must open the IP forwarding:

echo 1> / proc/sys/net/ipv4/ip_forward

To the idle disconnect automatically after a period of time, you need to / etc / ppp / options to add the following line:

idle 600

The code "600" for 600 seconds, or 10 minutes.

If you can not find the corresponding directory under / sbin / mgetty documentation and / etc / mgetty + sendfax / login.config file, you need to install the mgetty package.