/etc/resolv.conf getting over written with dhcp
Dima Panov
fluffy at fluffy.khv.ru
Fri Jun 15 13:42:19 UTC 2012
15.06.2012 23:09, Varuna написал:
> Hello Folks,
>
> Noticed a strange issue with the creation / update of
> /etc/resolv.conf. The details of the system that I noticed the issue
> on is:
> Version : FreeBSD 8.0
> Patch level: not patched
> Uname: FreeBSD shastry.eudaemonicsystems.net 8.0-RELEASE FreeBSD
> 8.0-RELEASE #0: Thu Sep 29 22:37:51 IST 2011
> root at shastry.bhuta.in:/usr/obj/usr/src/sys/SHASTRY i386
>
>
> I generally have a static IP 192.168.98.6 (via rc.conf) for my
> Beastie. The contents of my /etc/resolv.conf is as follows:
> domain eudaemonicsystems.net
> nameserver 208.67.222.222
> nameserver 208.67.220.220
> nameserver 4.2.2.2
> No matter how many times I reboot the system, the resolv.conf does not
> get overwritten when configured with a static IP.
>
> I modified the /etc/rc.conf to have the flag:
> ifconfig_re0="DHCP"
> The next reboot of the system caused the /etc/resolv.conf to be
> overwritten with the following contents:
> nameserver 192.168.98.4
>
> I was baffled with this behaviour and checked /etc/rc.d/resolv script
> and there was no reason as to why "[ ! -e /etc/resolv.conf]" should
> fail at any given instance. Out of curiosity executed "/bin/kenv
> dhcp.domain-name" which returned with the info: kenv: unable to get
> dhcp.domain-name. Would it be fair to assume that /etc/rc.d/resolv
> not to cause the issue?
>
> What is causing this behaviour? Have I missed something?
>
> Had a look at network-dhcp.html, and found /etc/dhclient.conf to be
> empty on my system.
>
> Digging further, was looking at the scripts under /etc/rc.d, found
> /etc/rc.d/named to be another script creating the /etc/resolv.conf and
> this was in the routine named_precmd(). I have not enabled
> 'named_enable' flag in /etc/rc.conf, while it is commented; by
> default; in /etc/defaults/rc.conf file.
>
From my /etc/dhclient.conf:
interface "lagg0" {
send dhcp-lease-time 3600;
prepend domain-name-servers 127.0.0.1, 4.4.4.4, 8.8.8.8;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers;
require subnet-mask, domain-name-servers;
}
And result is /etc/resolv.conf:
# Generated by resolvconf
nameserver 127.0.0.1
nameserver 4.4.4.4
nameserver 8.8.8.8
nameserver 192.168.1.1
--
Dima Panov (fluffy at FreeBSD.org)
(KDE, Office)@FreeBSD team
Facebook: http://www.facebook.com/fluffy.khv
IRC: fluffy at EFNet, fluffykhv at FreeNode
twitter: fluffy_khv | skype: dima.panov
More information about the freebsd-hackers
mailing list