📄 00000004.htm
字号:
# <BR> # Get dynamic IP from strings that sent by server <BR> # <BR> # get $local <remote/ip address> <n> <BR> # 在<n>秒内取得我们的ip,可指定dip自行抓或由我们直接指定 <BR> # get $local remote <n>: 让dip从server送出的讯息抓我们的ip <BR> # get $local xxx.xxx.xxx.xxx <n>: 直接告诉dip我们的ip <BR> # <BR> # 注意:在下get指令之前必须确定不会有类似ip的字串重复出现 <BR> # ,否则会造成dip误判,前面之所以要等Enter字串就是 <BR> # 考虑到这一点。 <BR> # <BR> get $local remote 3 # 由dip分析我们的IP <BR> if $errlvl != 0 goto error <BR> # <BR> # Get gateway IP from strings that sent by server <BR> # <BR> # get $remote <remote/ip address> <n> <BR> # 在<n>秒内取得server的ip,可指定dip自行抓或由我们直接指定 <BR> # get $remote remote <n>: 让dip从server送出的讯息抓server的ip <BR> # get $remote xxx.xxx.xxx.xxx <n>: 直接告诉dip server的ip <BR> # <BR> get $remote remote 3 # 由dip分析主机的IP <BR> if $errlvl != 0 goto error <BR> <BR> # <BR> # Set up the SLIP operating parameters. <BR> # <BR> get $mtu 1024 # 设封包长度最大值 <BR> <BR> # <BR> # Set Destination net/address as type 'default' (vice an address). <BR> # This is used by the 'route' command to set the kernel routing table. <BR> # Some machines seem to require this be done for SLIP to work properly. <BR> # <BR> default # 由dip自行建立route table <BR> <BR># <BR># Give the connection report ! <BR># <BR> <BR>done: <BR> <BR> print ****** Connected ****** <BR> print IP address is $local <BR> print Remote gateway is $remote <BR> # <BR> # mode <SLIP/CSLIP/PPP> <BR> # <BR> mode SLIP # 进入SLIP传输模式 <BR> goto exit <BR> <BR>error: <BR> <BR> print SLIP connection failed. <BR> goto exit <BR> <BR>modemerr: <BR> <BR> print Modem initializing failed. <BR> goto exit <BR> <BR>exit: <BR> <BR> <BR> 在script完成後,只要输入dip <script filename>,dip根据预 <BR>设的流程自动连上主机。以下是整个script执行过程: <BR> <BR>bash# dip /etc/xxxxx <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 script for xxx SLIP server by Vincent Chen 08/12/1994 <BR>--------------------------------------------------------- <BR>................ AutoDial procedure started .............. <BR>.................. Press Ctrl-C to abort ................. <BR>..................... Trying xxx-xxxx .................... <BR>****** Connected ****** <BR>IP address is xxx.xxx.xxx.xxx <BR>Remote gateway is yyy.yyy.yyy.yyy <BR> <BR> <BR> 从上面可看到在拨第一支电话後,成功的连上主机。主机指定给 <BR>我们的IP是xxx.xxx.xxx.xxx,Server的IP是yyy.yyy.yyy.yyy。本 <BR>□例会在忙线时,接著拨第二支电话,直到连线完成,只要稍作修 <BR>改可以支援第三、第四支电话。 <BR> <BR> 连线完成後我们可以用ifconfig指令看到dip已经为我们设定好 <BR>sl0这个slip channel,在1.1.78版之前的核心只支援4个channel, <BR>目前新的核心可以支援到16个channel,对外连线不论您同时ftp、 <BR>telnet几部主机都只占用一个channel。这表示如果您把linux当作 <BR>一部slip server的话,您还有15个channel提供dial-in的服务。 <BR> <BR> <BR> 接著我们先用ifconfig指令检查dip是否已经设好slip界面。 <BR> <BR>bash# ifconfig <BR> <BR>lo Link encap:Local Loopback <BR> inet addr:127.0.0.1 Bcast:127.255.255.255 Mask:255.0.0.0 <BR> UP BROADCAST LOOPBACK RUNNING MTU:2000 Metric:1 <BR> RX packets:0 errors:0 dropped:0 overruns:0 <BR> TX packets:20 errors:0 dropped:0 overruns:0 <BR> <BR>sl0 Link encap:VJ Serial Line IP <BR> inet addr:xxx.xxx.xxx.xxx P-t-P:yyy.yyy.yyy.yyy Mask:255.255.0.0 <BR> UP POINTOPOINT RUNNING MTU:1024 Metric:1 <BR> RX packets:0 errors:0 dropped:0 compressed:0 <BR> TX packets:0 errors:0 dropped:0 compressed:0 <BR> <BR>eth0 Link encap:10Mbps Ethernet HWaddr 00:00:C0:00:02:F1 <BR> inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 <BR> UP BROADCAST RUNNING MTU:1500 Metric:1 <BR> RX packets:2 errors:0 dropped:0 overruns:0 <BR> TX packets:0 errors:0 dropped:0 overruns:0 <BR> Interrupt:15 Base address:0x340 <BR> <BR> <BR> 在下表我们可以看到除了原有的loop back、ethernet之外又多了 <BR>xxx.xxx.xxx.xxx及default这两个dip为我们设好的封包传输路径。 <BR>default route是一个特殊的封包传输路径,所有目的地不在传输路 <BR>径表上的封包都透这个管道对外传送,我们可以看到default route <BR>是以xxx.xxx.xxx.xxx为getway,因此必须另外指定送往xxx.xxx.xxx <BR>..xxx的封包是透过sl0□面传送。 <BR> <BR> <BR>bash# route <BR> <BR>Kernel routing table <BR>Destination Gateway Genmask Flags MSS Window Use Iface <BR>xxx.xxx.xxx.xxx * 255.255.255.255 UH 960 0 0 sl0 <BR>192.168.1.0 * 255.255.255.0 U 1436 0 0 eth0 <BR>loopback * 255.0.0.0 U 1936 0 20 lo <BR>default xxx.xxx.xxx.xxx * UG 960 0 0 sl0 <BR> <BR> <BR> 要结束连线时只要下dip -k指令,dip会帮我们挂断电话、清除传 <BR>输路径表、关闭sl0传输界面等所有工作,回复未连线前的系统状况 <BR>。当然用kill -9 <dip process id>也有同样的效果。 <BR> <BR> <BR>bash# dip -k <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: process 115 killed. <BR> <BR> <BR> <BR>SLIP CHECKLIST: <BR> <BR> <BR>1. /etc/HOSTNAME及/etc/hosts档内有定义您自已的linux主机吗? <BR>2. /etc/resolv.conf档内有定义您的nameserver吗? <BR>3. dip script内mode <protocol>指令和主机端所用的协定相符吗? <BR>4. 连线後所显示□ <BR> <BR> <BR><CENTER><H1>BBS水木清华站∶精华区</H1></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -