Can't ping Windows hostname

Solution 1:

It turned out to be a firewall problem.

Solution as suggested at https://fitzcarraldoblog.wordpress.com/2017/08/11/prevent-linux-firewalls-interfering-with-samba-commands-in-a-home-network-that-uses-broadcast-netbios-name-resolution/

  1. iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns
  2. Add the following lines to the end of the file /etc/ufw/before.rules
    # The following is needed to enable Samba commands to
    # work properly for broadcast NetBIOS name resolution
    #
    # raw table rules
    *raw
    :OUTPUT ACCEPT [0:0]
    -F OUTPUT
    -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns
    COMMIT
  1. Restart UFW!