tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: dhcpcd for IPv6 + old static IPv4 setup not working well together



On 02/02/2020 13:15, Andy Ruhl wrote:
Sorry if I'm missing something obvious. Searching on this stuff isn't so easy.

Well, the man pages for both dhcpcd and resovlconf should be sufficient.

I have a long running NetBSD/i386 machine that was set with a static
IPv4 address and ip6mode=host in /etc/rc.conf. I upgraded it to the
most recent release-8 from nyftp.netbsd.org a few days ago.

Recently I decided to allow it to be autoconfigured for IPv6 via
router advertisement. So I set ip6mode=autohost, dhcpcd=YES. This
configures IPv6 but it also adds an APIPA IPv4 address and broke the
default gateway (none defined in netstat -r even though /etc/mygate
exists). So I added dhcpcd_flags="-6" to /etc/rc.conf. This removed
the APIPA address and the default route exists again. By the way, I'm
rebooting each time I make a change to /etc/rc.conf.

dhcpcd is not aware of OS specific static configuration.
Limiting dhcpcd to IPv6 is perfectly correct in this regard.

My current problem is /etc/resolv.conf only contains IPv6 DNS servers
advertised from my router, even though a previous /etc/resolv.conf
exists with a valid IPv4 DNS server. Actually, I don't know if this is
a problem, DNS is working with the IPv6 server. But I wonder if this
is correct behavior?

It seems like I'm doing this wrong and there is a better way for IPv6
autoconfig and IPv4 static setup to coexist. Am I?

What we're now dealing with is how /etc/resolv.conf is owned.
Ideally we shouldn't have to touch anything in /etc, but resolv.conf is expected to be touched by anything which wants to add it's DNS servers for you.

This is why we have resolvconf - instead of every daemon under the sun writing to resolv.conf they instead write to resolv.conf which in turn examines it's configuration - resolvconf.conf and each resolv.conf file handed to it and then writing the net result of that.

man 5 resolvconf.conf

should tell you all you need.

TL;DR

# in /etc/resolvconf.conf
# Disable resolvconf - you maintain /etc/resolv.conf
resolvconf=NO

# inject static ipv4
search_domains="foo.com bar.org"
name_servers="192.168.0.1 10.0.0.5"

Good luck!

Roy


Home | Main Index | Thread Index | Old Index