一、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
#!/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=555-1212 # The telephone number for the connection ACCOUNT=george # The account name for logon PASSWORD=gracie # The password for this account LOCAL_IP=0.0.0.0 # Local IP address if known. Dynamic = 0.0.0.0 REMOTE_IP=0.0.0.0 # Remote IP address if desired. Normally 0.0.0.0 NETMASK=255.255.255.0 # The proper netmask if needed # # Export them so that they will be available at 'ppp-on-dialer' time. 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 $PA