Two NIC Cards with different DNS settings

Kernels & Hardware, configuring network, installing services

Two NIC Cards with different DNS settings

Postby faragalla » 2017-05-04 11:18

I have a machine with two NIC cards, the eth0 ( comes up first and routes normaly through my router and is assigned DNS (which is my router) using DHCP the wlan0 ( comes up about 30 seconds later and routes through an OpenVPN connection on my router and is assigned DNSs and through DHCP. When I check to see what my DNS settings are using cat /etc/resolv.conf I only get and I read up on this issue and it seems that if Linux aquires DNS servers initially then acquires different DNS servers later, the former are replaced with the latter. My issue is that I want to access a local server ip from both inside and outside the network without having to change from a local to a public IP addresses on my client machine. What I did is I changed the cname for a sub-domain which I own "" to point back to my router's public IP address and am able to access the server fine from outside using the address "". To access the server from inside the network, I assigned a static DNS in my router pointing "" to and since all my local machines, save one, use my router as their DNS server, I am able to access the server locally using the domain name "" The only machine that can not access the server locally is the machine with two NICs even though I changed its /etc/hosts file to point "" to If I were however, to change the DNS which my router assigns to the wlan0 on that machine from and to then that machine is also able to access the server locally. Is there a way to either force my machine to use DNS for all queries coming out of eth0 and DNSs and for all queries coming out of wlan0 or if not, is there anyway to accomplish what I want to do?
Posts: 1
Joined: 2017-05-04 11:14

Re: Two NIC Cards with different DNS settings

Postby dasein » 2017-05-04 12:41


Do everyone a favor and put some whitespace in that post, please?

The [ENTER] key is your friend.
User avatar
Posts: 7775
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Two NIC Cards with different DNS settings

Postby marcetm » 2017-05-04 16:45

Hi faragalla,

Same issue with same solution here (internal DNS server for the PC's of the LAN)... The problem is in your router, at least it was in my case,that has not support for "NAT loopback" that manage this situation. You can call your ISP and ask them if your router can be activated for this feature or if they can change it for another one that support it. In my case, Vodafone told me they can't change any router if it's working so I had to do what you have explain in such a good way.

So maybe you want to check the feature "NAT loopback" for your router.
Posts: 135
Joined: 2015-08-02 21:30

Return to System configuration

Who is online

Users browsing this forum: No registered users and 9 guests