📄 00000004.htm
字号:
<HTML><HEAD> <TITLE>BBS水木清华站∶精华区</TITLE></HEAD><BODY><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER>发信人: <A HREF="mailto:vc0328@tpts1.seed.net.tw">vc0328@tpts1.seed.net.tw</A> (Vincent Chen), 信区: Linux <BR>标 题: linux SLIP/PPP howto(中文) <BR> <BR> <BR>TCP/IP over serial line <BR> <BR> <BR>一、 SLIP <BR> <BR> <BR> SLIP在实际应用上分为标准SLIP、封包压缩CSLIP两种。事实上, <BR>所谓的封包压缩只是压缩封包的表头部分,对资料传输上,有部分 <BR>提升。然而,在与主机端连线时必须确认对方所使用的协定种类, <BR>否则大部分的功能将无法使用。 <BR> <BR> 完成SLIP连线共包含三个步骤,数据机拨号接通主机、设定硬体 <BR>界面、设定route table。这三个步骤可分别执行dial、ifconfig <BR>、route三个指令来完成。这□我们不分别说明这三个程式如何执行 <BR>,我们把焦点集中在dip这个程式,它可以自动呼叫其他程式,完成 <BR>整个SLIP连线工作。 <BR> <BR> 下dip -t指令可以进入测试模式,得到dip所有指令列表,我们也 <BR>不对测式模式多作介绍,所有动作都可以写入script中,拨号、签 <BR>入、从主机送出的讯息抓出我们的IP一次完成。 <BR> <BR> <BR> 这□是dip所有指令列表: <BR> <BR>DIP: Dialup IP Protocol Driver version 3.3.7l-uri (27 Dec 94) <BR>Written by Fred N. van Kempen, MicroWalt Corporation. <BR> <BR>DIP> help <BR>DIP knows about the following commands: <BR> <BR> bootp break chatkey config databits <BR> dec default dial echo flush <BR> get goto help if inc <BR> init mode modem netmask parity <BR> password proxyarp print port quit <BR> reset securidf securid send skey <BR> sleep speed stopbits term timeout <BR> wait <BR> <BR> <BR> 下面我们透过一个script□例来看整个连线过程: <BR> <BR> <BR>* dip只有支援四个内部变数,$local存放主机指定给我们的IP, <BR> $remote存放SLIP主机的IP,$mtu存放最大传输封包大小, <BR> $errlvl存放指令执行传回值。目前尚没有支援使用者自定变数 <BR> 。 <BR> <BR>* dip的script没有迥路的功能,只有简单的if-goto逻辑判断、 <BR> 及goto的分支执行 <BR> <BR>* 在完成slip连线後,我们所拥有的IP及domain皆为主机所指定, <BR> 在执行ftp、telnet等程式不会有问题。特别要注意e-mail时, <BR> 发信人地址是用我们所设的domain,别人在回信时会无法投递, <BR> 因为自设的domain没有注册,对方的信件程式无法从domain找 <BR> 出您的IP。如果要测试信件收发,可以用<user>@<ip addr>的 <BR> 方式传递。 <BR> <BR> <BR># <BR># xxx.dip Dialup IP connection support script. (dynamic) <BR># <BR># Version: xxx.dip 1.0 08/12/94 <BR># <BR># Author: Vincent Chen <BR># <BR># Features: Support multiple phone numbers <BR># Redial automatically when busy <BR># <BR> <BR>main: <BR> <BR> # <BR> # Set serial port and speed. <BR> # <BR> port cua1 # 指定modem连接port (COM2) <BR> speed 57600 # RS-232传输速度 <BR> netmask 255.255.0.0 <BR> <BR> # <BR> # Prepare for dialing. <BR> # <BR> # send <string>: 传送指令给modem <BR> # \r代表CR字元,modem在收到CR後开始解释、执行指令 <BR> # \n代表LF+CR <BR> # <BR> send AT&FL1S0=0S7=25\r <BR> if $errlvl != 0 goto modemerr # modem指令执行失败的处理 <BR> # <BR> # wait <string> <n> <BR> # 在<n>秒内从modem取得<string>,成功传回0 <BR> # <BR> wait OK 3 # 等待modem传回执行结果 <BR> if $errlvl != 0 goto modemerr <BR> # <BR> # print <string>: 在萤幕上显示<string> <BR> # <BR> print DIP script for XXX SLIP server by Vincent Chen 08/12/1994 <BR> print --------------------------------------------------------- <BR> print ............... AutoDial procedure started .............. <BR> print ................. Press Ctrl-C to abort ................. <BR> <BR>dialsvr: <BR> <BR> # <BR> # Now trying the 1st number <BR> # 先拨第一支电话 <BR> # <BR> # sleep <n>: 暂停执行n秒 <BR> # <BR> sleep 3 <BR> print .................... Trying xxx-xxxx .................... <BR> send ATDTxxx-xxxx\r # 拨server电话号码 <BR> if $errlvl != 0 goto modemerr <BR> wait BUSY 15 # 判断是否占线 <BR> if $errlvl == 0 goto next <BR> wait CONNECT 10 # 等待连线讯息 <BR> if $errlvl != 0 goto next <BR> goto login # 连线成功,开始签入主机 <BR> <BR>next: <BR> <BR> # <BR> # Now trying the 2nd number <BR> # 第一支电话无法连上,改拨第二支 <BR> # <BR> sleep 3 <BR> print .................... Trying 368-9280 .................... <BR> send ATDT368-9280\r <BR> if $errlvl != 0 goto modemerr <BR> wait BUSY 15 <BR> if $errlvl == 0 goto dialsvr <BR> wait CONNECT 15 <BR> if $errlvl != 0 goto dialsvr <BR> goto login <BR> <BR># <BR># 数据机连线成功,开始签入主机 <BR># <BR> <BR>login: <BR> <BR> wait login: 10 # 等主机送出签入的提示讯息 <BR> if $errlvl != 0 goto error <BR> send slip\r # 送出您的帐号 <BR> if $errlvl != 0 goto error <BR> #wait password: 10 # 等待主机要求输入密码 <BR> #if $errlvl != 0 goto error <BR> #send xxxxx\r # 送出您的密码 <BR> #if $errlvl != 0 goto error <BR> # <BR> # Catch the key word to confirm that IP will show up shortly. <BR> # <BR> wait \nEnter 5 # 等待主机送出我们IP前的字串 <BR> if $errlvl != 0 goto error # '\n'是专为台大而设的 <BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -