Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: General Ports
Date: Fri, 27 Feb 2004 20:05:37 +0000	[thread overview]
Message-ID: <200402272005.37354.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <003501c3fd6b$236d27b0$5b65810a@tsr1>

On Friday 27 February 2004 7:50 pm, Chris Godwin wrote:

> Hello My name is Chris,
>
> I'm new to linux and iptables and I've just started running qmail and
> vpopmail.

There is a lot of good documentation about netfilter which I recommend you 
read - try Oskar Andreasson's tutorial at 
http://iptables-tutorial.frozentux.net

> :OUTPUT ACCEPT [0:0]
> :FORWARD ACCEPT [0:0]
> :INPUT ACCEPT [0:0]
>
> # allow only on the ports that internet services listen to
> -A INPUT -p tcp -m tcp -m multiport -j ACCEPT --dports
> 21,22,25,80,110,143,3306 # all my internet server ports
> -A INPUT -p tcp -m tcp --dport 30000:31000 -j ACCEPT # ports for passive
> ftp transfer
> -A INPUT -p tcp -j DROP kill everything else
> COMMIT
> # Completed on Tue Feb 24 20:53:02 2004

When you have questions for the list in future, please post either the 
iptables commands which you enter in order to create your rules, or else the 
output of "iptables -L -nvx; iptables -L -t nat -nvx" - either of these 
provides a rather easier format for us to understand your ruleset when it 
gets a bit bigger.

No problem this time round, though - this is a request, not a criticism.

> HERE'S MY QUESTION:
> What are some ports I need to have open for usuall networking functions...
> like looking up hostnames and what not... as of right now with iptables and
> the current iptables file qmail doens't accept or send mail and the server
> cannot lookup hostnames or cannot connect to http or ftp servers via wget
> or lynx... the server is running redhat 7.3

Well, looking up hostnames is done using DNS (Domain Name Service) which 
operates on TCP and UDP ports 53.

However, if you are talking about the machine with the netfilter rules on it 
being able to make outbound connections, you have a default ACCEPT policy on 
your OUTPUT chain, so all packets are allowed.   You only need to add a 
single rule to your INPUT chain for the replies, and I think almost 
everything you want will start working:

iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Once you have this rule (and assuming you have compiled in, or loaded the 
module for ftp support), you can get rid of your second rule in the INPUT 
chain, because both passive and active ftp will simply work :)

By the way, please set your default policy on INPUT and FORWARD to DROP (and 
then add rules which allow the packets you know you want).   This is a tip 
for good security practice - allow what you want, and block anything else.

Regards,

Antony.

-- 
Most people are aware that the Universe is big.

 - Paul Davies, Professor of Theoretical Physics

                                                     Please reply to the list;
                                                           please don't CC me.



      reply	other threads:[~2004-02-27 20:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-27  2:23 iptables mustafa hassan
2004-02-27 19:50 ` General Ports Chris Godwin
2004-02-27 20:05   ` Antony Stone [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200402272005.37354.Antony@Soft-Solutions.co.uk \
    --to=antony@soft-solutions.co.uk \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox