hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : How I can block all traffic to one of IPs on server with iptables?
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)
Forum Jump

How I can block all traffic to one of IPs on server with iptables?

Reply Post New Thread In Hosting Security and Technology Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 06-15-2005, 07:02 AM
gurika gurika is offline
Web Hosting Guru
 
Join Date: Aug 2004
Posts: 305

How I can block all traffic to one of IPs on server with iptables?


Somebody know how I can block ALL traffic to one IP on my server (destination ip) with iptables??

And how I can remove that ip from blocking list?

Thanks.

Reply With Quote


Sponsored Links
  #2  
Old 06-15-2005, 07:53 AM
layer0 layer0 is offline
Performance Specialist
 
Join Date: Dec 2004
Location: New York, NY
Posts: 10,339
To block an IP use:

Code:
/sbin/iptables -A INPUT -s 1.1.1.1 -j REJECT
To unblock an IP use:

Code:
/sbin/iptables -A INPUT -s 1.1.1.1 -j ACCEPT
To unblock all IPs use:

Code:
iptables -F
Thanks,

__________________
MediaLayer, LLC - Lightning fast web hosting since 2005. Ask about our new pure SSD storage platform!
›› First and leading provider of LiteSpeed based hosting combined with enterprise grade hardware.
›› Free Account Migrations, Custom Solutions, and Servers in US, EU, and Asia
›› Our Application Hosting plans outperform the typical VPS. Ask us about special offers on yearly plans!

Reply With Quote
  #3  
Old 06-15-2005, 08:51 AM
Sheps Sheps is offline
Community Guide
 
Join Date: Dec 2002
Location: The Shadows
Posts: 2,900
Ah.... I wouldn't use -F unless you change your default policies to allow. Might cause some unexpected problems(It blokcing everything for example.

__________________
Dan Sheppard ~ Freelance whatever

Reply With Quote
Sponsored Links
  #4  
Old 06-15-2005, 09:42 AM
gurika gurika is offline
Web Hosting Guru
 
Join Date: Aug 2004
Posts: 305
Great!!

And one more question, how I can block only one port (80)??

Thanks.

Reply With Quote
  #5  
Old 06-15-2005, 10:01 AM
HP-Jonathan HP-Jonathan is offline
Newbie
 
Join Date: Apr 2005
Posts: 29
iptables -A INPUT -p tcp --destinataion-port 80 -j REJECT

will do everything to port 80

iptables -A INPUT -p tcp -s 1.1.1.1 --destination-port 80 -j REJECT

would block it for only stuff from 1.1.1.1

__________________
Jonathan
Hostingplex Support

http://www.hostingplex.com
Webhosting, VPS, Dedicateds and more.

Reply With Quote
  #6  
Old 06-15-2005, 11:31 AM
gurika gurika is offline
Web Hosting Guru
 
Join Date: Aug 2004
Posts: 305
But this don`t work, I want block DESTINATION IP, I don`t want visitors access to that IP on port 80, how I can do that? If I good see this block visitor with IP 1.1.1.1!!???

Thanks.

Reply With Quote
  #7  
Old 06-15-2005, 11:51 AM
gurika gurika is offline
Web Hosting Guru
 
Join Date: Aug 2004
Posts: 305
I think this is what I need:
iptables -A INPUT -p tcp -d 2.2.2.2 --dport 80 -j REJECT

Reply With Quote
  #8  
Old 06-15-2005, 12:18 PM
gurika gurika is offline
Web Hosting Guru
 
Join Date: Aug 2004
Posts: 305
This don`t want work :(

This iptables -A INPUT -p tcp -d 2.2.2.2 --dport 80 -j REJECT

work fine but only few minutes, something on my server RESET THIS and again allow access to this IP, what can do that? Why???

What can AUTO reset my iptables? cPanel?? This is MAIN/SHARED IP on my server...

Reply With Quote
  #9  
Old 06-15-2005, 05:03 PM
layer0 layer0 is offline
Performance Specialist
 
Join Date: Dec 2004
Location: New York, NY
Posts: 10,339
Re: This don`t want work :(

Quote:
Originally posted by gurika
This iptables -A INPUT -p tcp -d 2.2.2.2 --dport 80 -j REJECT

work fine but only few minutes, something on my server RESET THIS and again allow access to this IP, what can do that? Why???

What can AUTO reset my iptables? cPanel?? This is MAIN/SHARED IP on my server...
I'm not aware of something like that done at short intervals. However, I do know of something that may clear out iptable's rules every 24 hours or so.

Thanks,

__________________
MediaLayer, LLC - Lightning fast web hosting since 2005. Ask about our new pure SSD storage platform!
›› First and leading provider of LiteSpeed based hosting combined with enterprise grade hardware.
›› Free Account Migrations, Custom Solutions, and Servers in US, EU, and Asia
›› Our Application Hosting plans outperform the typical VPS. Ask us about special offers on yearly plans!

Reply With Quote
  #10  
Old 06-16-2005, 02:52 AM
likonar likonar is offline
WHT Addict
 
Join Date: Mar 2005
Posts: 164
try to save you iptables rules such as:
iptables-save > /etc/sysconfig/iptables

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Liquid Web Updates Block Storage, Adding Scale, Cross Mounting Web Hosting News 2012-12-14 16:17:44
Liquid Web Block Storage Offering Provides Flexible, Affordable Storage Option Web Hosting News 2012-11-20 15:03:47
Canonical Releases Ubuntu Server 12.10 with OpenStack Folsom Web Hosting News 2012-10-19 11:11:43
InterNetX Launches Server Administration Software Web Hosting News 2011-12-22 22:06:48
Akamai Report Names Taiwan Number-One Source of Attack Traffic Web Hosting News 2011-10-28 18:33:23


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?