You are not logged in.

#1 2020-01-25 17:32:26

bohokash
Member
Registered: 2019-11-30
Posts: 28

NFS: How to manage in /etc/exports when client IP changes ?

I have NFS shares from my virtual server, /etc/exports looks like:

# /etc/exports - exports(5) - directories exported to NFS clients
#
# Example for NFSv2 and NFSv3:
#  /srv/home        hostname1(rw,sync) hostname2(ro,sync)
# Example for NFSv4:
#  /srv/nfs4	    hostname1(rw,sync,fsid=0)
#  /srv/nfs4/home   hostname1(rw,sync,nohide)
# Using Kerberos and integrity checking:
#  /srv/nfs4        *(rw,sync,sec=krb5i,fsid=0)
#  /srv/nfs4/home   *(rw,sync,sec=krb5i,nohide)
#
# Use `exportfs -arv` to reload.

/srv/nfs4/ 85.235.xxx.xxx(rw,no_root_squash,no_subtree_check,fsid=root,crossmnt)
/srv/nfs4/pcom 85.235.xxx.xxx(rw)
/srv/nfs4/util 85.235.xxx.xxx(rw)
<similar lines 6 times>

The only allowed client IP is hardcoded in the configuration file: 85.235.xxx.xxx.

Unfortunately my client IP address changes from time to time due to the ISP. In fact not so often, maybe only 2 - 4 times per year.

So I would like to know if some mechanism does exist, which makes it easier to update, or automatically keep updated the /etc/exports configuration file. For example using some kind of variable to substitute the IP address at the right places.

Or should I write a program for this reason which updates this file in case of need?

Offline

#2 2020-01-25 22:14:57

seth
Member
Registered: 2012-09-03
Posts: 13,725

Re: NFS: How to manage in /etc/exports when client IP changes ?

dyndns service?
How would the server be supposed to "know" the proper new IP?

For example using some kind of variable to substitute the IP address at the right places.

You can use a (degenerated) netgroup, https://linux.die.net/man/5/netgroup

Online

#3 2020-02-02 15:42:58

lahwaacz
Wiki Admin
From: Czech Republic
Registered: 2012-05-29
Posts: 655

Re: NFS: How to manage in /etc/exports when client IP changes ?

You can set up a VPN.

Offline

Board footer

Powered by FluxBB