Wednesday, August 4, 2010

The osi model

"What is The OSI model? Is this related to any of the atom models done in old school ? Huh!" No, my friend the OSI model [OPEN SYSTEM INTERCONNECTION ] is a way of subdividing a system into smaller or simpler parts [ with respect to the communications ] called layers.

Things to remember
  1. A layer is a collection of services/functions .
  2. Each layer provides services to the layer above it and receive services from the layer below it.
  3. It have 7 layers coming to that in a minute.
Layers of the OSI model:-
  1. Application
  2. Presentation
  3. Session
  4. Transport
  5. Network
  6. Data-Link
  7. Physical layer
How to remember all these layers....

Yeah! I know that you guyz would be thinking how do I remember these stuff..

As usual I'll make it easy:-

Here comes the acronym to remember these layers with their orders . I came to know about this from a youtube video...
Code:
All        : application
People : presentation
Seem : session
to : transport
need : network
Data : data-link
processing : physical
What are these layers man What do they do..

Lets start explaining them 1 by 1 :-
  1. Application layer



    This layer is basically there so that you can interact with any application on the WWW or the world wide web or on your own network. Protocols in there are : HTTP , FTP , SMTP etc etc.........
  2. Presentation Layer



    This layer is the easiest one it deals with the ANCII code means it deals with the relationship between binary and letters.. We'll be doing the byte-ordering and conversion topics few pages down. Then you'll be able to properly understand this..
  3. Session Layer



    This one's easy too.. The dictionary meaning of session is : A period of time spend on a particular activity. What a session in OSI model means that it finds the destination PC on the network .

    Ask about can they initiate a connection between our comp's and theirs.

    In easy language it just there to establish a connection between the source computer to the destination.

    I'll make it easy :-

    Imagine you make a chat server program and decide to establish a connection between you and your friend so in that ,the role of this layer will be to carry the request from your computer to your friend's computer "knock knock" and ask him "Sir can we initiate a connection between each other and do some chat,if you dont mind"

    So that was the session layer.
  4. Transport



    In our case this is the most Important stuff . It contains the two most important protocols for us :- TCP and UDP .. I'll explain these two in a healthy 2 pages topic .. Which is coming next in the next tutorial.

    After this.
  5. Network layer



    This layer is also a very important layer. This is where IP : INETERNET PROTOCOL is found …

    We all know that net is like a matrix it is the most complex network so it has lots and lots of webs of wires so what the IP and other protocols here does that they find or actually they know the shortest and the most reliable way to connect host and the destination . I'll explain you this topic more clearly through the following "kind of picture"
    Code:
    ******                  Route 2nd                         ****** 
    * C1 *-------->------>------------>---------------------->* C2 *
    ****** ******
    | |
    | 1st route |
    | |
    ****** |
    * C3 *---------<---------------<--------------<----------<------
    ******
    In the above diagram there is a network of 3 computers C1,C2 and C3.

    We want to initiate a connection between C1 and C3. There are 2 routes :-

    The straight and the shorter route is "route 1st"

    The coiled , complex and the longer route is "route 2nd".

    You'll have a better understanding of this topic while in the next section. "When I'll talk about TCP/IP in more detail".
  6. Data-Link layer



    According to me it is the most confusing layer . It contains two sub-layers MAC and LLC:-

    MAC :- The id given to every network card manufactured.

    Is known as MAC address.

    Don't be confused between logical address and physical address .

    They both are different logical addresses are what we call IP addresses and physical addresses are one associated with this layer.
  7. Physical layer



    This is the most easy layer according to me It only deals with zeroes and ones yeah! Binary.. The ethernet cable , hub , switch , modem , etc etc all come in this layer....

Where he is getting us with all this stuff!!!" Sorry guyz but it is important if you want to be a good and a successful socket programmer you have to know about all this stuff so Fix in your seat and bear it with me....

Ip versions:-



Till date there are two IP VERSIONS :-

1.IPv4 [The old one but still the dominant one]
2.IPv6 [The new and the complex one]

The reason why we needed to get this new ip versions is that we were getting short of it "what" yes we were getting short of it..
Day by day the net was spreading more and more faster which lead to creation of new Ip version that is Ipv6...

What are thes Ipv4 and Ipv6 :-

See before getting what are these different versions and differentiate them i'd like you to introduce about.

What is an IP?

IP is known as Internet protocol it is the primary protocol in the Internet layer. It have many uses like incapsulation [ explained above ] , addressing , etc , etc....

But I'll only cover the basics:-

TCP/IP in terms of Addressing

Before talking in terms of the biggy big net I'll talk this topic with respect to a smaller network let call it "The tutorial network" .

What I did is that I connected 3 of my computers with each other . Ok . You are sitting at comp no.1 I'm at comp no.2 and my uncle "Mr Sachin Sharma " is sitting on the third . I requested to download a file name "blah blah blah.jpg " on the Sachin's computer [3rd computer] . Now suppose that you are the [3rd computer ] how will you find who wanted to download that file.

Here when the ip's comes in work .. You can actually suppose IP's as the names of computer.

Now when I'll make a request to read a file on comp 3rd The computer will respond back to my ip address .

The exact definition of IP address :-

It is a numeric address given to every device including/participating in a computer network.

That was IP in terms on Addressing.

More about ip :- http://en.wikipedia.org/wiki/Internet_Protocol

IPV4 and IPV6:-

As I explained above that IP is a numeric address given to every device participating in a computer network .whether its a mobile phone , a PSP etc etc..

IPV4 : It is a 32 bit ip version and the old one.

Eg:- 127.0.0.1

Yeah I'll explain you what is 32 bit.

Actually its a 4 byte address.

As there are 8 bits in each byte . And 8*4=32 . Got it …

Wait a sec I'll make it easy.

234.44.55.22

here:-

234 = 11101010 ? 8 bits
44 = 00101100 ? 8 bits
55 = 00110111 ? 8 bits
22 = 00010110 ? 8 bits

IPV6 :

See as, I said above we needed IPV6 as we were getting short of IPV4 addresses .

IPV6 are a 128 bit IP version . And they were invented in 1995 …

"Whats so cool about that" I was born in the same year... Yupiii!!!

LOL...

eg:-

1001:0bb8:65a3:08c1:1339:9b2d:1370:5434
You can also see a IP like this :-
0000:0000:0000:0000:1339:9b2d:1370:5434

in the form of this:-

::::1339:9b2d:1370:5434
or:-
::1339:9b2d:1370:5434

This is because the zeros in the IPV6 can be omitted.

Memory Management In C and C + +

For simple applications, it's enough just to rely on automatic memory management through local variables. But once the data become larger, it is no longer imperative to request memory from the heap and manage.

Content


  1. Function Families
  2. Allocators
  3. Toolbox
  4. Smart Pointer
  5. STL Containers

A function families



In principle, belong to the memory always two parts. First, an area of memory are requested, and second, the memory used at the end of the work be returned. For this reason, memory management functions normally exist in pairs, sharing the work.

When working with C + + objects is yet to fill the requested memory with sensible starting values or the data of the object at the end of the work to clean up again. For this purpose, there are constructors and destructors that are called automatically to suit the use or management must be handled manually.

Over time, various function pairs were developed, which can be requested and memory freed. It is particularly important to the different methods of memory management not to interfere with each other. In the simplest case, it is "just" a memory leak (if the sharing function "just forget" to call the Objektdestruktor or returns too little heap memory), in the worst case, can not be predicted what will make the program (for example, it can happen that the release function tries to interpret something in her memory structure unknown).

For this reason, libraries, heap areas and request the user to pass, always provide a compatible release function, which is suitable to its own working memory - or in the documentation at least set the method of the memory they use.

1.1 malloc () and free ()

This family dates back to C and has been for reasons of compatibility for C + +: Accepted
  • malloc (s)
    allocates a memory area with (at least) s bytes in size and returns a pointer to the beginning of this area. The content of this field is undefined.
  • calloc (n, s)
    enough allocates memory for n objects of size s and initialize it with zeros
  • realloc (p, s)
    the amount of memory changes, the p shows on s bytes and returns the new address of the memory (realloc (NULL, s) "is equivalent to 'malloc (s)" and "realloc (p, 0)" corresponds "free (p)")
  • free (p)
    there by the malloc () etc. requested memory range again free (p must be the NULL pointer, in which case nothing happens)
These functions do not care about the contents of the managed memory areas and therefore should only be used with POD (plain old data) types.

Note: The function realloc () can also single-handedly take over the entire memory of a program by its parameters are set appropriately:

Code:
char* str = realloc (NULL, 100);/ / memory allocation 
...
realloc (str, 0);/ / Release memory
1.2 New and delete

For C + +, a new mechanism for memory management, which provides a better approach to the class. Unlike malloc () / free () the memory areas are regarded as objects of arbitrary classes, and now initialized with an appropriate constructor.
  • new T (...)
    enough reserved memory for an object of type T, and calls its constructor according to the specified parameter list (the parameter list can be removed also, then the default constructor uses)
  • delete p;
    calls the destructor of the object pointed to by p, and are then free the memory


Another advantage of new and delete is the fact that they can be overridden by the user. This requires either a global (for every new call) or static member function (for their own class, and all children) "operator new ()" or "operator delete ()", or the free memory can request. These operators work with unstructured data fields - the call to constructors and destructors are independently:

Code:
void* operator new(size_t s) 
(
void* p;
/ / Reserve memory for at least s bytes
return p;
)

void operator delete(void* p)
(
/ / Give free hand p
)
Both functions can obtain additional parameters of any type to implement the so-called "placement new". These parameters are by calling "new (values) T (ctor parameter) passed. The most common use cases of this are the specification of a destination address (an object to initialize in available memory) and the installation of debugging information (the MFC-operator DEBUG_NEW passes "as file name and program line to be able to track memory leaks).

Note: "operator new" and "operator delete" operate with bare areas of memory. The constructor and destructor of the object involved is called when operator new has come back before or operator delete is called.

Caution: Do not overcharge the global operators only if you are absolutely sure what you want to achieve. The global version of operator new and operator delete takes really ANY memory request within the program - and in contrast to klasseninternen operators can not here from the predefined memory access operators.

Another typical application for operator new and operator delete is to use a pool manager: in order to save computing time, the memory of precaution required in larger blocks, replaced and forwarded as needed to the program. From the program of shared memory is not returned to the system, but also for future requirements repealed.

1.3 New [] and delete []

In parallel with new and delete, playing with various objects, there are versions to manage whole object array:
  • new T [n]
    enough reserved memory for n objects of type T, and calls for an object whose default constructor
    Note: It is not possible to specify parameters for the constructor invoked
  • delete [] p;
    calls for all objects in the array after p destructor on the memory and are then free to
    Just like new / delete can be adapted to these functions by "be void * operator new [] (size_t s);" or "void operator delete [] (void * p); overwritten.

Note: new [] remember (just like malloc ()) internally the size of the allocated memory. However, there is no portable way to access this information.

Note: Despite the name similarity is not guaranteed that new / delete and new [] / delete [] are compatible with each other. So try NIE, the two mix with each other.

1.4 Other families

Many libraries define your own function pairs in order to request and release memory, eg VirtualAlloc () / manage Virtual Free () from the WinAPI, the memory in the "shared memory". All such families function in common is that they consist of at least two functions - one for requesting memory, one for release. Analogous to the malloc () family may be added other features that can reorganize the managed memory.

Because different memory strategies are not necessarily compatible with each other, you should always use the correct release function if you need more memory not yours. Therefore, it is usually a good idea to have a program on a strategy and set within this largely unsustainable. If that is not generally possible, should know where he is to his memory relate to each case are set for each pointer used.

Even in the standard library yet another function family is defined, which can be used to manage temporary storage:
  • get_temporary_buffer (num)
    allocates a temporary buffer for a maximum of num objects of type T and is a couple with its address and available disk space back to the
  • return_temporary_buffer (p)
    have requested a temporary buffer back to the system
These temporary buffer can be used within a function to provide large amounts of additional memory (eg, merge sort requires an auxiliary memory for its data). Make sure that the returned memory region may be less than requested.

Allocators



The containers of the STL default to new [] and delete [] to know the memory request for their elements. However, as it should be possible to switch to a different memory management, this behavior had been moved into so-called allocators - these can be interchanged, to use a different memory behavior. In addition, each container class as the last template parameter an indication of the allocator class. The default value for this is std:: allocator - this allocates memory using new [] and returns it with delete [] free again.

An allocator has to be used with the STL, provide some basic methods and definitions. If you write an allocator for its own purposes, the requirements may be lower.

2.1 management

The most important are the Allokatorklasse course, the functions that can manage the memory:
  • allocate (n, h = 0)
    Reserved uninitialized memory for n elements and returns it (eg by: operator new () or malloc ()). The optionally specified pointer h can be used to influence the storage strategy.
  • construct (p, val)
    Initializes the object pointed to by p, as a copy of val (usually via placement new)
  • destroy (p)
    Destroy the object pointed to by p (usually by direct destructor call)
  • deallocate (p, n)
    Is an area behind free p consisting of n elements (the parameter can be useful if the size of memory used can not be determined from the pointer itself) - The objects must first be destroyed
In addition, the allocator max_size the helper methods () that can specify the maximum size of a memory block (in elements) and address (ref) can be defined by the object at a given address.

Custom allocators are generally allocate the methods (), deallocate () and max_size () override to implement the storage strategy. construct () and destroy () are likely to differ only in the rarest cases, by the standard version:

Code:
template 
class Alloc
(
...
public:
void construct (pointer p, const T & val)
( New((void*) p) T val ();)
void destroy (pointer p)
(P-> ~ T ();)
...
);
2.2 rebind <>

In order to offer the ability to store various objects that contains a substructure Allokatorklasse called "Rebind. This is used as the associative container classes, which receive as an allocator template parameter , but need an internal TreeNode allocator <>.

This structure is pretty simple and serves only to "packaging" of the alternate type:
Code:
template 
class Alloc
(
...
public:
template
struct rebind
( typedef Alloc other;);
...
);
In this way, one can easily allocator for any data obtained by inspecting the structure:

Code:
template> 
class mycont
(
public:
//...
typedef A allocator_type;
typedef typename A:: rebind :: other ptr_allocator,/ / Pointer to compatible allocator
//...
);
2.3 Comparisons

Different allocators can be compared with the operators == and! =. These features will be released equality that two allocators are interchangeable - is requested by a memory on b again.

For example, building allocators, to delete the new /, are interchangeable, as is required for the delete-object call no tax. In contrast pool allocators are limited interchangeable because each allocator manages its own list of reserve memory.

Note: STL compatible allocators have to be interchangeable. reduce most of the comparison operators to a "return true reason," or return false; ".

2.4 Type definitions

Allocators also define some basic types used by the connected container classes continue:
  • value_type (T)
    the underlying value type
  • size_type (size_t) and difference_type (ptrdiff_t)
    two integer types for specifying memory sizes (unsigned) or "points-difference (signed)
  • pointer (T *) and const_pointer (const T *)
    Pointer to variable or constant objects
  • reference (T &) and const_reference (const T &)
    Reference to variable or constant objects
Note: STL compatible allocators is the award of these basic types defined (according to the above information).

Auxiliary functions for memory management



In addition to the standard library allocators defines some utility functions that can deal with non-uninitialized memory. These serve as a logical extension of memset () and memcpy ():
  • uninitialized_fill (beg, end, val)
    initializes the field (in the sense STL) [beg, end [with the corresponding number of copies of 'val'
  • (Uninitialized_fill_n beg, n, val)
    initializes the array behind 'beg' with n copies of 'val'
  • uninitialized_copy (beg, end, nbeg)
    initializes the array behind 'nbeg' with copies of the range [beg, end [
These functions can be also referred to in section 1.3 restriction bypass that new [] can only call the default constructor:
Code:
T * data =::operator new[] (n *sizeof(T)); 
unitialized_fill_n (data, n, T (4711));
...
delete[] data;
In an emergency, it is also possible to fill a new placement of uninitialized memory area with values:

Code:
* p myType = (myType *) malloc (sizeof(myType)); 
new(p) myType (params);
...
p-> ~ myType ();/ / direct call destructor
free (p);
(Note: should normally take place this construction rather directly to new / delete be used)

3.1 Rohspeicher iterators

Full Name:
Code:
template 
class raw_storage_iterator;
This Hilfsiteratoren can be used to an uninitialized memory as a target STL algorithm indicated. They translate into calls on assignments of the copy constructor placement new.

The template parameter of this class are, first, an output iterator that is used as the basis for the iterator arithmetic (usually enough for this one 'T *') and second, the data type used.

3.2 Functions of the C library

Unlike C + + interprets the C library typically anything in the memory areas, which it manages. Logically, obtained from malloc () a bunch of bytes with no internal structure. Then it depends on the programmer, as he fills the memory and interpreted.

To process this naked memory areas can be either the malloc () pointer obtained in the "right" type casting and processing of hand or some ready-made functions of the C library (memcpy (), memset (), etc.), or (with restrictions ) the string processing functions (strcpy (), strcat () to take, etc.) to help.

Note: Try to be better not to interpret bare memory than C + + objects. Most methods expect an existing basic structure and lead to undefined behavior if they get junk data set before.

Smart Pointer



The management of heap memory (no matter how it was obtained) on bare hands always suffer the same problem - no one can verify when and by whom the memory must be freed. Forget the last owner of the release shows a memory leak, because no one knows more about the existence of the memory block. If the memory released too early, you get access violations and undefined behavior if other users want to access the shared memory.

A solution to this problem is to make the pointer itself to instruct the memory management, instead of bare hands by so-called "smart pointer" is used. These differ in principle three different approaches to control the access and control:
  • Reference counting (boost:: shared_ptr, boost:: shared_array)
    The referenced object counts how many pointers point to it. And only when the last pointer from the object, separates the memory is freed.
  • Exclusive access (boost:: scoped_ptr, boost:: scoped_array)
    The address may not be transferred. The owner of the pointer and puts him in the end is also responsible to release him again.
  • Ownership transfer (std:: auto_ptr)
    There is always just a pointer that points to a memory (owner). When an assignment is the possession and passed the former owner loses access to the memory.


The operation and characteristics of the different smart pointer classes was some time ago in the article "Smart pointer" peter's declared.

Note: Normal smart pointer classes to a specific memory function (usually new / delete and new [] / delete []) defined and therefore expect that their managed storage "was created correctly."

The above smart pointer classes (except auto_ptr to find) into the Boost Library or TR1 extension of the standard. The auto_ptr class is part of the C + + Standard Library.

STL Container



Whom the whole burden of memory management is too complicated, it can also make it easier - and use the various classes of the STL containers. All the container take care of their own so to provide enough memory and to manage, so that the user no longer needs to worry about where their data is housed.

The usable container classes differ mainly from the perspective of memory in it, the strategy that they require memory and organize:
  • vector <> and basic_string <>
    use a contiguous area of memory that grows as needed
  • deque <>
    usually used a two-layered structure with multiple memory blocks hung together logically to be extended if needed or released
  • list <>
    uses a linked list, where each element has a pointer to predecessor and successor
  • set <>, multiset <>, map <> and multimap <>
    use a (balanced) binary tree of individually requested node into which they sort their elements

Note: This will of course depend on the type of allocator, where the containers maintain their memory.

Finding time of execution of code in c

#include <time.h>

clock_t start;
clock_t diff;
clock_t end;

start= clock();
various algorithm;
end = clock();

diff = end - start;
print diff;

Tuesday, August 3, 2010

Some udfs for arrays in cpp

void printArray (int *array,int size)
{
int i;
for (i = 0; i <= size; i++)
cout << array[i] << " ";
cout << endl;
}

Reading from file or Reading integers from file

#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdlib>

using namespace std;

int main() {
    int sum = 0;
    int x;
    ifstream inFile;

    inFile.open("integers.txt"); // read integers from text file
    if (!inFile) {
        cout << "Unable to open file";
        exit(0); // terminate with error
    }


while (inFile >> x) {
        sum = sum+x;
    }
    inFile.close();

cout << "Sum = " << sum << endl;
    return 0;
}

‘exit’ was not declared in this scope

#include is solution.
Similarly if one does not get these kinds of errors include respective header file.

Sunday, August 1, 2010

Troubleshooting DNS servers

There may be 3 problems we face when dealing with DNS server:
  • The DNS server is not responding to clients.
  • The DNS server does not resolve names correctly.
  • The DNS server appears to be affected by a problem for reasons not described above.
Dealing with this 1 by 1.
1. The DNS server is not responding to clients

Cause 1: Network failure

Solution: Check if the hardware is fully ok, i.e. adapters are properly plugged or not. Then check network connectivity by pinging other computers or routers (such as its default gateway) that are used and available on the same network as the affected DNS servers.


Cause2: Network is o.k. but non-responsive to client's query

Solution: If the DNS client can ping the DNS server, verify that the DNS server is started or not and is able to listen to client's request. Try using the nslookup command to test whether the server can respond to DNS clients. You need to install a package called dnsutils - which provide clients such as nslookup, host and other tools. The Berkeley Internet Name Domain (BIND) implements an Internet domain name server. his package delivers various client programs related to DNS that are derived from the BIND source tree.


Cause: The DNS server has restricted some IP addresses to which it will respond.
Solution: If above is the case, it is possible that the IP address being used by clients to contact it is not in the list of restricted IP addresses permitted to provide service to clients.   
Try testing the server for a response again, but specify a different IP address known to be in the restricted interfaces list for the server. If the DNS server responds for that address, add the missing server IP address to the list.

Cause: The DNS server has been configured to disable the use of its automatically created default reverse lookup zones.
Solution: Verify that automatically created reverse lookup zones have been created for the server or that advanced configuration changes have not been previously made to the server.

By default, DNS servers automatically create the following three standard reverse lookup zones based on Request for Comments (RFC) recommendations:

These zones are created with common IP addresses covered by these zones that are not useful in a reverse lookup search (0.0.0.0, 127.0.0.1, and 255.255.255.255). By being authoritative for the zones corresponding to these addresses, the DNS service avoids unnecessary recursion to root servers in order to perform reverse lookups on these types of IP addresses.

It is possible, although unlikely, that these automatic zones are not created. This is because disabling the creation of these zones involves advanced manual configuration of the server registry by a user.

To verify that these zones have been created, do the following:

1. Open the DNS console.

2. From the View menu, click Advanced.

3. In the console tree, click Reverse Lookup Zones.

Where?

* DNS/applicable DNS server/Reverse Lookup Zones

4. In the details pane, verify that the following reverse lookup zones are present:

* 0.in-addr.arpa

* 127.in-addr.arpa

* 255.in-addr.arpa

See also: Open the DNS console; DNS RFCs.

Cause: The DNS server is configured to use a non-default service port, such as in an advanced security or firewall configuration.
Solution: Verify that the DNS server is not using a non-standard configuration.

This is a rare but possible cause. By default, the nslookup command sends queries to targeted DNS servers using User Datagram Protocol (UDP) port 53. If the DNS server is located on another network only reachable through an intermediate host (such as a packet-filtering router or proxy server), the DNS server might use a non-standard port to listen for and receive client requests.

If this situation applies, determine whether any intermediate firewall or proxy server configuration is intentionally used to block traffic on well-known service ports used for DNS. If not, you might be able to add such a packet filter onto these configurations to permit traffic to standard DNS ports.

Also, check the DNS server event log to see if Event ID 414 or other critical service-related events have occurred which might indicate why the DNS server is not responding.

See also: DNS server log reference; View the DNS server system event log; Microsoft Windows Deployment and Resource Kits.
The DNS server does not resolve names correctly.

Cause: The DNS server provides incorrect data for queries it successfully answers.

Solution: Determine the cause of the incorrect data for the DNS server.

Some of the most likely causes include the following:

* Resource records (RRs) were not dynamically updated in a zone.

* An error was made when manually adding or modifying static resource records in the zone.

* Stale resource records in the DNS server database, left from cached lookups or zone records not updated with current information or removed when they are no longer needed.

To help prevent the most common types of problems, be sure to first review best practices for tips and suggestions on deploying and managing your DNS servers. Also, follow and use the checklists appropriate for installing and configuring DNS servers and clients based on your deployment needs.

If you are deploying DNS for Active Directory, note new directory integration features. These features can cause some differences for DNS server defaults when the DNS database is directory-integrated, that differ from those used with traditional file-based storage.

Many DNS server problems start with failed queries at a client, so it is often good to start there and troubleshoot the DNS client first.

See also: DNS best practices; DNS Checklists; Troubleshooting DNS clients; Modify an existing resource record in a zone; Clear the server names cache; Modifying server defaults.

Cause: The DNS server does not resolve names for computers or services outside of your immediate network, such as those located on external networks or the Internet.

Solution: The server has a problem based on its ability to correctly perform recursion. Recursion is used in most DNS configurations to resolve names that are not located within the configured DNS domain name used by the DNS servers and clients.

If a DNS server fails to resolve a name for which it is not authoritative, the cause is usually a failed recursive query. Recursive queries are used frequently by DNS servers to resolve remote names delegated to other DNS zones and servers.

For recursion to work successfully, all DNS servers used in the path of a recursive query must be able to respond to and forward correct data. If not, a recursive query can fail for any of the following reasons:

* The recursive query times out before it can be completed.

* A remote DNS server fails to respond.

* A remote DNS server provides incorrect data.

If a server fails a recursive query for a remote name, review the following possible causes to troubleshoot the problem. If you do not understand recursion or the DNS query process, review conceptual topics in Help to better understand the issues involved.

See also: How DNS query works.

Cause: The DNS server is not configured to use other DNS servers to assist it in resolving queries.

Solution: Check whether the DNS server can use both forwarders and recursion.

By default, all DNS servers are enabled to use recursion, although the option to disable its use is configurable using the DNS console to modify advanced server options. The other possibility where recursion might be disabled is if the server is configured to use forwarders and recursion has been specifically disabled for that configuration.

Note

* If you disable recursion on the DNS server, you will not be able to use forwarders on the same server.

See also: Disable recursion on the DNS server; Configure a DNS server to use forwarders.

Cause: Current root hints for the DNS server are not valid.
Solution: Check whether server root hints are valid.

If configured and used correctly, root hints always should point to DNS servers authoritative for the zone containing the domain root and top-level domains.

By default, DNS servers are configured to use root hints appropriate to your deployment, based on the following available choices when using the DNS console to configure a server:

1. If the DNS server is installed as the first DNS server for your network, it is configured as a root server.

For this configuration, root hints are disabled at the server because the server is authoritative for the root zone.

2. If the installed server is an additional DNS server for your network, you can direct the Configure DNS Server Wizard to update its root hints from an existing DNS server on the network.

3. If you do not have other DNS servers on your network but still need to resolve Internet DNS names, you can use the default root hints file which includes a list of Internet root servers authoritative for the Internet DNS namespace.

See also: Update root hints on the DNS server; Updating root hints.

Cause: The DNS server does not have network connectivity to the root servers.
Solution: Test for connectivity to the root servers.

If root hints appear to be configured correctly, verify that the DNS server used in a failed query can ping its root servers by IP address.

If a ping attempt to one root server fails, it might indicate that an IP address for that root server has changed. Reconfiguration of root servers, however, is uncommon.

A more likely cause is a full loss of network connectivity or in some cases, poor network performance on the intermediate network links between the DNS server and its configured root servers. Follow basic TCP/IP network troubleshooting steps to diagnose connections and determine whether this is the problem.

By default, the DNS service uses a recursive time-out of 15 seconds before failing a recursive query. Under normal network conditions, this time-out does not need to be changed. If performance warrants it, however, you can increase this value.

To review additional performance related information on DNS queries, you can enable and use the DNS server debug log file, Dns.log, which can provide extensive information about some types of service-related events.

See also: Test a TCP/IP configuration by using the ping command; Using server debug logging options; View a DNS server debug log file; Tuning advanced server parameters.

Cause: Other problems exist with updating DNS server data, such as an issue related to zones or dynamic updates.
Solution: Determine whether the problem is related to zones. As needed, Troubleshoot any issues in this area, such as possible failure of zone transfer.