Webmaster Forum

Go Back   Webmaster Forum > Web Development > Web Hosting Forum > Dedicated Servers

Dedicated Servers Dedicated server help.


Reply
 
LinkBack Thread Tools Display Modes
Old 01-08-2004, 07:53 AM   #1 (permalink)
QT_
Senior Member
 
Join Date: 10-13-03
Location: San Antonio, Tx
Posts: 264
iTrader: 0 / 0%
Latest Blog:
None

QT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really nice
[Linux] Block IP Address using IPtables

1. Login to your server via SSH and su - to root (do not forget the - after su).

2. After logging in as root, you may want to look at what's already loaded, if anything. To look at the tables that are currently in effect:

(Note: You might need to add "| less" to the end of your iptables -L commands if you have a lot of iptables rules. This will let you view the rules one page at a time. You can use "q" to quit.)

# iptables -L -n

3. To successfully block an IP address, the syntax would be:

# iptables -I INPUT -s IP_ADDRESS_HERE -j DROP

e.g.:

# iptables -I INPUT -s 123.123.123.123 -j DROP

4. To verify that your entry was successful:
(Note: You might need to add "| less" to the end of your iptables -L commands if you have a lot of iptables rules. This will let you view the rules one page at a time. You can use "q" to quit.)

(as root still)

# /sbin/iptables -L -n

5. If you want to flush your IPtables:

# /sbin/iptables -F

You can find other options to choose from with the following command:

# /sbin/iptables --help
QT_ is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-01-2004, 10:04 AM   #2 (permalink)
Junior Member
 
Join Date: 02-01-04
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

sam hain is liked by many
Hi QT,

Thank you for the iptable info. I would like to block a complete range of IP address from say: 0.0.0.0 to 0.23.255.255 do I have to type each one in individually or is there some option that will allow me to do this more easily?

Thanks,
Sam
sam hain is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-01-2004, 07:41 PM   #3 (permalink)
QT_
Senior Member
 
Join Date: 10-13-03
Location: San Antonio, Tx
Posts: 264
iTrader: 0 / 0%
Latest Blog:
None

QT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really nice
Quote:
Originally Posted by sam hain
Hi QT,

Thank you for the iptable info. I would like to block a complete range of IP address from say: 0.0.0.0 to 0.23.255.255 do I have to type each one in individually or is there some option that will allow me to do this more easily?

Thanks,
Sam
You can find an example of blocking an IP range here:

http://serverbeach.com/forums/showth...&threadid=1970

QT_ is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-01-2004, 07:44 PM   #4 (permalink)
Individualist
 
John Scott's Avatar
 
Join Date: 09-27-03
Location: Japan, mostly
Posts: 27,026
iTrader: 3 / 100%
John Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster materialJohn Scott is supreme webmaster material
Send a message via AIM to John Scott Send a message via Yahoo to John Scott
QT, why not do a WHM IP Block tutorial? I would like to do it, too.

Please
__________________
Individualism .::. My Facebook - Add Me
John Scott is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-01-2004, 08:37 PM   #5 (permalink)
QT_
Senior Member
 
Join Date: 10-13-03
Location: San Antonio, Tx
Posts: 264
iTrader: 0 / 0%
Latest Blog:
None

QT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really nice
Quote:
Originally Posted by JohnScott
QT, why not do a WHM IP Block tutorial? I would like to do it, too.

Please
cPanel can block IP's from websites, but only for web access. There is nothing in cPanel or WHM that will allow you to block an IP address from accessing a server. So if you want to block someone from accessing a server completely, it would have to be done through IPtables.
QT_ is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-03-2004, 10:37 AM   #6 (permalink)
Junior Member
 
Join Date: 02-01-04
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

sam hain is liked by many
Hi QT_,

Thanks again! I got it
Sam
sam hain is offline  
Add Post to del.icio.us
Reply With Quote
Old 02-03-2004, 10:53 AM   #7 (permalink)
QT_
Senior Member
 
Join Date: 10-13-03
Location: San Antonio, Tx
Posts: 264
iTrader: 0 / 0%
Latest Blog:
None

QT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really niceQT_ is just really nice
Quote:
Originally Posted by sam hain
Hi QT_,

Thanks again! I got it
Sam
Glad you got it all figured out.
QT_ is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-20-2004, 03:20 AM   #8 (permalink)
T
Junior Member
 
Join Date: 05-20-04
Posts: 1
iTrader: 0 / 0%
Latest Blog:
None

T is liked by many
Hi,

This is great info QT,

Thank you

I am a bit of a newbie with this, and was wondering if I could use iptables to drop outgoing packets to certain IP's to protect them from a DOS attack if my box got infected.

Would it be as simple as changing the INPUT to OUTPUT?

Its just that I wouldnt know what to do if I was contacted by a host who said my server was DOSing them.

I would imagine dropping outgoing packets to them would be the first step, and then look around for the scripts causing it?

Thanks in advance,
T is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-27-2004, 03:48 AM   #9 (permalink)
Junior Member
 
Join Date: 05-27-04
Posts: 1
iTrader: 0 / 0%
Latest Blog:
None

surfgod is liked by many
Block some IP's allow others?

Hello,
First of all, thanks for the discussion, this is the only play on the web I have found knowledgle answers to ipchains.

I read about blocking ranges and blocking in general, my question has to do with deny and allow.

If I block a range of internal IP's in one chain, can I allow a few of those IP's through in the next chain? Meaning, will the next chain countermand the previous chain?

I need to block certain people, but not others from telnet and www.

Thanks
J
surfgod is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-07-2004, 07:36 AM   #10 (permalink)
Junior Member
 
Join Date: 06-03-04
Location: South Africa
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

NetReaper is liked by many
QT_ thanks for the info, but once I rebooted the server I lost all the IP addresses that I block, help please?
NetReaper is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-09-2009, 09:48 PM   #11 (permalink)
Contributing Member
 
Join Date: 03-09-09
Location: Tempe, AZ
Posts: 63
iTrader: 0 / 0%
Latest Blog:
Good Insurance Tips

MRamses is an unknown quantity at this point
I'd just like to add a few things.

When your server reboots, iptables is flushed. So you may want to do the following. To backup your iptables:

/sbin/iptables-save -c > /iptables-backup.txt

Then, to restore after server reboot:

/sbin/iptables-restore -c < /iptables-backup.txt

You can add the restore line to your rc.local script to automate it.
__________________
| Vampire | Science Fiction |
MRamses is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-10-2009, 02:04 AM   #12 (permalink)
Contributing Member
 
~ServerPoint~'s Avatar
 
Join Date: 11-27-07
Posts: 1,217
iTrader: 0 / 0%
Latest Blog:
None

~ServerPoint~ is on the right path~ServerPoint~ is on the right path
Do you think that would be actual for the more then 4 year old thread?
__________________
ServerPoint - a true hosting company since 1998
Web Hosting, colocation, dedicated servers, Virtual Private Server (VPS) hosting
Wholly owned multi homed network, servers and facilities
~ServerPoint~ is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Hosting Forum > Dedicated Servers

Reply


Currently Active Users Viewing This Thread: 3 (0 members and 3 guests)
 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Linux] Unblock IP Address using iptables NetReaper Dedicated Servers 2 11-18-2007 08:54 AM
Linux IPtables renan Dedicated Servers 1 04-09-2004 07:43 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 01:47 AM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.