Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My iptables configuration is based upon Arch Linux's Simple Stateful Firewall solution. However, Samba doesn't work with it, even though I order the 137/UDP, 138/UDP, 139/TCP and 445/TCP ports to be open! Here's my configuration:
Code:
# Generated by iptables-save v1.4.16.2 on Mon Nov 12 23:02:57 2012
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:TCP - [0:0]
:UDP - [0:0]
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -p icmp -m icmp --icmp-type 8 -m conntrack --ctstate NEW -j ACCEPT
-A INPUT -p udp -m conntrack --ctstate NEW -j UDP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j TCP
-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -j REJECT --reject-with icmp-proto-unreachable
-A TCP -s 192.168.0.0/24 -p tcp -m tcp --dport 22 -j ACCEPT
-A TCP -s 192.168.0.0/24 -p tcp -m tcp --dport 631 -j ACCEPT
-A TCP -s 192.168.0.0/24 -p tcp -m tcp --dport 139 -j ACCEPT
-A TCP -s 192.168.0.0/24 -p tcp -m tcp --dport 445 -j ACCEPT
-A TCP -s 192.168.0.0/24 -p tcp -m tcp --dport 2049 -j ACCEPT
-A UDP -s 192.168.0.0/24 -p udp -m udp --dport 137 -j ACCEPT
-A UDP -s 192.168.0.0/24 -p udp -m udp --dport 138 -j ACCEPT
-A UDP -s 192.168.0.0/24 -p udp -m udp --dport 5353 -j ACCEPT
COMMIT
Everything covered by the rules I open with iptables -A TCP/UDP -p tcp/udp --dport DPORT works...
With the firewall enabled, smbtree (and nautilus navigation) returns nothing... and smbclient SERVER/Sharename returns with (Error NT_STATUS_BAD_NETWORK_NAME)...
This is what I have in my firewall script for Samba
Code:
## Samba
# Samba uses UDP on ports 137 & 138 for nmbd and
# Samba uses TCP on ports 139 & 445 for smbd
# Accept the UDP packets so that they are not logged
$IPTABLES -A INPUT -i $EXTIF -s $LOCAL_LAN -p udp --sport 137 -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -s $LOCAL_LAN -p udp --dport 137 -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -s $LOCAL_LAN -p udp --dport 138 -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -s $LOCAL_LAN -p tcp --dport 139 -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -s $LOCAL_LAN -p tcp --dport 445 -j ACCEPT
I am not familiar with the Arch Linux Simple Stateful Firewall solution, so I do not know how the TCP and UDP chains are used.
Have you tried changing these to the INPUT chain?
That was the missing rule, the *source port* for nmbd calls... it's working now, THANKS!
I guess I'll post that in the wiki and/or warn the Samba documentation folks, because when we hear 'open up port x' we associate immediatly with a --dport type of rule.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.