Linux Netfilter discussions
 help / color / mirror / Atom feed
* RE: Re: iptables help
@ 2004-07-29 21:41 Jason Opperisano
  2004-07-29 21:59 ` Ashley M. Kirchner
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Opperisano @ 2004-07-29 21:41 UTC (permalink / raw)
  To: Ashley M. Kirchner, netfilter

>     Heh, I just realized this won't help a whole helluva lot because
> www.yahoo.com's round-robin setup isn't contiguous:
>
>     66.94.230.35
>              .39
>              .41
>              .45
>              .48
>              .49
>              .51
>              .52

$ i=35; while [ $i -le 52 ]; do echo -n "$i:"; lynx -dump 66.94.230.$i | head -3; let "i = $i + 1"; done

gives me nuthin' but "[1]Yahoo!"  so i'd say you're safe in blocking the range 66.94.230.35 - 66.94.230.52.

$ i=34; while [ $i -ge 1 ]; do echo -n "$i:"; lynx -dump 66.94.230.$i | head -3; let "i = $i - 1"; done

gives me Yahoo's down to .16 so i'd say you'd be safe blocking 66.94.230.16 - 66.94.230.52.

"-d 66.94.230.16/28" will block .16 - .31
"-d 66.94.230.32/28" will block .32 - .47
"-d 66.94.230.48/30" will block .48 - .51
"-d 66.94.230.52" will block .52

i'll leave hotmail as an excercise for the user...

someone already mentioned this--but this is *not* the "best" way to do this.  a transparent redirect to a squid server with a "dstdomain .yahoo.com" will block access to anything.yahoo.com regardless of IP address.

-j


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: iptables help
@ 2004-07-29  6:32 Antony Stone
  2004-07-29 16:29 ` Ashley M. Kirchner
  0 siblings, 1 reply; 9+ messages in thread
From: Antony Stone @ 2004-07-29  6:32 UTC (permalink / raw)
  To: netfilter

On Thursday 29 July 2004 12:20 am, Ashley M. Kirchner wrote:

>     I need some help adding a few blocking rules (*) to an iptables
> script that I once inherited, and grown over time.  I don't want to post
> the whole thing here because I don't need to be spamming everyone with
> it, but if there's a kind soul willing to help, I'll gladly send it
> (unless no one objects to getting the whole file.)
>
>     (*) the basic gist is that I need to block places like hotmail.com,
> yahoo.com, and other sites from getting accessed from only two machines
> on our private network, during a specific period of time.  If we like
> the way it works, we'll add more machines/IPs to it later.

1. What help do you need?   Adding rules to block specific traffic is quite 
simple:

iptables -I FORWARD -s a.b.c.d -d w.x.y.z -p tcp --dport 80 -j REJECT

(this is assuming that you meant you want to block web access - I've assumed 
this because the domains you mentioned are best known as large websites)

a.b.c.d is the machine in your network you want the block to apply to
w.x.y.z is a machine on the Internet you don't want them to access

2. Applying a time window to rules is also fairly simple once you've applied 
the 'time' match from patch-o-matic:

iptables -I FORWARD -s a.b.c.d -d w.x.y.z -p txp --dport 80 -m time 
--timestart 09:00 --timestop 17:00 -j REJECT

Do block the same packets as for the previous rule, but only between 09:00 and 
17:00 each day.

3. If it is primarily web access you want to restrict, you may well find that 
Squid http://www.squid-cache.org is a better way of doing it; that can 
control access to domains by domain name rather than requiring a rule for 
each web server IP address (as netfilter does), and can also do time-based 
matching as a standard facility.

Hope this helps,

Regards,

Antony.

-- 
Wanted: telepath.   You know where to apply.

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



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

end of thread, other threads:[~2004-07-29 21:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-29 21:41 Re: iptables help Jason Opperisano
2004-07-29 21:59 ` Ashley M. Kirchner
  -- strict thread matches above, loose matches on Subject: below --
2004-07-29  6:32 Antony Stone
2004-07-29 16:29 ` Ashley M. Kirchner
2004-07-29 18:28   ` Antony Stone
2004-07-29 21:07     ` Ashley M. Kirchner
2004-07-29 21:20       ` Antony Stone
2004-07-29 21:35         ` Ashley M. Kirchner
2004-07-29 21:18     ` Ashley M. Kirchner
2004-07-29 21:28       ` Antony Stone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox