sahlberg / libnfs-python

Python bindings for libnfs
GNU Lesser General Public License v2.1
64 stars 34 forks source link

Unable to change default port #14

Closed bestksw closed 7 years ago

bestksw commented 8 years ago

libnfs.NFS('nfs://127.0.0.1:3000/tmp')

The above code does not work. Could you fix this to be able to connect to another port?

Thanks

sahlberg commented 7 years ago

Can you explain the usecase? Generally nfs servers do not allow you to run on ports other than 2049 which means that clients, such as the linux kernel client, have the nfs port hardcoded. As such I am not convinced abut the usefulness of this feature.

(which server are you using that allows you to use a non-standard port?)

libnfs and thus libnfs-python use portmapper to discover whch port is used for nfs. so you can get this work, for libnfs not for the linux kernel, by updating portmapper to point to port 3000 for nfs.

You can use the 'rpcinfo' command to view the portmapper database. rpcinfo 127.0.0.1 simply prints the current mapping. 100003 is the program number for the nfs service.

Portmapper is what tells libnfs which port to use for nfs.

If you want to modify the portmapper database, I don't think rpcinfo allows you to do so but the examples folder for libnfs contains a portmapper-client program that can be used to register and unregister which port nfs is bound to.

You can use that utility to update portmapper to point to port 3000 for nfs and then libnfs/libnfs-python will be ble to connect to the server.