# Forwarding DNS-server for LAN



## folivora (Sep 20, 2010)

Hi,

I need to setup forwarding dns-server for my LAN, so that the dns-server uses my isp's dns-server.

What is the best solution for this. I've read about BIND,UNBOUND, POWERDNS-RECURSOR adn UDNS.

This LAN-environment has maximum 20 *nix computers.

Please tell me that which solution is "best" and so on..

- folivora


----------



## kpa (Sep 20, 2010)

I use dns/dnsmasq for that purpose on my gateway/firewall.


----------



## tty23 (Sep 20, 2010)

Depends what you define as "best".

I use maradns (also in ports) and like it for its easy configuration file format. Especially if you want to use local domains for you network.
The other one I like is unbound, which is also quite easy to set up and allows it to easily add dns entries for local use. Especially if you want to do that only for a few hosts, not for a whole domain.

The ones I do not like are djbdns and bind, both are complicated to use and set up IMHO.


----------



## aragon (Sep 20, 2010)

I also use dns/dnsmasq.  Lightweight with tons of useful features, including builtin DHCP.  Perfect for small LANs.


----------



## folivora (Sep 20, 2010)

Thanks for the answers. 

After reading and so on, i decide to use pdnsd, since i don't need dhcp-server ect.

Got question, how i can tell pdnsd to start in boot?  I've added it to rc.conf (pdnsd_enable="YES"). It seems that it starts, but it doesn't use right configuration file ?

If i start it manually (pdnsd --daemon --config-file /etc/pdnsd.conf) it works perfectly.

I do not know what i am doing wrong.

- folivora


----------



## kpa (Sep 20, 2010)

It's probably expecting the configuration file to be in /usr/local/etc since it's installed from ports/packages.


----------



## folivora (Sep 20, 2010)

Got configuration file in /usr/local/etc/ but still the same thing. When i reboot and i do ps aux |grep pdnsd, i see that it's running but nslookup won't work. When i kill it and start it manually by issuing cmd: p`dnsd --daemon --config-file /usr/local/etc/pdnsd.conf`everything starts working like a charm.


----------



## kpa (Sep 20, 2010)

Does it start working after restart if you run: `# /usr/local/etc/rc.d/pdnsd restart` as root? Is your network interface configured with DHCP or static address?


----------



## folivora (Sep 20, 2010)

Yes it works after issuing command:

`# /usr/local/etc/rc.d/pdnsd restart`

my NIC is configured via DHCP.


----------



## kpa (Sep 20, 2010)

Change your /etc/rc.conf from:


```
ifconfig_xxx="DHCP"
```

To:


```
ifconfig_xxx="SYNCDHCP"
```

This will make the boot up process wait until the DHCP negotiation has finished before starting any network services.


----------



## folivora (Sep 20, 2010)

Thank you. 

It's working now, i didn't thought that DHCP was causing the trouble.


----------

