Запись на диске fstab NAS

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:

//mybooklive/ /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.

enter image description here

enter image description here

задан 21 July 2020 в 00:06

2 ответа

3 Ways to Solve This Problem

1. Change Router Setting

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.

2. Static IP within Device

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:

  1. 192.168.0.nnn
  2. 192.168.1.nnn

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 or

instructions for Ubuntu Desktop

  1. Open the setting for the wired (or WiFi) connection for which you want to assign the static IP address.
  2. Go to IPv4 tab
  3. Change IPv4 Method from Automatic to Manual
  4. Assign the 3 values for:
  • The static IP address
  • Network Mask. This is almost always
  • Gateway: This is the IP address of your router

enter image description here

3. Use FQDN

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 /etc/fstab as

//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

ответ дан 30 July 2020 в 22:04

Я бы предложил заменить фиксированный IP-адрес DNS-именем в записи fstab. В локальной сети вы сможете преобразовать DNS-имя в IP-адрес. Это не имеет значения, если NAS перезагружается и ip меняется.

ответ дан 30 July 2020 в 22:04

Другие вопросы по тегам:

Похожие вопросы: