LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-16-2003, 11:35 PM   #1
robertmarkbram
Member
 
Registered: May 2003
Location: Melbourne, Australia
Distribution: Cygwin, Windows XP
Posts: 69

Rep: Reputation: 15
using iptables to allow samba


Howdy All,

To learn more about my RedHat 9 firewall, I have been reading iptables man entry and this page:
http://www.groovyweb.uklinux.net/?pa...20Basics%20NHF

I have a more general question and then something more specific.

First, I read the following from the above page:

== start quote ==
Let's say that, like me, you have a local area network and then you have a connection to the internet. We're going to also say that the LAN is eth0 while the internet connection is called ppp0. Now suppose we wanted to allow telnet to run as a service to computers on the LAN but not on the insecure internet. Well there is an easy way to do this. We can use -i for the input interface and -o for the output interface. You could always block it on the OUTPUT chain, but we'd rather block it on the INPUT so that the telnet daemon never even sees the request. Therefore we'll use -i. This should set up just the rule:


iptables -A INPUT -p tcp --destination-port telnet -i ppp0 -j DROP

== end quote ==

So the above command specifies a rule:
- for the INPUT chain
- for any packet using the tcp protocol
- headed to the telnet port
- from the internet interface - ppp0

Does this rule imply that there are two network cards in the machine - one with a linux NIC interface called pp0 (for the internet) and one called etho (for the LAN?)?

What if I have only one NIC that connects me to both a LAN and the internet? How could I then specify a similar rule?

Now the specific question: how do I specify this rule for samba only?

I want to allow samba connections from one specific IP on the LAN and deny the connection for everything else.

Is samba a protocol? What is its name?

Thank you for any help!
 
Old 08-17-2003, 02:13 AM   #2
jalal
Member
 
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

Rep: Reputation: 30
ppp0 is usually the dialup or DSL connection, while eth0 is the ethernet connection.

SAMBA uses the netbios / SMB protocol, and it listens on port 139.
 
Old 08-17-2003, 03:00 AM   #3
robertmarkbram
Member
 
Registered: May 2003
Location: Melbourne, Australia
Distribution: Cygwin, Windows XP
Posts: 69

Original Poster
Rep: Reputation: 15
Thanks for the response Jalal,

OK... so I tried this:

/sbin/iptables -A INPUT -p smb -s machine.full.name --destination-port 139 -i eth0 -j ACCEPT

Result:

[root@robertmarkbram robertmarkbram]# /sbin/iptables -A INPUT -p smb -s machine.full.name --destination-port 139 -i eth0 -j ACCEPT
iptables v1.2.7a: unknown protocol `smb' specified
Try `iptables -h' or 'iptables --help' for more information.
[root@robertmarkbram robertmarkbram]#

same with "-p netbios", "-p smb/netbios" and "-p netbios/smb".. mm..

What is the protocol called?

*scratching my head*

Thanks!
 
Old 08-17-2003, 03:08 AM   #4
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
TCP or UDP or ALL
 
  


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 MrBiggZ Linux - Security 1 10-08-2005 02:20 PM
iptables and samba shankariyer Linux - Security 1 02-18-2004 01:26 AM
Samba and iptables TheRealDeal Linux - Networking 3 09-22-2003 10:13 AM
samba and iptables p1az Linux - Networking 1 08-04-2003 08:51 PM
iptables and Samba frkstein Linux - Networking 2 09-19-2002 09:00 PM

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

All times are GMT -5. The time now is 05:12 AM.

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