#StackBounty: #ip #samba #mount #ubuntu-18.04 #autofs Disabling IP caching in samba or dealing with dynamic IP

Bounty: 50

We want to mount external storage that has been provided to us. We use something like the following in our /etc/fstab file on Ubuntu 18.04.

//external/storage /mounting/point cifs noperm,cred=/home/user/.smbcredentials,domain=WORK,iocharset=utf8,vers=3.0,sec=ntlmv2i,uid=user,gid=WORKGROUP,dir_mode=0770,file_mode=0770 0 0

And .smbcredentials

user=user
password=pass

Unfortunately we are running into mounting issues where the shares sometimes become inaccessible. Strangely enough, we could access it with smbclient and even mount on other OS’s (MacOS, Windows). After asking for feedback from the storage’s sysadmin, we were told that this is caused by the nature of how the datacenter is set up: the IPs can change dynamically. We were also told that this is not a problem for Windows or MacOS, but that on Linux this causes far-reaching problems because the IP of the remote storage is cached. Thus, if the IP of its host changes, the share cannot be found anymore on the client because the cached IP is incorrect.

My question then is: how do we deal with our set up? We were recommended to only access the shares when we need them with smbclient but never actually mounting them. I definitely do not want to go this direction because we use that remote storage as the data storage for running program tasks. So it should be available at all times. Idally, I am looking for a way to disable the IP caching all together but other suggestions are welcome, too. At the moment my eye is on autofs, though I have no experience with it and I am not sure whether it also caches the IP of the shares it should connect to.

PS: it’s also odd to me that – if the analysis of sysadmin is correct – a share becomes unavailable after the IP change (Host is down) but that unmounting and re-mounting does not work. sudo mount -av just hangs.

(Originally asked over at Ask Ubuntu, but it seems a better fit here.)


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.