Escolar Documentos
Profissional Documentos
Cultura Documentos
Name
nfs - nfs and nfs4 fstab format and options
Synopsis
/etc/fstab
Description
The fstab file contains information about which filesystems to mount where and with what options. For NFS
mounts, it contains the server name and exported server directory to mount from, the local directory that is
the mount point, and the NFS specific options that control the way the filesystem is mounted.
Three different versions of the NFS protocol are supported by the Linux NFS client: NFS version 2, NFS
version 3, and NFS version 4. To mount via NFS version 2, use the nfs file system type and specify
nfsvers=2. To mount via NFS version 3, use the nfs file system type and specify nfsvers=3. Version 3 is the
default protocol version for the nfs file system type when nfsvers= is not specified on the mount command.
To mount via NFS version 4, use the nfs4 file system type. The nfsvers= keyword is not supported for the
nfs4 file system type.
These file system types share similar mount options; the differences are listed below.
Here is an example from an /etc/fstab file for an NFSv2 mount over UDP.
server:/usr/local/pub /pub nfs rsize=32768,wsize=32768,timeo=14,intr
Here is an example for an NFSv4 mount over TCP using Kerberos 5 mutual authentication.
server:/usr/local/pub /pub nfs4 proto=tcp,sec=krb5,hard,intr
Options for the nfs file system type
rsize=n
The number of bytes NFS uses when reading files from an NFS server. The rsize is negotiated between the
server and client to determine the largest block size that both can support. The value specified by this option
is the maximum size that could be used; however, the actual size used may be smaller. Note: Setting this
size to a value less than the largest supported block size will adversely affect performance.
wsize=n
The number of bytes NFS uses when writing files to an NFS server. The wsize is negotiated between the
server and client to determine the largest block size that both can support. The value specified by this option
is the maximum size that could be used; however, the actual size used may be smaller. Note: Setting this
size to a value less than the largest supported block size will adversely affect performance.
timeo=n
The value in tenths of a second before sending the first retransmission after an RPC timeout. The default
value is 7 tenths of a second. After the first timeout, the timeout is doubled after each successive timeout
until a maximum timeout of 60 seconds is reached or the enough retransmissions have occured to cause a
major timeout. Then, if the filesystem is hard mounted, each new timeout cascade restarts at twice the initial
value of the previous cascade, again doubling at each retransmission. The maximum timeout is always 60
seconds. Better overall performance may be achieved by increasing the timeout when mounting on a busy
network, to a slow server, or through several routers or gateways.
retrans=n
The number of minor timeouts and retransmissions that must occur before a major timeout occurs. The
default is 3 timeouts. When a major timeout occurs, the file operation is either aborted or a "server not
responding" message is printed on the console.
acregmin=n
The minimum time in seconds that attributes of a regular file should be cached before requesting fresh
information from a server. The default is 3 seconds.
acregmax=n
The maximum time in seconds that attributes of a regular file can be cached before requesting fresh
information from a server. The default is 60 seconds.
acdirmin=n
The minimum time in seconds that attributes of a directory should be cached before requesting fresh
information from a server. The default is 30 seconds.
acdirmax=n
The maximum time in seconds that attributes of a directory can be cached before requesting fresh
information from a server. The default is 60 seconds.
actimeo=n
Using actimeo sets all of acregmin, acregmax, acdirmin, and acdirmax to the same value. There is no default
value.
retry=n
The number of minutes to retry an NFS mount operation in the foreground or background before giving up.
The default value for forground mounts is 2 minutes. The default value for background mounts is 10000
minutes, which is roughly one week.
namlen=n
When an NFS server does not support version two of the RPC mount protocol, this option can be used to
specify the maximum length of a filename that is supported on the remote filesystem. This is used to support
the POSIX pathconf functions. The default is 255 characters.
port=n
The numeric value of the port to connect to the NFS server on. If the port number is 0 (the default) then
query the remote host's portmapper for the port number to use. If the remote host's NFS daemon is not
registered with its portmapper, the standard NFS port number 2049 is used instead.
proto=n
Mount the NFS filesystem using a specific network protocol instead of the default TCP protocol. Valid
protocol types are udp and tcp.
mountport=n
The numeric value of the mountd port. mounthost=name The name of the host running mountd .
mountprog=n
Use an alternate RPC program number to contact the mount daemon on the remote host. This option is
useful for hosts that can run multiple NFS servers. The default value is 100005 which is the standard RPC
mount daemon program number.
mountvers=n
Use an alternate RPC version number to contact the mount daemon on the remote host. This option is useful
for hosts that can run multiple NFS servers. The default value depends on which kernel you are using.
nfsprog=n
Use an alternate RPC program number to contact the NFS daemon on the remote host. This option is useful
for hosts that can run multiple NFS servers. The default value is 100003 which is the standard RPC NFS
daemon program number.
nfsvers=n
Use an alternate RPC version number to contact the NFS daemon on the remote host. This option is useful
for hosts that can run multiple NFS servers. The default value depends on which kernel you are using.
vers=n
vers is an alternative to nfsvers and is compatible with many other operating systems.
nolock
Disable NFS locking. Do not start lockd. This has to be used with some old NFS servers that don't support
locking.
bg
If the first NFS mount attempt times out, retry the mount in the background. After a mount operation is
backgrounded, all subsequent mounts on the same NFS server will be backgrounded immediately, without
first attempting the mount. A missing mount point is treated as a timeout, to allow for nested NFS mounts.
fg
If the first NFS mount attempt times out, retry the mount in the foreground. This is the complement of the bg
option, and also the default behavior.
soft
If an NFS file operation has a major timeout then report an I/O error to the calling program. The default is to
continue retrying NFS file operations indefinitely.
hard
If an NFS file operation has a major timeout then report "server not responding" on the console and continue
retrying indefinitely. This is the default.
intr
If an NFS file operation has a major timeout and it is hard mounted, then allow signals to interupt the file
operation and cause it to return EINTR to the calling program. The default is to not allow file operations to be
interrupted.
posix
Mount the NFS filesystem using POSIX semantics. This allows an NFS filesystem to properly support the
POSIX pathconf command by querying the mount server for the maximum length of a filename. To do this,
the remote host must support version two of the RPC mount protocol. Many NFS servers support only
version one.
nocto
Suppress the retrieval of new attributes when creating a file.
noac
Disable all forms of attribute caching entirely. This extracts a significant performance penalty but it allows two
different NFS clients to get reasonable results when both clients are actively writing to a common export on
the server.
noacl
Disables Access Control List (ACL) processing.
sec=mode
Set the security flavor for this mount to "mode". The default setting is sec=sys, which uses local unix uids
and gids to authenticate NFS operations (AUTH_SYS). Other currently supported settings are: sec=krb5,
which uses Kerberos V5 instead of local unix uids and gids to authenticate users; sec=krb5i, which uses
Kerberos V5 for user authentication and performs integrity checking of NFS operations using secure
checksums to prevent data tampering; and sec=krb5p, which uses Kerberos V5 for user authentication and
integrity checking, and encrypts NFS traffic to prevent traffic sniffing (this is the most secure setting). Note
that there is a performance penalty when using integrity or privacy.
tcp
Mount the NFS filesystem using the TCP protocol. This is the default protocol.
udp
Mount the NFS filesystem using the UDP protocol instead of the default TCP protocol.
nordirplus
Disables NFSv3 READDIRPLUS RPCs. Use this options when mounting servers that don't support or have
broken READDIRPLUS implementations.
nosharecache
As of kernel 2.6.18, it is no longer possible to mount the same same filesystem with different mount options
to a new mountpoint. It was deemed unsafe to do so, since cached data cannot be shared between the two
mountpoints. In consequence, files or directories that were common to both mountpoint subtrees could often
be seen to be out of sync following an update.
This option allows administrators to select the pre-2.6.18 behaviour, permitting the same filesystem to be
mounted with different mount options.
Beware: Use of this option is not recommended unless you are certain that there are no hard links or
subtrees of this mountpoint that are mounted elsewhere.
fsc
Enable the use of persistent caching to the local disk using the FS-Cache facility for the given mount point.
All of the non-value options have corresponding nooption forms. For example, nointr means don't allow file
operations to be interrupted.
Options for the nfs4 file system type
rsize=n
The number of bytes nfs4 uses when reading files from the server. The rsize is negotiated between the
server and client to determine the largest block size that both can support. The value specified by this option
is the maximum size that could be used; however, the actual size used may be smaller. Note: Setting this
size to a value less than the largest supported block size will adversely affect performance.
wsize=n
The number of bytes nfs4 uses when writing files to the server. The wsize is negotiated between the server
and client to determine the largest block size that both can support. The value specified by this option is the
maximum size that could be used; however, the actual size used may be smaller. Note: Setting this size to a
value less than the largest supported block size will adversely affect performance.
timeo=n
The value in tenths of a second before sending the first retransmission after an RPC timeout. The default
value depends on whether proto=udp or proto=tcp is in effect (see below). The default value for UDP is 7
tenths of a second. The default value for TCP is 60 seconds. After the first timeout, the timeout is doubled
after each successive timeout until a maximum timeout of 60 seconds is reached or the enough
retransmissions have occured to cause a major timeout. Then, if the filesystem is hard mounted, each new
timeout cascade restarts at twice the initial value of the previous cascade, again doubling at each
retransmission. The maximum timeout is always 60 seconds.
retrans=n
The number of minor timeouts and retransmissions that must occur before a major timeout occurs. The
default is 5 timeouts for proto=udp and 2 timeouts for proto=tcp. When a major timeout occurs, the file
operation is either aborted or a "server not responding" message is printed on the console.
acregmin=n
The minimum time in seconds that attributes of a regular file should be cached before requesting fresh
information from a server. The default is 3 seconds.
acregmax=n
The maximum time in seconds that attributes of a regular file can be cached before requesting fresh
information from a server. The default is 60 seconds.
acdirmin=n
The minimum time in seconds that attributes of a directory should be cached before requesting fresh
information from a server. The default is 30 seconds.
acdirmax=n
The maximum time in seconds that attributes of a directory can be cached before requesting fresh
information from a server. The default is 60 seconds.
actimeo=n
Using actimeo sets all of acregmin, acregmax, acdirmin, and acdirmax to the same value. There is no default
value.
retry=n
The number of minutes to retry an NFS mount operation in the foreground or background before giving up.
The default value for forground mounts is 2 minutes. The default value for background mounts is 10000
minutes, which is roughly one week.
port=n
The numeric value of the port to connect to the NFS server on. If the port number is 0 (the default) then
query the remote host's portmapper for the port number to use. If the remote host's NFS daemon is not
registered with its portmapper, the standard NFS port number 2049 is used instead.
proto=n
Mount the NFS filesystem using a specific network protocol instead of the default TCP protocol. Valid
protocol types are udp and tcp. Many NFS version 4 servers only support the TCP protocol.
clientaddr=n
On a multi-homed client, this causes the client to use a specific callback address when communicating with
an NFS version 4 server. This option is currently ignored.
sec=mode
Same as sec=mode for the nfs filesystem type (see above).
bg
If an NFS mount attempt times out, retry the mount in the background. After a mount operation is
backgrounded, all subsequent mounts on the same NFS server will be backgrounded immediately, without
first attempting the mount. A missing mount point is treated as a timeout, to allow for nested NFS mounts.
fg
If the first NFS mount attempt times out, retry the mount in the foreground. This is the complement of the bg
option, and also the default behavior.
soft
If an NFS file operation has a major timeout then report an I/O error to the calling program. The default is to
continue retrying NFS file operations indefinitely.
hard
If an NFS file operation has a major timeout then report "server not responding" on the console and continue
retrying indefinitely. This is the default.
intr
If an NFS file operation has a major timeout and it is hard mounted, then allow signals to interupt the file
operation and cause it to return EINTR to the calling program. The default is to not allow file operations to be
interrupted.
nocto
Suppress the retrieval of new attributes when creating a file.
noac
Disable attribute caching, and force synchronous writes. This extracts a server performance penalty but it
allows two different NFS clients to get reasonable good results when both clients are actively writing to
common filesystem on the server.
nosharecache
As of kernel 2.6.18, it is no longer possible to mount the same same filesystem with different mount options
to a new mountpoint. It was deemed unsafe to do so, since cached data cannot be shared between the two
mountpoints. In consequence, files or directories that were common to both mountpoint subtrees could often
be seen to be out of sync following an update.
This option allows administrators to select the pre-2.6.18 behaviour, permitting the same filesystem to be
mounted with different mount options.
Beware: Use of this option is not recommended unless you are certain that there are no hard links or
subtrees of this mountpoint that are mounted elsewhere.
fsc
Enable the use of persistent caching to the local disk using the FS-Cache facility for the given mount point.
All of the non-value options have corresponding nooption forms. For example, nointr means don't allow file
operations to be interrupted.
Files
/etc/fstab
See Also
fstab(5), mount(8), umount(8), exports(5)
Author
"Rick Sladkey" <jrs@world.std.com>
Bugs
The posix, and nocto options are parsed by mount but currently are silently ignored.
The tcp and namlen options are implemented but are not currently supported by the Linux kernel.
The umount command should notify the server when an NFS filesystem is unmounted.
Checking files on NFS filesystem referenced by file descriptors (i.e. the fcntl and ioctl families of functions)
may lead to inconsistent result due to the lack of consistency check in kernel even if noac is used.
Referenced By
clunfsops(8), mount.nfs(8), nfsstat(8), rpcdebug(8), rquotad(8), sfs(7), umount.nfs(8)
Un Sistema de archivos de red (NFS) permite a los hosts remotos montar sistemas de archivos sobre
la red e interactuar con esos sistemas de archivos como si estuvieran montados localmente. Esto
permite a los administradores de sistemas consolidar los recursos en servidores centralizados en la
red.
Este captulo se centra en los conceptos fundamentales de NFS e informacin suplementaria. Para
instrucciones especficas con respecto a la configuracin y operacin del software NFS en
servidores o clientes, vea el captulo titulado Sistema de archivos de red (NFS) en el Manual de
administracin del sistema de Red Hat Enterprise Linux.
9.1. Funcionamiento
Hay tres versiones de NFS actualmente en uso. La versin 2 de NFS (NFSv2), es la ms antigua y
est ampliamente soportada por muchos sistemas operativos. La versin 3 de NFS (NFSv3) tiene
ms caractersticas, incluyendo manejo de archivos de tamao variable y mejores facilidades de
informes de errores, pero no es completamente compatible con los clientes NFSv2. NFS versin 4
(NFSv4) incluye seguridad Kerberos, trabaja con cortafuegos, permite ACLs y utiliza operaciones
con descripcin del estado. Red Hat Enterprise Linux soporta clientes tanto NFSv2, NFSv3 como
NFSv4, y cuando monta un sistema de archivos a travs de NFS, Red Hat Enterprise Linux usa
NFSv4 por defecto.
Todas las versiones de NFS pueden utilizar el Protocolo de control de transmisiones (TCP)
ejecutndose sobre una red IP. En el caso de NFSv4, ste lo requiere. NFSv2 y NFSv3 pueden
utilizar el Protocolo de datagrama de usuarios (UDP) sobre una red IP para proporcionar
conexiones de red sin supervisin (stateless) entre el cliente y el servidor.
Cuando se utiliza NFSv2 o NFSv3 con UDP, bajo condiciones normales la conexin UDP
desatendida minimiza el trfico de la red, ya que el servidor NFS envia un cookie al cliente despus
que este tiene acceso al volumen compartido. Esta cookie es un valor aleatorio guardado en el lado
del servidor y es pasado junto con las peticiones RPC desde el cliente. El servidor NFS puede ser
reiniciado sin afectar a los clientes y las cookies permanecen intactas. Sin embargo, debido a que
UDP es sin supervisin, si el servidor se cae de forma inesperada, los clientes UDP continan
saturando la red con peticiones para el servidor. Por esta razn, TCP es el protocolo preferido
cuando se conecte a un servidor NFS.
Cuando se autentifique utilizando NFSv4, se crea una conexin atenta y, de forma opcional, est
disponible la autenticacin de usuarios y grupos con Kerberos. NFSv4 no tiene interaccin con
portmapper, rpc.mountd, rpc.lockd y rpc.statd, pues estos han sido incorporados en el kernel.
NFSv4 escucha en el puerto TCP 2049.
Nota
TCP es el protocolo por defecto para NFS bajo Red Hat Enterprise Linux. Consulte
el captulo llamado Sistema de archivos de red (NFS) en el Manual de
administracin del sistema de Red Hat Enterprise Linux para ms informacin
sobre la conexin a servidores NFS usando TCP. UDP se puede utilizar para
propsitos de compatibilidad si se necesita, pero no es recomendado para uso
general.
La nica vez que NFS lleva a cabo la autentificacin es cuando el cliente intenta montar un recurso
compartido NFS. Para limitar el acceso al servicio NFS, se utilizan envolturas TCP (TCP wrappers).
Los TCP wrappers leen los archivos /etc/hosts.allow y /etc/hosts.deny para determinar si a
un cliente particular o red tiene acceso o no al servicio NFS. Para ms informacin sobre cmo
configurar los controles de acceso con envolturas TCP (TCP wrappers), consulte el Captulo 17.
Despus de que al cliente se le permite acceso gracias a un TCP wrapper, el servidor NFS recurre a
su archivo de configuracin, /etc/exports, para determinar si el cliente tiene suficientes
privilegios para acceder a los sistemas de archivos exportados. Una vez otorgado el acceso, todas
las operaciones de archivos y de directorios estn disponibles para el usuario.
Aviso
Importante
Para que NFS funcione con una instalacin de Red Hat Enterprise Linux con un
cortafuegos instalado, se debe configurar IPTables con el puerto predeterminado
TCP 2049. Sin una configuracin IPTables, NFS no funcionar correctamente.
El script de inicializacin NFS y el proceso rpc.nfsd ahora permiten la
vinculacin a cualquier puerto especificado durante el inicio del sistema. Sin
embargo, esto puede ser susceptible a errores si el puerto no est disponible o si
entra en conflicto con otro demonio.
Red Hat Enterprise Linux utiliza una combinacin de soporte a nivel del kernel y procesos demonio
para proporcionar los archivos compartidos con NFS. NFSv2 y NFSv3 confa en las Llamadas de
procedimientos remotos ((RPC)) para enrutar peticiones entre clientes y servidores. Los servicios
RPC bajo Linux son controlados por el servicio portmap. Para compartir o montar sistemas de
archivos NFS, los servicios siguientes funcionan juntos, dependiendo de cul versin de NFS se
tenga implementada:
Inicia los procesos RPC apropiados para servir peticiones para los sistemas de
archivos compartidos NFS.
nfs
nfslock
portmap
Un servicio opcional que inicia los procesos RPC adecuados para permitir que
clientes NFS bloqueen archivos en el servidor.
El servicio RPC para Linux; responde a las peticiones para servicios RPC y
configura las conexiones al servicio RPC solicitado. No se utiliza con NFSv4.
rpc.mountd
rpc.nfsd
rpc.lockd
rpc.statd
rpc.rquotad
rpc.idmapd
Este proceso es el servidor NFS. Trabaja con el kernel Linux para satisfacer las
demandas dinmicas de clientes NFS, tales como proporcionar hilos del servidor cada vez
que se conecta un cliente NFS. Este proceso corresponde al servicio nfs.
Un proceso opcional que permite a los clientes NFS bloquear archivos en el
servidor. Esto corresponde al servicio nfslock. No se utiliza con NFSv4.
Este proceso implementa el protocolo RPC Network Status Monitor (NSM) el
cual notifica a los clientes NFS cuando un servidor NFS es reiniciado luego de haber sido
apagado abruptamente. Este proceso es iniciado automticamente por el servicio nfslock y
no requiere configuracin por parte del usuario. No se utiliza con NFSv4.
Proporciona informacin de cuotas de usuario para los usuarios remotos.
Este proceso se inicia automticamente por el servicio nfs y no requiere configuracin por
parte del usuario.
Este proceso proporciona al cliente y servidor NFSv4 llamadas ascendentes
(upcalls) que hacen corresponder los nombres NFSv4 (los cuales son cadenas en la forma
usuario@dominio) y los UIDs y GIDs locales. Para que idmapd funcione con NFSv4, el
/etc/idmapd.conf debe estar configurado. Se requiere este servicio para su uso con
NFSv4.
rpc.svcgssd
rpc.gssd
9.1.2. NFS y
portmap
Nota
programversprotoport
1000002tcp111portmapper
1000002udp111portmapper
1000211udp32774nlockmgr
1000213udp32774nlockmgr
1000214udp32774nlockmgr
1000211tcp34437nlockmgr
1000213tcp34437nlockmgr
1000214tcp34437nlockmgr
1000111udp819rquotad
1000112udp819rquotad
1000111tcp822rquotad
1000112tcp822rquotad
1000032udp2049nfs
1000033udp2049nfs
1000032tcp2049nfs
1000033tcp2049nfs
1000051udp836mountd
1000051tcp839mountd
1000052udp836mountd
1000052tcp839mountd
1000053udp836mountd
1000053tcp839mountd
La salida de este comando revela que los servicios NFS correctos se estn ejecutando. Si uno de los
servicios NFS no comienza correctamente, portmap puede ser incapaz de corresponder las
peticiones RPC de los clientes para ese servicio con sus respectivos puertos. En muchos casos, si
NFS no est presente en la salida de rpcinfo, reiniciando NFS provocar que estos servicios se
registren correctamente con portmap y empiecen a funcionar. Para ms instrucciones sobre el inicio
de NFS, consulte la Seccin 9.2.
Estn disponibles otras opciones tiles para el comando rpcinfo. Para ms informacin, consulte la
pgina man de rpcinfo.
Para ejecutar un servidor NFS, debe estar ejecutndose el servicio portmap. Para verificar que
portmap est activo, escriba el comando siguiente como root:
/sbin/serviceportmapstatus
Si el servicio portmap se est ejecutando, entonces se puede iniciar nfs. Para iniciar un servidor
NFS, como root escriba:
/sbin/servicenfsstart
Para detener el servidor, como usuario root, escriba:
/sbin/servicenfsstop
La opcin restart es un atajo para detener y luego iniciar NFS. Esta es la forma ms eficiente de
hacer que los cambios en la configuracin tomen efecto luego de modificar el archivo de
configuracin por NFS.
Para reiniciar el servidor, como usuario root, escriba:
/sbin/servicenfsrestart
La opcin condrestart (reinicio condicional) solamente inicia nfs si este est actualmente
ejecutndose. Esta opcin es til para los scripts, porque no inicia el demonio si este no se est
ejecutando.
Para reiniciar condicionalmente el servidor, como root escriba:
/sbin/servicenfscondrestart
Para recargar el archivo de configuracin del servidor NFS sin reiniciar el servicio, como root
escriba:
/sbin/servicenfsreload
Por defecto, el servicio nfs no arranca automticamente en el momento del inicio. Para configurar
NFS para que inicie en el momento del arranque, utilice una utilidad de initscript, tal como
/sbin/chkconfig, /sbin/ntsysv o la Herramienta de configuracin de servicios
9.3. Configuracin del servidor NFS
Existen tres formas de configurar un servidor NFS bajo Red Hat Enterprise Linux: usando la
Herramienta de configuracin del servidor NFS (systemconfignfs), modificando
manualmente su archivo de configuracin (/etc/exports), o utilizando el comando
/usr/sbin/exportfs.
Para las instrucciones sobre cmo utilizar la Herramienta de configuracin del servidor NFS,
consulte el captulo llamado Sistemas de archivo de red (NFS) en el Manual de administracin
del sistema de Red Hat Enterprise Linux. El resto de esta seccin discute la modificacin manual
de /etc/exports y el uso del comando /usr/sbin/exportfs para exportar sistemas de archivos
NFS.
/etc/exports
El archivo /etc/exports controla cules sistemas de archivos son exportados a las mquinas
remotas y especifica opciones. Las lneas en blanco son ignoradas, se pueden comentar lneas con el
smbolo # y las lneas largas pueden ser divididas con una barra invertida (\). Cada sistema de
archivos exportado debe tener su propia lnea y cualquier lista de hosts autorizadas colocada
despus de un sistema de archivos exportado, debe estar separada por un espacio. Las opciones para
cada uno de los hosts deben ser colocadas entre parntesis directamente detrs del identificador del
host, sin ningn espacio de separacin entre el host y el primer parntesis.
Una lnea para un sistema de archivos exportado tiene la estructura siguiente:
<export><host1>(<options>)<hostN>(<options>)...
En esta estructura, reemplace <export> con el directorio a exportar, reemplace <host1> con el host
o la red a la cual va a compartir el directorio y reemplace <options> con las opciones para ese host
o red. Los hosts adicionales se pueden especificar en una lista separada por espacios.
Se pueden usar los mtodos siguientes para especificar nombres de host:
host nico Cuando una mquina en particular es especificada con nombre completo de
dominio, nombre de mquina o direccin IP.
redes IP Permite la coincidencia de hosts basados en sus direcciones IP dentro de una red
ms grande. Por ejemplo, 192.168.0.0/28 permite al acceso a las primeras 16 direcciones
IP, desde la 192.168.0.0 a la 192.168.0.15, acceder al sistema de archivos exportado, pero no
a la 192.168.0.16 y superiores.
grupos de redes Permite usar un nombre de grupo de red NIS, escrito como @<groupname>. Esto pone al servidor NIS controlando el acceso de este sistema de archivos, donde
los usuarios pueden ser aadidos o borrados de un grupo NIS sin que afecte a
/etc/exports.
Se montan los sistemas de archivos como de slo lectura (read-only). Los host
remotos no pueden hacer cambios a los datos compartidos en el sistema de archivos. Para
ro
permitir que los hosts puedan hacer cambios, debe especificar la opcin rw (lecturaescritura, read-write).
Provoca que el servidor NFS retrase el escribir a disco si sospecha que otra
peticin de escritura es inminente. Esto puede mejorar el rendimiento reduciendo las veces
que se debe acceder al disco por comandos de escritura separados. Use no_wdelay para
desactivar esta opcin, la cual slo funciona si est usando la opcin sync.
wdelay
root_squash
Importante
Por defecto, las listas de control de acceso (ACLs) son soportadas por NFS bajo
Red Hat Enterprise Linux. Para desactivar esta funcionalidad, especifique la opcin
no_acl cuando est exportando el sistema de archivos. Para ms informacin sobre
esta funcionalidad, vea el captulo Sistemas de archivo de red (NFS) en el Manual
de administracin del sistema de Red Hat Enterprise Linux.
Cada valor predeterminado para un sistema de archivos exportado debe ser explcitamente
ignorado. Por ejemplo, si no se especifica la opcin rw, entonces el sistema de archivos es
exportado como de slo lectura. Lo siguiente es una lnea de muestra de /etc/exports la cual
sobreescribe dos opciones predeterminadas:
/another/exported/directory192.168.0.3(rw,sync)
En este ejemplo 192.168.0.3 puede montar /another/exported/directory/ como
lectura/escritura y todas las transferencias al disco son efectuadas antes de completar la peticin de
escritura del cliente.
Adicionalmente, hay otras opciones que estn disponibles que no tienen especificado un valor
predeterminado. Estas incluyen la habilidad de desactivar la verificacin por subdirectorios,
permitir el acceso desde puertos inseguros y permitir bloquear archivos inseguros (necesario para
algunas implementaciones antiguas de clientes NFS). Vea la pgina man de exports para estas
opciones menos usadas.
Aviso
9.3.2. El comando
exportfs
Cada sistema de archivos que se exporta a usuarios remotos a travs de NFS, as como los niveles
de acceso relativos a ellos, son listados en el archivo /etc/exports. Cuando comienza el servicio
nfs, se lanza el comando /usr/sbin/exportfs y lee este archivo, pasa el control a rpc.mountd (si
es NFSv2 or NFSv3) para el proceso de montaje real, luego a rpc.nfsd donde los sistemas de
archivos estn disponibles a los usuarios remotos.
Cuando se ejecuta manualmente, el comando /usr/sbin/exportfs permite al superusuario
exportar o no de forma selectiva, directorios concretos sin reiniciar los servicios NFS. Cuando se le
pasan las opciones apropiadas, el comando /usr/sbin/exportfs escribe los sistemas de archivos
exportados a /var/lib/nfs/xtab. Como rpc.mountd se refiere al archivo xtab para decidir
privilegios de acceso a un sistema de archivos, los cambios en la lista de sistemas de archivos
exportados toman efecto inmediatamente.
Lo siguiente es una lista de las opciones ms comunes disponibles para /usr/sbin/exportfs:
Provoca que todos los directorios sean exportados o no, dependiendo de qu otras
opciones hemos pasado a /usr/sbin/exportfs. Si no se pasan otras opciones,
/usr/sbin/exportfs exporta todos los sistemas de archivos especificados en
/etc/exports.
-a
-o sistema-de-archivos
-i
-u
-v
gss/krb5p:/exports/opt
exportfsorw,nohide,insecure,no_subtree_check
gss/krb5p:/exports/etc
En este ejemplo, se proporciona a los clientes con mltiples sistemas de archivos a montar, usando
la opcin --bind.
9.4. Archivos de configuracin de clientes NFS
Las comparticiones NFS son montadas en el lado del cliente usando el comando mount. El formato
del comando es como sigue:
mountt<nfs-type>o<options><host>:</remote/export>
</local/directory>
Reemplace <nfs-type> con nfs para servidores NFSv2 o NFSv3, o nfs4 para servidores NFSv4.
Reemplace <options> con una lista de opciones separadas por comas para el sistema NFS (para
ms detalles, consulte la Seccin 9.4.3). Reemplace <host> con el host remoto, </remote/export>
con el directorio remoto que est siendo montado y sustituya </local/directory> con el
directorio local donde el sistema de archivos remoto se montar.
Consulte la pgina man de mount para ms detalles.
Si est accediendo a una comparticin NFS emitiendo manualmente el comando mount, el sistema
de archivos debe ser remontado manualmente despus de reiniciar el sistema. Red Hat Enterprise
Linux ofrece dos mtodos para el montaje automtico de sistemas de archivos al momento del
arranque: el archivo /etc/fstab o el uso del servicio autofs.
9.4.1.
/etc/fstab
El archivo /etc/fstab lo referencia el servicio netfs al momento del arranque, por lo que las
lneas haciendo referencia a las comparticiones NFS tienen el mismo efecto que escribir
manualmente el comando mount durante el arranque.
Una muestra de lnea de /etc/fstab para montar un NFS exportado ser parecida a:
<server>:</remote/export></local/directory><nfs-type><options>00
Reemplace <nfs-type> con nfs para servidores NFSv2 o NFSv3, o con nfs4 para servidores
NFSv4.
Reemplace <options> con una lista de opciones separada por comas para el sistema NFS (refirase
a la Seccin 9.4.3 para ms detalles). Consulte la pgina man de fstab para informacin adicional.
9.4.2.
autofs
Una desventaja de usar /etc/fstab es que, sin tener en cuenta con que frecuencia se use este
sistema de archivos montado, el sistema debe dedicar recursos para mantener este montaje en su
sitio. Esto no es un problema con uno o dos montajes, pero cuando su sistema est manteniendo
montajes a una docena de sistemas al mismo tiempo, el rendimiento global puede decaer. Una
alternativa a /etc/fstab es usar la utilidad basada en el kernel automount, la cual monta y
desmonta sistemas de archivos NFS automticamente, ahorrando recursos.
El servicio autofs es utilizado para controlar el comando automount a travs del archivo de
configuracin primario /etc/auto.master. Mientras que automount puede ser especificado en la
lnea de comandos, es ms conveniente especificar los puntos de montaje, nombres de hosts,
directorios exportados y opciones en un conjunto de archivos que teclearlo todo a mano.
Los archivos de configuracin autofs estn fijados en una relacin padre-hijo. El principal archivo
de configuracin (/etc/auto.master) lista los puntos de montaje en el sistema que estn
enlazados a un tipo de mapa particular, el cual toma la forma de otros archivos de configuracin,
programas, mapas NIS y otros mtodos de montaje menos comunes. El archivo auto.master
contiene lneas que se refieren a cada punto de montaje, organizadas como:
<mount-point><map-type>
El elemento <mount-point> de esta lnea indica la ubicacin del montaje en el sistema de archivos
local. <map-type> se relaciona con la forma en la cual el punto de montaje ser montado. El
mtodo ms comn para el automontaje de las exportaciones NFS es usar un archivo como la gua
para un punto de montaje particular. El mapa del archivo, usualmente llamado auto.<mountpoint>, donde <mount-point> es el punto de montaje designado en auto.master, contiene lneas
que se ven similar a:
</local/directory><options><server>:</remote/export>
o soft Especifican si el programa que usa un archivo va una conexin NFS, debe
parar y esperar (hard) a que el servidor vuelva a estar en lnea, si el host que sirve el sistema
de archivos no est disponible, o si debe informar de un error (soft).
hard
Si se especifica la opcin hard, el usuario no podr terminar el proceso que est esperando
que la comunicacin NFS se reanude a menos que especifique la opcin intr.
Si usa soft, puede usar la opcin adicional timeo=<valor>, donde <valor> especifica el
nmero de segundos que deben pasar antes de informar del error.
Permite que se interrumpan las peticiones NFS si el servidor se cae o no puede ser
accedido.
intr
nfsvers=2
noacl
nolock
noexec
nosuid
port=num
rsize=num
estos valores; algunos kernels antiguos de Linux y tarjetas de red no funcionan bien con
grandes tamaos de bloques. Para NFSv2 o NFSv3, los valores por defecto para ambos
parmetros est configurado a 8192. Para NFSv4, los valores por defecto para ambos
parmetros es 32768.
sec=mode
NFS.
es la configuracin por defecto, lo que utiliza UNIX UIDs y GIDs locales a travs
de AUTH_SYS para autentificar las operaciones NFS.
sec=sys
sec=krb5
utiliza Kerberos V5 en vez de UNIX UIDs y GIDs locales para autentificar a los
usuarios.
utiliza Kerberos V5 para la autenticacin de usuarios y realiza la verificacin de
integridad de las operaciones NFS usando sumas de verificacin para prevenir el dao de los
datos.
sec=krb5i
tcp
udp
NFS trabaja muy bien compartiendo sistemas de archivos enteros con un gran nmero de hosts
conocidos de una manera muy transparente. Sin embargo, esta facilidad de uso trae una variedad de
problemas potenciales de seguridad.
Los puntos siguientes deberan ser considerados cuando se exporten sistemas de archivos NFS en
un servidor o cuando se monten en un cliente. Haciendo esto reducir los riesgos de seguridad NFS
y proteger mejor los datos en el servidor.
Para una lista concisa de los pasos que los administradores deben seguir al asegurar servidores NFS,
consulte el captulo titulado Seguridad del servidor en el Manual de seguridad de Red Hat
Enterprise Linux.
Nota
Se asume que se tiene instalado un servidor de entrega de tckets (KDC) y que est
configurado de la forma correcta, antes de configurar el servidor NFSv4.
NFSv4 incluye el soporte a ACL basado en el modelo de Microsoft Windows NT, no en el modelo
POSIX, por sus funcionalidades y porque es implementado ampliamente. NFSv2 y NFSv3 no son
compatibles con los atributos nativos de ACL.