In fstab I mount a WD NAS « MyBookLive » with an entry in fstab using a fixed IP address (which was previously established in the router software).
/media/ cifs vers=1.0,uid= ,credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlmv2,_netdev 0 0
Following an update to the router software, it is no longer possible to have a fixed IP/MAC address association which means that if the NAS is rebooted, it will do so with a new dynamic IP address which of course means that the fstab entry is ignored and the drive is not then accessible from the desktop shortcut.
I tried changing the fstab entry to what I had previously set which worked some time ago giving the url of the drive but this no longer seems to work:
/media/ cifs uid= ,credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlmv2,_netdev,vers=3.0 0 0
Is there a way to set the entry in fstab such that it is not reliant upon the dynamic IP address allocated to the drive on reboot?
UPDATE1: Following a comment by @User68186 I have set the following params in the MyBookLive LAN configuration but have yet to test it as not sure if they are correct.
Most routers allows reserving a static IP address for a device. Sometimes a device is associated with the MAC address of the Ethernet port or WiFi chip. The exact method varies by router makes and models.
Another way to set a static IP address for a device is from within the device itself. Again this will depend on the device. First you have to find out which IP address range your home router uses. Most home routers use one of the two address ranges:
where nnn is a number between 2 and 255. You can figure this out by looking at the IP address of the router. It may be either 192.168.0.1 or 192.168.1.1.
The third method is not to bother with assigning a static IP address, but use the Fully Qualified Domain Name (FQDN). For this Ubuntu comes with Avahi preinstalled. This allows us to use
.local suffix to identify various devices in the network. For example if you have a NAS with the hostname
mybooklive, the FQDN of that device would be
mybooklive.local. With this information you can change the line in the file
//mybooklive.local/<share name> /media/<share name> cifs uid=<name>,credentials=/root/.smbcredentials,iocharset=utf8,sec=ntlmv2,_netdev,vers=3.0 0 0
Now even if the IP address of your device is changed by the router, your Ubuntu computer will be able to connect to the device and mount the share as expected.
Hope this helps
Я бы предложил заменить фиксированный IP-адрес DNS-именем в записи fstab. В локальной сети вы сможете преобразовать DNS-имя в IP-адрес. Это не имеет значения, если NAS перезагружается и ip меняется.