Solaris NFS

Network File System (NFS) Version 3.0

1. Concept:
NFS is a set of protocals


2. Daemons:

Server
----------
nfsd
mountd ; receives client's mount request and sends back handle

statd
lockd


Client
----------
statd
lockd

3. Files
A) Server
/etc/dfs/dfstab ;list what to share out
------------------
share -o ro /usr/share/man

related commands:
share
shareall
unshare
unshareall

share ;show what's currently share out
/etc/dfs/sharetab ;stores the results of the share command

B) Client
/etc/vfstab ;specifies nfs server's share
/etc/rmtab ;shows what's currently mounted


#dfshares server

#dfmounts server ;not supported in NFS 4.0


NFS 4.0
-----------------------------
Features:
- Stateful connections
- Single protocal - (server) nfsd,nfsmapid (client) nfs4cbd,nfsmapid
- Improved firewall support, uses well-known port 2049


Note: server may run mountd/lockd/statd to support earlier versions of nfs.

Extra daemon: nfs4cbd - NFS V4 callback daemon. Runs on the client.
Files
/etc/dfs/dfstab
/etc/dfs/sharetab
/etc/nfs/nfslog.conf
/etc/default/nfslogd
/etc/default/nfs
/etc/dfs/fstypes ; the default filesystem types for remote FS

ksh:gulf1# cat /etc/dfs/fstypes
nfs NFS Utilities
autofs AUTOFS Utilities
cachefs CACHEFS Utilities


----------------------------------
Commands:
To start NFS server
#/etc/init.d/nfs.server start or
svcadm -v enable svc:/network/nfs/server

#mount -o ro server:/usr/share/man /usr/share/man
#mount ; shows what's currently mounted


share -F nfs -o ro /directory

share -F nfs -o rw,rw=client1 /directory

share -F nfs -o root=client2 /directory

share -F nfs -o ro,anon=0 /directory ; anonymous user is uid 0, jumpstart

share -F nfs \
-o ro=client:client2,rw=netgrp:@192.168.100:.us.db.com,root=client4 /directory

By default, anonymous user is mapped as nobody 60001. But anon= access list
can set it to something else. anonymous user is any user who doesn't have
account on the server. "-o anon=-1 " will deny anonymous users.


Quick Guide:
Server -
#svcadm -v enable svc:/network/nfs/server
#echo "share -F nfs -o ro=client /export/home/nfs" >> /etc/dfs/dfstab
#shareall
#share

Client -
#svcadm -v enable svc:/network/nfs/client
#dfsshare server
#mount -F nfs server:/export/home/nfs /mnt

mount options:
rw | ro
bg | fg ; default is fg - trys mount in foreground
soft | hard ; soft reports error and stops trying
intro | nointr ; enable or disable keyboard interrupts to kill hanging client
; intr+hard will allow control C to stop trying
suid | nosuid ; whether to enable setuid
timeo=n ; time out n thenths of a second
retry=n ; number of retry, default 10,000 times!!!!
retrans=n ; number of NFS retransmissions . default udp 5. NA for tcp



nfslogging

Server logging isn't supported in NFS version 4.

nfslogd
/etc/nfs/nfslog.conf


Read write for client1, read only for the rest clients
#share -o rw=client, ro=10.10.100.0 /directory


Example : NFS implementation

ROOT@server1:/root # cat /etc/dfs/dfstab

# Place share(1M) commands here for automatic execution
# on entering init state 3.
#
# Issue the command 'svcadm enable network/nfs/server' to
# run the NFS daemon processes and the share commands, after adding
# the very first entry to this file.
#
# share [-F fstype] [ -o options] [-d ""] [resource]
# .e.g,
# share -F nfs -o rw=engineering -d "home dirs" /export/home2
share -F nfs -o rw=client.sg.abcd.com -d "CVS Share" /apps/opus/Scripts

ROOT@server1:/root # svcs -a | grep nfs
disabled Nov_12 svc:/network/nfs/client:default
disabled Nov_12 svc:/network/nfs/server:default
disabled Nov_12 svc:/network/nfs/rquota:default
online Nov_12 svc:/network/nfs/status:default
online Nov_12 svc:/network/nfs/nlockmgr:default
online Jun_18 svc:/network/nfs/cbd:default
online Jun_18 svc:/network/nfs/mapid:default
ROOT@server1:/root # share /apps/opus/Scripts
ROOT@server1:/root # showmount -e
export list for server1:
/apps/opus/Scripts client.sg.abcd.com
ROOT@server1:/root # svcadm enable svc:/network/nfs/server
ROOT@server1:/root # share
- /apps/opus/Scripts rw=client.sg.abcd.com "CVS Share"
ROOT@server1:/root # dfshares
RESOURCE SERVER ACCESS TRANSPORT
server1:/apps/opus/Scripts server1 - -
ROOT@server1:/root # dfmounts
ROOT@server1:/root # svcs -a | grep nfs
disabled Nov_12 svc:/network/nfs/client:default
online Nov_12 svc:/network/nfs/status:default
online Nov_12 svc:/network/nfs/nlockmgr:default
online Jun_18 svc:/network/nfs/cbd:default
online Jun_18 svc:/network/nfs/mapid:default
online 16:28:26 svc:/network/nfs/rquota:default
online 16:28:26 svc:/network/nfs/server:default

ROOT@server1:/root # rpcinfo
program version netid address service owner
100000 4 ticots server1.rpc rpcbind superuser
100000 3 ticots server1.rpc rpcbind superuser
100000 4 ticotsord server1.rpc rpcbind superuser
100000 3 ticotsord server1.rpc rpcbind superuser
100000 4 ticlts server1.rpc rpcbind superuser
100000 3 ticlts server1.rpc rpcbind superuser
100000 4 tcp 0.0.0.0.0.111 rpcbind superuser
100000 3 tcp 0.0.0.0.0.111 rpcbind superuser
100000 2 tcp 0.0.0.0.0.111 rpcbind superuser
100000 4 udp 0.0.0.0.0.111 rpcbind superuser
100000 3 udp 0.0.0.0.0.111 rpcbind superuser
100000 2 udp 0.0.0.0.0.111 rpcbind superuser
100024 1 udp 0.0.0.0.128.4 status superuser
100024 1 tcp 0.0.0.0.128.3 status superuser
100024 1 ticlts \000\000\000\022 status superuser
100024 1 ticotsord \000\000\000\025 status superuser
100024 1 ticots \000\000\000\030 status superuser
100133 1 udp 0.0.0.0.128.4 - superuser
100133 1 tcp 0.0.0.0.128.3 - superuser
100133 1 ticlts \000\000\000\022 - superuser
100133 1 ticotsord \000\000\000\025 - superuser
100133 1 ticots \000\000\000\030 - superuser
100007 3 udp 0.0.0.0.128.7 ypbind superuser
100007 2 udp 0.0.0.0.128.7 ypbind superuser
100007 1 udp 0.0.0.0.128.7 ypbind superuser
100007 3 tcp 0.0.0.0.128.4 ypbind superuser
100007 2 tcp 0.0.0.0.128.4 ypbind superuser
100007 1 tcp 0.0.0.0.128.4 ypbind superuser
100007 3 ticlts \000\000\000< ypbind superuser
100007 2 ticlts \000\000\000< ypbind superuser
100007 3 ticotsord \000\000\000C ypbind superuser
100007 2 ticotsord \000\000\000C ypbind superuser
100007 3 ticots \000\000\000J ypbind superuser
100021 1 udp 0.0.0.0.15.205 nlockmgr 1
100021 2 udp 0.0.0.0.15.205 nlockmgr 1
100021 3 udp 0.0.0.0.15.205 nlockmgr 1
100021 4 udp 0.0.0.0.15.205 nlockmgr 1
100021 1 tcp 0.0.0.0.15.205 nlockmgr 1
100021 2 tcp 0.0.0.0.15.205 nlockmgr 1
100021 3 tcp 0.0.0.0.15.205 nlockmgr 1
100021 4 tcp 0.0.0.0.15.205 nlockmgr 1
100169 1 ticlts \000\000\000\177 - superuser
100169 1 ticotsord \000\000\000\201 - superuser
100169 1 ticots \000\000\000\203 - superuser
100134 1 ticotsord \000\000\013\002 ktkt_warnd superuser
100155 1 ticotsord \000\000\013\005 smserverd superuser
100068 2 udp 0.0.0.0.178.168 cmsd superuser
100068 3 udp 0.0.0.0.178.168 cmsd superuser
100068 4 udp 0.0.0.0.178.168 cmsd superuser
100068 5 udp 0.0.0.0.178.168 cmsd superuser
100424 1 ticotsord \000\000\013\020 - superuser
100234 1 ticotsord \000\000\013\023 gssd superuser
100068 2 tcp 0.0.0.0.215.172 cmsd superuser
100068 3 tcp 0.0.0.0.215.172 cmsd superuser
100068 4 tcp 0.0.0.0.215.172 cmsd superuser
100068 5 tcp 0.0.0.0.215.172 cmsd superuser
1289637086 5 tcp 0.0.0.0.218.201 - 8444
1289637086 1 tcp 0.0.0.0.218.201 - 8444
100099 4 ticotsord server1.autofs - superuser
1289637087 5 tcp 0.0.0.0.162.45 - 2287271
1289637087 1 tcp 0.0.0.0.162.45 - 2287271
805306372 1 udp 0.0.0.0.137.177 - superuser
1289637088 5 tcp 0.0.0.0.128.120 - 2002919
1289637088 1 tcp 0.0.0.0.128.120 - 2002919
1073741824 1 tcp 0.0.0.0.185.102 - 1
1289637089 5 tcp 0.0.0.0.172.202 - 2287271
1289637089 1 tcp 0.0.0.0.172.202 - 2287271
100011 1 ticlts \000\000\232\002 rquotad superuser
100011 1 udp 0.0.0.0.162.189 rquotad superuser
100231 1 ticlts server1.nfsauth - superuser
100231 1 ticotsord server1.nfsauth - superuser
100231 1 ticots server1.nfsauth - superuser
100005 1 udp 0.0.0.0.162.190 mountd superuser
100005 1 ticlts \000\000\232\026 mountd superuser
100005 1 tcp 0.0.0.0.132.158 mountd superuser
100005 1 ticotsord \000\000\232\033 mountd superuser
100005 1 ticots \000\000\232\036 mountd superuser
100005 2 udp 0.0.0.0.162.190 mountd superuser
100005 2 ticlts \000\000\232\026 mountd superuser
100005 2 tcp 0.0.0.0.132.158 mountd superuser
100005 2 ticotsord \000\000\232\033 mountd superuser
100005 2 ticots \000\000\232\036 mountd superuser
100005 3 udp 0.0.0.0.162.190 mountd superuser
100005 3 ticlts \000\000\232\026 mountd superuser
100005 3 tcp 0.0.0.0.132.158 mountd superuser
100005 3 ticotsord \000\000\232\033 mountd superuser
100005 3 ticots \000\000\232\036 mountd superuser
100003 2 udp 0.0.0.0.8.1 nfs 1
100003 3 udp 0.0.0.0.8.1 nfs 1
100227 2 udp 0.0.0.0.8.1 nfs_acl 1
100227 3 udp 0.0.0.0.8.1 nfs_acl 1
100003 2 tcp 0.0.0.0.8.1 nfs 1
100003 3 tcp 0.0.0.0.8.1 nfs 1
100003 4 tcp 0.0.0.0.8.1 nfs 1
100227 2 tcp 0.0.0.0.8.1 nfs_acl 1
100227 3 tcp 0.0.0.0.8.1 nfs_acl 1