下一页 上一页 目录

10. 将您的 Linux 机器配置为 NCP 服务器。

有两个软件包可用于使 Linux 提供 Novell 文件服务器的功能。它们都允许您在您的 Linux 机器上与使用 Novell NetWare 客户端软件的用户共享文件。用户可以像连接到真正的 Novell 文件服务器一样,连接和映射文件系统,使其在他们的机器上显示为本地驱动器。您可能需要尝试两者,看看哪个最适合您的预期目的。

10.1 mars_nwe 软件包。

Martin Stover <mstover@freeway.de> 开发了 mars_nwe,使 Linux 能够为 NetWare 客户端提供文件和打印服务。

如果您对名称感到好奇:mars_nwe 是 Martin Stover 的 Netware 模拟器。

mars_nwe 的功能。

mars_nwe 实现了完整 Novell NCP 的一个子集,用于文件服务、基于磁盘的绑定和打印服务。它可能包含错误,但现在有很多人在使用它,随着新版本的发布,错误的数量正在稳步减少。

获取 mars_nwe

您可以从 ftp.gwdg.deftp://sunsite.unc.edu/pub/Linux/system/filesystems/ncpfs/ 获取 mars_nwe

撰写本文时,当前版本为:mars_nwe-0.99.pl10.tgz

构建 mars_nwe 软件包。

构建一个支持 Ethernet 和 IPX 的内核

1.2.13 版本内核中,您只需确保对问题 'The IPX protocol' 回答 Y,对问题 'Full internal IPX network' 回答 N,如图所示

 ...
 ...
The IPX protocol (CONFIG_IPX) [n] y
 ...
 ...
Full internal IPX network (CONFIG_IPX_INTERN) [N/y/?] n
 ...
 ...
在较新的内核中,采用了类似的过程,但提示的实际文本可能略有变化。

您还需要确保包含适用于您的以太网卡的驱动程序。如果您不知道如何执行此操作,则应阅读 Ethernet-HOWTO

然后您可以继续构建您的内核。确保您记得在完成后运行 lilo 来安装它。

解压 mars_nwe 软件包。

# cd /usr/src
# tar xvfz mars_nwe-0.99.pl10.tgz

编译 mars_nwe

编译软件包非常简单。第一步是简单地运行 make,这将为您创建一个 config.h 文件。接下来,您应该查看并编辑 config.h 文件(如果需要)。它允许您配置诸如将使用的安装目录以及服务器将支持的最大会话数和卷数等项目。真正重要的条目是

FILENAME_NW_INI       the location of the initialisation file
PATHNAME_PROGS        where the executable support programs will be found.
PATHNAME_BINDERY      where the 'bindery' files will go.
PATHNAME_PIDFILES     the directory for the 'pid' files to be written.
MAX_CONNECTIONS       the maximum number of simultaneous connections allowed.
MAX_NW_VOLS           the maximum number of volumes mars_nwe will support.
MAX_FILE_HANDLES_CONN the maximum number of open files per connection.
WITH_NAME_SPACE_CALLS if you want to support ncpfs clients.
INTERNAL_RIP_SAP      whether you want mars_nwe to provide rip/sap routing.
SHADOW_PWD            whether you use shadow passwords or not.

默认值可能没问题,但您还是应该检查一下。

完成此操作后

# make
# make install

将构建服务器并将它们安装在适当的目录中。安装脚本还会安装配置文件 /etc/nwserv.conf

配置服务器。

配置相当简单。您需要编辑 /etc/nwserv.conf 文件。此文件的格式乍一看可能有点神秘,但它相当简单明了。该文件包含许多单行配置项。每行都用空格分隔,并以一个数字开头,该数字指示行的内容。'#' 字符后面的所有字符都被视为注释并被忽略。Martin 在软件包中提供了一个示例配置文件,但我将提供我认为的简化示例,为您提供另一种选择。

# VOLUMES (max. 5)
# Only the SYS volume is compulsory. The directory containing the SYS
# volume must contain the directories: LOGIN, PUBLIC, SYSTEM, MAIL.
# The 'i' option ignores case.
# The 'k' option converts all filenames in NCP requests to lowercase.
# The 'm' option marks the volume as removable (useful for cdroms etc.)
# The 'r' option set the volume to read-only.
# The 'o' option indicates the volume is a single mounted filesystem.
# The 'P' option allows commands to be used as files.
# The 'O' option allows use of the OS/2 namespace
# The 'N' option allows use of the NFS namespace
# The default is upper case.
# Syntax:
#    1 <Volumename> <Volumepath>   <Options>

1   SYS         /home/netware/SYS/               # SYS
1   DATA        /home/netware/DATA/      k       # DATA
1   CDROM       /cdrom                   kmr     # CDROM

# SERVER NAME
# If not set then the linux hostname will be converted to upper case
# and used. This is optional, the hostname will be used if this is not
# configured.
# Syntax:
#    2 <Servername>

2   LINUX_FS01

# INTERNAL NETWORK ADDRESS
# The Internal IPX Network Address is a feature that simplifies IPX routing
# for multihomed hosts (hosts that have ports on more than one IPX network).
# Syntax:
#    3 <Internal Network Address> [<Node Number>]
# or:
#    3 auto
#
# If you use 'auto' then your host IP address will be used. NOTE: this may
# be dangerous, please be sure you pick a number unique to your network.
# Addresses are 4byte hexadecimal (the leading 0x is required).

3   0x49a01010  1


# NETWORK DEVICE(S)
# This entry configures your IPX network. If you already have your
# IPX network configured then you do not need this. This is the same as
# using ipx_configure/ipx_interface before you start the server.
# Syntax:
#    4 <IPX Network Number> <device_name> <frametype> [<ticks>]
#                         Frame types: ethernet_ii, 802.2, 802.3, SNAP

4  0x39a01010  eth0  802.3  1

# SAVE IPX ROUTES AFTER SERVER IS DOWNED
# Syntax:
#    5 <flag>
#       0 = don't save routes, 1 = do save routes

5 0

# NETWARE VERSION
# Syntax:
#    6 <version>
#      0 = 2.15, 1 = 3.11

6 1

# PASSWORD HANDLING
# Real Novell DOS clients support a feature which encypts your
# password when changing it. You can select whether you want your
# mars server to support this feature or not.
# Syntax
#    7 <flag>
#    <flag> is:
#        0 to force password encryption. (Clients can't change password)
#        1 force password encryption, allow unencrypted password change.
#        7 allow non-encrypted password but no empty passwords.
#        8 allow non-encrypted password including empty passwords.
#        9 completely unencrypted passwords (doesn't work with OS/2)

7 1

# MINIMAL GID UID rights
# permissions used for attachments with no login. These permissions
# will be used for the files in your primary server attachment.
# Syntax:
#    10 <gid>
#    11 <uid>
#    <gid> <uid> are from /etc/passwd, /etc/groups

10  200
11  201

# SUPERVISOR password
# May be removed after the server is started once. The server will
# encrypt this information into the bindery file after it is run.
# You should avoid using the 'root' user and instead use another
# account to administer the mars fileserver.
#
# This entry is read and encrypted into the server bindery files, so
# it only needs to exist the first time you start the server to ensure
# that the password isn't stolen.
#
# Syntax:
#    12 <Supervisor-Login> <Unix username> [<password>]

12  SUPERVISOR  terry  secret

# USER ACCOUNTS
# This associates NetWare logins with unix accounts. Password are
# optional.
# Syntax:
     13 <User Login> <Unix Username> [<password>]

13  MARTIN martin
13  TERRY  terry  

# LAZY SYSTEM ADMIN CONFIGURATION
# If you have a large numbers of users and could not be bothered using
# type 13 individual user mappings, you can automatically map mars_nwe
# logins to linux user names. BUT, there is currently no means of making
# use of the linux login password so all users configured this way are
# will use the single password supplied here. My recommendation is not
# to do this unless security is absolutely no concern to you.
# Syntax:
#    15 <flag> <common-password>
#    <flag> is: 0  - don't automatically map users.
#               1  - do automatically map users not configured above.
#               99 - automatically map every user in this way.

15  0  duzzenmatta

# SANITY CHECKING
# mars_nwe will automatically ensure that certain directories exist if
# you set this flag.
# Syntax:
#    16 <flag>
#    <flag> is 0 for no, don't, or 1 for yes, do.

16  0

# PRINT QUEUES
# This associates NetWare printers with unix printers. The queue
# directories must be created manually before printing is attempted.
# The queue directories are NOT lpd queues.
# Syntax:
#    21 <queue_name> <queue_directory> <unix_print_cmd>

21  EPSON  SYS:/PRINT/EPSON lpr -h
21  LASER  SYS:/PRINT/LASER lpr -Plaser

# DEBUG FLAGS
# These are not normally needed, but may be useful if are you debugging
# a problem.
# Syntax:
#    <debug_item> <debug_flag>
#
#    100 = IPX KERNEL
#    101 = NWSERV
#    102 = NCPSERV
#    103 = NWCONN
#    104 = start NWCLIENT
#    105 = NWBIND
#    106 = NWROUTED
#                 0 = disable debug, 1 = enable debug

100 0
101 0
102 0
103 0
104 0
105 0
106 0

# RUN NWSERV IN BACKGROUND AND USE LOGFILE
# Syntax:
#    200 <flag>
#        0 = run NWSERV in foreground and don't use logfile
#        1 = run NWSERV in background and use logfile

200  1

# LOGFILE NAME
# Syntax:
#    201 <logfile>

201  /tmp/nw.log

# APPEND LOG OR OVERWRITE
# Syntax:
#    202 <flag>
#        0 = append to existing logfile
#        1 = overwrite existing logfile

202  1

# SERVER DOWN TIME
# This item sets the time after a SERVER DOWN is issued that the
# server really goes down.
# Syntax:
#    210 <time>
#        in seconds. (defaults 10)

210  10

# ROUTING BROADCAST INTERVAL
# The time is seconds between server broadcasts
# Syntax:
#    211 <time>
#        in seconds. (defaults 60)

211  60

# ROUTING LOGGING INTERVAL
# Set how many broadcasts take place before logging of routing
# information occurs.
# Syntax:
#    300  <number>

300  5

# ROUTING LOGFILE
# Set the name of the routing logfile
# Syntax:
#    301 <filename>

301  /tmp/nw.routes

# ROUTING APPEND/OVERWRITE
# Set whether you want to append to an existing log file or
# overwrite it.
# Syntax:
#    302 <flag>
#        <flag> is 0 for append, 1 for create/overwrite

302  1

# WATCHDOG TIMING
# Set the timing for watchdog messages that ensure the network is
# still alive.
# Syntax:
#    310 <value>
#        <value> =   0 - always send watchdogs
#                  < 0 - (-ve) for disable watchdogs
#                  > 0 - send watchdogs when network traffic
#                        drops below 'n' ticks

310  7

# STATION FILE
# Set the filename for the stations file which determine which
# machines this fileserver will act as the primary fileserver for.
# The syntax of this file is described in the 'examples' directory
# of the source code.
# Syntax:
#    400 <filename>

400  /etc/nwserv.stations

# GET NEAREST FILESERVER HANDLING
# Set how SAP Get Nearest Fileserver Requests are handled.
# Syntax:
#    401 <flag>
#        <flag> is: 0 - disable 'Get Nearest Fileserver' requests.
#                   1 - The 'stations' file lists stations to be excluded.
#                   2 - The 'stations' file lists stations to be included.

401  2

启动服务器

如果您已将服务器配置为期望外部程序来配置您的网络和/或提供路由功能,那么您应该在启动服务器之前启动这些程序。假设您已将服务器配置为它将为您配置接口并提供路由服务,您只需发出命令

# nwserv

测试服务器

要测试服务器,您应该首先尝试从网络上的 NetWare 客户端连接并登录。然后,您从客户端设置 CAPTURE 并尝试打印。如果这两者都成功,则服务器正在工作。

10.2 lwared 软件包。

Ales Dryak <A.Dryak@sh.cvut.cz> 开发了 lwared,使 Linux 能够充当基于 NCP 的文件服务器。

Ales 将该软件包称为 lwared,它是 LinWare Daemon 的缩写。

lwared 的功能。

lwared 服务器能够提供 Novell NCP 完整功能的一个子集。它包含消息传递,但不提供任何打印功能。它目前与 Windows95 或 Windows NT 客户端的兼容性不是很好。lwared 服务器依赖外部程序来构建和更新 IPX 路由和 SAP 表。行为不端的客户端可能会导致服务器崩溃。重要的是,文件名转换功能尚未包含在内。

该服务器适用于 NETX 和 VLM NetWare shell。

获取 lwared

lwared 软件包可以为任何高于 1.2.0 的内核构建,我建议您使用 1.2.13 版本,因为这样做不需要内核补丁。一些 IPX 功能已随着 1.3.* 内核版本的更改而更改,这意味着现在需要补丁才能使其正常工作。新内核包含适当的补丁,因此如果您必须使用 alpha 内核,您仍然应该能够使 lwared 为您正常工作。

您可以通过匿名 ftp 从以下位置获取 lwared 软件包:klokan.sh.cvut.cz

或者从

sunsite.unc.edu 或镜像站点。撰写本文时,当前版本为:lwared-0.95.tar.gz

构建 lwared

解压 lwared 软件包

类似这样

# cd /usr/src
# tar xvpfz lwared-0.95.tar.gz

构建一个支持 Ethernet 和 IPX 的内核

如果您正在使用 alpha 1.3.* 内核,那么您应该尝试使用 1.3.17 或更高版本的内核,因为提供的补丁是针对它构建的。低于 1.3.171.3.* 内核将需要手动修补才能安装。(有关如何执行此操作的一些信息包含在软件包的 INSTALL 文件中。)。要针对 1.3.17 或更高版本的内核安装补丁,您应该尝试

# make patch

在应用补丁(如果需要)后,您需要做的下一件事是确保您的内核已构建并启用了 IPX 支持。在 1.2.13 版本内核中,您只需确保对问题 'The IPX protocol' 回答 Y,如图所示

 ...
 ...
Assume subnets are local (CONFIG_INET_SNARL) [y]
Disable NAGLE algorithm (normally enabled) (CONFIG_TCP_NAGLE_OFF) [n]
The IPX protocol (CONFIG_IPX) [n] y
*
* SCSI support
 ...
 ...
在较新的内核中,采用了类似的过程,但提示的实际文本可能略有变化。

您还需要确保包含适用于您的以太网卡的驱动程序。如果您不知道如何执行此操作,则应阅读 Ethernet-HOWTO

然后您可以继续构建您的内核。确保您记得在完成后运行 lilo 来安装它。

编译并安装 lwared

要编译 lwared,您应该首先检查 server/config.h 文件,并在必要时进行编辑。此文件包含各种设置,这些设置将控制您的服务器在运行时的行为方式。默认值是合理的,但您可能需要检查为日志文件和配置文件指定的目录是否适合您的系统。

# make depend
# make
# make install
我发现 'make depend' 抱怨找不到我系统上的 float.h 文件,但似乎仍然可以工作。我还发现,当我尝试使用 gcc 2.6.3 进行编译时,我发现我必须更改行
#include <net/route.h>
改为
#include <net/if_route.h>
lib/ipxkern.c 中,因为此文件有时会更改名称。

'make install' 将尝试将服务器和路由守护程序程序安装到您的 /usr/sbin 目录中,将 lwpasswd 程序安装到您的 /usr/bin 目录中,IPX 实用程序程序将安装到您的 /sbin 目录中,最后但并非最不重要的是,手册页将进入 /usr/man 目录结构。如果这些位置中有任何一个不适合您的系统,那么您应该编辑相关的 Makefile 并更改目标目录以适合您的系统。

配置和使用 lwared

现在是有趣的部分了!

配置 IPX 网络

您必须做的第一件事是配置您的以太网接口以支持您的服务器将支持的 IPX 网络。为此,您需要知道每个 LAN 段的 IPX 网络地址、哪个以太网设备(eth0eth1 等)位于哪个段上、每个 LAN 段使用的帧类型(802.3EtherII 等)以及您的服务器应使用的内部网络地址(如果您的服务器将服务于多个 LAN 段,则真正需要此地址)。对于位于两个不同网段的服务器的配置,IPX 网络地址为 23a9130023a91301,内部网络地址为 bdefaced,可能如下所示

# ipx_internal_net add BDEFACED 1
# ipx_interface add eth0 802.3 23a91300
# ipx_interface add eth1 etherii 23a91301

启动路由守护程序

内核软件本身实际上执行 IPX 数据包转发,就像它对 IP 所做的那样,但内核需要额外的程序来管理路由表更新。在 IPX 的情况下,需要两个守护程序,它们都随 lwared 提供:ipxripd 管理 IPX 路由信息,ipxsapd 管理 SAP 信息。要启动守护程序,您只需指定它们应将日志消息写入的位置

# ipxripd /var/adm/ipxrip
# ipxsapd /var/adm/ipxsap

配置 lwared 服务器

有两个文件您必须手动配置才能允许用户登录到您的 lwared 服务器。它们是

/etc/lwpasswd

这是 LinWare 用户帐户信息的保存位置。lwpasswd 程序用于保持其最新状态。在其最简单的形式中,/etc/lwpasswd 文件看起来像

ales:
terryd:
guest:
其格式是一个简单的登录 ID 列表,后跟一个 ':' 字符,然后是加密版本的登录密码。这里有几个重要的注意事项:没有加密密码意味着没有密码,LinWare 用户必须拥有 Linux 帐户,也就是说,您放在 /etc/lwpasswd 中的任何用户也必须出现在 /etc/passwd 中,并且 root 是唯一可以更改另一个 LinWare 用户密码的帐户。如果您以 root 身份登录,您可以更改 LinWare 用户的密码,如下面的记录所示
# lwpasswd rodg
Changing password for RODG
Enter new password: 
Re-type new password: 
Password changed.
/etc/lwvtab

这是 LinWare 卷表,它存储有关应向 LinWare 用户提供的目录的信息(此文件在性质上类似于 NFS /etc/exports 文件)。其格式的一个简单示例如下

SYS             /lwfs/sys
DATA            /lwfs/data
HOME            /home
格式很简单:卷名后跟空格,然后是要导出的 Linux 目录。您必须至少SYS 卷添加一个条目,服务器才能启动。如果您希望您的基于 DOS 的用户能够将您的 LinWare 服务器用作他们的主服务器,那么您必须在您导出为 SYS 卷的目录下方安装标准的 SYS 卷目录结构。由于这些文件是 Novell 公司的专有和版权所有,因此您应该拥有这些文件的许可证。如果您的用户将使用 Novell 文件服务器作为他们的主服务器,则这不是必需的。

启动 lwared 服务器。

哒哒!

# lwared
这几乎是一个虎头蛇尾,不是吗?好的,您有一个问题,对吗?正在广播的文件服务器名称是什么?如果您按照所示方式启动服务器,那么正在广播的 LinWare 服务器名称将基于 Linux hostname 返回的内容。如果您希望它是其他名称,那么您可以在启动服务器时为其指定名称,例如
# lwared -nlinux00
将启动名为 linux00 的服务器。

测试 lwared 服务器。

要测试的第一件事是您的 LinWare 服务器是否出现在网络上 DOS 客户端的 slist 中。slist 程序存储在 Novell 文件服务器的 SYS 卷上,因此您必须从已在某处登录的计算机执行此操作。如果这不成功,请检查 ipxsapdlwared 是否都在运行。如果 slist 成功,那么您应该尝试连接到服务器并映射一个卷

C:> attach linux00/ales
 ...
 ...
C:> map l:=linux00/data:
C:> l:
然后您应该能够像对待任何其他映射一样对待新映射。您将拥有的文件权限将基于允许与您的 LinWare 登录平行的 linux 帐户的权限。


下一页 上一页 目录