Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Two NIC Cards with different DNS settings

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
faragalla
Posts: 1
Joined: 2017-05-04 11:14

Two NIC Cards with different DNS settings

#1 Post by faragalla »

I have a machine with two NIC cards, the eth0 (192.168.0.3) comes up first and routes normaly through my router and is assigned DNS 192.168.0.1 (which is my router) using DHCP the wlan0 (192.168.0.4) comes up about 30 seconds later and routes through an OpenVPN connection on my router and is assigned DNSs 209.222.18.218 and 209.222.18.222 through DHCP. When I check to see what my DNS settings are using cat /etc/resolv.conf I only get 209.222.18.218 and 209.222.18.222. 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 192.168.0.2 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 "1.mydomain.com" to point back to my router's public IP address and am able to access the 192.168.0.2 server fine from outside using the address "1.mydomain.com". To access the server from inside the network, I assigned a static DNS in my router pointing "1.mydomain.com" to 192.168.0.2 and since all my local machines, save one, use my router 192.168.0.1 as their DNS server, I am able to access the server locally using the domain name "1.mydomain.com" 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 "1.mydomain.com" to 192.168.0.2. If I were however, to change the DNS which my router assigns to the wlan0 on that machine from 209.222.18.218 and 209.222.18.222 to 192.168.0.1 then that machine is also able to access the server locally. Is there a way to either force my machine to use DNS 192.168.0.1 for all queries coming out of eth0 and DNSs 209.222.18.218 and 209.222.18.222 for all queries coming out of wlan0 or if not, is there anyway to accomplish what I want to do?

User avatar
dasein
Posts: 7680
Joined: 2011-03-04 01:06
Location: Terra Incantationum

Re: Two NIC Cards with different DNS settings

#2 Post by dasein »

Solidwallsoftextareveryhardtoread.

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

The [ENTER] key is your friend.

marcetm
Posts: 135
Joined: 2015-08-02 21:30

Re: Two NIC Cards with different DNS settings

#3 Post by marcetm »

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.

Post Reply