Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Andrew Beverley <andy@andybev.com>
To: Ivan Matala <ivanmatala@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: iptables blocking all ports except port 80
Date: Tue, 14 Jun 2011 21:15:22 +0100	[thread overview]
Message-ID: <1308082522.1837.13.camel@andybev-desktop> (raw)
In-Reply-To: <BANLkTimH9xLROcOosO+Qa5-hhOGYyG8pjA@mail.gmail.com>

On Tue, 2011-06-14 at 07:41 -0700, Ivan Matala wrote:
> In short, what rules to add to block other ports except, ssh and port 80, 3128.

Assuming you're using iptables to forward packets, something like:

iptables -A FORWARD -p tcp -m multiport --dports 22,80,3128 -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -j DROP

Your email is not very clear, so it depends whether you are trying to
allow inbound connections or connections to external servers. You'll
therefore need to change dports to sports as required. In the same vein
you may also need to change FORWARD to INPUT.

Andy



      reply	other threads:[~2011-06-14 20:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14 14:41 iptables blocking all ports except port 80 Ivan Matala
2011-06-14 20:15 ` Andrew Beverley [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=1308082522.1837.13.camel@andybev-desktop \
    --to=andy@andybev.com \
    --cc=ivanmatala@gmail.com \
    --cc=netfilter@vger.kernel.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