Report this

What is the reason for this report?

How can I dynamically create NFS clients?

Posted on October 31, 2019

I have one droplet that is a NFS host and others that are clients. I’d like to create clients dynamically. However, the NFS host requires a list of clients. Is there any way to use NFS when the number of clients will change dynamically? It doesn’t seem realistic to modify the files on the host and restart NFS.

I’m wondering whether I could use a range of IP addresses and use a private network for the clients? Or do I just have to use some other storage solution?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

Yes, in your /etc/exports file you should be able to specify an IP range, for example:

/mnt/your_shared_folder your_subnet/24(rw,sync,no_subtree_check)

Another thing that I could suggest is using the DigitalOcean block storage instead:

https://www.digitalocean.com/docs/volumes/

Hope that this helps! Regards, Bobby

Heya,

Yes, you can certainly design a dynamic setup for NFS clients, and using a private network with a range of IP addresses is a reasonable approach. This allows you to add and remove clients without manually modifying configuration files on the NFS server each time.

Here’s a high-level guide on how you might achieve this:

  1. Private Network Setup:
  • Assign a private IP address range for your NFS clients within your private network.
  • Ensure that your NFS host and clients can communicate over this private network.
  1. Dynamic Client Addition:
  • Set up a system or script on your NFS host that can dynamically generate the list of allowed clients based on the current IP addresses in your private network.
  • This script could periodically scan for active machines in the private IP range and update the NFS server’s configuration accordingly.
  1. Automated Configuration:
  • Automate the process of updating the NFS server’s configuration file whenever a new client is added or an existing client is removed.
  • You might use tools like Ansible, Puppet, or custom scripts to manage this configuration dynamically.
  1. NFS Server Configuration:
  • Configure your NFS server to allow connections from any IP within your private network. This usually involves setting up the NFS export options appropriately.

Example /etc/exports on the NFS server:

/path/to/export 10.0.0.0/24(rw,sync,no_root_squash)

This example allows any IP in the range 10.0.0.1 to 10.0.0.254 to connect with read-write access.

  1. Firewall Rules:
  • Adjust your firewall rules to permit traffic between the NFS server and clients on the private network.
  1. Security Considerations:
  • Ensure that your NFS server is secure and that you are following best practices for NFS security, especially when allowing connections from a dynamic range of IP addresses.

Remember to test this setup in a controlled environment to ensure that it meets your security and performance requirements. Also, make sure to have proper backups and monitoring in place.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.