Setting up NFS server and client on FreeBSD and Linux [How To]
|NFS server (FreeBSD):
/etc/rc.conf:
1 2 3 | portmap_enable = "YES" nfs_server_enable = "YES" nfs_reserved_port_only = "YES" |
/etc/exports (FreeBSD)
1 2 3 | /usr/local/nfs-rw 192.168.1.2 /usr/local/nfs-ro-mapall = nobody-network 192.168.1-mask 255.255.255.0 /cdrom-alldirs , quiet, ro-network 192.168.33.0-mask 255.255.255.0 |
/etc/exports (For Linux)
(start – service start portmap and nfs):
1 | /usr/local/nfs 192.168.1.0 /255 .255.255.0 (ro) 192.168.2.1 (rw) |
NFS client:
/etc /rc.conf:
1 | portmap_enable = "YES" , nfs_client_enable = "YES" |
/etc/fstab: (mounting)
1 | 192.168.1.1: /usr/local/nfs/ home /nfs nfs ro 0 0 |
or manually:
1 | /sbin/mount_nfs -r 32768 -w 32768 -i noatime 192.168.1.1: /usr/local/nfs/ home /nfs |
To optimize performance, is recommended for mounting with Linux to specify options:
1 | rsize = 32768, wsize = 32768, intr, noatime |
The number of clients and servers running on FreeBSD regulated through the parameter “-n” in the variables rc.conf: nfs_client_flags and nfs_server_flags
In some Linux distributions, the number of servers specified in the file /etc/sysconfig/nfs, variable NFSDCOUNT, whose value is passed as an argument when you start rpc.nfsd.
Source: OpenNET.ru