4. 准备你的 Linux 机器

简而言之,这是所需的内容。我将详细解释前三项。

你还需要获取适用于你的远程主机的模拟器二进制文件并安装它。SLiRP 可在 Sunsite 和其他优秀的 Linux FTP 站点获取。有关 TIA 的所有相关信息可在 TIA 官方网站 获取。

就这样!让我们开始吧。

4.1. 编译你的内核

如果你从未做过这件事,你应该尝试一下。你应该先阅读 FAQ,但别担心,这很容易。如果你愿意,你可以给我发电子邮件,我会帮助你。

为了简洁起见,我假设你已经在这里了。当你运行 'make config' 时,查找 “网络设备”。当然选择 'y',然后对 SLIP、CSLIP、(或 PPP) 和 TCP/IP 选择 'y',对其余所有内容选择 'n',除非你有以太网卡或需要其他协议用于其他用途。如果你不这样做,它将无法工作! 完成编译并安装新内核,然后,

4.2. 编辑以下目录中的一些文件/etc

这些文件将设置你的路由到你的远程主机。/etc是系统配置的目录。将双引号中的所有内容替换为适当的值,这是自然的(但不包括引号 - 它们仅供参考)。你需要编辑三个文件,它们是

4.3. DIP

DIP (拨号 Internet 协议) 是你将用来拨号连接远程主机、启动模拟器并将线路转换为 SLIP/PPP 的工具。它包含在 Slackware 的 “N” 集中,以及许多客户端和实用程序,你可能也想安装其中一些 =)。它也可以在 Sunsite 的单独 tar 文件中获取。

一旦你安装了它,你将需要一个 dip 脚本。这是一个示例,只需将适当的内容插入双引号所在的位置(但不包括引号 - 它们仅供参考)。

main:
  get $local "yourhostname.domain.name"
  get $remote "remotehostname.domain.name"

#Your port here
  port cua"?" 

#Use 115200 for 28.8 modems 
  speed 57400
  reset

#don't use spaces in your AT command string! 
  init AT "string of commands" 
  wait OK 5

# This will redial. If it doesn't work, play with the wait time (listen 
# to your modem). If it still doesn't work, mail me.
# See also; the note at the bottom of the script re: error codes.

dial:
  dial "phonenumber"
  print Dialing...
  if $errlvl != 0 goto error

#You may need to change this wait time to suit your modem
  wait BUSY 20
  if $errlvl == 0 goto dial	

login:
  print Connected and Logging in...

#This wait and send gets me past my hosts Annex. Change for your site!
  wait ==> 60
  send 4\n
  wait ogin: 60
  if $errlvl != 0 goto login_error1
  send "LOGIN"\n
  wait assword: 60
  if $errlvl != 0 goto login_error2
  send "PASSWORD"\n

loggedin:
  wait "SYSTEM PROMPT" 60
  if $errlvl != 0 goto shell_error
  print Logged in!
  send "emulator startup command"\n
  wait "emulator startup response" 60
  if $errlvl != 0 goto emu_error

#The recommended mtu setting is 1500, but this is faster interactively. 
#Ftp may be slower, so adjust to taste.
  get $mtu 296
  default

done:
  print CONNECTED to $remote with address $rmtip
  mode CSLIP
  goto exit

error:
  print Dialing Error

login_error1:
  print No Login

login_error2:
  print No Password prompt

shell_error:
  print No shell prompt

emu_error:
  There was a problem starting the emulator

exit:

#This will error out when the -v flag is used, but work when run normally 
#(ends dip at a local prompt).
  \r		

   

4.3.1. DIP 注意事项

较新版本的 dip 不返回调制解调器状态代码(BUSY、NO CONNECT 等),而是使用数字代替。这是一个表格

  • 0 = 正常

  • 1 = 连接

  • 2 = 错误

  • 3 = 忙碌

  • 4 = 无载波

这将使你的拨号部分看起来像这样
dial:
  dial "phonenumber"
  print Dialing...
  if $errlvl != 0 goto error
  wait 1 20	
  if $errlvl != 1 goto dial
   

感谢 Lee Olds感谢他提供的这些信息。

\n = 换行符,\r = 回车符。你可能需要在适当的位置使用其中一个(或两者都用)。如果提供的这些不起作用,请尝试实验。

关于 wait 和 send 命令的形式说明一下。如果示例不够清楚,这里解释一下正在发生的事情

wait ogin: 60

脚本将等待远程主机发送 'ogin:' 60 秒。当收到时,脚本会继续执行。如果未收到,它将在 60 秒超时后继续执行。

if $errlvl != 0 goto login_error

(整行是可选的。)如果脚本因为收到了它正在等待的内容而继续执行,则会跳过此行。如果脚本因为超时而继续执行,它将跳转到你指示的位置(在本例中为 'login_error1')。

send "LOGIN"\n

DIP 将发送 'LOGIN' 和一个换行符

如果需要,你可以放入 sleep 语句,例如这样: "sleep 10"。这将使脚本暂停 10 秒。

编辑此文件后,将其重命名,例如 remote.dip,并将其放在/root。然后,以 root 用户身份运行 'dip remote'。第一次使用 -v 标志进行调试 ('dip -v remote'),这将显示 dip 执行的所有步骤。

Dip 只能以 root 用户身份运行,但有一种方法可以使其从用户帐户运行。目前,如果你需要此信息,请询问。如果足够多的人想要,我可能会在稍后将其包含在此文件中。

如果 dip 立即报错,请尝试删除脚本中的注释。

4.4. PPP

上述内容使你开始使用 CSLIP,这在大多数情况下都很好。它确实很容易工作,因为该协议在内核级别得到支持 - 只需确保它在那里并且可以工作。

然而,你们中的一些人会想要 PPP,至于什么原因,只有你自己能说。我不会在这里告诉你如何设置它,有另一份 HOWTO 专门为此编写。我要做的是告诉你在使用 PPP 和模拟器时需要注意的事项。

首先,最新版本的 DIP 说你可以使用它来启动 PPP,而且你可以,但是它只启动 PPP 守护进程 - 没有标志,什么都没有。因此,如果你想使用 DIP 启动 PPP,请务必将所有启动信息放在/etc/ppp/options文件中,否则它将无法工作。

说到 options 文件,无论你如何启动 pppd,都必须在其中包含以下内容:'192.0.2.1:XXX.XXX.XX.XX'。这是 'localIPaddress:remoteIPaddress'。你需要它在那里,因为通常 pppd 可以自行填写空白,但在连接到模拟器时会失败。

确保获取最新和最好的 pppd 软件包。似乎最近有几个版本有点问题。

最后,除非你有充分的理由使用 PPP,或者只是想学习它是如何工作的,否则你真的不需要它。我两种都试过了,并且没有注意到与标准客户端集有任何性能差异。当然,你的结果可能会有所不同。:)