Monday, February 25, 2013

Why DNS works on both the protocols; TCP and UDP.


DNS and some other Services work on both the TCP and UDP Protocols. Two protocols are different from each other. TCP is a connection-oriented protocol whereas UDP is a connection-less protocol. TCP requires the data to be consistent at the destination and UDP does not require the data to be consistent or does not need to establish the connection with the host for data accuracy.

DNS uses TCP for Zone Transfer over Port: 53

It is necessary to maintain a consistent DNS database between DNS Servers. This is achieved by the TCP protocol. This communication happens between DNS Servers only. The Zone Transfer feature of DNS Server will always use TCP protocol. The connection is established between the DNS Server to transfer the zone data and Source and Destination DNS Servers will make sure that data is consistent by using TCP ACK bit.

DNS uses UDP for DNS Queries over Port: 53

A client computer will always send a DNS Query using UDP Protocol over Port 53. If a client computer does not get response from a DNS Server, it must re-transmit the DNS Query using the TCP after 3-5 seconds of interval.

UDP packets are smaller in size. Can't be greater then 512bytes. So any application needs data to be transfferedgreter than 512 bytes uses TCP We often discuss why services use both the protocols i.e.TCP and UDP. These services can also realy on TCP instead ofUDP because     TCP is a connection-oriented protocol whereasUDP is connection-less! then why use UDP?     For example, DNS uses both TCP and UDP for valid reasonsdescribed below. Note that UDP messages are not larger than512 Bytes and are trucncted when greater than this size. SoDNS uses TCP for Zone transfer and UDP for name querieseither regular (primary) or reverse.         UDP can be used toexchange small information whereas TCP must be used toexchange information larger than 512 bytes. If a clientdoesn't get response from DNS it must retransmit the datausing TCP after 3-5 seconds of interval.

No comments:

Post a Comment