Nfs
NFS
Linux Server ( NFS versions 2 & 3)
used udp
edit /etc/exports
/www client.vcu.edu(ro,no_root_squash) or /www client.vcu.edu(rw) exportfs -av
daemons:
service iptables stop service portmap start service nfs start service nfslock start
edit /etc/hosts.allow
portmap: client.vcu.edu
edit /etc/sysconfig/iptables
Linux Client ( NFS versions 2 & 3)
edit /etc/fstab
server.vcu.edu:/www /www-ro nfs noauto 1 5
daemons:
service iptables stop service portmap start service netfs start mount /www-ro
Linux Server (NFS version 4)
Additional Reading:
Implementing non-secure ( no rpcgssd ) nfs4
uses tcp
Packages:
nfs-utils rpcbindDaemons
portmap or rpcbindrpcidmapdnfsdnfslock or nfs.statdedit /etc/hosts.allow
edit /etc/sysconfig/nfs and uncomment/add the following lines:
LOCKD_TCPPORT=32803LOCKD_UDPPORT=32769MOUNTD_PORT=892RQUOTAD_PORT=875STATD_PORT=662STATD_OUTGOING_PORT=2020SECURE_NFS="no"edit /etc/sysconfig/iptables and add the following lines before the ending DROP rule:
-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p udp --dport 111 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p tcp --dport 111 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p tcp --dport 32803 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p udp --dport 32769 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p tcp --dport 892 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p udp --dport 892 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p tcp --dport 875 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p udp --dport 875 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p tcp --dport 662 -j ACCEPT-A RH-Firewall-1-INPUT -s 192.168.89.0/24 -m state --state NEW -p udp --dport 662 -j ACCEPTservice iptables restart
edit /etc/idmapd.conf add domain - restart rpcidmapd
Create pseudofilesystem root - its aribrary, but I'll go with /export because of its long time use in solaris, then make directories as mount points for other filesystems
mkdir /exportmkdir /export/homemkdir /export/globalbind the other filesystems to the mount points in /etc/fstab
/usr/global /export/global none bind 0 0/home /export/home none bind 0 0
mount -a
/etc/exports ( with pseudofilesystem)
/export 192.168.89.0/24(rw,fsid=0,insecure,no_subtree_check,nohide,sync,no_root_squash,anonuid=65534,anongid=65534)
/export/global 192.168.89.0/24(rw,insecure,no_subtree_check,nohide,sync,no_root_squash,anonuid=65534,anongid=65534)
/export/home 192.168.89.0/24(rw,insecure,no_subtree_check,nohide,sync,no_root_squash,anonuid=65534,anongid=65534)
exportfs -av
restart nfs, nfslock. portmap (or tcpbind), rpcidmapd
Linux Client ( NFS version 4)
Edit /etc/hosts
add server_ip_address server.vcu.eduedit firewall
edit /etc/idmapd.conf add domain - restart rpcidmapd
Daemons
rpcidmapdnetfs
rpcinfo -p <server>
test mount
mount -t nfs4 -o rw,intr <server>:/ /mountpoint
note: its always server:/ even if the server is delivering a subdirctory due to
fstab ( with pseudofilesystem )
<server>:/global /usr/global nfs4 rw,hard,intr,proto=tcp,port=2049 0 0<server>:/home /home nfs4 rw,hard,intr,proto=tcp,port=2049 0 0
Linux References:
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/ref-guide/ch-nfs.html
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/security-guide/s1-server-nfs.html
http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/sysadmin-guide/ch-nfs.html
http://www.citi.umich.edu/projects/nfsv4/linux/using-nfsv4.html
http://wiki.linux-nfs.org/wiki/index.php/Nfsv4_configuration
http://devresources.linux-foundation.org/jasonn/wiki/index.php?n=Docs.NetAppNFSv4AndLinux
http://www.crazysquirrel.com/computing/debian/servers/setting-up-nfs4.jspx
NFS v4:
OSX Tiger Client
Solaris Server (pre-Solaris 10)
edit /etc/dfs/dfstab
share -F nfs -o ro,root=client.vcu.edu /www share -F nfs -o rw=client.vcu.edu /www share -F nfs -o rw=@192.168.100.0/25 /home
shareall
daemons:
/etc/init.d/rpc /etc/init.d/nfs.server
Solaris 10 Server nfs v4
/etc/default/nfs
NFSMAPID_DOMAIN=<domain>
confirm with
more /var/run/nfs4_domains
http://serversolaris.blogspot.com/2008/01/sharing-directories-with-nfs-in-solaris.html
http://blogs.sun.com/tdh/entry/open_solaris_and_sharing_subnets
http://www.unix.com/sun-solaris/76997-svcadm-fails-enable-nfs-server.html
http://learningsolaris.com/archives/2005/04/25/smf_and_rbac/
IRIX Server
edit /etc/exports
/www -ro,root,access=client.vcu.edu /www -rw,access=client.vcu.edu or exportfs -av
Bad NFS
originally: http://www.kwiki.wrcs.vcu.edu/index.cgi?BadNFS
Try
umount -l
first; the below doesn't work on recent operating systems.
Below taken from http://www.redhat.com/magazine/005mar05/departments/tips_tricks/ :
Anyone whose dealt with NFS administration has sooner or later had to confront a downed server that results in a horde of unkillable processes that build up waiting for the NFS server to return. A quick glance at the NFS mount options in mount(8) will tell us we can mount with the "intr" or "soft" options to instruct our client to allow interrupts or to time out in the case of an unresponsive server, but what if we didn't anticipate it? Or what if we chose to use uniterruptible for a reason such as to avoid risks to data integrity if the application is writing over NFS?
Often the advice you'll find in newsgroups is to stop these processes is to simply reboot the machine, but even that can be problematic since a system shutdown can be hampered by lingering dead NFS mounts.
The reason these processes are unkillable is because it's not actually the process that is running, but rather the kernel is interacting with a device or filesystem on the processes behalf. If you've ever tried to mount a damaged floppy or CD and had the mount command block, then you've run into this. In those cases the solution is simply to eject the media; cause the subsystem to fail and the hung process will then error and exit.
In the case of NFS, the subsystem is handled by a kernel thread called rpciod. The quick and dirty way is the old kill -9 <pid> on the rpciod kernel thread (or killall -9 rpciod). Don't worry, it won't actually die, but it will respond to the signal by delivering errors to processes waiting on it. A more elegant approach is to simply cause rpciod to decide it is not worth while to continue its attempts to reach the server. Bringing down your network interface or setting a firewall rule that will reject with "icmp-port-unreachable" will do the trick... just be patient, it can take a few minutes before rpciod gives up, but it will give up, even with hard mounts. Assuming the offending server was 128.172.X.Y, inserting this rule on the client should do the trick.
iptables -I OUTPUT -d 128.172.X.Y -j REJECT
after it unmount to remove the above rule without restarting iptables do:
iptables -D OUTPUT -d 128.172.X.Y -j REJECT