Skip to content

Keep both IPv4 and IPv6 DNS server (provided by dhcp server) addresses in /etc/resolv.conf #251

@evergtreen

Description

@evergtreen

In one scenario, users adopt both IPv4 and IPv6, and devices get addresses from IPv4 and IPv6 dhcp servers, respectively.
In addition, each dhcp servcer provides its own DNS option. For example, the DNS server provied by IPv4 dhcp server is 2.2.2.2, while the DNS server obtained from IPv6 dhcp server is FCD0::2. However, the /etc/resolv.conf file only keeps one DNS server address from IPv4 or IPv6 dhcp server, which will result in the failure to resolve another protocol domain name.

In /etc/sysconfig/network-scripts/network-functions file, the /etc/resolv.conf will be rewritten by change_resolv_conf func rather than appending new dns server to the file as follows,

533 # Invoke this when /etc/resolv.conf has changed:
534 change_resolv_conf ()
535 {
		...
538     oldumask=$(umask)
539     umask 022
		...
566        fi;
567     fi;
568     (echo "$s" > /etc/resolv.conf;) >/dev/null 2>&1;
569     r=$?
		...
576     umask $oldumask
577     return $r;
578 }

Is there a good way to keep both DNS server addresses from IPv4 and IPv6 dhcp servers at the same time? Finally, users can obtain the available /etc/resolv.conf as follows,
#cat /etc/resolv.conf
nameserver 2.2.2.2
nameserver fcd0::2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions