How would you configure a DNS Name Server per NIC (eth0 vs eth1) interface on RHEL/Centos 6?
eth0 is on subnet 10.0.0.1/24
eth1 is on subnet 192.168.0.1/24
Any requests sent over eth0 should use DNS server 10.0.0.2.
Any requests sent over eth1 should use DNS server 192.168.0.2.
DNS1:10.0.0.2 > /etc/sysconfig/network-scripts/ifcfg-eth0
DNS1:126.96.36.199 > /etc/sysconfig/network-scripts/ifcfg-eth1
However these values get ignored, and it always defaults to the setting in resolv.conf "nameserver 10.0.0.2" When eth0 is down, connections are sent over eth1 ... however DNS can no longer resolve as it's trying to reach 10.0.0.2.
How do I get it to respect the DNS settings in ifcfg rather than a default for resolv.conf?
Or how do I configure a different DNS Name Server for eth0 vs eth1?
Is there a better way of handling this?
We have two VLANS, each has it's own DNS server on it's respective subnet. These handle look-ups for local DNS (example.loc, guest.app etc), as well as forwarding when needed.
These are two separate servers in two separate physical locations. If possible I'd rather not run one server across the two subnets (one handles sensitive data).
If eth0 was to go down, I need eth1 to continue to be able to make DNS requests.
I thought about adding two IPs to resolv.conf, and then letting it fallover if it can't reach the server in the first subnet, but this seems inelegant (having to wait for the first server to timeout with every DNS query when eth0 is down).