LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-06-2014, 04:02 PM   #1
codeman1234
Member
 
Registered: Jul 2009
Posts: 206

Rep: Reputation: 27
Question Blocking class A IP Ranges with htaccess, some help please!


Hello,

I am trying to block class A Ip ranges on my server from 213.238.237.10 to 210.243.21.254 with htaccess and I am doing this the following way:

<Limit GET POST>
order allow,deny
allow from all
deny from 213.238.237.10 210.243.21.254
</Limit>


My question if is this correct or not? Since I dont find other way to block class a ip ranges with htaccess.

Thanks!
 
Old 12-06-2014, 04:17 PM   #2
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
This should explain it: http://www.toshop.com/htaccess-generator.cfm

jlinkels
 
1 members found this post helpful.
Old 12-06-2014, 07:37 PM   #3
codeman1234
Member
 
Registered: Jul 2009
Posts: 206

Original Poster
Rep: Reputation: 27
Hey jlinkels,

Thanks a lot, in case anyone has same issue this is explained bellow

Quote:
Valid IP Addresses

IP addresses are in the form xxx.xxx.xxx.xxx and each of these four numbers is from 0-255.
You can enter partial addresses to restrict larger blocks of addresses:
1.2.3.4 Blocks one specific IP address
1.2.3. Blocks IP address in the range 1.2.3.0 to 1.2.3.255 (ie.. 1.2.3.xxx)
1.2. Blocks IP address in the range 1.2.xxx.xxx
1.2 Blocks IP address in the range 1.2xx.
So for B Classes here is an example how to do it to block B Class IP 101.3.55.66:

RewriteEngine On

order allow,deny
deny from 103.3.
allow from all



Thanks again!! Just one last favor jlinkels can you just confirm me that I understand it correctly please?
 
Old 12-06-2014, 08:35 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by codeman1234 View Post
So for B Classes here is an example how to do it to block B Class IP 101.3.55.66:

RewriteEngine On

order allow,deny
deny from 103.3.
allow from all

Thanks again!! Just one last favor jlinkels can you just confirm me that I understand it correctly please?
This blocks 103.3.0.0 until 103.3.255.255. Not 101.3.55.66, but that might be a type. And addresses are nowadays classless, so the range is correct but it is not called class B anymore.

jlinkels
 
1 members found this post helpful.
Old 12-12-2014, 05:25 PM   #5
codeman1234
Member
 
Registered: Jul 2009
Posts: 206

Original Poster
Rep: Reputation: 27
Hey jlinkels

Thanks a lot for the help!
 
  


Reply

Tags
block, htaccess



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables rules for blocking everyone but certain ranges? nyheat Linux - Security 6 07-03-2011 04:58 PM
Firestarter - iptables and blocking ranges ithawtewrong Linux - Security 4 11-04-2006 01:41 PM
Blocking IP ranges to the Internet caps_phisto Linux - Security 1 09-18-2006 10:19 AM
Blocking IP Address ranges in dhcpd.conf pmcdaid Linux - Networking 4 06-09-2004 09:18 AM
Blocking Iptables Ranges SuperSadSmile Linux - Security 6 02-09-2004 02:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration