LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2008, 02:18 PM   #1
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Rep: Reputation: 20
Samba and iptables


I've set up Samba on a couple of machines with iptables (to allow 137UDP, 138UDP, 139TCP, and 445TCP in from allowed hosts). This works fine, but if I try to start / restart smb while the firewall is up, I get "Starting SMB services:" and it hangs there. Adding 127.0.0.1 and the IP address of the host didn't help. Googling didn't help me either. What else needs to be allowed for the service to start? tcpdump isn't helping.

Last edited by jnojr; 09-12-2008 at 02:21 PM.
 
Old 09-12-2008, 02:50 PM   #2
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Rep: Reputation: 32
Well really interesting.

1. can you give the output of iptables -vnL when you can not start samba ?
2. I am sure that you do not need to open any ports to the eth to start samba as we have several server working with samba but not allowing any connection for the eth.
3. does /log/messages say anything
4. does /log/samba/smb... say anything
 
Old 09-12-2008, 03:01 PM   #3
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,191

Rep: Reputation: 49
The server wouldnt rely on the firewall to start. Everything is local so it wouldnt stop the service from running.
Just to clarify, if you have the firewall disabled does the service start properly?

Another thing,
Quote:
bash-3.1# cat /etc/services | grep netbios
netbios-ns 137/tcp #NETBIOS Name Service
netbios-ns 137/udp #NETBIOS Name Service
netbios-dgm 138/tcp #NETBIOS Datagram Service
netbios-dgm 138/udp #NETBIOS Datagram Service
netbios-ssn 139/tcp #NETBIOS Session Service
netbios-ssn 139/udp #NETBIOS Session Service
bash-3.1# cat /etc/services | grep microsoft
microsoft-ds 445/tcp
microsoft-ds 445/udp
 
Old 09-12-2008, 03:46 PM   #4
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by saavik View Post
Well really interesting.

1. can you give the output of iptables -vnL when you can not start samba ?
[root@localhost ~]# iptables -vnL
Chain INPUT (policy DROP 805 packets, 81092 bytes)
pkts bytes target prot opt in out source destination
460 32396 ACCEPT tcp -- * * 10.0.0.0/22 0.0.0.0/0 tcp dpt:22
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 0
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 3
0 0 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmp type 11
193 27127 ACCEPT udp -- * * 10.99.16.5 0.0.0.0/0 udp spt:53 dpts:1024:65535
0 0 ACCEPT tcp -- * * 10.99.16.5 0.0.0.0/0 tcp spt:53 dpts:1024:65535
18 1406 ACCEPT udp -- * * 10.99.16.7 0.0.0.0/0 udp spt:53 dpts:1024:65535
0 0 ACCEPT tcp -- * * 10.99.16.7 0.0.0.0/0 tcp spt:53 dpts:1024:65535
14 1064 ACCEPT udp -- * * 10.99.16.5 0.0.0.0/0 udp spt:123
0 0 ACCEPT tcp -- * * 10.3.0.0/24 0.0.0.0/0 tcp dpt:111
0 0 ACCEPT udp -- * * 10.3.0.0/24 0.0.0.0/0 udp dpt:111
0 0 ACCEPT tcp -- * * 10.3.0.0/24 0.0.0.0/0 tcp dpt:2049
0 0 ACCEPT udp -- * * 10.3.0.0/24 0.0.0.0/0 udp dpt:2049
0 0 ACCEPT tcp -- * * 10.3.0.0/24 0.0.0.0/0 tcp dpts:4000:4005
0 0 ACCEPT udp -- * * 10.3.0.0/24 0.0.0.0/0 udp dpts:4000:4005
0 0 ACCEPT tcp -- * * 10.4.0.0/24 0.0.0.0/0 tcp dpt:111
0 0 ACCEPT udp -- * * 10.4.0.0/24 0.0.0.0/0 udp dpt:111
0 0 ACCEPT tcp -- * * 10.4.0.0/24 0.0.0.0/0 tcp dpt:2049
0 0 ACCEPT udp -- * * 10.4.0.0/24 0.0.0.0/0 udp dpt:2049
0 0 ACCEPT tcp -- * * 10.4.0.0/24 0.0.0.0/0 tcp dpts:4000:4005
0 0 ACCEPT udp -- * * 10.4.0.0/24 0.0.0.0/0 udp dpts:4000:4005
0 0 ACCEPT tcp -- * * 10.5.0.0/24 0.0.0.0/0 tcp dpt:111
0 0 ACCEPT udp -- * * 10.5.0.0/24 0.0.0.0/0 udp dpt:111
0 0 ACCEPT tcp -- * * 10.5.0.0/24 0.0.0.0/0 tcp dpt:2049
0 0 ACCEPT udp -- * * 10.5.0.0/24 0.0.0.0/0 udp dpt:2049
0 0 ACCEPT tcp -- * * 10.5.0.0/24 0.0.0.0/0 tcp dpts:4000:4005
0 0 ACCEPT udp -- * * 10.5.0.0/24 0.0.0.0/0 udp dpts:4000:4005
0 0 ACCEPT tcp -- * * 10.99.17.0/24 0.0.0.0/0 tcp dpt:111
0 0 ACCEPT udp -- * * 10.99.17.0/24 0.0.0.0/0 udp dpt:111
0 0 ACCEPT tcp -- * * 10.99.17.0/24 0.0.0.0/0 tcp dpt:2049
0 0 ACCEPT udp -- * * 10.99.17.0/24 0.0.0.0/0 udp dpt:2049
0 0 ACCEPT tcp -- * * 10.99.17.0/24 0.0.0.0/0 tcp dpts:4000:4005
0 0 ACCEPT udp -- * * 10.99.17.0/24 0.0.0.0/0 udp dpts:4000:4005
0 0 ACCEPT udp -- * * 10.99.23.49 0.0.0.0/0 udp dpt:137
4 996 ACCEPT udp -- * * 10.99.23.49 0.0.0.0/0 udp dpt:138
0 0 ACCEPT tcp -- * * 10.99.23.49 0.0.0.0/0 tcp dpt:139
0 0 ACCEPT tcp -- * * 10.99.23.49 0.0.0.0/0 tcp dpt:445
0 0 ACCEPT udp -- * * 10.0.1.21 0.0.0.0/0 udp dpt:137
0 0 ACCEPT udp -- * * 10.0.1.21 0.0.0.0/0 udp dpt:138
0 0 ACCEPT tcp -- * * 10.0.1.21 0.0.0.0/0 tcp dpt:139
0 0 ACCEPT tcp -- * * 10.0.1.21 0.0.0.0/0 tcp dpt:445

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

Chain OUTPUT (policy ACCEPT 914 packets, 230K bytes)
pkts bytes target prot opt in out source destination
[root@localhost ~]#

Quote:
2. I am sure that you do not need to open any ports to the eth to start samba as we have several server working with samba but not allowing any connection for the eth.
Well, since the only difference is with the firewall running or not...

Quote:
3. does /log/messages say anything
Nope.

Quote:
4. does /log/samba/smb... say anything
Nope.

[root@localhost ~]# echo "<<< MARK >>>" >> /var/log/messages
[root@localhost ~]# echo "<<< MARK >>>" >> /var/log/samba/smbd.log
[root@localhost ~]# service smb start
Starting SMB services:
[root@localhost ~]# tail /var/log/messages
Sep 12 12:53:46 localhost dhclient: DHCPACK from 10.99.16.1
Sep 12 12:53:46 localhost dhclient: bound to 10.99.23.49 -- renewal in 1668 seconds.
Sep 12 13:21:34 localhost dhclient: DHCPREQUEST on eth0 to 10.99.16.1 port 67
Sep 12 13:21:34 localhost dhclient: DHCPACK from 10.99.16.1
Sep 12 13:21:34 localhost dhclient: bound to 10.99.23.49 -- renewal in 1403 seconds.
Sep 12 13:44:57 localhost dhclient: DHCPREQUEST on eth0 to 10.99.16.1 port 67
Sep 12 13:44:57 localhost dhclient: DHCPACK from 10.99.16.1
Sep 12 13:44:57 localhost dhclient: bound to 10.99.23.49 -- renewal in 1480 seconds.
<<< MARK >>>
[root@localhost ~]# tail /var/log/samba/smbd.log
10.0.1.21 (10.0.1.21) connect to service data initially as user nfsnobody (uid=65534, gid=65534) (pid 7576)
[2008/09/12 12:07:31, 1] smbd/service.c:close_cnum(1230)
10.0.1.21 (10.0.1.21) closed connection to service data
[2008/09/12 12:16:07, 0] smbd/server.c:main(948)
smbd version 3.0.28-1.el5_2.1 started.
Copyright Andrew Tridgell and the Samba Team 1992-2007
<<< MARK >>>
[2008/09/12 13:45:51, 0] smbd/server.c:main(948)
smbd version 3.0.28-1.el5_2.1 started.
Copyright Andrew Tridgell and the Samba Team 1992-2007
 
Old 09-12-2008, 03:53 PM   #5
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Original Poster
Rep: Reputation: 20
Quote:
Originally Posted by w3bd3vil View Post
The server wouldnt rely on the firewall to start. Everything is local so it wouldnt stop the service from running.
Just to clarify, if you have the firewall disabled does the service start properly?
That is correct. I flush the iptables rules and reset the policies to ACCEPT, and smb starts just fine. Load the iptables rules, and smb no longer starts.

Quote:
Another thing,
For giggles, I added the reverse, so I have TCP and UDP for 137, 138, 139, and 445. No difference.
 
Old 09-12-2008, 03:55 PM   #6
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Original Poster
Rep: Reputation: 20
Oh, and if I stop the firewall, start smb, and then start the firewall, Samba works just fine.
 
Old 09-12-2008, 04:28 PM   #7
jnojr
Member
 
Registered: Sep 2007
Location: Chandler, AZ
Posts: 227

Original Poster
Rep: Reputation: 20
I found my answer.

$IPTABLES -A INPUT -i lo -j ACCEPT
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables and samba captain-cat Linux - Networking 2 07-18-2004 09:22 PM
iptables and samba shankariyer Linux - Security 1 02-18-2004 01:26 AM
iptables and SAMBA oracsol Linux - Networking 2 10-08-2003 09:33 AM
using iptables to allow samba robertmarkbram Linux - Networking 3 08-17-2003 03:08 AM
Samba and iptables Zvezda Linux - Networking 3 02-17-2002 11:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration