Jan 052010

It may come as a surprise to quite a few guys that know me, but I use FreeNAS as my main file server. I used version 0.6 for quite a while but I switched to 0.7 few weeks ago.

At one point in time I noticed that one of my scripts is not working anymore. That script checked my external IP address and displayed it on character LCD. I could not say when exactly it stopped working since I didn’t checked it for a while.

Little bit of digging discovered that I had problems with host name resolving:

host example.dyndns.org connect: Address family not supported by protocol family connect: Address family not supported by protocol family
example.dyndns.org A record not found, try again

Then I remembered. Few days after upgrading server to new FreeNAS edition, I also changed configuration from DHCP to static IP. That meant that DNS servers were not set anymore. All I needed to do is to manually set DNS addresses and script would be working once more.

Only problem – no manual setting of DNS is available. Since I know a thing-or-two about command line interface, I went to add missing entries to /etc/resolv.conf from there. Unfortunately, that file gets overwritten after every reboot.

Since I didn’t want to depend on power grid to keep my server alive, I devised a cunning plan. If you go into System -> Advanced menu, there is option to set commands to be executed after every reboot. I just added new postinit command:

echo "nameserver" >> /etc/resolv.conf

That line just appended DNS server definition to file. Once that line is there, all DNS resolving works once more.

Problem solved.

P.S. After all this effort, I found place where DNS can be setup in more user friendly manner. To my surprise it is under System -> General menu.

  One Response to “DNS problems with FreeNAS”

Comments (1)
  1. it’s a good thinking but it only write a new line on the file.
    if you want to use your config it’s easier to create a file with the config and copy it to /etc/resolv.conf on the PostInit

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>