Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iptables for samba server and client

Status
Not open for further replies.

pavNell

Technical User
Sep 27, 2002
178
US
Need a little help with iptables setup for a host and client. Here's my basic setup...

Local Host 192.168.1.103 is running Samba Server. No other network services running.

Local Client 192.168.1.104 needs to access the samba shares from host 192.168.1.103.


Needed iptables configurations....

For the host 192.168.1.103, accept only samba connections. And in particular, only from 192.168.1.104.

For the client 192.168.1.104, accept samba connections only from the host 192.168.1.103.

Here's what I think I need...

For the host:
# Flush all tables
iptables -F
# Allow self access by loopback interface
iptables -A INPUT -i lo -p all -j ACCEPT
iptables -A OUTPUT -o lo -p all -j ACCEPT
# Accept established connections
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --tcp-option ! 2 -j REJECT --reject-with tcp-reset
# Accept samba connections from client 192.168.1.104
iptables -A INPUT -p tcp --syn -s 192.168.1.104 --destination-port 139 -j ACCEPT
iptables -A INPUT -p tcp --syn -s trancas --destination-port 139 -j ACCEPT
# Drop all other connection attempts. Only connections defined above are allaowed
iptables -P INPUT DROP

For the client (almost the same as above):
iptables -F
iptables -A INPUT -i lo -p all -j ACCEPT
iptables -A OUTPUT -o lo -p all -j ACCEPT
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp --tcp-option ! 2 -j REJECT --reject-with tcp-reset
iptables -A INPUT -p tcp --syn -s 192.168.1.103 --destination-port 139 -j ACCEPT
iptables -A INPUT -p tcp --syn -s trancas --destination-port 139 -j ACCEPT
iptables -P INPUT DROP

Does this configuration sound correct for my needs?
Thanks for any help/advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top