Closed aasenov closed 5 years ago
This is not related to the same port. Rpcbind is a kind on service registry. If you start two mountd services, then only one of them get published and the last one wins. IOW, you can't have two mountd runningat the same time. With nfs is a bit different, as you run two different nfs versions, e,g it two different services.
To answer your question: yes, it is possible to run mountd and nfs on different ports. You just need to start two OncRpcSvc on two different ports and use one for nfs and other one for mountd.
Thanks for the clarification - my bad. I've checked the results when executing "rpcinfo -p" on host machine and it seems that native NFS server is always the one listed, no matter when I start NFS4J server - maybe it re-register or something. So no matter of the ports, I'm unable to mount as the client is actually asking for port of program NFS(100003) and Mountd(100005) and it always receive the native NFS ones. It seems that if I specify port/mountport it works cause it didn't ask for ports at all. Native NFS server registry:
# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 39302 status
100024 1 tcp 47442 status
100005 1 udp 20048 mountd
100005 1 tcp 20048 mountd
100005 2 udp 20048 mountd
100005 2 tcp 20048 mountd
100005 3 udp 20048 mountd
100005 3 tcp 20048 mountd
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 3 tcp 2049 nfs_acl
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 3 udp 2049 nfs_acl
100021 1 udp 47909 nlockmgr
100021 3 udp 47909 nlockmgr
100021 4 udp 47909 nlockmgr
100021 1 tcp 34293 nlockmgr
100021 3 tcp 34293 nlockmgr
100021 4 tcp 34293 nlockmgr
I wanted to ask - is it OK to use the same Mount server instance to register both V1 and V3:
MountServer mountd = new MountServer(exportFile, mVFS);
mNFSService.register(new OncRpcProgram(mount_prot.MOUNT_PROGRAM, mount_prot.MOUNT_V1), mountd);
mNFSService.register(new OncRpcProgram(mount_prot.MOUNT_PROGRAM, mount_prot.MOUNT_V3), mountd);
You can run and publish multiple versions of any service, including mountd. However be aware that you can't use mountd from nfs4j with regular nfsd server as export path to file handle mapping will not work.
OK, thanks for the information.
I'm facing an issue running NFS4j server on Linux environment, while the default OS's NFS server is running. I'm changing port of NFS and Mountd daemons of OS's nfs, but still, there are some problems mounting the server. I construct my server the following way: `
` But it seems that both NFS server and Mountd server runs on same port - 2049. If I try to mount using the following command: mount -v -t nfs -o vers=3,nolock,noacl,proto=tcp,:/ /
it works fine both with version 3 and 4.1 if the default nfs server is stopped.
But if I start the OS's NFS server on port 11200 and mountd on 11300 it seems that portmap detect that mountd on 11300 is the default one and redirect calls to it, instead to NFS4J mountd server.
So now if I run the same command, it fails with:
mount.nfs: mount(2): Permission denied
and message in Linux's mountd log -> refused mount request from for / (/): not exported
This works OK for version 4.1 but fails for 3, not sure what's the difference.
If I add the following to mount command "port=2049,mountport=2049" I'm able to mount with version 3 too, so I'm suspecting that the problem is that mountd is running on the same port as nfs.
Is it possible to configure different port for mountd daemon, so the mount command to succeed without specifying ports for both version 3 and 4.1?