HP-UX环境下如何配置NFS

来源:岁月联盟 编辑:zhu 时间:2008-03-31
HP-UX环境下如何配置NFS内容简介:一般按照如下步骤来配置NFS: 1. Meet pre-NFS configuration requirements on Client and Server 2. Meet NFS software requirements on Client and Server 3. Start Server daemons 4. Start Client daemons 5. Configure 一般按照如下步骤来配置NFS:
      1. Meet pre-NFS configuration requirements on Client and Server
      2. Meet NFS software requirements on Client and Server
      3. Start Server daemons
      4. Start Client daemons
      5. Configure NFS on Server
      6. Configure NFS on Client
      7. Verify Server configuration
      8. Verify Client configuration
 
   下面,就详细讲解以上步骤的具体配置方法。

   1. Meet pre-NFS configuration requirements on Client and Server
      (1)网卡的状态用ioscan -fnC lan查到的为CLAIMED
      (2)hostname的配置
      (3)IP地址和子网掩码的配置
      (4)route的配置
      (5)/etc/hosts文件的配置,将IP地址和hostname对应起来

   2. Meet NFS software requirements on Client and Server
      (1)NFS fileset loaded?
         用swlist -l product | grep -i nfs命令来查看相关的NFS软件是否安装了,如果没有安装,则使用swinstall命令安装相应的软件。
      (2)Drivers/subsystems in kernel?
         可以使用“sam”来进行确认。

   3. Start Server daemons
      与NFS server有关的后台进程有如下几个:
         (1)portmap
            Dynamic port assignment daemon used by NFS
         (2)nfsd
            NFS server data daemons that are usually started 4 at a time
         (3)mountd
            NFS server that responds to client mount requests
      可以按照如下步骤来启动nfsd和mountd进程:
         (1)配置/etc/rc.config.d/nfsconf,配置以下几个信息:
            NFS_SERVER=1 #(start nfsd)
            NUM_NFSD=4  #(start four of them)
            MOUNTD_OPTIONS="" #(no mountd options shown here)
            START_MOUNTD=1 #(start mountd)
         (2)配置完以上信息以后,重新启动将激活以上的修改配置
      说明:每次系统启动的时候,portmap会被/sbin/rc2.d/S400nfs.core自动启动。

   4. Start Client daemons
      与NFS client有关的后台进程有如下几个:
         (1)portmap
            Dynamic port assignment daemon, used by NFS
         (2)bion
            NFS client data daemons that are usually started 4 at a time
         (3)automount
            Optional NFS client. Dynamic mounting/unmounting daemon
      可以按照如下方法来启动biod和automount进程:
         (1)编辑/etc/rc.config.d/nfsconf, 配置以下几个信息:
            NFS_CLIENT=1   #(start biod)
            NUM_NFSIOD=4   #(start four of them)
            AUTOMOUNT=1    #(start automount)
            AUTO_MASTER="/etc/auto_master" #(automount configuration file)
            AUTO_OPTIONS="-f $AUTO_MASTER" #(use the file above)
         (2)重新启动系统以后,以上配置将会生效

   5. Configure NFS on Server
      (1)确认第三步的配置已经修改完成,而且相应的后台进程已经启动
      (2)确认要exported to clients的文件系统
      (3)确认exported to clients的文件系统有权限被client access
      (4)Optional: Determine if there is any logical grouping of clients that could make use of a "netgroup" name. Referring to this "netgroup" name in configuration files would automatically include all clients defined as a part of the "netgroup".
         看看如下例子:
         #vi /etc/netgroup
         examplegroup1 (host_a,,) (host_b,,) (host_x,,)
         In this example, referring to the "netgroup" name examplegroup1 in a configuration file automatically means host_a, host_b, and host_x.
      (5)Using the decisions made in steps 2 & 3 above, create the export configuration, for example:
         #vi /etc/exports
         /opt/app1
         /usr/share host_c host_d examplegroup1
         In this example, we are exporting 2 file systems: /opt/app1 and /usr/share. Since there no hostname after /opt/app1, we are exporting them to everyone (any system can mount or import them). Since we have names following /usr/share, we are restricting the systems who can mount or import /usr/share to host_c, host_d and all clients who are a part of "netgroup"(examplegroup1 (host_a, host_b, and host_x)).
      (6)If the NFS server daemons weren't running in step 1, reboot the system. If they are already running, type:
         #exportfs -a
      NOTE: Any time you modify /etc/exports after this step, use the -u option with exportfs to unexport the filesystem(s) whose entry was modified and then repeat this step.

   6. Configure NFS on Client
      (1)确认第四步的配置已经修改完成,而且相应的后台进程已经启动,可以用ps -ef命令来查看portmap, nfsd, mountd进程
      (2)用如下命令来确认server的配置:
         #exportfs
         #showmount -e host_a (在这里,host_a是server的hostname)
         #more /etc/netgroup

   7. Verify Client configuration
      (1)Verify that NFS client daemons are running by typing "ps -ef" and looking for the following processes:
         a. portmap
         b. biod (Multiple occurences running)
         c. automount (optional on-demand mounts only)
      (2)See what is currently mounted by typing "mount"
      (3)See what is supposed to be mountd by looking at:
         a. /etc/fstab
         b. /etc/auto_master (optional on-demand mounts only)

图片内容