20150603 bending resolv conf to your will on freebsd - plembo/onemoretech GitHub Wiki

title: Bending resolv.conf to your will on FreeBSD link: https://onemoretech.wordpress.com/2015/06/03/bending-resolv-conf-to-your-will-on-freebsd/ author: phil2nc description: post_id: 9750 created: 2015/06/03 12:57:36 created_gmt: 2015/06/03 16:57:36 comment_status: closed post_name: bending-resolv-conf-to-your-will-on-freebsd status: publish post_type: post

Bending resolv.conf to your will on FreeBSD

Restarted my FreeBSD machine's network interfaces today and lost all my IPv4 DNS server mappings in /etc/resolv.conf, leading to the usual chaos. What happened and how I fixed it below. There are days that I look over at my trusty FreeBSD file server and swear I'm going to just install Fedora 22 Server over it, converting the data drives to XFS. But not today. Last night I was messing around with the IPv6 configuration on the home router, and was able to see my Linux workstation get a real IPv6 address. So this morning I decided to restart the interfaces on the file server to see if it was also able to get an IPv6 address. It did. But /etc/resolv.conf was overwritten by resolvconf (I know it was resolvconf because of the tell-tale "Generated by resolvconf" line at the top of the file), which wiped out the IPv4 nameserver directives I'd added when the box was stood up. After Googling around awhile I found this article on one of the blogs at PaaS provider Pivotal. Basically the answer was to create a resolvconf.conf file to force the prepending of my static name server addresses. The man page for resolvconf.conf was, as expected, quite thorough but didn't provide any examples of how multiple name servers should be listed using the name_servers directive. I guessed and used spaces instead of commas or multiple directives. Turned out I was right.

# Prepend to /etc/resolv.conf
name_servers="172.16.6.1 208.67.222.222 208.67.222.220"

Running "resolvconf -u" as root resulted in my /etc/resolv.conf being updated. I then did a "service netif restart" to recycle networking and confirm that everything would survive a reboot.

Copyright 2004-2019 Phil Lembo