How to disable resolv.conf re-write?

jonfr

Active Member

Reaction score: 10
Messages: 235

If I run IPv6 on automatic configure the resolv.conf gets rewritten by Generated by resolvconf. I guess this also applies to IPv4 DHCP settings. How do I disable the re-write of resolv.conf?

Thanks for the help.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,283
Messages: 33,826

IPv6 SLAAC doesn't change the DNS settings as it doesn't receive any. For IPv4 you can add a bit of code to /etc/dhclient-enter-hooks to prevent /etc/resolv.conf from being overwritten:
Code:
add_new_resolv_conf() {
        return 0
}
 
OP
J

jonfr

Active Member

Reaction score: 10
Messages: 235

That is what happened. I got an IPv6 DNS server in resolv.conf, this creating all types of problems in the process. I did add this commands to rc.conf since I was testing my new router IPv6 abilities.

Code:
ifconfig_bge0_ipv6="inet6 accept_rtadv"
rtsold_enable="YES"
This is accordance with the FreeBSD guide.

Thanks for the help.
 

kpa

Beastie's Twin

Reaction score: 1,826
Messages: 6,318

SirDice said:
IPv6 SLAAC doesn't change the DNS settings as it doesn't receive any.
I'm not sure if you're correct here. It is possible to specify DNS forwarders in rtadvd.conf(5) and at least my laptop that is OS X 10.10 (Yosemite BETA) seems to be picking them up.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,283
Messages: 33,826

kpa said:
I'm not sure if you're correct here. It is possible to specify DNS forwarders in rtadvd.conf(5) and at least my laptop that is OS X 10.10 (Yosemite BETA) seems to be picking them up.
I've tried this on numerous occasions but neither my FreeBSD machines nor my Windows machines picked them up.
 
OP
J

jonfr

Active Member

Reaction score: 10
Messages: 235

I just have to hope that the rules that I added are good enough to prevent IPv6 address assignment overwriting my resolv.conf file.
 
OP
J

jonfr

Active Member

Reaction score: 10
Messages: 235

It is important that this re-write of my resolv.conf does not happen. Since I am going to be moving from tunnel IPv6 to native IPv6 soon (I hope). Since Denmark has some support of it according to this website here.

Thanks for the help.
 
OP
J

jonfr

Active Member

Reaction score: 10
Messages: 235

That did not work. I got today an Linksys router that is able to connect to tunnelbroker website tunnel without issues. When that happens the resolv.conf is re-written with just this DNS servers.

Code:
# Generated by resolvconf
search bbsyd.net
nameserver 2001:470:dd6c:0:b675:eff:fef9:fe9b
There is no change in IPv4 functions that I can tell. I do want to keep my IPv4 DNS servers in place since I have to use them too. How do I stop this from happening when it comes to IPv6?

Thanks for the help.
 

wblock@

Beastie Himself
Developer

Reaction score: 3,683
Messages: 13,851

You can edit dhclient.conf(5) to override or add DNS servers or other settings.

However, in the past, it was more effective for me to set /etc/resolv.conf as desired and then just set the system immutable flag on it: # chflags schg /etc/resolv.conf. Of course that means it will not change, even when the DHCP data changes, but as long as you are aware of that, it works.
 
OP
J

jonfr

Active Member

Reaction score: 10
Messages: 235

This is the dhcp server for my LAN. So it has an static IPv4 address. It also does few other things that need a static LAN IPv4 address. I rather not make the file in so way that is read-only. Since that does not solve this issue.
 

wblock@

Beastie Himself
Developer

Reaction score: 3,683
Messages: 13,851

I'm confused. Your DHCP server gets a static address from DHCP itself? Even so, that would not change this. One way to keep /etc/resolv.conf from being overwritten by dhclient(8) is to set the schg flag on it. It does not change anything except the DNS settings from that file.
 
OP
J

jonfr

Active Member

Reaction score: 10
Messages: 235

No. That is now how my network is set-up. The FreeBSD computer is the dhcp server for my IPv4 network (LAN).

The networks part of my rc.conf.

Code:
[...]

ifconfig_bge0=" inet 192.168.1.2 netmask 255.255.255.0"
defaultrouter="192.168.1.1"

[...]

ipv6_network_interfaces="bge0"
ipv6_activate_all_interfaces="YES"
ifconfig_bge0_ipv6="inet6 accept_rtadv"
rtsold_enable="YES"

[...]
I hope this explains my set-up a bit better. Now all IPv6 connections are handled by my Linksys WRT 1900AC WAN router.

Thanks for the help.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,283
Messages: 33,826

I haven't played with it myself but have a look at resolvconf(8). It could be useful.
 

ColorfulOne

Member

Reaction score: 4
Messages: 35

My /etc/resolv.conf was overwritten with IPv4 . I noticed in /etc/rc.conf that I only had lines from the installation for the wireless interface, so I simply added the line:
Code:
ifconfig_rl0="DHCP"
Have not had an issue since.
 

mickey

Aspiring Daemon

Reaction score: 189
Messages: 577

It should be possible to keep resolvconf(8) from writing to /etc/resolv.conf entirely:
Code:
     resolvconf assumes it has a job to do.  In some situations resolvconf
     needs to act as a deterrent to writing to /etc/resolv.conf.  Where this
     file cannot be made immutable or you just need to toggle this behaviour,
     resolvconf can be disabled by adding resolvconf=NO to resolvconf.conf(5).
 

Lamia

Aspiring Daemon

Reaction score: 152
Messages: 619

It should be possible to keep resolvconf(8) from writing to /etc/resolv.conf entirely:
Code:
     resolvconf assumes it has a job to do.  In some situations resolvconf
     needs to act as a deterrent to writing to /etc/resolv.conf.  Where this
     file cannot be made immutable or you just need to toggle this behaviour,
     resolvconf can be disabled by adding resolvconf=NO to resolvconf.conf(5).
Resolvconf.conf does not fill it with its contents to make matter worse. A number of people have used cron to regularly copy resolv.conf to resolvconf.conf.
 

Lamia

Aspiring Daemon

Reaction score: 152
Messages: 619

Resolvconf.conf does not fill it with its contents to make matter worse. A number of people have used cron to regularly copy resolv.conf to resolvconf.conf.
I meant copy resolvconf.conf to resolv.conf.
 

mickey

Aspiring Daemon

Reaction score: 189
Messages: 577

I meant copy resolvconf.conf to resolv.conf.
You should never do that as both files serve completely different purposes. The file /etc/resolv.conf configures how your system resolves names into addresses and vice versa, i.e. what DNS server it uses for that purpose. The file /etc/resolvconf.conf however configures how the resolvconf(8) program, that accumulates information from various sources (i.e. DHCP) and then writes that information into /etc/resolv.conf operates.

Normally you don't need an /etc/resolvconf.conf file, as resolvconf(8) should do the right thing by default, therefore the file doesn't exist by default. If however your goal is to keep resolvconf(8) from ever touching your /etc/resolv.conf file, then you need to create the file /etc/resolvconf.conf with the following content:
Code:
resolvconf=NO
 

Zvoni

Member

Reaction score: 41
Messages: 98

Or if you need special settings you add a supersede or append in /etc/dhclient.conf.
Happened to me.
FreeBSD-PC with 1 NIC (DHCP) connected to my Laptop with LAN-Wire (Address-Range 192.168.3.X), my Laptop connected to Wifi-Router on Address-Range 192.168.2.Y, on my Laptop BIND and DHCP-Server running, serving the 192.168.3.X-Subnet incl. NAT-Rules.
I had to enter the supersede/append to get my FreeBSD-PC to accept an additional DNS
 
Top