Bind on different port with linux

7,589

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.

Share:
7,589

Related videos on Youtube

Mini Fridge
Author by

Mini Fridge

Computer Science and Engineering student

Updated on September 18, 2022

Comments

  • Mini Fridge
    Mini Fridge over 1 year

    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 [email protected]
    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.

    • Frank Thomas
      Frank Thomas over 8 years
      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: 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. linux.die.net/man/5/resolv.conf
    • Mini Fridge
      Mini Fridge over 8 years
      @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
    • Frank Thomas
      Frank Thomas over 8 years
      No, port redirection would leave the redirected port inaccessible.
    • milli
      milli over 8 years
      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.