Blocking IP address with iptables.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Red Hat support > Red Hat General > Blocking IP address with iptables.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Blocking IP address with iptables.  
Richard Gutery


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-29-04 02:58 PM

G'day. I have been trying to get an answer for this.

I am form the Microsoft and OpenBSD world and have recently begun
using RH7.3 for my firewall.

I need to block an Internet Address.

In OpenBSD I would use -> 'block out quick on ethx ...'

I have theses two rules in my iptables file:

$IPT -t filter -A INPUT  -p tcp -s 0/0 -d 64.246.26.185  --dport 80 -m
limit --limit 2/minute -j $STOP
$IPT -t filter -A OUTPUT -p tcp -s 64.246.26.185 -d 0/0  --dport 80 -m
limit --limit 2/minute -j $STOP

$STOP and $IPT are macro substitutions that works for everything else,
so I know that's not the problem.

What am I missing?

tx in advance.

RG





[ Post a follow-up to this message ]



    Re: Blocking IP address with iptables.  
pete


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-03-04 11:58 PM

Richard Gutery wrote:

> I have theses two rules in my iptables file:
>
> $IPT -t filter -A INPUT  -p tcp -s 0/0 -d 64.246.26.185  --dport 80 -m
> limit --limit 2/minute -j $STOP
> $IPT -t filter -A OUTPUT -p tcp -s 64.246.26.185 -d 0/0  --dport 80 -m
> limit --limit 2/minute -j $STOP
>
> $STOP and $IPT are macro substitutions that works for everything else,
> so I know that's not the problem.
>

I'm not sure why you're using the limit match, but the following should
work:

$IPT -A INPUT -p tcp -d 64.246.26.185 --dport 80 -j $STOP
$IPT -A INPUT -p tcp -s 64.246.26.185 --sport 80 -j $STOP

.. assuming the $STOP variable is "REJECT" or "DENY" or a custom target.

These two rules stop TCP packets destined for, or origination from, the
remote webserver. If you wanted to block *any* traffic to and from the
host, just omit the -p tcp and --dport 80/--sport 80 arguements. Oh, and
you can omit -t filter, since the filter table is assumed by default.

HTH,

pete





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:30 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register