All of lore.kernel.org
 help / color / mirror / Atom feed
* restriction for some hosts.
@ 2004-12-02 11:20 BusyBoy
  2004-12-02 17:55 ` Jason Opperisano
  0 siblings, 1 reply; 2+ messages in thread
From: BusyBoy @ 2004-12-02 11:20 UTC (permalink / raw)
  To: netfilter

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.


-- 
Nasir Mahmood
Systems + Network Admin.
Asia Net.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: restriction for some hosts.
  2004-12-02 11:20 restriction for some hosts BusyBoy
@ 2004-12-02 17:55 ` Jason Opperisano
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Opperisano @ 2004-12-02 17:55 UTC (permalink / raw)
  To: netfilter

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-12-02 17:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-02 11:20 restriction for some hosts BusyBoy
2004-12-02 17:55 ` Jason Opperisano

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.