LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-02-2005, 12:52 PM   #1
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
iptables help please


just started playing around with iptables and i have a question. if i want to set up a rule to block a domain (doubleclick.net) would it look like the following:

Code:
-A CUSTOMINPUT -s doubleclick.net -j DROP
or do i need something different in the CUSTOMINPUT spot?
 
Old 11-02-2005, 01:37 PM   #2
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
or better yet, how can i track down all of the IPs used by someone like doubleclick.net if i can not block their domain name.
 
Old 11-02-2005, 04:40 PM   #3
imitheos
Member
 
Registered: May 2005
Location: Greece
Posts: 441

Rep: Reputation: 141Reputation: 141
Quote:
Originally posted by Lleb_KCir
or better yet, how can i track down all of the IPs used by someone like doubleclick.net if i can not block their domain name.
If you want to block all ips from doubleclick.net then an easy thing you can do is the following

Code:
nslookup doubleclick.net

Name:   doubleclick.net
Address: 216.73.92.112
and then
Code:
whois 216.73.92.112
which returns among other things
Code:
NetRange:   216.73.80.0 - 216.73.95.255 
CIDR:       216.73.80.0/20
so if you want to block you use the cidr 216.73.80.0/20 and you are ok
for example
Code:
iptables -A CUSTOMINPUT -s 216.73.80.0/20 -j REJECT
This is just a few steps in order you can get easily what ips do they own, but they may own another set of ips too.

In this case you can also setup a proxy or dns and tell it to translate doubleclick.net as 127.0.0.1 for example
 
Old 11-02-2005, 07:40 PM   #4
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
that is awsome. thank you. ill get to work on that tonight.
 
Old 11-02-2005, 07:46 PM   #5
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
ok, really blonde question here, what is the netrange, and how can i block that?
 
Old 11-02-2005, 07:52 PM   #6
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
one more fast question. why REJECT vs DROP?
 
Old 11-03-2005, 08:16 AM   #7
imitheos
Member
 
Registered: May 2005
Location: Greece
Posts: 441

Rep: Reputation: 141Reputation: 141
Quote:
Originally posted by Lleb_KCir
ok, really blonde question here, what is the netrange, and how can i block that?
Netrange ?

Do you mean this "NetRange: 216.73.80.0 - 216.73.95.255"
If yes, this is the set of ips that belong to doubleclick.net according to ARIN
You can block all of them by figuring out what CIDR these ips correspond to.
In this case you don't need to figure it because it is given

CIDR: 216.73.80.0/20

So, if you block 216.73.80.0/20 you essentially block all these ips, that is why i mentioned this rule
"iptables -A CUSTOMINPUT -s 216.73.80.0/20 -j REJECT"

When you drop a packet, then this is it. it is denied and nothing else happens.
When you reject a packet then you send a reply back (usually icmp but you can choose what you want)
to the sender.

So, for example if i do "iptables -A INPUT -p tcp --dport 22 -j DROP"
it will drop all packets and so one who is portscanning will now that my firewall is cutting this port
if i do "iptables -A INPUT -p tcp --dport 22 -j REJECT" then this port will show as it is closed
and whoever is portscanning will not know that i have ssh running on this port.

There are other things, but i try to explain it simply.
If you check the iptables manpage or http://iptables-tutorial.frozentux.net it describes this and many more things.
 
Old 11-03-2005, 10:11 AM   #8
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
thank you for clearing that up for me. always good to understand what you are doing.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
An error occured getting IPtables status from the command /etc/rc.d/init.d/iptables s CrazyMAzeY Linux - Newbie 10 08-12-2010 05:25 AM
Iptables - Couldn't load target `ACCPET':/lib/iptables/libipt_ACCPET.so: z00t Linux - Security 3 01-26-2004 02:24 AM
IPtables Log Analyzer from http://www.gege.org/iptables/ brainlego Linux - Software 0 08-11-2003 06:08 AM
iptables book wich one can you pll recomment to be an iptables expert? linuxownt Linux - General 2 06-26-2003 04:38 PM
My iptables script is /etc/sysconfig/iptables. How do i make this baby execute on boo ForumKid Linux - General 3 01-22-2002 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:03 AM.

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