How to make nfs share accessible across subnets?
Little Girl
littlergirl at gmail.com
Thu Feb 10 19:48:35 UTC 2022
Hey there,
Bo Berglund wrote:
>#NFS video share on ubuntuserv
>192.168.119.216:/home/bosse/www/video /mnt/video nfs tcp,noexec,intr
>0 0
>So I looked at how nfs was set up on my Ubuntu server:
>In the file /etc/exports I found this:
>
>/home/bosse/www/video 192.168.119.0/24(rw,sync,no_subtree_check)
>/home/bosse/www/video 192.168.117.0/24(rw,sync,no_subtree_check)
The /etc/fstab line is all about who is sharing what with me and
where I can find it:
[who is sharing with me]:[what they are sharing] [where I can find it
on my system] [options]
The /etc/exports line is all about what I am sharing and with whom:
[what I am sharing] [who I am sharing it with](options)
If you look at your current set-up, those don't quite seem to match
up with what I get the impression you'd like NFS to be doing. Your
who, what, and where might need some sorting out, and you'll want to
check the /etc/fstab and /etc/exports files on both machines to make
sure the information matches up nicely.
====================
Here's your ubuntuserv machine's /etc/fstab line:
192.168.119.216:/home/bosse/www/video /mnt/video nfs tcp,noexec,intr
0 0
====================
My reading of your ubuntuserv /etc/fstab line is:
The machine at the 192.168.119.216 IP is sharing
the /home/bosse/www/video directory with me and I can find it in
my /mnt/video directory and these are the options that must be used.
====================
Here are your ubuntuserv machine's /etc/exports lines:
/home/bosse/www/video 192.168.119.0/24(rw,sync,no_subtree_check)
/home/bosse/www/video 192.168.117.0/24(rw,sync,no_subtree_check)
====================
My reading of your ubuntuserv /etc/exports lines is:
I am sharing my /home/bosse/www/video directory with the machines at
the 192.168.119.0 through 192.168.119.255 IP addresses and these are
the options that must be used.
I am sharing my /home/bosse/www/video directory with the machines at
the 192.168.117.0 through 192.168.117.255 IP addresses and these are
the options that must be used.
====================
I get the feeling that's not quite what you want those lines to say.
Your /etc/exports lines look like they do what you're after as long
as /home/bosse/www/video is on the ubuntuserv machine and as long as
it wants to share that directory with any machine at any of the
specified IP addresses.
It's the /etc/fstab line on ubuntuserv that seems to be what's
messing things up. I get the impression that that line should be in
the remote machine's /etc/fstab file and not on ubuntuserv and it
should contain ubuntuserv's IP.
>Then I did this:
>
>sudo exportfs -a
>sudo systemctl restart nfs-kernel-server
Here are the commands I would use after making changes (see man
exportfs for why the r option might be helpful):
# Restart NFS:
sudo exportfs -ar
sudo systemctl restart nfs-kernel-server
# Restart the network:
sudo systemctl restart systemd-networkd
--
Little Girl
There is no spoon.
More information about the ubuntu-users
mailing list