# Need help setting up a local DNS



## notooth (Nov 2, 2019)

Hello,

Can anyone guide me to set up a local DNS which forward "my.domain.name" to "192.168.100.200"?


----------



## ShelLuser (Nov 2, 2019)

Install dns/bind914 *, check out /usr/local/share/doc/bind/arm (in specific index.html), study carefully and you should be somewhat set.

(edit)

* Use `# pkg install bind914` I suppose....


----------



## rigoletto@ (Nov 2, 2019)

If you just need one (or few) address you can use unbound(8) local-zone due to simplicity.


----------



## notooth (Nov 2, 2019)

I have not found any complete instruction about setting up unbound.


----------



## rigoletto@ (Nov 2, 2019)

If you are using FreeBSD with the default DNS resolver (aka `local_unbound`) you already have it configured. You just need now to have a look on how to configure local-zone and local-data and add to the end of the config file.

*[EDIT]*

unbound.conf(5) and also Calomel.


----------



## Alain De Vos (Nov 2, 2019)

For a simple configuration i would go for unbound.
Google unbound setup


----------



## ShelLuser (Nov 2, 2019)

And if this is merely an issue of having a name resolved into an IP address there's an even easier solution: /etc/hosts. Just add the name and the IP and you're pretty much done.


----------



## msplsh (Nov 2, 2019)

If you don't use /etc/hosts, you'll need to set it up in a configuration called "split-horizon" which should be documented for any resolver you use.  You'll have to maintain your public and local zonefiles at the same time.


----------



## trev (Nov 2, 2019)

msplsh said:


> ou'll need to set it up in a configuration called "split-horizon" ... You'll have to maintain your public and local zonefiles at the same time.



It's easier to leave your public DNS records with your domain registrar and run a local name service that only resolves local IPs and forwards all other queries to your favourite external DNS provider. I've used /dns/bind911 to do this since FreeBSD 2.1, but if i was starting afresh today, I'd look into local-unbound(8).


----------



## msplsh (Nov 3, 2019)

I don't know how you would "only resolve local IPs" when the DNS server only gets domain name queries, not IP addresses?  If the DNS server "only returns local IPs" then that would be a split-horizon configuration.


----------



## Datapanic (Nov 3, 2019)

If you want to do per domain forwarding of a zone to a different name server, just use the *forward* and *forwarders* in your named.conf*:*

```
zone "my.domain.name" IN {
    type forward;
    forwarders {192.168.100.200;};
};
```

If that zone is a subdomain of a zone you already have, then you could also declare it as an NS in the zone file itself.

A "Split Horizon" DNS server provides different zone views based on the source IP, TSIG key or both using views, in-views and match-clients and more which in turn provides different IP addresses for the same hostname query.  It gets complicated fast!  I don't think that's what you want. 

Your question is not very clear about what you want to do.


----------



## blind0ne (Nov 16, 2021)

Alain De Vos said:


> For a simple configuration i would go for unbound.
> Google unbound setup


Could I connect my pc to remote freebsd with unbound, or I need to get some server instead?


----------



## msplsh (Nov 16, 2021)

Yes and no.


----------

