Bind on different port with linux

4

I have a bind9 DNS server that I have configured to run in port 55 but I can't get the setup working. The server is works fine but I can't tune my local machine to resolve nameserver queries from 127.0.0.1, port 55

Example:

dig -p 55 a1.mylocalinstance.dip
...
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; QUESTION SECTION:
;a1.mylocalinstance.dip.        IN  A

;; ANSWER SECTION:
a1.mylocalinstance.dip. 10800   IN  A   192.168.1.107

;; AUTHORITY SECTION:
mylocalinstance.dip.    10800   IN  NS  ns.mylocalinstance.dip.

;; ADDITIONAL SECTION:
 ns.mylocalinstance.dip.    10800   IN  A   192.168.1.100

;; Query time: 0 msec
;; SERVER: 127.0.0.1#55(127.0.0.1)
;; WHEN: Fri Dec 18 00:20:54 EET 2015
;; MSG SIZE  rcvd: 96

When I try to ssh at my server:

$ssh test@a1.mylocalinstance.dip
ssh: Could not resolve hostname a1.mylocalinstance.dip: Name or service not known

My /etc/resolv.conf file:

nameserver [127.0.0.1]:55
nameserver fe80::1%wlan0

I don't understand the relations-dependencies between the network manager and the resolver and how to get things working with bind in my port and how can I forward my dns queries at port 55.

Mini Fridge

Posted 2015-12-17T23:42:47.887

Reputation: 173

1

I have never seen any OS (and I've used quite a few) that will allow you to specify the port for DNS resolution. they will likely try both TCP and UDP, but always on port 53. about the best you can do, is use IP tables to redirect traffic from UDP\53 to UDP\55. see any example of port redirection here: http://www.cyberciti.biz/faq/linux-port-redirection-with-iptables/ Ultimately however, I believe you are chasing an untamed ornithoid without cause. Per the resolv.conf man page, a colon in nameserver will cause it to believe that its an IPv6 address. http://linux.die.net/man/5/resolv.conf

– Frank Thomas – 2015-12-17T23:46:42.877

@FrankThomas Will another service be able to bind in port 53? That's the whole reason for migrating to port 55 in the first place. I find it absurd that there is not such functionality – Mini Fridge – 2015-12-18T10:45:16.317

No, port redirection would leave the redirected port inaccessible. – Frank Thomas – 2015-12-18T15:41:24.997

The problem with changing this well-known port is you cannot create a reachable authoritative DNS server doing this. There is no way in the protocol to tell other nameservers that the port to use is anything other than 53. You could consider it a deficeincy, but it's never been needed in practice. There is a cleaner way to achieve what you want. – milli – 2016-01-03T06:13:59.103

Answers

0

Keep in mind that port 53 is the destination port (of the DNS server), whether it's on the local machine or elsewhere. About the only option you have to connect to a DNS server on port 55 would be to use an iptables command. As long as /etc/resolv.conf points to another machine, any other service can run on port 53 of the local box (though you'd need to be root to run it and I can't think of a good reason to do so).

NetManger reads a config file (in Debian variants /etc/network/interfaces) and writes the /etc/resolv.conf file when it's started (normally, at boot). In other words, NetworkManager is just a program that writes the config files used by other programs and/or calls the programs/scripts to employ those config files.

joat

Posted 2015-12-17T23:42:47.887

Reputation: 466

0

You haven't explained what is wrong with port 53, 127.0.0.1:53. If it is already in use, you might try to set the bind9 DNS server at port 53 of another local address, say 127.0.0.53. That is, 127.0.0.53:53. I haven't tested that.

As an aside, I think that some OSs, perhaps MAC, can be set to also read a port, say 55, in resolv.conf, or their equivalent.

nh4c

Posted 2015-12-17T23:42:47.887

Reputation: 1