Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

DNS requests switch from UDP to TCP

Reply
 
Thread Tools Display Modes
  #1  
Old 04-18-2005, 02:12 PM
Default DNS requests switch from UDP to TCP



Hello everybody,

I have witnessed a strange behavior of my machine and would like
to understand what has been happening. The situation is as follows.
My machine, which is online 24/7, uses fwlogwatch to generate daily
reports about connection attempts. I use a switch that makes
fwlogwatch try to resolve IP addresses, so that it sends requests
to an exterior DNS server when preparing a report. Usually, these
requests use UDP. Still, I have seen several times it using TCP
for these queries. My question is: What can make a program use TCP
for DNS requests?

Thanks!

Mikhail



muxaul@lenta.ru
Reply With Quote
  #2  
Old 04-18-2005, 02:35 PM
Trygve Selmer
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP

(E-Mail Removed) wrote:
> Hello everybody,
>
> I have witnessed a strange behavior of my machine and would like
> to understand what has been happening. The situation is as follows.
> My machine, which is online 24/7, uses fwlogwatch to generate daily
> reports about connection attempts. I use a switch that makes
> fwlogwatch try to resolve IP addresses, so that it sends requests
> to an exterior DNS server when preparing a report. Usually, these
> requests use UDP. Still, I have seen several times it using TCP
> for these queries. My question is: What can make a program use TCP
> for DNS requests?


When the packet is too big for UDP, DNS automatically switch to TCP for
that request.


Reply With Quote
  #3  
Old 04-18-2005, 11:33 PM
David Schwartz
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP


"Trygve Selmer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When the packet is too big for UDP, DNS automatically switch to TCP for
> that request.


Some smart programs also switch to UDP if they are seeing packet loss
issues. TCP is much better than UDP at dealing with this.

DS


Reply With Quote
  #4  
Old 04-19-2005, 01:07 PM
muxaul@lenta.ru
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP

Thank you for the reply. I would like to clarify it if possible.
Do you mean that this is the machine that sends a DNS
request `decides' whether to use UDP or TCP? The point
is that this was _my_ machine, not the DNS server that
was switching UDP to TCP.

Reply With Quote
  #5  
Old 04-19-2005, 02:04 PM
Trygve Selmer
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP

(E-Mail Removed) wrote:
> Thank you for the reply. I would like to clarify it if possible.
> Do you mean that this is the machine that sends a DNS
> request `decides' whether to use UDP or TCP? The point
> is that this was _my_ machine, not the DNS server that
> was switching UDP to TCP.


Normally your machine sends an UDP request to the server, and you get an
UDP response back. If the response is too big to fit into one UDP
packet, the server will return an indication of this. The client (your
machine) then retries the request, this time using TCP.


Reply With Quote
  #6  
Old 04-19-2005, 03:04 PM
muxaul@lenta.ru
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP


Trygve Selmer wrote:
> (E-Mail Removed) wrote:
> > Thank you for the reply. I would like to clarify it if possible.
> > Do you mean that this is the machine that sends a DNS
> > request `decides' whether to use UDP or TCP? The point
> > is that this was _my_ machine, not the DNS server that
> > was switching UDP to TCP.

>
> Normally your machine sends an UDP request to the server, and you get

an
> UDP response back. If the response is too big to fit into one UDP
> packet, the server will return an indication of this. The client

(your
> machine) then retries the request, this time using TCP.


Oh, thanks! I've got it.

Still, there seems to be an issue related to firewalling.
AFAIK, a common practice of protecting DNS servers is to
accept UDP requests from anyone but accept TCP requests
from a limited number of `upper-level' DNS servers only
(those that really need to transfer your zone). For all
other clients, TCP queries are prohibited. Thus, there
seems to be a collision between firewall rules and the
protocol suggested by the DNS server itself.

Mikhail

Reply With Quote
  #7  
Old 04-19-2005, 04:35 PM
Trygve Selmer
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP

(E-Mail Removed) wrote:
> Trygve Selmer wrote:
>
>>(E-Mail Removed) wrote:
>>
>>>Thank you for the reply. I would like to clarify it if possible.
>>>Do you mean that this is the machine that sends a DNS
>>>request `decides' whether to use UDP or TCP? The point
>>>is that this was _my_ machine, not the DNS server that
>>>was switching UDP to TCP.

>>
>>Normally your machine sends an UDP request to the server, and you
>>get an UDP response back. If the response is too big to fit into
>>one UDP packet, the server will return an indication of this. The
>>client (your machine) then retries the request, this time using TCP.

>
> Oh, thanks! I've got it.
>
> Still, there seems to be an issue related to firewalling.
> AFAIK, a common practice of protecting DNS servers is to
> accept UDP requests from anyone but accept TCP requests
> from a limited number of `upper-level' DNS servers only
> (those that really need to transfer your zone). For all
> other clients, TCP queries are prohibited. Thus, there
> seems to be a collision between firewall rules and the
> protocol suggested by the DNS server itself.


On an official server, you normally use tcp-ports other than 53 to
transfer zones between trusted servers. Port 53 (udp and tcp) normally
are reserved for client requests and prohibits zone transfers. And if
the zone is set up correctly, there should not be any need for tcp
requests/responses :-)

I will recommend the book "DNS and BIND" 4th edition from O'Reilly.

Reply With Quote
  #8  
Old 04-19-2005, 06:09 PM
Rick Jones
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP

(E-Mail Removed) wrote:
> Still, there seems to be an issue related to firewalling. AFAIK, a
> common practice of protecting DNS servers is to accept UDP requests
> from anyone but accept TCP requests from a limited number of
> `upper-level' DNS servers only (those that really need to transfer
> your zone). For all other clients, TCP queries are prohibited.
> Thus, there seems to be a collision between firewall rules and the
> protocol suggested by the DNS server itself.


That would not be the first time firewalls have caused trouble.

rick jones
--
Wisdom Teeth are impacted, people are affected by the effects of events.
these opinions are mine, all mine; HP might not want them anyway...
feel free to post, OR email to raj in cup.hp.com but NOT BOTH...
Reply With Quote
  #9  
Old 04-19-2005, 07:11 PM
David Schwartz
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...

> Still, there seems to be an issue related to firewalling.
> AFAIK, a common practice of protecting DNS servers is to
> accept UDP requests from anyone but accept TCP requests
> from a limited number of `upper-level' DNS servers only
> (those that really need to transfer your zone).


DNS servers are required to support TCP client queries. This "common
practice" is as broken as using path MTU discovery and filtering all ICMP.

> For all
> other clients, TCP queries are prohibited. Thus, there
> seems to be a collision between firewall rules and the
> protocol suggested by the DNS server itself.


Not everyone who configures a firewall knows what the hell they're
doing.

DS


Reply With Quote
  #10  
Old 04-20-2005, 04:24 AM
muxaul@lenta.ru
Guest
 
Posts: n/a
Default Re: DNS requests switch from UDP to TCP

David Schwartz wrote:
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> > Still, there seems to be an issue related to firewalling.
> > AFAIK, a common practice of protecting DNS servers is to
> > accept UDP requests from anyone but accept TCP requests
> > from a limited number of `upper-level' DNS servers only
> > (those that really need to transfer your zone).

>
> DNS servers are required to support TCP client queries. This "common
> practice" is as broken as using path MTU discovery and filtering all

ICMP.

Thank you for the reply, David. Still, I am afraid not everyone will
agree with you. At least, there are guys at comp.os.linux.security
who seem to share what I have called `a common practice'.

> > For all
> > other clients, TCP queries are prohibited. Thus, there
> > seems to be a collision between firewall rules and the
> > protocol suggested by the DNS server itself.

>
> Not everyone who configures a firewall knows what the hell they're
> doing.


Sure thing. ;-)


Mikhail

Reply With Quote
Reply

Tags
dns, requests, switch, tcp, udp

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
Forum Jump


All times are GMT. The time now is 07:12 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.