[Dnsmasq-discuss] Source modification for known suffixes

Jima jima at beer.tclug.org
Thu Jan 3 13:32:20 GMT 2008

On Thu, 3 Jan 2008, Antonio González Artime wrote:
> When a DNS query ends with, for example, .p2p (www.thankyou.p2p), 
> dnsmasq should answer with "localhost" and a specific port. I'm not sure 
> what is the best place in the code to make the change... ¿forward.c 
> rfc1035.c? I would appreciate your help. Thank you,

  Not to burst your bubble, but could you enlighten me with what RFC 
outlines DNS A records containing port numbers? :-)
  Port numbers aren't really a part of DNS; I suspect that you'll need to 
use a mix of DNS hackery and routing (iptables?) to fulfill your goal. 
I'm thinking it'd be doable to hand out a bogus IP via DNS, and do 
something like this with iptables:

iptables -t nat -A OUTPUT -p tcp -d -j REDIRECT --to-ports 4321

  On the dnsmasq side, I don't think you need any hackery at all.  Just add 
something like this to dnsmasq.conf:


  Based on a cursory test (using --to-ports 22 and `ssh -p 45 
www.thankyou.p2p`), I found myself miraculously connecting to my own 
machine, on completely arbitrary ports.  Is this the kind of thing you're 
going for?

  *blink*  Re-reading the question before I send this, I now realize I may 
have entirely misinterpreted it.  Did you mean that you wanted the DNS 
response to come from a particular port?  If that's the case, then I have 
no idea. :-(


More information about the Dnsmasq-discuss mailing list