Difference between revisions of "NFS"
m |
|||
Line 34: | Line 34: | ||
− | In order to configure a successful nfs server the "nfs" and "nfslock" services need to be configured to start automatically for runlevels 3 and 5. On Red Hat and Fedora machines this can be achieved easily with | + | In order to configure a successful nfs server the "nfs" and "nfslock" services need to be configured to start automatically for runlevels 3 and 5. On Red Hat and Fedora machines this can be achieved easily with these commands (as root): |
− | chkconfig -- | + | chkconfig --level 35 nfs on |
+ | chkconfig --level 35 nfslock on | ||
== Useful commands == | == Useful commands == |
Revision as of 02:17, 23 November 2010
NFS Configuration
/etc/exports
The /etc/exports file tells what should be exported. The syntax of this file is fairly straightforward. Each entry should contain the path to the directory you want to export followed by a list of hosts or IP address ranges that are allowed to access that export. Options are set per host or IP range in parentheses. You can use a backslash as a line continuation indicator to break up long lines. Here is an example from Taro:
/data @servers(rw,sync) @npg_clients(rw,sync) \ 10.0.0.0/24(rw,no_root_squash,sync)
Entries that start with an ampersand (@) refer to NetGroups that are defined in LDAP. You can see which hosts are members of a netgroup with this command:
getent netgroup group_name
Here are some details on the more common export options:
- rw
- Mounts the directory as read/write
- ro
- Mounts the directory as read only
- sync
- Reply to requests only after the changes have been committed to stable storage (it is a good idea to always use this to protect against lost or corrupted data due to a server crash.
- no_root_squash
- Does not allow root on the local machine to have root access to files on the network share. Probably a good idea for security reasons. Set this unless you have a significantly good reason not to.
/etc/sysconfig/nfs
The /etc/sysconfig/nfs file is used to pin down the the ports used by NFS. This is necessary because we have to know which ports to open in the firewall to allow machines to make NFS connections. For more information see iptables.
These are the port numbers that need to be set in this file:
LOCKD_TCPPORT=32050 LOCKD_UDPPORT=32050 MOUNTD_PORT=32051 STATD_PORT=32052 RQUOTAD_PORT=32053
Set NFS to start on boot
In order to configure a successful nfs server the "nfs" and "nfslock" services need to be configured to start automatically for runlevels 3 and 5. On Red Hat and Fedora machines this can be achieved easily with these commands (as root):
chkconfig --level 35 nfs on chkconfig --level 35 nfslock on
Useful commands
To check what ports NFS is using issue an
rpcinfo -p localhost
A full restart of the nfs related system
service portmap restart service nfs restart service rpcsvcgssd restart
Issues
Occasionally, issues crop up due to network-mounted home directories. Some applications, like firefox, don't behave properly. It seems to strike everyone at once when it does, and the solution so far has been to restart the nfs service. CIS has related issues with their CIFS-based home directories.