All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Opperisano <opie@817west.com>
To: netfilter@lists.netfilter.org
Subject: Re: restriction for some hosts.
Date: Thu, 2 Dec 2004 12:55:37 -0500	[thread overview]
Message-ID: <20041202175537.GA5532@bender.817west.com> (raw)
In-Reply-To: <d594c764041202032049654f4b@mail.gmail.com>

On Thu, Dec 02, 2004 at 03:20:10AM -0800, BusyBoy wrote:
> Hello,
> 
> I need some help in iptables  and I want to allow   some  hosts
> to ping to my box and rest of the network or internet blocked.
> 
> like I have linux box 192.168.0.1 (Gateway) and 192.168.0.2 to
> 192.168.0.100 are clients.
> 
> I want only
> 
> 192.168.0.5
> 192.168.0.10
> 192.168.0.55
> 
> to be allowed to ping my linux box 192.168.0.1 and internet hosts  but
> rest of the machines should be  blocked.( not being able  to ping and
> traceroute )
> 
> any help in this reagrd will be highly appriciated.

traceroute can use either ICMP Echo Requests with TTL's incrementing
from 1, or UDP packets starting at UDP port 33434.  these rules
accommodate both types:

  PINGERS="192.168.0.5 192.168.0.10 192.168.0.55"

  # allow specific hosts to ping fw and traceroute via UDP
  for i in $PINGERS; do
    iptables -A INPUT -p icmp --icmp-type echo-request -s $i -j ACCEPT
    iptables -A INPUT -p udp --dport 33434:33534 -s $i -j ACCEPT
  done

  # allow specific hosts to ping internet and traceroute via UDP
  for i in $PINGERS; do
    iptables -A FORWARD -p icmp --icmp-type echo-request -s $i -j ACCEPT
    iptables -A FORWARD -p udp --dport 33434:33534 -s $i -j ACCEPT
  done

i'm assuming you utilize "-P DROP" on your filter chains, and "-m state
--state ESTABLISHED,RELATED -j ACCEPT" at the top of each filter chain.

-j

--
"Do you want to change your name to Homer Junior? The kids can call
 you Hoju!"
        --The Simpsons



      reply	other threads:[~2004-12-02 17:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-02 11:20 restriction for some hosts BusyBoy
2004-12-02 17:55 ` Jason Opperisano [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=20041202175537.GA5532@bender.817west.com \
    --to=opie@817west.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.