Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Domain Name System
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==DNS message format== The DNS protocol uses two types of DNS messages, queries and responses; both have the same format. Each message consists of a header and four sections: question, answer, authority, and an additional space. A header field (''flags'') controls the content of these four sections.{{Ref RFC|1034}} The header section consists of the following fields: ''Identification'', ''Flags'', ''Number of questions'', ''Number of answers'', ''Number of authority resource records'' (RRs), and ''Number of additional RRs''. Each field is 16 bits long, and appears in the order given. The identification field is used to match responses with queries. After the flags word, the header ends with four 16-bit integers which contain the number of records in each of the sections that follow, in the same order. {{APHD|start|title=DNS Header}} {{APHD|0|bits1=16|field1=Transaction ID|bits2=1|vfield2=QR|bits3=4|field3=OPCODE|bits4=1|vfield4=AA|bits5=1|vfield5=TC|bits6=1|vfield6=RD|bits7=1|vfield7=RA|bits8=1|field8=Z|bits9=1|vfield9=AD|bits10=1|vfield10=CD|bits11=4|field11=RCODE}} {{APHD|4|bits1=16|field1=Number of Questions|bits2=16|field2=Number of Answers}} {{APHD|8|bits1=16|field1=Number of Authority RRs|bits2=16|field2=Number of additional RRs}} {{APHD|end}} ;{{APHD|def|name=Transaction ID|length=16 bits|text=Transaction ID}} ;{{APHD|def|name=Flags|length=16 bits|text=The flag field consists of sub-fields as follows:}} :;{{APHD|def|name=QR|length=1 bit|text=Indicates if the message is a query (0) or a reply (1).}} :;{{APHD|def|name=OPCODE|length=4 bits|text=The type can be QUERY (standard query, 0), IQUERY (inverse query, 1), or STATUS (server status request, 2).}} :;{{APHD|def|name=AA|length=1 bit|text=Authoritative Answer, in a response, indicates if the DNS server is authoritative for the queried hostname.}} :;{{APHD|def|name=TC|length=1 bit|text=TrunCation, indicates that this message was truncated due to excessive length.}} :;{{APHD|def|name=RD|length=1 bit|text=Recursion Desired, indicates if the client means a recursive query.}} :;{{APHD|def|name=RA|length=1 bit|text=Recursion Available, in a response, indicates if the replying DNS server supports recursion.}} :;{{APHD|def|name=Z|length=1 bit|constraint=(Z) == 0|text=Zero, reserved for future use.}} :;{{APHD|def|name=AD|length=1 bit|text=Authentic Data, in a response, indicates if the replying DNS server verified the data.}} :;{{APHD|def|name=CD|length=1 bit|text=Checking Disabled, in a query, indicates that non-verified data is acceptable in a response.}} :;{{APHD|def|name=RCODE|length=4 bits|text=Response code, can be NOERROR (0), FORMERR (1, Format error), SERVFAIL (2), NXDOMAIN (3, Nonexistent domain), etc.<ref>{{cite web |url=https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6 |title=Domain Name System (DNS) Parameters |at=DNS RCODEs |author=<!--Not stated--> |publisher=[[IANA]] |access-date=14 June 2019}}</ref>}} ;{{APHD|def|name=Number of Questions|length=16 bits|text=Number of Questions.}} ;{{APHD|def|name=Number of Answers|length=16 bits|text=Number of Answers.}} ;{{APHD|def|name=Number of Authority RRs|length=16 bits|text=Number of Authority Resource Records.}} ;{{APHD|def|name=Number of Additional RRs|length=16 bits|text=Number of Additional Resource Records.}} ===Question section=== The question section has a simpler format than the resource record format used in the other sections. Each question record (there is usually just one in the section) contains the following fields: {| class="wikitable" |+ Resource record (RR) fields |- ! Field !! Description !! Length ([[Octet (computing)|octets]]) |- | NAME || Name of the requested resource || Variable |- | TYPE || Type of RR (A, AAAA, MX, TXT, etc.) || 2 |- | CLASS || Class code || 2 |} The domain name is broken into discrete labels which are concatenated; each label is prefixed by the length of that label.<ref>James F. Kurose and Keith W. Ross, Computer Networking: A Top-Down Approach, 6th ed. Essex, England: Pearson Educ. Limited, 2012</ref>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Domain Name System
(section)
Add topic