LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   DNS Dialog?? (https://www.linuxquestions.org/questions/linux-networking-3/dns-dialog-251753/)

codedv 11-06-2004 07:08 AM

DNS Dialog??
 
If I were to open a connection on port 53 to a name server. What commands would I send to it to resolve host names?

scowles 11-06-2004 07:54 AM

DNS queries are UDP based, so opening up port 53 (like with telnet) will not work. If you are asking about quering a DNS server in code, then take a look at: man resolver

win32sux 11-06-2004 08:03 AM

Re: DNS Dialog??
 
Quote:

Originally posted by codedv
If I were to open a connection on port 53 to a name server.
you can't really open a "connection" as the UDP protocol is connectionless...

Quote:

What commands would I send to it to resolve host names?
look at "man resolver" as suggested by scowles, or you can also use a packet sniffer when making a dns query...


Quote:

Originally posted by scowles
DNS queries are UDP based, so opening up port 53 (like with telnet) will not work.
what do you mean with this?? telnet listens on port 23/tcp and hence uses connections...

dns servers listen on port 53/udp... the port needs to be open and accessible for them to work...


scowles 11-06-2004 10:15 AM

Quote:

--------------------------------------------------------------------------------
Originally posted by scowles
DNS queries are UDP based, so opening up port 53 (like with telnet) will not work.
--------------------------------------------------------------------------------

what do you mean with this?? telnet listens on port 23/tcp and hence uses connections...

dns servers listen on port 53/udp... the port needs to be open and accessible for them to work...
Sorry for the confusion. I did not really understand what the OP was asking (command line or code), so I was referring to using "telnet dns_server 53", which will not work since DNS queries are UDP based.

codedv 11-06-2004 04:03 PM

OK - so it uses UDP and UDP is a conectionless protocol. But how does that work, you send something to the DNS server and it sends a response, but there is no connection. So how does the program querying the DNS server know where to look for it? :confused:

I used telnet as an example, but as it only does TCP connections thats a bit useless. If I were to use socket proramming in C for example. Surely the commands you send to the DNS server are documented somewhere, I can't seem to find them anywhere though.

scowles 11-06-2004 05:16 PM

See: man resolver
See: man gethostbyname

RHELL 11-06-2004 07:27 PM

This might be more of a developers forum question, but try these out:

http://www.protocols.com/pbook/tcpip7.htm
http://www.cis.ohio-state.edu/htbin/rfc/rfc1035.html
http://www.cis.ohio-state.edu/htbin/rfc/rfc1706.html

For a tool, the perl sockets module might be a quick start.


All times are GMT -5. The time now is 12:01 PM.