How to troubleshoot Samba error NT_STATUS_HOST_UNREACHABLE

9,189

Solved with two changes.

I'd added Firewalld to my laptop to use the firewall-applet to display firewall status. Whilst GUFW showed the firewall was off, the Network 'Edit Connections' (nm-connection-editor) showed a different 'Firewall Zone' was in use on my WiFi connection.

I removed Gufw and Ufw and set up the Firewalld zone with mdns (for Avahi), nfs, samba and samba-client enabled.

This enabled the Desktop to browse the Laptop with Nautilus, to connect via smb://Desktop/ and with CLI smbclient.

Secondly I added

browseable = yes

to the Desktop's smb.conf shared folders. The folders could already be connected but this enabled the workgroup and shares to be browsed from Nautilus on the Laptop.

Both Laptop and Desktop are now visible under the workgroup (under 'Windows Server'...) whereas neither could be viewed before.

Two other changes may have helped. I installed Avahi, and edited the Laptop's /etc/nsswitch.conf file to match the Desktop's, by adding myhostname to the end of the hosts line.

I didn't find any more useful logs from Samba other than /var/log/samba/nmbd.log; setting the syslog to 10 added little to level 3.

Share:
9,189

Related videos on Youtube

Raphael Ragul
Author by

Raphael Ragul

Updated on September 18, 2022

Comments

  • Raphael Ragul
    Raphael Ragul over 1 year

    I'm struggling to share folders over the Lan between two Ubuntu 17.04 machines.

    I tried the Nautilus public share approach first, but when I couldn't browse folders in both directions I switched to using Samba. AFAIK both Samba installations are almost identical; I copied smb.conf between the machines several times without any effect.

    I can see both machines under 'Other Locations' in Nautilus, and can browse the desktop's shared folders from the laptop, but not the other way round.

    Running:

    john@Laptop:~$ smbclient -L //192.168.20.136 -U john

    on my laptop, it produces the expected list of shared resources. On the desktop it generates an error:

    john@Desktop:~$ smbclient -L //192.168.20.102 -U john
    WARNING: The "syslog" option is deprecated
    Enter john2's password: 
    Connection to 192.168.20.102 failed (Error NT_STATUS_HOST_UNREACHABLE)
    

    I was using passdb backend = tdbsam but switched to smbpasswd to simplify things with no effect.

    Firewalls are off; GUFW reports the same ports are being used on both machines.

    Name resolution is working; I can ping network names. I checked Wireshark, and Samba is communicating from the desktop to the laptop, and vice-versa.

    I set syslog = 3 in smb.conf on both machines and looked at their journalctrl, auth.log, /var/log/samba/log.smbd, /var/log/samba/log.nmbd without finding anything relating to the failed connection.

    The only minor issue is that both machines are taking it in turns to act as local master browser for the workgroup; I raised the priority of the desktop to avoid this but the behaviour continued.

    It looks like some sort of authorisation issue, so I set up a second user account on the laptop to test a clean setup but got the same results as before.

    How can I get a closer look at what's happening when the desktop's Samba tries to access the laptop's shared folders?

    john@Laptop:/etc/samba$ samba -V    
    Version 4.5.8-Ubuntu
    

    Desktop smb.conf:

    john@Desktop:~$ testparm -s
    Load smb config files from /etc/samba/smb.conf
    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
    WARNING: The "syslog" option is deprecated
    Processing section "[printers]"
    Processing section "[print$]"
    Processing section "[Public]"
    Processing section "[Documents]"
    Loaded services file OK.
    Server role: ROLE_STANDALONE
    
    # Global parameters
    [global]
        server string = %h server (Samba, Ubuntu)
        workgroup = office-design
        os level = 33
        log file = /var/log/samba/log.%m
        max log size = 1000
        syslog = 3
        panic action = /usr/share/samba/panic-action %d
        usershare allow guests = Yes
        usershare owner only = No
        printcap name = CUPS
        name resolve order = bcast lmhosts hosts wins
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passdb backend = smbpasswd
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        security = USER
        server role = standalone server
        unix password sync = Yes
        username map = /etc/samba/smbusers
        dns proxy = No
        idmap config * : backend = tdb
    
    
    [printers]
        comment = All Printers
        path = /var/spool/samba
        browseable = No
        printable = Yes
        create mask = 0700
    
    
    [print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers
    
    
    [Public]
        path = /home/nicole/Public
        read only = No
    
    
    [Documents]
        path = /home/john/Documents
        read only = No
        valid users = john john2
    

    Desktop smbtree; no Laptop resources visible:

    john@Desktop:~$ smbtree
    Enter john's password: 
    OFFICE-DESIGN
        \\DESKTOP           Desktop server (Samba, Ubuntu)
            \\DESKTOP\Downloads         
            \\DESKTOP\Pictures          
            \\DESKTOP\PDF               PDF
            \\DESKTOP\IX6500            IX6500
            \\DESKTOP\Canon-PIXMA-iX6560    Canon PIXMA iX6560
            \\DESKTOP\Canon-iX6500-series   Canon iX6500 series
            \\DESKTOP\iX6500-series     Canon iX6500 series
            \\DESKTOP\Canon-iX6500-series-2 Canon iX6500 series
            \\DESKTOP\IPC$              IPC Service (Desktop server (Samba, Ubuntu))
            \\DESKTOP\Documents         
            \\DESKTOP\Public            
            \\DESKTOP\print$            Printer Drivers
        \\LAPTOP        laptop server (Samba, Ubuntu)
    

    Desktop smbd; no errors. Desktop nmbd errors:

    john@Desktop:~$ systemctl status nmbd.service
    ● nmbd.service - Samba NMB Daemon
       Loaded: loaded (/lib/systemd/system/nmbd.service; enabled; vendor preset: enabled)
       Active: active (running) since Tue 2017-12-19 11:52:52 +07; 20min ago
         Docs: man:nmbd(8)
               man:samba(7)
               man:smb.conf(5)
     Main PID: 25317 (nmbd)
       Status: "nmbd: ready to serve connections..."
        Tasks: 1 (limit: 4915)
       CGroup: /system.slice/nmbd.service
               └─25317 /usr/sbin/nmbd
    
    Dec 19 12:09:58 Desktop nmbd[25317]:   
    Dec 19 12:09:58 Desktop nmbd[25317]:   Samba name server DESKTOP has stopped being a local master browser for workgroup OFFICE-DESIGN on subnet 192.168
    Dec 19 12:09:58 Desktop nmbd[25317]:   
    Dec 19 12:09:58 Desktop nmbd[25317]:   *****
    Dec 19 12:10:15 Desktop nmbd[25317]: [2017/12/19 12:10:15.371279,  0] ../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
    Dec 19 12:10:15 Desktop nmbd[25317]:   *****
    Dec 19 12:10:15 Desktop nmbd[25317]:   
    Dec 19 12:10:15 Desktop nmbd[25317]:   Samba name server DESKTOP is now a local master browser for workgroup OFFICE-DESIGN on subnet 192.168.20.136
    Dec 19 12:10:15 Desktop nmbd[25317]:   
    Dec 19 12:10:15 Desktop nmbd[25317]:   *****
    

    Laptop smb.conf:

    john@laptop:/etc/samba$ testparm -s
    Load smb config files from /etc/samba/smb.conf
    rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
    WARNING: The "syslog" option is deprecated
    Processing section "[printers]"
    Processing section "[print$]"
    Processing section "[Pictures]"
    Processing section "[Documents]"
    Processing section "[j2Documents]"
    Loaded services file OK.
    Server role: ROLE_STANDALONE
    
    # Global parameters
    [global]
        server string = %h server (Samba, Ubuntu)
        workgroup = office-design
        log file = /var/log/samba/log.%m
        max log size = 1000
        syslog = 3
        panic action = /usr/share/samba/panic-action %d
        usershare allow guests = Yes
        usershare owner only = No
        name resolve order = bcast lmhosts hosts wins
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passdb backend = smbpasswd
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        passwd program = /usr/bin/passwd %u
        security = USER
        server role = standalone server
        unix password sync = Yes
        username map = /etc/samba/smbusers
        dns proxy = No
        idmap config * : backend = tdb
    
    
    [printers]
        comment = All Printers
        path = /var/spool/samba
        browseable = No
        printable = Yes
        create mask = 0700
    
    
    [print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers
    
    
    [Pictures]
        path = /media/john/Home/john/Pictures
        read only = No
        valid users = @sambashare
    
    
    [Documents]
        path = /home/john/Documents
        read only = No
        valid users = @sambashare
    
    
    [j2Documents]
        path = /home/john2/Documents
        read only = No
        valid users = john2
    

    Laptop smbd status; no errors. Laptop nmbd status:

    john@laptop:/etc/samba$ systemctl status nmbd.service
    ● nmbd.service - Samba NMB Daemon
       Loaded: loaded (/lib/systemd/system/nmbd.service; enabled; vendor preset: enabled)
       Active: active (running) since Wed 2017-12-20 11:57:37 +07; 1min 38s ago
         Docs: man:nmbd(8)
               man:samba(7)
               man:smb.conf(5)
     Main PID: 11314 (nmbd)
       Status: "nmbd: ready to serve connections..."
        Tasks: 1 (limit: 4915)
       CGroup: /system.slice/nmbd.service
               └─11314 /usr/sbin/nmbd
    
    Dec 20 11:57:37 laptop systemd[1]: nmbd.service: Supervising process 11314 which is not our child. We'll most likely not notice when it exits.
    Dec 20 11:57:37 laptop nmbd[11314]: [2017/12/20 11:57:37.518663,  0] ../lib/util/become_daemon.c:124(daemon_ready)
    Dec 20 11:57:37 laptop nmbd[11314]:   STATUS=daemon 'nmbd' finished starting up and ready to serve connections
    Dec 20 11:57:37 laptop systemd[1]: Started Samba NMB Daemon.
    Dec 20 11:58:08 laptop nmbd[11314]: [2017/12/20 11:58:08.875623,  0] ../source3/nmbd/nmbd_become_lmb.c:397(become_local_master_stage2)
    Dec 20 11:58:08 laptop nmbd[11314]:   *****
    Dec 20 11:58:08 laptop nmbd[11314]:   
    Dec 20 11:58:08 laptop nmbd[11314]:   Samba name server LAPTOP is now a local master browser for workgroup OFFICE-DESIGN on subnet 192.168.20.102
    Dec 20 11:58:08 laptop nmbd[11314]:   
    Dec 20 11:58:08 laptop nmbd[11314]:   *****
    

    Using smbclient I can connect locally on both Laptop and Desktop, and remotely from Laptop to Desktop, but Desktop to Laptop fails.

    Desktop locally:

    john@Desktop:/etc/samba$ smbclient //192.168.20.136/Documents -U john
    WARNING: The "syslog" option is deprecated
    Enter john's password: 
    Domain=[VIVID-DESIGN] OS=[Windows 6.1] Server=[Samba 4.5.8-Ubuntu]
    smb: \>
    

    Desktop to laptop:

    john@Desktop:/etc/samba$ smbclient //192.168.20.102/j2Documents -U john2
    WARNING: The "syslog" option is deprecated
    Enter john2's password: 
    Connection to 192.168.20.102 failed (Error NT_STATUS_HOST_UNREACHABLE)
    
    • Adail Junior
      Adail Junior over 6 years
      Could you provide the Samba configuration files and the the error log?
    • Raphael Ragul
      Raphael Ragul over 6 years
      Updated. Are there other Samba logs?