Configuring bind9 on FreePBX

hello How to install bind9 on FreePBX and configure and turn an IP into a domain name without a controller

That’s an OS thing, nothing to do with FreePBX, but reading between the lines, the easiest way to do that is to add a line in /etc/hosts which has precedence over DNS when resolving names

How do you do it?

I googled ‘linux /etc/hosts’ and got

What Is the /etc/hosts File in Linux? | Pure Storage Blog.

:slight_smile:

I’ve already tried it but its not working

You will have to explain better, I can assure you that linux will resolve a name in /etc/hosts/ before any DNS lookup is performed.

bind9 is a DNS server but you probably already have another, dnsmasq, running on 127.0.0.1, both consult /etc/hosts before looking anything up.

It’s a very long time since I did anything like this, but you configure BIND to forward by default, then add a zone file, with SOA, NS, and A records for the subdomain you want to only have visible locally. Whilst I don’t recognize “controller” as an official term, but, here, you become, in some sense, the controller of the sub-domain.

This is fairly commonly done in order that local users see private addresses, and remote one see full internet one.

You need to make local users use you as their name server, rather than one only based on the public DNS.

I’m assuming bind9 is just a recent version of BIND, rather than something fundamentally different.


file /etc/hosts

What does “turn the ip into a domain name without a domain controller” mean. Setting up reverse DNS for the IP address?

but you haven’t added a line for the ip you want to resolve, the link I posted has the exact syntax as to how to do that, did you actually read it?


yes but it doesn’t work

doesn’t work in what way,

ping mycrmct.com

?

The ping goes through but I can’t use that name to access my server

is traffic blocked? what port is the server listening on?

nmap -vv mycrmct.com

port 80

that’s half an answer :wink: do the nmap thing or explicitly use netcat

nc -zv mycrmct.com 80

do the same for the ip for good measure

how to redirect an ip address to a domain name on freepbx locally

What does this mean? The direction of translation is domain name to IP address. Whilst you can use PTR records to find out the domain name(s) for an IP address that doesn’t change where traffic goes.

I suspect the person wants to be able to resolve a domain name to an internal IP when looking up the address from the same network.

For that to work you probably need to setup a local DNS server for DNS lookups from the local network and setup the appropriate Zone files to return the proper results to local workstations.

You probably don’t want to be running bind on the same machine as your phone system. You should probably set this up on a different device inside your network and administer it separately.

In any case, the answer on how to do this would be out of scope for this forum. You might want to look at how to do that somewhere else online.

If you are wanting to change what IP address your PBX resolves an A record to you would add a line inside the /etc/hosts file on your phone system. This change would only affect your phone system though.

You can’t but you can ‘redirect a domain name to an ip address’ by changing the A record on the responsible name server, or you can add a line in /etc/hosts as you have confirmed. Many routers like mkrotik or pfsense, openwrt or ubiquiti and so on . . . can maintain a table of “lookups” that kicks in before 53 is called if you want a lan resolution but you might get away with hair-pin rules