一、Linux 上的 PPP
Linux 中已经包括了点对点协议PPP,其主体是 pppd ,如果你已经使用过 Windows95 或 NT 的拨号网络,那么你已经具备了 PPP 的基本经验了。在 Windows95 的 PPP 在同 ISP 连接后,视 ISP 情况不同,会自动为 Windows 客户机提供 IP 地址和 DNS 服务器地址,而 Linux 的 PPP 不会自动接收 DNS 地址,这是 Linux 与 Windows 的一点区别,所以,Linux 上的 PPP 在协议连接成功后,要多一步 DNS 的配置。
#!/bin/sh
#
# Script to initiate a ppp connection. This is the first part of the
# pair of scripts. This is not a secure pair of scripts as the codes
# are visible with the 'ps' command. However, it is simple.
#
# These are the parameters. Change as needed.
TELEPHONE=163 # 拨号号码
ACCOUNT=YourUserName # 用户名
PASSWORD=YourPassword # 口令,注意限制其他人读取本文件!
LOCAL_IP=0.0.0.0 # 本地IP地址,0.0.0.0 表示动态分配
REMOTE_IP=0.0.0.0 # 原端IP地址,一般是 0.0.0.0
NETMASK=255.255.255.0 # 子网掩码
export TELEPHONE ACCOUNT PASSWORD
#
# This is the location of the script which dials the phone and logs
# in. Please use the absolute file name as the $PATH variable is not
# used on the connect option. (To do so on a 'root' account would be
# a security hole so don't ask.)
#
DIALER_SCRIPT=/etc/ppp/dialer.163 # 拨号登录脚本文件名
#
# Initiate the connection
#
# I put most of the common options on this command. Please, don't
# forget the 'lock' option or some programs such as mgetty will not
# work. The asyncmap and escape will permit the PPP link to work with
# a telnet or rlogin connection. You are welcome to make any changes
# as desired. Don't use the 'defaultroute' option if you currently
# have a default route to an ethernet gateway.
#
exec /usr/sbin/pppd debug lock modem crtscts /dev/ttycua0 57600 \
asyncmap 20A0000 escape FF kdebug 0 $LOCAL_IP:$REMOTE_IP \
noipdefault netmask $NETMASK defaultroute connect $DIALER_SCRIPT