Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I can't connect to file shares on Windows computers using smbclient -L //hostname when the firewall is enabled.

This occurs whether I'm using ufw (which allows outgoing traffic and replies back in with the default configuration) or iptables (where I'm allowing outgoing traffic and replies back in with iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT).

However, smbclient -L //ip-address works whether the firewall is enabled or not.

I also tested this against a Samba server running on Ubuntu and again smbclient -L //hostname does not work when the firewall is enabled, but smbclient -L //ip-address works whether the firewall is enabled or not.

For reference, here are the iptables rules I used during testing:

*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
-A INPUT -p icmp -j ACCEPT 
-A INPUT -d 224.0.0.251/32 -p udp -m udp --dport 5353 -j ACCEPT 
COMMIT
share|improve this question
1  
your dns lookup dosn't work. what happens when you try host <your-smb-host>? And what is in your /etc/resolv.conf ? –  schneehase Mar 6 '11 at 16:29

2 Answers 2

I was having a similar problem: I didn't had samba installed but I wanted to browse the network with smbclient and I couln't get no servers in my network, but with the firewall down I could see all the servers.

After searching I found out that ufw (my firewall) wasn't loading the nf_conntrack_netbios_ns module.

I've edited the file /etc/default/ufw, added the module in the line IPT_MODULES=, restarted the firewall with no ports open and voilá, I could browse the samba shares in my network :)

More people had this issue and a bug was opened in ufw about it: https://bugs.launchpad.net/ufw/+bug/360975

Hope this helps.

share|improve this answer

Turn off the firewall; you have blocked the SMB packets from the other machine trying to tell you its name.

share|improve this answer
    
Thanks, psusi, but how can I get this working without turning the firewall off? –  user8979 Mar 9 '11 at 20:27
    
@skyblue: open the correct ports, though if you aren't blocking any otherwise open ports, then what exactly is the firewall doing? A firewall that only blocks ports that are not open anyhow is kind of pointless. What are you actually trying to block with the firewall? –  psusi Mar 9 '11 at 21:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.