How can I find the IP of a NAS connected via SMB?

If you want a sophisticated or permanent solution, Bonjour protocol may fit, you can see its implementation in Linux Avahi. So you can point to your NAS as hostname.local or use Avahi Discover to get IP's and all services published in the network. (printers, ftp, smb, ssh...)

  • Minimum installation for client side (your machine):

    sudo apt-get install avahi-daemon avahi-dnsconfd avahi-discover avahi-utils
    

    avahi-dnsconfd listens to the publishing and passes them to resolvconf. So you can point to the server as nashostname.local. as any other real public domain name. You can use it with http (firefox), samba share, ftp,...

    examples:

    $ ping salah-Aspire-5738.local
    
    PING salah-Aspire-5738.local (192.168.1.3) 56(84) bytes of data.
    64 bytes from salah-Aspire-5738.local (192.168.1.3): icmp_seq=1 ttl=64 time=6.09 ms
    
    $ nmap salah-Aspire-5738.local
    
    Starting Nmap 6.40 ( http://nmap.org ) at 2014-01-30 15:31 CET
    Nmap scan report for salah-Aspire-5738.local (192.168.1.3)
    Host is up (0.066s latency).
    All 1000 scanned ports on salah-Aspire-5738.local (192.168.1.3) are closed
    
    Nmap done: 1 IP address (1 host up) scanned in 4.91 seconds
    

    avahi-discover & avahi-utils, GUI & CLI, are the user interact tool. They are optional in case you want to list all services published on the network.

    Avahi Discover showcase

    Avahi Discover showcase

  • For NAS server side, if it is a Ubuntu base (Linux/BSD you can build source):

    sudo apt-get install avahi-daemon
    

    avahi-daemon provide services publishing.

    In case you are using Commercial NAS, many of them support service publishing using Bonjour.

See Avahi (Wikipedia) or its official website.


You could scan your network to see where it is up, e.g.

nmap -sP 192.168.1.0/24

where obviously you should change the network to your own. Then you'll get a list of devices which are up and running on current LAN.

To find your LAN IP you can use ip addr. If you are on WiFi the IP address will be near right to inet on something like wlp2s0 network interface.