User Tools

Site Tools


unix:freebsd:system_builds:nfsserver

Differences

This shows you the differences between two versions of the page.


Next revision
unix:freebsd:system_builds:nfsserver [2019/07/11 02:11] – external edit 127.0.0.1
Line 1: Line 1:
 +====== Build NFS Server ======
 +
 +This is a total rewrite since FreeBSD and ZFS have the ability to export nfs directly. You can always not use the sharenfs function in zfs (ie, sharenfs=off) and use the standard way of exporting. ZFS running nfs actually is not as pretty as the old way, but it is very efficient for maintenance.
 +
 +The following assumes you have a zpool named //storage// and you will create a tree of nfs exportable directories under that.
 +
 +For our needs, we want some exports that will go to our Linux Xen machines, which will have common data between them. For example, our xen configuration files should be available across all of our DOM0's. That allows us to migrate from one DOM0 to another. Additionally, we need some space to store installer images (iso's), and another one where we just put some stuff that is handy to have on DOM0's.
 +
 +We also want to export to a couple of running virtuals to store large amounts of data. Since they have public interfaces, we need to set up our nfs server to only allow limited access to our nfs server, both by limiting through nfs and also with firewalls.
 +
 +<code bash>
 +zfs create -o atime=off -o dedup=off -o mountpoint=/media/nfs_root storage/nfs_root
 +
 +zfs create -o sharenfs='alldirs,network 10.19.209.0/24' -o quota=100G storage/nfs_root/dom0
 +mkdir /media/nfs_root/dom0/xen-configs
 +mkdir /media/nfs_root/dom0/xen-store
 +mkdir /media/nfs_root/dom0/xen-images
 +chmod 777 /media/nfs_root/dom0/xen*
 +
 +zfs create -o sharenfs='network 10.19.209.144/32' storage/nfs_root/simon
 +zfs create -o sharenfs='network 10.19.209.155/32' storage/nfs_root/strax
 +</code>
 +
 +Note that we created storage/nfs_root so we could set some options that will be inherited by subdirectories, in this case, the mount point, atime=off and dedup=off (that is the default anyway).
 +
 +We then created storage/nfs_root/dom0 under it, and gave it a quota of 100G. The dom0 stuff should be fairly secure since their firewalls limit the access, so we just put the alldirs option in to allow the dom0's to mount subdirectories wherever they want.
 +
 +Finally, we create two stores for some servers to put their stuff in, and we limit access to them to only the server itself.
 +
 +
 +===== Links =====
 +  * https://www.freebsd.org/doc/handbook/network-nfs.html
 +  * https://www.freebsd.org/cgi/man.cgi?query=exports&sektion=5&manpath=freebsd-release-ports
 +  * http://serverfault.com/questions/451287/how-to-nfsv4-share-a-zfs-file-system-on-freebsd#451663
 +  * [https://forums.freebsd.org/threads/rpcprog_mnt-rpc-authentication-error-why-client-credential-too-weak.22937/]
 +  * https://www.freebsd.org/doc/handbook/zfs-zpool.html
 +  * https://serverfault.com/questions/347163/mounting-nfsv4-share-from-debian-linux-6-to-freebsd-9-rc3-server-requires-stron?rq=1
 +  * https://forums.freebsd.org/threads/zfs-on-nfs-permissions-and-export-values.9570/
 +  * https://forums.freebsd.org/threads/creating-a-zfs-network-share-over-nfs.34828/
 +
  
unix/freebsd/system_builds/nfsserver.txt · Last modified: 2023/01/17 20:40 by rodolico