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: 7,371
Messages: 29,907

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
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,803
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: 7,371
Messages: 29,907

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
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
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
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@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,638
Messages: 13,850

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
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@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,638
Messages: 13,850

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
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: 7,371
Messages: 29,907

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