  NFS HOWTO
  Nicolai Langfeldt janl@math.uio.no,  Alex Ott
  ott@phtd.tpu.edu.ru
  v0.7, 3  1997

        NFS
  ______________________________________________________________________

  Table of Contents


  1. 

     1.1  
     1.2 
     1.3 

  2. README.first

  3.   NFS

     3.1  
     3.2  
     3.3 Portmapper
     3.4 Mountd  nfsd

  4.   NFS

     4.1  
     4.2  NFS

  5. NFS   

  6.   NFS

     6.1  
     6.2  : nfsd
     6.3  : portmapper
     6.4 NFS  firewall
     6.5 

  7.     

  8.    (FAQ)

  9.   

     9.1 IRIX, HP-UX, Digital-UNIX, Ultrix, SunOS 4 (Solaris 1), AIX
     9.2 Solaris 2

  10. PC-NFS



  ______________________________________________________________________

   ::      , 
  .



  11..  




  11..11..   

    Nicolai Langfeldt, 1997.    
    ,  ,   
   .  FAQ   NFS FAQ,  Alan
  Cox.        
  (checklist)  ,  IBM Corporation.


  11..22..  

        ,   
        --    
  .   ,  / 
  janl@math.uio.no.       ,
    ,       ,
           
        . .


       HOWTO    , 
          :-).


     Olaf Kirch,    
           :-)


   HOWTO   NFS,     2.0.x. 
    2.1.x     .


  11..33..  

     Anne Line Norheim Langfeldt.   
     ,       ,
    .


  22..  RREEAADDMMEE..ffiirrsstt

  NFS --- Network File System (  )  
   :


          .

         .

          ,  
             
      (, , )    .


          . ,
  ,           
         .
          
      IP    
  .      ,     
       HOWTO     
   TCP/IP,     TCP/IP.  
     ,     
   UNIX/Linux.       --  
  _T_C_P_/_I_P _N_e_t_w_o_r_k _A_d_m_i_n_i_s_t_r_a_t_i_o_n,  Craig Hunt  
  O'Reilly & Associates, Inc.   ,     
          ,    
    ;-)


            
     NFS,    ______ ________ _______
  ____________  _F_A_Q_s.   ,  -  
  ,  .


  33..    NNFFSS

  33..11..   

   ,         
     telnet  ,   
      .  -  ,  
   NET-3 HOWTO     .


  33..22..   

   ,     -   
   NFS.        ,
          NFS. ,
              
         ,     
            ``
   NFS''


      -Linux   ,   
      ,   
     NFS     
  NFS.  ,        
   .  ,    ,    
        . 
     ,    ,   
            .


  ,    ,      .


  33..33..  PPoorrttmmaappppeerr

  Portmapper  Linux   portmap  rpc.portmap.
       ,   "
    DARPA     RPC".  
     ,      .
   ,         `` 
  '',      .


   portmapper.    portmap,  rpc.portmap 
      /usr/sbin (   
   rpcbind).      ,  
        ,   
   / rc-.  
  rc-       init. 
      /etc/rc.d, /etc/init.d 
  /etc/rc.d/init.d.    ,  inet,    
   .  ,       
    ,     
  .  portmap,  ,     
   ps aux.   ? .
  33..44..  MMoouunnttdd  nnffssdd

   ,      --  mountd 
  nfsd.      .   /etc/exports.
    ,    /mn/eris/local, 
     eris      apollon.
        /etc/exports   eris 
  :


  ______________________________________________________________________
  /mn/eris/local  apollon(rw)
  ______________________________________________________________________



      apollon   / 
   /mn/eris/local.  rw    ro,  
      (    ,   
      .   ,  
    ,       , 
     .      
  exports,          .
     ,      
  exports.      ,   
    NIS ( NYS) (NIS    YP), 
     (wild cards)    IP 
   ,   - .   
  ,       
  ,      .

  ::   eexxppoorrttss     ,, 
     UUnniixx..      
    exports  Unix-.


        mountd (   
  rpc.mountd)  nfsd (   rpc.nfsd).    
      exports.


      /etc/exports,     ,
   nfsd  mountd   ,   .   
    --    exportfs.  
   Linux  exportfs .   , 
         :


  ______________________________________________________________________
  #!/bin/sh
  killall -HUP /usr/sbin/rpc.mountd
  killall -HUP /usr/sbin/rpc.nfsd
  echo re-exported file systems
  ______________________________________________________________________




     ,  /usr/sbin/exportfs,   
      chmod a+rx. ,   , 
     exports,     exportfs,
    .


     ,  mountd  nfsd  .
        rpcinfo -p.  
    -   :


  ______________________________________________________________________
     program vers proto   port
      100000    2   tcp    111  portmapper
      100000    2   udp    111  portmapper
      100005    1   udp    745  mountd
      100005    1   tcp    747  mountd
      100003    2   udp   2049  nfs
      100003    2   tcp   2049  nfs
  ______________________________________________________________________




     portmapper   ,   mountd  nfsd
  .


      rpcinfo: can't contact portmapper: RPC:
  Remote system error - Connection refused  -  
  ,   portmapper  .   .  
    No remote programs registered.,   portmapper
      ,  -   . 
   nfsd, mountd  portmapper    
   .


    ,  portmapper  ,   
        ps. Portmapper 
          
      .    
   ps   ,   ,  - 
  .


         rc-  
  mountd  nfsd  .  ,    
     ,      
          .


   ,     : portmap, mountd,
  nfsd  exports.


        ,      
      NFS.


  44..    NNFFSS

           NFS, 
    ,    .  
    .      ,  
      Rernel HOWTO     .
       (  RedHat)  
         (  
    ;-),  ,   nfs    .


    ,    , 
         
  .        
  /mn/eris/local   eris.      :
  ______________________________________________________________________
  mount -o rsize=1024,wsize=1024 eris:/mn/eris/local /mnt
  ______________________________________________________________________




  (     rsize  wsize).   
    /mnt           ls,
      .  ,   
          , 
     ftp.     
   mount     mount: eris:/mn/eris/local
  failed, reason given by server: Permission denied,   exports
        exportfs 
    exports.    mount
  clntudp_create: RPC: Program not registered  ,  nfsd 
  mountd    .


         :


  ______________________________________________________________________
  umount /mnt
  ______________________________________________________________________




        nfs 
  ,     /etc/fstab  
   .      :


  ______________________________________________________________________
  # device      mountpoint     fs-type     options              dump fsckorder
  ...
  eris:/mn/eris/local  /mnt    nfs        rsize=1024,wsize=1024 0    0
  ...
  ______________________________________________________________________




    ,  .   .


  44..11..   

     ,    
  ,     .   , 
   NFS      
  .    NFS  ,      
  ,     .  
     :


     ssoofftt
        NFS      ,  
               ,
          NFS.    
           ,    
         .      .


     hhaarrdd
                NFS
              
          .         
        ,       intr.   NFS 
         ,     
           .    ,   .
            hard,intr   
           NFS.



    ,     fstab  
   :


  ______________________________________________________________________
  # device      mountpoint     fs-type    options                  dump fsckorder
  ...
  eris:/mn/eris/local  /mnt    nfs        rsize=1024,wsize=1024,hard,intr 0 0
  ...
  ______________________________________________________________________





  44..22..   NNFFSS

  ,     rsize  wsize,  NFS   
     4096   8192 .   
  Linux         ,  
    .      
    rsize  wsize,    , 
   .       
       .  
           , 
      
  :


  ______________________________________________________________________
  time dd if=/dev/zero of=/mnt/testfile bs=16k count=4096
  ______________________________________________________________________




     64Mb ,    (
      ,  , 
        ,
     ,      ).
       (5-10?)   
  .   --   `', .. 
       .   
    ,     
  :


  ______________________________________________________________________
  time dd if=/mnt/testfile of=/dev/null bs=16k
  ______________________________________________________________________




         . 
        , 
    rsize  wsize.    
   1024,     16384 ,  
       NFS  2.  
        
        ls,  
  ,  ,    .   rsize/wsize
   ,   _____     100% .
          
   'ls',     .   
       .  ,  
  ,    rsize/wsize ,  
     .  
        . SunOS 
  Solaris   ,      
   4096 ,    .


    Linux (  1.3)    
   rsize      . 
   Intel    4096 . 
   ___________   NFS  . 
       Intel    
   rsize  4096 .


  ,     /etc/fstab  
    rsize/wsize.


      NFS    
      .  NFS ,
    NFS        
    ( ).    ,
          NFS.
   nfsd  Linux     , 
     Linux     , 
       Linux    
    ,     exports:


  ______________________________________________________________________
  /dir    -async,access=linuxbox
  ______________________________________________________________________




   - .     exports
    .  ,     
  .


  55..  NNFFSS   

       , ISDN    
   .


         ,   
   .       
  6  (     ),     
      .   
  ,      :-)

       ,  NFS --  .
   NFS      
  kermit   .  -- _______.     NFS.
  FTP . HTTP .  rcp . ssh .


         ? Ok.


      NFS     
     .     
        ,    
     ,  ,  
  ,   ,        
     .


  ,     --  __  
   soft.     
      .    
        .  
     .    
   hard.    hard,   
        
  .  ,    .


   ,    --   
    timeo  retrans.    
   nfs(5),     :


  ______________________________________________________________________
         timeo=n              
                            RPC. 
                            7 
                        .   ,  
                           ,  
                            
                         60 ,   
                        ,   .  
                             hard, 
                             
                             ,  
                         ,    
                         .   
                         60 .  
                           
                            
                         ,   , 
                          .

         retrans=n          
                          ,  
                            . 
                            3.  
                         ,    
                             
                        "server  not responding".
  ______________________________________________________________________




   :         0.7
   (700ms),   NFS      
   ,  1.4 .       1.4 ,
           2.8 .


          ping  
    ,   rsize/wsize.


  ______________________________________________________________________
  $ ping -s 8192 lugulbanda
  PING lugulbanda.uio.no (129.240.222.99): 8192 data bytes
  8200 bytes from 129.240.222.99: icmp_seq=0 ttl=64 time=15.2 ms
  8200 bytes from 129.240.222.99: icmp_seq=1 ttl=64 time=15.9 ms
  8200 bytes from 129.240.222.99: icmp_seq=2 ttl=64 time=14.9 ms
  8200 bytes from 129.240.222.99: icmp_seq=3 ttl=64 time=14.9 ms
  8200 bytes from 129.240.222.99: icmp_seq=4 ttl=64 time=15.0 ms

  --- lugulbanda.uio.no ping statistics ---
  5 packets transmitted, 5 packets received, 0% packet loss
  round-trip min/avg/max = 14.9/15.1/15.9 ms
  ______________________________________________________________________




         ping   
     lugulbanda.  15ms   .   
      28.000     -
  4000-5000ms,      -,    
  ,     .    ,   
   ' '.        
      .  timeo
      .   
         :  
     FTP  NFS     ,   
     ping    FTP  
  .


  66..    NNFFSS

           
  .     _________    
  .   :       
        NFS,    ,
         ,    
  ,     .


       ,     ________
  ,     ,       
          . , 
    dial-  ,      
    ,     ,    .
     ?   .    
  . ____________     
  ,        
    .


    NFS  ,  ,   , 
     .    .  , 
      NFS ,    
       .  .
       ,    
  .
      --    CERT
    NFS.    ,  
  ,    CERT.  ftp.cert.org/01-README
       CERT. 
      NFS  :


  ______________________________________________________________________
  CA-91:21.SunOS.NFS.Jumbo.and.fsirand                            12/06/91
             (NFS) Sun
       Microsystems, Inc. (Sun)   fsirand.  
          SunOS 4.1.1, 4.1, and 4.0.3  
       .  (Patches)   SunOS
       4.1.1.      SunOS 4.1 NFS. Sun
            SunOS 4.1  SunOS 4.0.3 .

  CA-94:15.NFS.Vulnerabilities                                    12/19/94
           
               
           (NFS).      
          ,   
          .

  CA-96.08.pcnfsd                                                 04/18/96
               pcnfsd
       (   rpc.pcnfsd).    
       .
  ______________________________________________________________________




  66..11..   

       ,      
   .    ,  
  . ,      
    suid    NFS,   
   nosuid.        ,
     NFS  .  , 
         
  suid-   ,     
         suid-
        .  
          
    noexec.        
  nosuid,        
  _________ ,  ,   . 
            rsize 
  wsize,   .


  66..22..   :: nnffssdd

       ,     
   .       root_squash
    exports:


  ______________________________________________________________________
  /mn/eris/local apollon(rw,root_squash)
  ______________________________________________________________________




  ,    UID 0    
    (, , ),   
    UID  `nobody'  . 
  ,        
   ,        
     .     
    root_squash    
  .  ,  "    
    'su',       
        ".   
  : "   ,     Unix  NFS.  
    :       
    root,    bin  
   -,    
        .  
   NFSd     ,    
  ,   ()  -   .  
         UID  GID. 
      Linux NFSd.


   root_squash      NFSd 
  Linux,       
      no_root_squash.


    ,   ,  , 
  nfsd ,       .
           , 
        ,
      Internet.   ""  
   nfs   ,    
  ,    . NFSD  Linux  
    ,       
     .      
   nfsd    .


   .        
   'localhost'  127.0.0.1.  .


  66..33..   :: ppoorrttmmaappppeerr

   portmapper,    nfsd   
  ,        NFS
   - .   portmapper  Linux 
      ,    
         .


      /etc/hosts.deny.   
  


  ______________________________________________________________________
  portmap: ALL
  ______________________________________________________________________




     ____.     ,
      ,   /etc/hosts.allow.
      ,    .   
    ,      
  portmapper.     Linux  
         . Portmapper
   nfsd, mountd, ypbind/ypserv, pcnfsd,  'r' , 
   ruptime  rusers.    nfsd, mountd, ypbind/ypserv 
   pcnfsd  -  .  ,
           
    .     129.240.223.254  
     129.240.223.0,       
    (   HOWTO  ,    
    ,   ).     
   hosts.allow


  ______________________________________________________________________
  portmap: 129.240.223.0/255.255.255.0
  ______________________________________________________________________



    ,    ,     route 
   ,     ifconfig.  
  eth0    ifconfig  


  ______________________________________________________________________
  ...
  eth0      Link encap:10Mbps Ethernet  HWaddr 00:60:8C:96:D5:56
            inet addr:129.240.223.254  Bcast:129.240.223.255  Mask:255.255.255.0
            UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
            RX packets:360315 errors:0 dropped:0 overruns:0
            TX packets:179274 errors:0 dropped:0 overruns:0
            Interrupt:10 Base address:0x320
  ...
  ______________________________________________________________________



    netstat -rn  


  ______________________________________________________________________
  Kernel routing table
  Destination     Gateway         Genmask         Flags Metric Ref Use    Iface
  ...
  129.240.223.0   0.0.0.0         255.255.255.0   U     0      0   174412 eth0
  ...
  ______________________________________________________________________



  (     ).

   hosts.deny  hosts.allow      
   .


  :: __     ______,  _I_P _______  
    portmap.      
  portmap,     ,   portmap,
   ...


        .
     ,  -   (
   MS-DOS)  ,     
        ,  
  ,    .


  66..44..  NNFFSS  ffiirreewwaallll

       nfs  portmap   firewall 
   . Nfsd    2049,  
   -- udp  tcp. Portmapper    111, tcp  udp, 
  mountd    745  747, tcp  udp.  . 
      ,   rpcinfo
  -p.


      NFS  firewall,    
    NFSd  mountd,  ,    
   ,      firewall.


  66..55..  

     hosts.allow/deny, root_squash, nosuid 
       portmapper/nfs, 
        nfs    
    .   :     
   ,  /       
  .forward   ,  /home  /var/spool/mail
    NFS.    ,    
        PGP  nfs.  
         .     
   .


  NFS  portmapper       
  ,    ,    , 
   ,   .     ,
   - .   .    
   ,       
  comp.os.linux.announce  comp.security.announce.


  77..      

         , 
     IBM Corp.     ,   
        .    
        NFS,  
    ,        .
         .


  1.    ,    
      .


     ::  


  2.          
      exports.


     :     
     johnmad,   johnmad   johnmad.austin.ibm.com 
      .


     ::       .


       ,    2    
              
       .


     ::   .


        ,      
     lookuphostbyname  lookuphostbyaddr (  ) 
     . ,      host <name>;
     host <ip_addr>;          .


     ::    .


  3.    ,    NFS  
     (  ).       
     ,     .


     ::  NFSd    .


     :: ,      
              
       .


  4.         ( 
      make).


     ::   .


      HOWTO   NTP   .
          NTP  US,  
       NTP  debian, redhat  slackware 
     ftp://ftp.hacktic.nl/pub/replay/pub/linux   -.


  5.      ,  
        8 .


     ::      
           .



  88..     ((FFAAQQ))

       (FAQ).    
  Alan Cox.


  1.      'stale nfs handle (
      nfs)'   Linux   nfs.

             nfsd. 
       nfs-server2.2beta16   .
  2.         


        can't register with portmap: system error on send
        (     portmap:    )





      Caldera.     rc.
     Caldera   .


  3.           NFS
     ?

       ,  nfsd     
       (,    
      ).  nfsd    ( 
      ,    ),     
      . Nfsds      95  
         ,    
          .


  4.    NFS       

        NFS  Linux     
     .     ``exports''  nfsd. 
        /etc/exports.


  5.       nfs  linux   
      ls       .

        Linux     NFS  
     rsize=1024,wsize=1024.


  6.       NFS  Linux  
       3500-4000       Linux

        .


  7.  Linux  NFS  TCP

     


  8.          
     Linux.

     ,      8  
      .    .


  9.          
         NFS.

         NFS    ,
       ,   ,   
       .     
     umount -avt nonfs.

  10.
      NFS  Linux       
     Sun  BSD.


      NFS     (   ,
       ,      ).  
     ,     BSD     
     .      4K     Linux
      1K ,  BSD    


                  4K
                1K
                  4K   
                  4K
                1K
                  4K   
                ....







  99..    

        NFS  
     .    
  Linux  Solaris 2.      
       .    
    ,      
   .   : nfsd, system
  administration tool (  ), rc
  scripts, boot scripts, boot sequence, /etc/exports, exportfs.   
       :  
    /mn/eris/local   apollon   
  /.


  99..11..  IIRRIIXX,, HHPP--UUXX,, DDiiggiittaall--UUNNIIXX,, UUllttrriixx,, SSuunnOOSS 44 ((SSoollaarriiss 11)),, AAIIXX

        Sun 
  .   /etc/exports :


  ______________________________________________________________________
  /mn/eris/local -rw=apollon
  ______________________________________________________________________



        exports. 
     exportfs -av  
   .


     exportfs .  
      ,   
   :





  ______________________________________________________________________
  /mn/eris/local apollon
  ______________________________________________________________________



     :


  ______________________________________________________________________
  /mn/eris/local rw=apollon
  ______________________________________________________________________



     .  ,   
  exportfs        .


  99..22..  SSoollaarriiss 22

  Sun      Solaris 2.   
       . ,   
   --    /etc/dfs/dfstab.    
      ,    
    share(1M).    :


  ______________________________________________________________________
  share -o rw=apollon -d "Eris Local" /mn/eris/local
  ______________________________________________________________________



      shareall  
   .


  1100..  PPCC--NNFFSS

      PC-NFS.    samba.


  :      PC-NFS.  -   
  ,         .





















