7. 设置您的服务器

本章节描述了服务器机器交付您的 JavaStation 启动镜像所需的配置步骤。

7.1. 前言

现在是时候设置您的服务器,以便将 OS 和文件系统交付给 JavaStation

在我们的示例中,我们将配置一台 Linux/SPARC 服务器 "lnxserv",其私有 IP 地址为 192.168.128.100,以向 JavaStation "java01" (私有 IP 地址为 192.168.128.1)交付启动镜像。两者都在私有网络 192.168.128/24 上。当使用 "NFS-Root" 文件系统时,我们示例中文件系统在服务器上的位置是 "/path/to/nfsroot"

7.2. 设置 RARP 服务

我们首先需要在服务器上设置 RARP 服务,以便 JavaStation 可以自动配置其 IP 地址。

首先,使用 JavaStation 的 MAC 地址到其主机名的映射填充 "/etc/ethers" 文件

### /etc/ethers 
8:0:20:82:7a:21  lnxserv  # 192.168.128.100 (server is not necessary,)
#                         #                 (just for completeness)
#
#
08:00:20:81:C2:ae java01   # 192.168.128.1 (JavaStation)
#
###

接下来,使用 IP 地址到主机名的映射填充 "/etc/hosts" 文件

### /etc/hosts 
192.168.128.100 lnxserv
192.168.128.1 java01
###

最后,配置 RARP 缓存以填充。在基于 2.2.x 的系统上,您可以使用 /sbin/rarp 命令执行此操作,因此在启动时填充缓存

### Part of rc.local
#
# If necessary, first load the rarp module to be able to fill the cache.
# /sbin/insmod rarp
#
# Now we fill the rarp cache.  You better have the rarp command available.
if [ -f /sbin/rarp ]; then
        /sbin/rarp -f
fi
###

在基于 2.4.x 的系统上,您必须使用用户态 RARP 守护程序来响应 RARP 请求。

7.3. 设置 DHCP 服务

您现在需要配置您的服务器以交付 DHCP 服务。这将有助于识别 JavaStation、它所在的网络以及从哪里获取其启动镜像。

以下是 ISC DHCP 服务器软件的示例 "dhcpd.conf" 文件,该软件随大多数 Linux/SPARC 发行版一起提供。

### Sample /etc/dhcpd.conf file for ISC DHCPD
#
deny unknown-clients;
#
subnet 192.168.128.0 netmask 255.255.255.0 
{
   range 192.168.128.1 192.168.128.150;
}

group 
{
   host java01 
   {
      hardware ethernet 08:00:20:81:C2:ae;
      filename "C0A88003";        # "/tftpboot/xxx"
      fixed-address java01;       # 192.168.128.1
   }
}
#
### End dhcpd.conf file

为了演示目的,此处镜像了 ZLS 上的一个更长的 dhcpd.conf

注意:据报告,某些早期版本的 ISC DHCPD 运行不佳。建议您使用 ISC DHCPD 2.0 及更高版本。如果您仍然遇到问题,ZLS 网站上有一个针对 ISC DHCP 服务器的补丁。

7.4. 设置 NFS 服务(仅 "NFS-Root Options"

当您提供 "NFS-Root" 文件系统时,您需要将您创建的文件系统共享给 JavaStation 客户端。您可以使用 "/etc/exports" 文件执行此操作。

###/etc/exports
/path/to/nfsroot        java01(rw,no_root_squash)
###

确保您的 NFS 服务器在启动时正确启动。

7.5. 设置使用 TFTP 启动

现在我们需要在服务器上设置最后一步:TFTP 配置。对于此步骤,您将需要您创建的内核(使用 "NFS-Root" 选项)或 piggybacked 内核/fs 启动镜像(使用 "Embedded-Root" 选项)、适当的 PROLL 以及一些十六进制编号的知识。

您需要做的第一件事是验证 "TFTPd" 是否在您的 "/etc/inetd.conf" 文件中启用

tftp	dgram	udp	wait	root	/usr/sbin/tcpd	in.tftpd

现在,将您的 JavaStation 架构的 proll 副本,以及您的内核或 piggybacked 内核镜像移动到 /tftpboot。

现在,从您的 IP 的十六进制版本创建到您的 PROLL 镜像的符号链接,并创建从 "HEXIP.PROL" 到您的真实内核镜像的映射。如果您使用 "Embedded-Root" 选项,您需要指向您的 "Embedded-Root" 文件系统加内核镜像。如果您使用 "NFS-Root" 选项,您需要指向普通的 "vmlinux.aout" 镜像,并且需要一个单独的 IP->nfsroot 位置的映射。为了完整性,您可能还需要一个 "HEXIP.SUN4M" -> "HEXIP" 映射,因为这是 Sun 处理网络启动情况的自定义方式。

java01 从 "NFS-Root" 启动的示例

  $ ls -ld /tftpboot
  -rw-r--r--   1 root     root        89608 Mar 20 10:15 proll.aout.krups.11
  -rw-r--r--   1 root     root        52732 Mar 17 11:52 proll.aout.mrcoffee.11
  lrwxrwxrwx   1 root     root           19 Mar 20 10:16 proll.krups -> proll.aout.krups.11
  lrwxrwxrwx   1 root     root           22 Mar 17 11:54 proll.mrcoffee -> proll.aout.mrcoffee.11
  lrwxrwxrwx   1 root     root           10 Apr  1 13:00 C0A88001.SUN4M -> COA88001
  lrwxrwxrwx   1 root     root           10 Apr  1 13:00 C0A88001 -> proll.mrcoffee
  lrwxrwxrwx   1 root     root           12 Apr  1 13:00 C0A88001.PROL -> vmlinux.aout
  -rw-r--r--   1 root     root      1456189 May 21 12:53 vmlinux.aout
  -rw-r--r--   1 root     root      6743821 Apr  1 12:53 vmlinux_embed.aout
  lrwxrwxrwx   1 root     root           18 Apr  1 12:53 192.168.128.1 -> /path/to/nfsroot

java01 从 "Embedded-Root" 启动镜像启动的示例

  $ ls -ld /tftpboot
  -rw-r--r--   1 root     root        89608 Mar 20 10:15 proll.aout.krups.11
  -rw-r--r--   1 root     root        52732 Mar 17 11:52 proll.aout.mrcoffee.11
  lrwxrwxrwx   1 root     root           19 Mar 20 10:16 proll.krups -> proll.aout.krups.11
  lrwxrwxrwx   1 root     root           22 Mar 17 11:54 proll.mrcoffee -> proll.aout.mrcoffee.11
  lrwxrwxrwx   1 root     root           10 Apr  1 13:00 C0A88001.SUN4M -> COA88001
  lrwxrwxrwx   1 root     root           10 Apr  1 13:00 C0A88001 -> proll.mrcoffee
  lrwxrwxrwx   1 root     root           12 Apr  1 13:00 C0A88001.PROL -> vmlinux_embed.aout
  -rw-r--r--   1 root     root      1456189 May 21 12:53 vmlinux.aout
  -rw-r--r--   1 root     root      6743821 Apr  1 12:53 vmlinux_embed.aout