Question

How do I block a specific DNS query (IP address) in a CENT/OS conputer.

Asked by: OOsorio

This particular computer is sending out a bogus DNS query to our DNS windows 2003 sever. I would like to block the query at the source. How can this be done?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-05-21 at 14:22:50ID24429331
Tags

CENT OS (Linux)

Topics

Linux Administration

,

Domain Name Service (DNS)

,

Linux Networking

Participating Experts
3
Points
250
Comments
28

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. DNS
    Hi, I'm setting up a new server: small business server 2003 premium edition It's basically going to be an application server, serving asp.net applications and a SQL server database. We already have another server that contains all the user acccounts for all workstations in...
  2. DNS
    I wanted to see if I could get some information. I have a windows 2000 and 2003 private network with DNS and Active Directory I also have a T1 dedicated line. My question here is my domain name is blaw blaw blaw I have a firewall that protects us from the outside and have a r...
  3. what is DNS?
    what is DNS?
  4. Prevent/Block DNS Replication
    Hello, One of our peer domains has turned off DNS replication on one of their servers. This is fine for them but one of my domain controllers has selected their server as a replication partner. My domain controller is spewing out KCC and DNS Replication errors. (1925/192...
  5. Using DNS for website blocking.
    I was wondering if it's possible to use my DNS server to create false forwards in order to website block. All DNS queries in the company first query the internal DNS server before being forwarded out to the ISP for unknown DNS queries via the DNS roots. Would it be possible t...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: giltjrPosted on 2009-05-21 at 14:25:05ID: 24446058

To block at the source, find out what program is doing this and stop it or remove it.

 

by: OOsorioPosted on 2009-05-21 at 14:31:08ID: 24446106

I don't know what program is generating this. Is there a way to create a IP table of blocked DNS queries?

 

by: giltjrPosted on 2009-05-21 at 14:38:15ID: 24446160

Sure you could, but you do realize that it could not do ANY dns resolution.  Which means it could not find any hosts by name.

 

by: AdraenysePosted on 2009-05-21 at 18:01:26ID: 24447147

Is the "particular" computer within your organization, or is it coming from the Internet?

If it's coming from the Internet, your choices are to firewall that IP address on TCP and UDP inbound destination port 53, or, you can lookup the technical contact information for the IP address through ARIN (http://ws.arin.net/whois/) and attempt to get a resolution from the netblock authority.

 

by: lanboyoPosted on 2009-05-21 at 19:14:30ID: 24447364

Put the bogus dns name that it is looking for, into the devices host table, preferably with a loopback address.

 

by: OOsorioPosted on 2009-05-22 at 12:38:48ID: 24454461

The DNS query is coming from a Linux server inside our network. lanboyo is right on the mark.
I can place the IP of the DNS query in ect/hosts
What would it look like with a loopback address?

 

by: giltjrPosted on 2009-05-22 at 12:44:29ID: 24454497

You would put:


127.0.0.1 hostname

where hostname is the host name it is trying to find.  This will not stop the queries, it will just stop them from going to your DNS server.  

However, now that the program is getting back a result, it will try and connect to 127.0.0.1 to something.  What you may want to do is put a invalid IP address (say 127.1.1.1) with the hostname and then issue the command:

   netstat -np | grep 127.1.1.1

every now and then. the "p" will give you the pid of the task that is trying to connect to 127.1.1.1, then you can find out what program is issuing the queries and "fix" it.

 

by: OOsorioPosted on 2009-05-22 at 13:31:21ID: 24454862

The query to the DNS server is a IP address so if I understand correctly the entry in etc/hosts would be
127.1.1.1 67.40.182.122
The 67 IP addresss is what the DNS server is receiving not a name perse.

 

by: AdraenysePosted on 2009-05-22 at 13:39:16ID: 24454918

Rather than redirecting the results and still taking in the traffic and trying to deal with it, why not just firewall it and forget about it?

If you have iptables installed:

iptables -A INPUT -p tcp --dport 53 -s 67.40.182.122 -j DROP
iptables -A INPUT -p udp --dport 53 -s 67.40.182.122 -j DROP
service iptables save

... and the traffic is gone. The machine can still send you email, or view websites, it just won't be able to pass you anymore DNS traffic.

 

by: AdraenysePosted on 2009-05-22 at 13:41:33ID: 24454932

In regards to my last comment, I gave you instructions for firewalling with Linux, as the question was zoned for Linux, but you have said you are using Windows 2003 for DNS. I wish you could edit comments on this thing...

 

by: OOsorioPosted on 2009-05-22 at 13:50:31ID: 24454996

Adraenyse my DNS server is a windows server 2003. This specific DNS query is coming from a Linux server and going to windows server. I thought this was made clear.

 

by: AdraenysePosted on 2009-05-22 at 14:42:54ID: 24455372

Yes, you did, I am just dyslexic today, I had the two machines backwards in my head.

You can block the lookup of the host by using the /etc/hosts file, but you need to enter it as the name being looked up, not the result IP

Example
127.0.0.1 name.domain.com

Any request for name.domain.com would be resolved as 127.0.0.1 without querying DNS.

If you want to create a log of the DNS requests leaving from the CentOS machine, you can use this iptables statement to make a log:

iptables -A OUTPUT -p tcp --dport 53 -j LOG
iptables -A OUTPUT -p udp --dport 53 -j LOG

The requests will be placed in /var/log/messages

 

by: OOsorioPosted on 2009-05-22 at 14:56:06ID: 24455440

The query sent is an IP address not a domain name. As mentioned the IP is 67.40.182.122

 

by: giltjrPosted on 2009-05-22 at 16:27:23ID: 24455842

That is a reverse lookup, which you can't over ride using a hosts file.

Are you running any server services on that Linux box?

Can you do a netstat -n  to see if that IP address happens to have a connection to it?



 

by: lanboyoPosted on 2009-05-22 at 19:25:26ID: 24456480

If you put a host entry for the ip,

67.40.182.122 any_name_you_want

It will likely not do a reverse lookup.

A lot of commands have a -n option to not do the reverse lookup if this is a tcdump or traceroute kind of thing.

 

by: lanboyoPosted on 2009-05-22 at 19:31:01ID: 24456490

This IP has a valid reverse lookup though, does the 2003 server not point to the ISPs server for reverse lookups ouside of your assigned space?

 

by: OOsorioPosted on 2009-05-26 at 13:59:41ID: 24477626

Yes it does. This IP has a block so it does not resolve and excessive traffic is created as a result. Several DNS errors. I'm going to try lanboyo's suggestion and let you all know what happens.
Thanks,

05/26/09 16:55:10 IP block 67.40.182.122
Trying 67.40.182.122 at ARIN
Trying 67.40.182 at ARIN

OrgName:    Qwest Communications Corporation
OrgID:      QCC-22
Address:    1801 California Street
City:       Denver
StateProv:  CO
PostalCode: 80202
Country:    US

NetRange:   67.40.0.0 - 67.42.255.255
CIDR:       67.40.0.0/15, 67.42.0.0/16
NetName:    QWEST-INET-116
NetHandle:  NET-67-40-0-0-1
Parent:     NET-67-0-0-0-0
NetType:    Direct Allocation

 

by: lanboyoPosted on 2009-05-26 at 17:45:09ID: 24479097

Yes, qwest needs to fix the block, or likely whoever assigned it does.

I assume you are now sending hundreds of dns reqests upstream to an annoyed dns server...

 

by: giltjrPosted on 2009-05-26 at 18:58:10ID: 24479427

What makes you think something is wrong?  The IP address is a valid address and it has a valid PTR record and a valid A record.

The question is why is your host doing a reverse lookup on that address?  

 

by: OOsorioPosted on 2009-05-27 at 07:04:56ID: 24483140

That is an issue that I plan to address once I get the query under control.

 

by: giltjrPosted on 2009-05-27 at 07:35:50ID: 24483507

I guess the problem I am having is I don't know if a way to prevent a query for a specific name/address.  You can prevent queries from occurring totally, but you can't say "don't allow query for name XXXX" or "don't allow query for address a.b.c.d".

My guess is that  address is attempting to connect to some service on that computer (http, ssh, ftp, smtp, or something else) that is configured to do reverse look-ups.

The only way to "get the query under control" is to find out what is doing it and stop it.  That I am aware of there is no "content filtering" for dns functions.

 

by: OOsorioPosted on 2009-05-27 at 07:56:27ID: 24483769

I haven't tried it yet but maybe this would work because the query would think it got its answer..

lanboyo:If you put a host entry for the ip,
67.40.182.122 any_name_you_want
It will likely not do a reverse lookup.
A lot of commands have a -n option to not do the reverse lookup if this is a tcdump or traceroute kind of thing.
Posted via EE Mobile

 

by: giltjrPosted on 2009-05-27 at 08:13:53ID: 24483997

You can try.  At one I didn't think that reverse look-ups used the hosts files, but they might.

Unfortunately the only way to really test it, is to make the change and see if it stops hitting your DNS server.

 

by: lanboyoPosted on 2009-05-27 at 08:26:25ID: 24484154

Yes, this entry in /etc/hosts will stop some of the madness.

However, rhe next reverse lookup may start the problem over again.

I have had a similiar problem with a microsoft dns infrastructure, where reverse lookups for ips that are not in the local ad schema are blasted to every registered server in ad that is running dns, and every dns server asks every registered dns server.. And so on.

If your external server has cached an nxerror for this reverse lookup, then you will get used to seeing this problem. My org was disconnected from a shared dns structure for exactly this problem.

Since the originator is a linux box perhaps you can tweak the resolve.conf file to look directly to the external dns server for addresses not used internally. Apps that do a surprisingly large number of reverse lookups are tcpdump, snort and ethereal, even when they are reading old capture files.

Also traceroute and mtr.

 

by: OOsorioPosted on 2009-10-17 at 14:06:51ID: 25597534

I appreciate the effort but did not get a solution. Thanks all.

 

by: lanboyoPosted on 2009-10-18 at 13:19:10ID: 25601230

It has been a while. Did the host entry not help? I suppose the issue is that the linux box is doing a reverse lookup on an IP address.

Some linux apps will not trust the listing in the host table.

You may need to set up a dns server on the linux box and put the servers own address in the dns search order.


I recommend dnsmasq, very lightweight, and it will serve the local addresses out of /etc/hosts .

http://dag.wieers.com/rpm/packages/dnsmasq/


I was able to get it working....

administrator@mail:/etc/init.d$ dig -x 67.40.182.122

; <<>> DiG 9.4.2-P2 <<>> -x 67.40.182.122
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27955
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;122.182.40.67.in-addr.arpa.    IN      PTR

;; ANSWER SECTION:
122.182.40.67.in-addr.arpa. 0   IN      PTR     any_name_you_want.


Do we know what app is doing the reverse lookup? That may be the key.



 

by: giltjrPosted on 2009-10-19 at 08:03:13ID: 25605783

I had to go back and re-read to try and remember what the issue is.  

--> "This particular computer is sending out a bogus DNS query to our DNS windows 2003 sever. I would like to block the query at the source. How can this be done?"

Basic answer, you can't.

From the posts, the request is not a bogus request, its just a request you would rather not have come to your DNS server.

The solution is to find out what is doing the reverse look-up and stop it from doing it.  You can't stop a reverse lookup request (or a forward lookup) for a specific entry.  

If you can't find out what is doing the look-up, then all you can do attempt to do is change what you return.  Which lanboyo did give you a possible solution: add and entry in your hosts file for the IP address that is attempting to be looked up.  This will not stop the look-up, but it may return a host name other than the real host name and it may return the result faster than if you forward the request to another name server.

I know that some web server report packages do reverse look-ups to do reporting, some ssh servers do reverse look-ups to validate the host name before allowing connections, and some e-mail servers also do reverse look-ups to verify that IP address is associated with the domain name that remote smtp server says it is coming from.  So returning a "bad" host name could cause something else to "break."

 

by: OOsorioPosted on 2010-03-29 at 17:48:26ID: 31584171

The suggestions are very useful.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...