How to bind to port 53

A

Anonymous

Guest
I'm trying to write a script in python that creates a socket and binds to port 53. The problem I'm having though is that when I try to connect to the server at that port I receive an ICMP port unreachable response. I know the problem is in the operating system because port 8080 works fine. Does anyone know how I can bind to port 53. By the way I'm running the script as root and that doesn't seem to be a difference.
 
Have you tried nc(1) to check whether the basic mechanism of creating a listener on port 53 actually works?
 
Just tried it, here's the result:
I have 2 systems set up 10.0.0.2 is acting as the server and 10.0.0.1 the client.

Using
Code:
nc -l 10.0.0.2 53
and
Code:
nc 10.0.0.2 53 (from 10.0.0.1)

works and allows me to echo text between to consoles. But when I let nc listen on 10.0.0.2 53 and set /etc/resolv.conf on the client to:

Code:
nameserver 10.0.0.2

and do a:

Code:
nslookup example.com

and look in wireshark, I see the DNS request to sent to 10.0.0.2:53 with only a IMCP (port unreachable) response.
 
Oh yeah, oops I forgot dns uses udp. So i guess my next question is how can I go about recieving the request in its orginal format? The output in nc for the dns request of google.com shows up as "xgooglecom"
 
A tcpdump with some additional -XXX flags should show its original raw format. I'm not sure how nc handles, parses or manipulates input from DNS resolvers. It probably strips out anything non-ASCII.
 
Back
Top