brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

accessing LAN NAS by name not IP Address

Sat Jan 13, 2018 10:43 am

Hi,
I can successfully mount access to my NAS device using FSTAB entry, BUT only if i specify the NAS IP Address

//192.168.1.130/Docs /home/pi/northfields cifs username=xxx,password=xxx,defaults 0 0

//192.168.1.130/BackUps /home/pi/BackUps cifs username=xxx,password=xxx,defaults 0 0

but if i use the NAS name and not the ip it fails.

if i ping the ip address its fine.if i ping the NAS name it gives me some weird internet address in the world. ( i guess there is a site out there with the same name as my local NAS)
ive checked the capitalisation is correct for the local name

If i ping from my windows 10 pc it all shows fine ( ie pingiing the name gives the correct IP address)

I am a reasonable PC expert, but a newbie on the PI and Linux.

thanks

neilgl
Posts: 65
Joined: Sun Jan 26, 2014 8:36 pm
Location: MIlton Keynes

Re: accessing LAN NAS by name not IP Address

Sat Jan 13, 2018 2:59 pm

Probably you could install samba on the pi and set up a share in that using the name of your NAS (e.g. Fred)
Then from Windows 10 File Explorer look under Network to see "RASPERRYPI" then the share "Fred"

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sat Jan 13, 2018 3:31 pm

thanks ill give that a try later. i only need to access the nas from the PI . accessing the PI and the NAS from windows 10 works fine.

ill update the result later

neilgl
Posts: 65
Joined: Sun Jan 26, 2014 8:36 pm
Location: MIlton Keynes

Re: accessing LAN NAS by name not IP Address

Sat Jan 13, 2018 11:27 pm

OK what is in your fstab for that NAS

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sat Jan 13, 2018 11:34 pm

I’m sorry I am confused by the question
The fstab content was in the original question

Im not able to try samba approach until tmrw

Thanks

bertlea
Posts: 12
Joined: Wed Dec 07, 2016 6:33 am
Location: Hong Kong

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 12:53 am

How about just adding the IP to name mappings to the /etc/hosts file on the Pi?

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 7:43 am

The IP address assigned to the nas isn’t a static one

drgeoff
Posts: 7508
Joined: Wed Jan 25, 2012 6:39 pm

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 9:27 am

brianharding wrote:
Sun Jan 14, 2018 7:43 am
The IP address assigned to the nas isn’t a static one
Is there a good reason for that? Set the DHCP server (on your router?) to always give it the same address.

User avatar
DougieLawson
Posts: 30935
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 10:35 am

brianharding wrote:
Sun Jan 14, 2018 7:43 am
The IP address assigned to the nas isn’t a static one
Everything that runs a service on your LAN should have a static IP address or needs to run zero configuration networking (aka Zeroconf, aka Bonjour, aka mDNS).

If your NAS supports Bonjour you may be able to find it with hostname.local (for example your Raspberry Pi (default hostname=raspberrypi) will appear as raspberrypi.local on your network if the Avahi daemon is running).
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 12:17 pm

Hi that’s interesting i had always assumed it was better to have non-static to be flexible thanks for that.

User avatar
DougieLawson
Posts: 30935
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 12:48 pm

Without doing any special configuration on your network you get 253 addresses (192.168.xxx.1 to .254) to play with.

On my network every address from 192.168.1.1 to 192.168.1.40 is reserved for fixed IP addresses for Raspberries (I've, currently, got fourteen). Every address from 192.168.1.41 to 192.168.1.100 is the DHCP pool for phones, laptops, tablets, smart TVs, my Arduino, esp8266s and a couple of Wemoses. Addresses above .230 are also reserved for fixed IPs. My NAS is at 192.168.1.230. My printer is at 192.168.1.249. My old WiFi AP is 192.168.1.250. The router is 192.168.1.254. There's a big gap from .101 to .229 that's free for future use.

Most I've ever seen is 31 devices connected (I let visitors connect, I don't restrict anything except dailymail.co.uk is DNS poisoned).
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

User avatar
davidcoton
Posts: 2567
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 12:51 pm

brianharding wrote:
Sun Jan 14, 2018 12:17 pm
Hi that’s interesting i had always assumed it was better to have non-static to be flexible thanks for that.
It's better NOT to define a static address on each PC, NAS, or printer itself. That results in making equipment difficult to move between networks.

However many DHCP servers (usually part of the router or other AP) can be told to issue the same IP address to each node based on its (supposedly) unique MAC address.
That means that each network maintains its integrity and a consistent set of addresses.
The remaining problem is for each network client to find other resources. Looking for a fixed IP address has limitations, but using a name finding service (as per @DougieLawson) overcomes this.
"If it ain't broke, fix it until it is."
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”
The Pink Unicorn is a symbol of commitment to sensible discussion of future versions of the Raspberry Pi ™

User avatar
DougieLawson
Posts: 30935
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 1:09 pm

I also run a bind9 DNS server (which is how I poison dailymail.co.uk) so that every machine with a static IPv4 and static IPv6 (I switched back to use slaac hardware) can be addressed on my .bogus domain.

Bonjour is easier than bind9. Bind9 is easier than /etc/hosts files.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 1:16 pm

@david and @dougie - thanks. i get it now.

Now, back to my original issue.
I have now installed samba and i can see its working from windows as i have allocated a couple of shares and i can see them from windows explorer.

But it hasnt fixed my original problem of being able to access my NAS by name.

if i ping the op address - 192.168.1.130 - i get a response fine
pi@raspberrypi:~ $ ping 192.168.1.130
PING 192.168.1.130 (192.168.1.130) 56(84) bytes of data.
64 bytes from 192.168.1.130: icmp_seq=1 ttl=64 time=3.52 ms
64 bytes from 192.168.1.130: icmp_seq=2 ttl=64 time=6.91 ms
64

if i ping the name i get the odd one which oi guess is coming from somewhere out ion the wild

pi@raspberrypi:~ $ sudo service smbd restart
pi@raspberrypi:~ $ ping northfields
PING northfields (92.242.132.15) 56(84) bytes of data.
64 bytes from unallocated.barefruit.co.uk (92.242.132.15): icmp_seq=4 ttl=242 time=14.4 ms
64 bytes from unallocated.barefruit.co.uk (92.242.132.15): icmp_seq=5 ttl=242 time=15.0 ms
64 bytes f

as a reminder my fstab is
proc /proc proc defaults 0 0
/dev/mmcblk0p6 /boot vfat defaults 0 2
/dev/mmcblk0p7 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
//192.168.1.130/Docs /home/pi/northfields cifs username=xxx,password=xxx,defaults 0 0
//192.168.1.130/BackUps /home/pi/BackUps cifs username=xxx,password=xxx,defaults 0 0

anyone help and point me int he right direction

thanks

User avatar
DougieLawson
Posts: 30935
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 1:25 pm

Does your NAS do NFS? Because that's orders of magnitude better with Linux (no credentials needed).

What do you get from
sudo mount -o user=xxx -t cifs \\\\192.168.1.130\\Docs /mnt

Note: it's user=xxx not username=xxx
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 1:52 pm

pi@raspberrypi:~ $ sudo mount -o user=xx -t cifs \\\\192.168.1.130\\Docs /mnt
Password for pi@\192.168.1.130\Docs: *********
pi@raspberrypi:~ $ sudo mount -o user=xxx -t cifs \\\\northfields\\Docs /mnt
Password for pi@\northfields\Docs: *********
mount error(115): Operation now in progress
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
pi@raspberrypi:~ $

User avatar
DougieLawson
Posts: 30935
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 2:21 pm

115 means it can't find northfields as an NMBD domain.

Do you have a machine running as domain master? Do you have two machines fighting to be domain master?

What does nmblookup -A 192.168.1.130 give you?
If you've got smbclient installed what does smbtree -b -U pi give you?
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 2:36 pm

i thought i found it, the smblookuop shows the nas as capitalised , but the capitalisation didnt work either..

i also changed to NFS that seems to work ( with the Ip address of course)
1)
pi@raspberrypi:~ $ nmblookup -A 192.168.1.130
Looking up status of 192.168.1.130
NORTHFIELDS <00> - B <ACTIVE>
NORTHFIELDS <03> - B <ACTIVE>
NORTHFIELDS <20> - B <ACTIVE>
WORKGROUP <00> - <GROUP> B <ACTIVE>
WORKGROUP <1e> - <GROUP> B <ACTIVE>

MAC Address = 00-00-00-00-00-00

pi@raspberrypi:~ $
2) i dont - command not found

3) i havent heard of domain master before, googline around i dont think i have nor need one.
its a relatively simple lan , bb router acts as dhcp, ok - lots of devices circa 20, wifi access points etc.
mt windows and mac devices can find northfields ok
Pinging northfields [192.168.1.130] with 32 bytes of data:
Reply from 192.168.1.130: bytes=32 time=1ms TTL=64
Reply from 192.168.1.130: bytes=32 time=2ms TTL=64
Reply from 192.168.1.130: bytes=32 time=2ms TTL=64
Reply from 192.168.1.130: bytes=32 time=4ms TTL=64

Ping statistics for 192.168.1.130:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 4ms, Average = 2ms

C:\Users\brian>

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 2:38 pm

btw, checking my router, the NAS shows as lower case...

User avatar
DougieLawson
Posts: 30935
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 2:39 pm

You need a domain master running NMBD that's the thingy that gets the Windows CIFS/Samba network addressing by name working. The important thing is ONE domain master per network.

Your NAS may be doing that.

CIFS/Samba doesn't care about upper vs lower case names because Windows never cared about upper vs lower case.

Stick with NFS, it's easier, more secure and owner/group/world permissions "just work" with NFS.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

brianharding
Posts: 10
Joined: Sat Jan 13, 2018 10:35 am

Re: accessing LAN NAS by name not IP Address

Sun Jan 14, 2018 4:36 pm

so, i am about to give up and stick with ip adressing :(

I used
pi@raspberrypi:~ $ nmblookup -M -- -
192.168.1.1 __MSBROWSE__<01>
pi@raspberrypi:~ $

which seems to suggest that my gateway router is acting as master browser. I am guessing that something within my network is storing names to ip address and providing lookups to those devices but just not to the raspberry pi.

thanks for the help

Return to “Beginners”

Who is online

Users browsing this forum: mline, stinsonmaster and 47 guests