TransWikia.com

fstab NAS drive entry

Ask Ubuntu Asked by 24601 on November 9, 2021

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).

//192.168.1.105/<share name> /media/<share name> cifs vers=1.0,uid=<name>,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/<share name> /media/<share name> cifs uid=<name>,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

2 Answers

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 254. 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.

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 255.255.255.0
  • 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

Answered by user68186 on November 9, 2021

I would suggest to replace fixed IP address by DNS Name in fstab entry. In local network you would be able to resolve DNS name into Ip address. It doesn't matter in case NAS is rebooted and ip is change.

Answered by KK Patel on November 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP