Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFS client unable to connect #40

Closed
xttjsn opened this issue Mar 8, 2020 · 2 comments
Closed

NFS client unable to connect #40

xttjsn opened this issue Mar 8, 2020 · 2 comments

Comments

@xttjsn
Copy link

xttjsn commented Mar 8, 2020

This might be a noob question, but I have two VMs running in the same bridged network. I configured VM1 as the NFS server:

$ sudo docker run \
-v /nfsroot:/nfsroot \
-v /etc/exports:/etc/exports:ro \
--cap-add SYS_ADMIN \
-p 2049:2049 \
--security-opt apparmor=erichough-nfs \
erichough/nfs-server

==================================================================
      SETTING UP ...
==================================================================
----> setup complete

==================================================================
      STARTING SERVICES ...
==================================================================
----> starting rpcbind
----> starting exportfs
----> starting rpc.mountd on port 32767
----> starting rpc.statd on port 32765 (outgoing from port 32766)
----> starting rpc.nfsd on port 2049 with 4 server thread(s)
----> all services started normally

==================================================================
      SERVER STARTUP COMPLETE
==================================================================
----> list of enabled NFS protocol versions: 4.2, 4.1, 4, 3
----> list of container exports:
---->   /nfsroot 10.0.0.0/24(ro,no_root_squash,no_subtree_check)
----> list of container ports that should be exposed:
---->   111 (TCP and UDP)
---->   2049 (TCP and UDP)
---->   32765 (TCP and UDP)
---->   32767 (TCP and UDP)

==================================================================
      READY AND WAITING FOR NFS CLIENT CONNECTIONS
==================================================================

Here's VM1's network status:

ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:76:8b:0e brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.94/24 brd 10.0.0.255 scope global dynamic noprefixroute ens33
       valid_lft 594618sec preferred_lft 594618sec
...

VM2 will be using the interface ens33 at 10.0.0.94.

When I connect to the server using VM2, I get:

sudo mount 10.0.0.94:/nfsroot /mnt/shared_client
mount.nfs: requested NFS version or transport protocol is not supported

Some more verbose output:

$ sudo mount -v -t nfs -o vers=3,nfsvers=3 10.0.0.94:/nfsroot /mnt/shared_client
mount.nfs: timeout set for Sun Mar  8 17:34:18 2020
mount.nfs: trying text-based options 'vers=3,nfsvers=3,addr=10.0.0.94'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 10.0.0.94 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: requested NFS version or transport protocol is not supported
$ sudo mount -v -t nfs -o vers=4,nfsvers=4 10.0.0.94:/nfsroot /mnt/shared_client
mount.nfs: timeout set for Sun Mar  8 17:34:53 2020
mount.nfs: trying text-based options 'vers=4,addr=10.0.0.94,clientaddr=192.168.117.129'
mount.nfs: mount(2): No such file or directory
mount.nfs: trying text-based options 'addr=10.0.0.94'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 10.0.0.94 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: portmap query retrying: RPC: Program not registered
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: portmap query failed: RPC: Program not registered
mount.nfs: requested NFS version or transport protocol is not supported

Strangely, when I set up VM1's server by systemctl start nfs-kernel-server in the same network setup, VM2 CAN connect to the server without issue.

Am I missing anything?

@xttjsn
Copy link
Author

xttjsn commented Mar 9, 2020

It turns out that I only have to change /shared to / when doing mount:

sudo mount -v -t nfs -o vers=4,nfsvers=4 10.0.0.94:/ /mnt/shared_client      
mount.nfs: timeout set for Sun Mar  8 18:18:33 2020
mount.nfs: trying text-based options 'vers=4,addr=10.0.0.94,clientaddr=192.168.117.129'

@xttjsn xttjsn closed this as completed Mar 9, 2020
@ehough
Copy link
Owner

ehough commented Mar 10, 2020

Glad that you got it worked out and thank you for sharing your solution; hopefully it will help others.

NFSv4 uses a "pseudo filesystem" that causes widespread confusion wrt mount points. It's counter intuitive at best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants