LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-07-2009, 10:19 AM   #1
rubberducky
Member
 
Registered: Sep 2009
Posts: 46

Rep: Reputation: 20
Trying to configure Iptables to block certain internal IP's


I have an ubuntu server that acts as a gateway. Right now we have certain people who are allowed to access the net, and ones that aren't. What I'm trying to do is block the IP range that we dont want accessing the net. I tried 'iptables -I INPUT -m iprange --src-range 192.168.1.20-192.168.1.254 -j DROP' but that didnt work. What am I doing wrong?
 
Old 12-07-2009, 10:42 AM   #2
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
INPUT chain - for incoming to firewall traffic, OUTPUT chain - for outgoing.
 
Old 12-07-2009, 11:20 AM   #3
rubberducky
Member
 
Registered: Sep 2009
Posts: 46

Original Poster
Rep: Reputation: 20
D'oh!
It still didnt work though. The command I used was: 'iptables -I OUTPUT -m iprange --src-range 192.168.1.20-192.168.1.254 -j DROP'
 
Old 12-07-2009, 11:27 AM   #4
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
check your rule list with command from root console: iptables-save
 
Old 12-07-2009, 11:37 AM   #5
nimnull22
Senior Member
 
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571

Rep: Reputation: 92
And what is "iprange"?
 
Old 12-07-2009, 12:29 PM   #6
rubberducky
Member
 
Registered: Sep 2009
Posts: 46

Original Poster
Rep: Reputation: 20
Finally got it using 'sudo iptables -A INPUT -m iprange --src-range 192.168.1.20-192.168.1.254 -i eth1 -j DROP'

iprange is a nice little command I picked up from http://www.cyberciti.biz/tips/linux-...-or-ports.html
awesome little tool from all appearances.
Thanks a lot for the help!

Last edited by rubberducky; 12-07-2009 at 12:36 PM.
 
  


Reply



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
[SOLVED] ipTables rule to block a port for all internal IP Addresses except one pranaysharmadelhi Linux - Security 8 07-08-2009 07:57 AM
Configure iptables to forward ports to an internal server ikaro_tatsomura Linux - Networking 1 02-08-2007 06:45 PM
IPTABLES BLOCK ALL NON-US IP's cachemonet Linux - Security 3 06-14-2006 03:57 PM
All internal IP's are taken? kuplo Linux - Newbie 3 12-04-2005 06:29 PM
IPTables - Multiple Public IP's to private IP's matneyc Linux - Security 8 05-27-2005 12:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:52 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