Author Topic: (SOLVED) DNS resolution problem for intra net  (Read 743 times)

Offline mrslother

  • Sr. Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
(SOLVED) DNS resolution problem for intra net
« on: February 03, 2017, 01:33:54 am »
Code I write is unable to resolve DNS queries on my intranet (home network). Adding my internal DNS server's IP to the /etc/resolv.conf file solves the problem. But that file is regenerated at each boot.

I was assuming that the DNS server setting in the network configuration would have been used to populate the resolve.conf file, but alas I was mistaken.

How can I fix this?
« Last Edit: February 20, 2017, 07:54:24 pm by mrslother »

Offline mrslother

  • Sr. Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
Re: DNS resolution problem for intra net
« Reply #1 on: February 20, 2017, 07:53:55 pm »
I fixed this. For anyone who wants to know how...

The /etc/resolv.conf file is a link to /tmp/resolv.conf which is auto generated at each boot. So any changes made to /etc/resolv.conf or /tmp/resolv.conf will be purged at the next boot.

To fix delete the /etc/resolv.conf file; really just deletes the link. Then create a new one with your details. The /tmp/resolv.conf will still autogenerate at boot time but your modified /etc/resolv.conf file will persist. Nice!

In my case I deleted /etc/resolv.conf and replaced it with a file containing:
Code: [Select]
    search intra.foo.com
    nameserver 192.168.1.1 

In this case assume that my internal DNS domain is intra.foo.com and my internal DNS server is 192.168.1.1.
If I SSH into the Vera box or have scene code that refers to a DNS name of "mail" then it will assume I meant mail.intra.foo.com and try looking it up on 192.168.1.1.

Nice. What I really would like to know is how I affect changes to the default resolv.conf setttings.


Offline mrslother

  • Sr. Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
Re: (SOLVED) DNS resolution problem for intra net
« Reply #2 on: March 05, 2017, 08:49:11 pm »
I just updated my Vera 3 to the latest firmware and as expected, I had to repeat this process. Once done DNS was resolving correctly on my intra net.

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 365
  • Karma: +4/-21
Re: (SOLVED) DNS resolution problem for intra net
« Reply #3 on: March 05, 2017, 09:00:32 pm »
The CORRECT way to update your local resolver is in the web portal under Settings -> Net & Wi-Fi

This is where you input your local DNS host by IP Address.

Alternatively, create a DHCP host reservation on your DHCP server for the Vera and it will automatically supply the IP Address (always the same), the DNS server, and the domain search strings as well.

Additionally, it's good programming practice to use FQDN's -ALWAYS- and never rely on host names to resolve addresses.

Offline mrslother

  • Sr. Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
Re: (SOLVED) DNS resolution problem for intra net
« Reply #4 on: March 20, 2017, 01:00:35 pm »
The CORRECT way to update your local resolver is in the web portal under Settings -> Net & Wi-Fi

This is where you input your local DNS host by IP Address.

Alternatively, create a DHCP host reservation on your DHCP server for the Vera and it will automatically supply the IP Address (always the same), the DNS server, and the domain search strings as well.

Additionally, it's good programming practice to use FQDN's -ALWAYS- and never rely on host names to resolve addresses.

Agreed, but unfortunately modifying the Net & Wi-Fi settings did not yield the result I was expecting. Most specifically I expected DHCP settings to resolve this as it does with all DHCP devices on my network. Failure for this more proper configuration steps is what led me to the solution I am using.

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 365
  • Karma: +4/-21
Re: (SOLVED) DNS resolution problem for intra net
« Reply #5 on: March 20, 2017, 01:19:24 pm »
The CORRECT way to update your local resolver is in the web portal under Settings -> Net & Wi-Fi

This is where you input your local DNS host by IP Address.

Alternatively, create a DHCP host reservation on your DHCP server for the Vera and it will automatically supply the IP Address (always the same), the DNS server, and the domain search strings as well.

Additionally, it's good programming practice to use FQDN's -ALWAYS- and never rely on host names to resolve addresses.

Agreed, but unfortunately modifying the Net & Wi-Fi settings did not yield the result I was expecting. Most specifically I expected DHCP settings to resolve this as it does with all DHCP devices on my network. Failure for this more proper configuration steps is what led me to the solution I am using.

The OS will always use 127.0.0.1 which proxies the connection to whatever is either defined in the section I mentioned or is handed out via DHCP.

Offline mrslother

  • Sr. Newbie
  • *
  • Posts: 29
  • Karma: +0/-0
Re: (SOLVED) DNS resolution problem for intra net
« Reply #6 on: March 20, 2017, 02:39:06 pm »
The OS will always use 127.0.0.1 which proxies the connection to whatever is either defined in the section I mentioned or is handed out via DHCP.

In my case this was not happening. That said, I did have to have the fine Vera support guys fix a problem on my Vera 3 where the autogenerated IP address was colliding with my home network's IP range. They mentioned that this was an unusual case. Maybe this has something to do with it.

Regardless, neither DHCP nor static values resulted in proper intra network DNS lookup. But now it does. Maybe this is a scenario gap.

Offline sgruby

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +3/-1
Re: (SOLVED) DNS resolution problem for intra net
« Reply #7 on: April 10, 2017, 10:50:22 am »
Did the Vera support folks fix the DNS problem or a related one? While my /etc/resolv.conf points to 127.0.0.1 that should then goto my upstream server that it gets from DHCP, that isn't happening. Vera has Google's DNS server of 8.8.8.8 hardcoded and even after changing that, nslookup doesn't resolve my LAN entries.

Offline JS007

  • Sr. Member
  • ****
  • Posts: 318
  • Karma: +1/-3
Re: (SOLVED) DNS resolution problem for intra net
« Reply #8 on: April 10, 2017, 02:57:15 pm »
I think if you only turn off the firewall (nat) on the vera, but leave the DHCP server running on the vera, you were probably getting your vera ip and dns servers from that dhcp server rather then your router, which could also cause ip conflicts if using the same range
« Last Edit: April 10, 2017, 03:03:27 pm by JS007 »

Offline sgruby

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +3/-1
Re: (SOLVED) DNS resolution problem for intra net
« Reply #9 on: April 10, 2017, 03:59:58 pm »
My vera is definitely getting its IP address from my router. The DHCP server on the Vera is turned off and I just turned off the firewall, not that it should matter.