# How to set NFS export to allow 192.168.1.x



## eydaimon (Mar 9, 2015)

Hi, I'm doing performing an NFS mount via ZFS:
`zfs set sharenfs="-mapall=daniel 192.168.1.5" zroot/work`

However, what if I want all machines on the 192.168.1.x network to be able to mount it as opposed to just .5?

I've tried the following:

`zfs set sharenfs="-mapall=daniel 192.168.1.1 -network=255.255.255.0" zroot/work
zfs set sharenfs="-mapall=daniel 192.168.1.3/255.255.255.0" zroot/work`


----------



## tobik@ (Mar 9, 2015)

According to exports(5) it should just be:

`zfs set sharenfs="-mapall=daniel 192.168.1/24" zroot/work`


----------



## Beeblebrox (Mar 9, 2015)

In case you did not understand what tobik was saying,
It makes absolutely no difference (performance or otherwise) whether the entry is placed by "zfs set" or in /etc/exports

The ZFS entries append to the exports line anyway, and NFS performance does not benefit from ZFS.


----------



## eydaimon (Mar 9, 2015)

Hi and thanks tobik. It didn't work for me, alas

`zfs set sharenfs="-mapall=daniel 192.168.1/24" zroot/work`

resulted in

`[~/sync]$ mount -t nfs luffy:/usr/home/daniel/work work`

```
mount_nfs: can't mount /usr/home/daniel/work from luffy onto /Users/daniel/sync/work: Permission denied
```
I did just get it to work with this:

`zfs set sharenfs="-mapall=daniel -network 192.168.1.0 -mask=255.255.255.0" zroot/work`

Thanks


----------



## gkontos (Mar 9, 2015)

OK. Just my opinion but for NFS I always use /etc/exports even with ZFS. I have seen a lot of problems with using the sharenfs property under FreeBSD.


----------



## ANOKNUSA (Mar 9, 2015)

gkontos said:


> OK. Just my opinion but for NFS I always use /etc/exports even with ZFS. I have seen a lot of problems with using the sharenfs property under FreeBSD.



I agree. I'm still new to ZFS myself, but I haven't bothered setting the NFS properties via `zfs set` / `zfs get` itself simply because it would be too tedious to set each property individually, then track down every property individually for troubleshooting. It's pretty hard to track down a typo if you're looking at one entry at a time, and the more times you need to type out similar lines the more likely you are to make a mistake. Even with a single NFS share, though, you'd need to type multiple commands and re-type the entire property every time you wanted to correct something. Much better to write a single line in a text editor, copy-paste it and edit as necessary, then have a complete list of adjacent lines in front of you to make sure everything's written out properly.


----------



## eydaimon (Mar 9, 2015)

thanks gkontos. I may go that route.


----------



## tobik@ (Mar 9, 2015)

When you set sharenfs the value is written to /etc/zfs/exports, so you can look there for typos.

Of course this does not safe you from typing multiple commands to fix a typo or correct something...


----------

