How can I use smbclient to connect to Windows shares by hostname when a firewall is enabled?
Posted
by
skyblue
on Ask Ubuntu
See other posts from Ask Ubuntu
or by skyblue
Published on 2011-03-06T11:42:45Z
Indexed on
2011/03/06
16:18 UTC
Read the original article
Hit count: 228
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
© Ask Ubuntu or respective owner