Problem with /etc/resolv.conf and DNS

Don't miss a thing. Post your questions and discussion about other uncategorized NAS features here.
Post Reply
User avatar
groot
New here
Posts: 8
Joined: Sun Mar 10, 2019 12:08 pm

Problem with /etc/resolv.conf and DNS

Post by groot »

551+ running 4.5.0, `/etc/resolv.conf` auto reset to `nameserver 127.0.0.1` every time I reboot the NAS.
It cause some connection request error in Emby.
Network setting: DHCP or Static IP, same problem.
In the Virtual Switch setting, the DNS information shows right:
Image
TS-551 with Intel Celeron J3355 @ 2.00GHz
Mousetick
Experience counts
Posts: 1081
Joined: Thu Aug 24, 2017 10:28 pm

Re: Problem with /etc/resolv.conf and DNS

Post by Mousetick »

Nothing's wrong here, that's how /etc/resolv.conf is configured with the current firmware. There is a caching resolver (dnsmasq) that runs on the NAS and forwards DNS requests to the DNS server you specify in the network configuration. Therefore the local resolver is 'localhost' (127.0.0.1).
User avatar
groot
New here
Posts: 8
Joined: Sun Mar 10, 2019 12:08 pm

Re: Problem with /etc/resolv.conf and DNS

Post by groot »

Mousetick wrote: Wed Jan 13, 2021 2:01 am Nothing's wrong here, that's how /etc/resolv.conf is configured with the current firmware. There is a caching resolver (dnsmasq) that runs on the NAS and forwards DNS requests to the DNS server you specify in the network configuration. Therefore the local resolver is 'localhost' (127.0.0.1).
when resolv.conf set to 127.0.0.1, this is the Emby error:

2021-01-13 10:08:57.834 Info HttpClient: GET https://www.thetvdb.com/api/GetSeries.p ... anguage=zh
2021-01-13 10:08:57.901 Error HttpClient: Error getting response from https://www.thetvdb.com/api/GetSeries.p ... anguage=zh
*** Error Report ***
Version: 4.5.4.0
Command line: ****.qpkg/EmbyServer/system/EmbyServer.dll -programdata ****.qpkg/EmbyServer/programdata -ffdetect ****.qpkg/EmbyServer/bin/ffdetect -ffmpeg ****.qpkg/EmbyServer/bin/ffmpeg -ffprobe ****.qpkg/EmbyServer/bin/ffprobe -defaultdirectory **** -updatepackage emby-server-qnap_{version}_x86_64.qpkg
Operating system: Linux version 4.14.24-qnap (root@U16BuildServer49) (gcc version 4.9.2 (toolchain config: [gcc-4.9.2 binutils-2.25 glibc-2.21])) #1 SMP Thu Jan 7 01:40
Framework: .NET Core 3.1.8
OS/Process: x64/x64
Runtime: ****.qpkg/EmbyServer/system/System.Private.CoreLib.dll
Processor count: 2
Data path: ****.qpkg/EmbyServer/programdata
Application path: ****.qpkg/EmbyServer/system
System.Net.Http.HttpRequestException: System.Net.Http.HttpRequestException: Name or service not known
---> System.Net.Sockets.SocketException (0xFFFDFFFF): Name or service not known
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Emby.Server.Implementations.HttpClientManager.CoreHttpClientManager.SendAsyncInternal(HttpRequestOptions options, String httpMethod)
Source: System.Net.Http
TargetSite: Void MoveNext()
InnerException: System.Net.Sockets.SocketException: Name or service not known
Source: System.Private.CoreLib
TargetSite: Void Throw()
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)

change it to 1.1.1.1 or any available nameserver can solve this problem.
TS-551 with Intel Celeron J3355 @ 2.00GHz
Mousetick
Experience counts
Posts: 1081
Joined: Thu Aug 24, 2017 10:28 pm

Re: Problem with /etc/resolv.conf and DNS

Post by Mousetick »

Works fine on my NAS:

Code: Select all

# /bin/nslookup www.thetvdb.com
Server:         127.0.1.1
Address:        127.0.1.1#53

Non-authoritative answer:
Name:   www.thetvdb.com
Address: 54.230.106.111
Notice the name server above is 127.0.0.1.

Code: Select all

# /usr/bin/wget "https://www.thetvdb.com/api/GetSeries.php?seriesname=dickinson&language=zh"
--2021-01-13 03:24:29--  https://www.thetvdb.com/api/GetSeries.php?seriesname=dickinson&language=zh
Resolving www.thetvdb.com... 13.32.218.109
Connecting to www.thetvdb.com|13.32.218.109|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1978 (1.9K) [application/xml]
Saving to: 'GetSeries.php?seriesname=dickinson&language=zh'

GetSeries.php?seriesname=dic 100%[=============================================>]   1.93K  --.-KB/s    in 0s

2021-01-13 03:24:30 (20.9 MB/s) - 'GetSeries.php?seriesname=dickinson&language=zh' saved [1978/1978]
Try on your NAS. The issue is likely an incorrect network configuration on your NAS (Network & Virtual Switch), or upstream.
User avatar
groot
New here
Posts: 8
Joined: Sun Mar 10, 2019 12:08 pm

Re: Problem with /etc/resolv.conf and DNS

Post by groot »

Mousetick wrote: Wed Jan 13, 2021 10:31 am Works fine on my NAS:

Code: Select all

# /bin/nslookup www.thetvdb.com
Server:         127.0.1.1
Address:        127.0.1.1#53

Non-authoritative answer:
Name:   www.thetvdb.com
Address: 54.230.106.111
Notice the name server above is 127.0.0.1.

Code: Select all

# /usr/bin/wget "https://www.thetvdb.com/api/GetSeries.php?seriesname=dickinson&language=zh"
--2021-01-13 03:24:29--  https://www.thetvdb.com/api/GetSeries.php?seriesname=dickinson&language=zh
Resolving www.thetvdb.com... 13.32.218.109
Connecting to www.thetvdb.com|13.32.218.109|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1978 (1.9K) [application/xml]
Saving to: 'GetSeries.php?seriesname=dickinson&language=zh'

GetSeries.php?seriesname=dic 100%[=============================================>]   1.93K  --.-KB/s    in 0s

2021-01-13 03:24:30 (20.9 MB/s) - 'GetSeries.php?seriesname=dickinson&language=zh' saved [1978/1978]
Try on your NAS. The issue is likely an incorrect network configuration on your NAS (Network & Virtual Switch), or upstream.
not work for me.

nameserver 127.0.0.1:

Code: Select all

[~] # cat /etc/resolv.conf
nameserver 127.0.0.1

[~] # wget https://www.thetvdb.com/api/GetSeries.php?seriesname=dickinson&language=zh
[1] 30260
[~] # --2021-01-13 11:02:59--  https://www.thetvdb.com/api/GetSeries.php?seriesname=dickinson
Resolving www.thetvdb.com (www.thetvdb.com)... failed: Name or service not known.
wget: unable to resolve host address ‘www.thetvdb.com’

[1]+  Done(4)                 wget https://www.thetvdb.com/api/GetSeries.php?seriesname=dickinson
[~] # /bin/nslookup www.thetvdb.com
;; connection timed out; no servers could be reached

[~] # dig

; <<>> DiG 9.10.1-P2 <<>>
;; global options: +cmd
;; connection timed out; no servers could be reached

nameserver 1.1.1.1:

Code: Select all

[~] # cat /etc/resolv.conf
nameserver 1.1.1.1

[~] # dig

; <<>> DiG 9.10.1-P2 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16167
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 27
...
;; Query time: 12 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: Wed Jan 13 11:05:07 HKT 2021
;; MSG SIZE  rcvd: 811

[~] # /bin/nslookup www.thetvdb.com
Server:		1.1.1.1
Address:	1.1.1.1#53

Non-authoritative answer:
Name:	www.thetvdb.com
Address: 13.224.153.106
All other settings remain the same.
TS-551 with Intel Celeron J3355 @ 2.00GHz
Mousetick
Experience counts
Posts: 1081
Joined: Thu Aug 24, 2017 10:28 pm

Re: Problem with /etc/resolv.conf and DNS

Post by Mousetick »

Code: Select all

# /bin/netstat -ulnp | grep ':53\b'
udp        0      0 127.0.1.1:53            0.0.0.0:*                           8414/dnsmasq
# ps -l 8414
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY        TIME CMD
5 S     0  8414     1  0  80   0 -  3225 -      ?          0:15 /sbin/dnsmasq

Code: Select all

# grep resolv-file /etc/dnsmasq.conf
resolv-file=/etc/resolv.dnsmasq
# cat /etc/resolv.dnsmasq
nameserver 192.168.1.1@eth0
nameserver redacted:6cff:fe36:4026@eth0
^^^ This is the DHCP+DNS server on my LAN.

Code: Select all

# dig www.thetvdb.com

; <<>> DiG 9.16.8 <<>> www.thetvdb.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28399
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 9d4bfa6144cc41a972e212ae5ffe6d4fefe023db6e18d6f1 (good)
;; QUESTION SECTION:
;www.thetvdb.com.               IN      A

;; ANSWER SECTION:
www.thetvdb.com.        60      IN      A       54.230.106.111

;; Query time: 60 msec
;; SERVER: 127.0.1.1#53(127.0.1.1)
;; WHEN: Wed Jan 13 04:47:29 CET 2021
;; MSG SIZE  rcvd: 88

Code: Select all

# dig www.thetvdb.com @192.168.1.1

; <<>> DiG 9.16.8 <<>> www.thetvdb.com @192.168.1.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14288
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 6a3af99d6244579fb766151c5ffe6b77bc5f811c1ccc62d4 (good)
;; QUESTION SECTION:
;www.thetvdb.com.               IN      A

;; ANSWER SECTION:
www.thetvdb.com.        60      IN      A       143.204.230.95

;; Query time: 47 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Wed Jan 13 04:39:37 CET 2021
;; MSG SIZE  rcvd: 88
Mousetick
Experience counts
Posts: 1081
Joined: Thu Aug 24, 2017 10:28 pm

Re: Problem with /etc/resolv.conf and DNS

Post by Mousetick »

Actually I just noticed that the address of dnsmasq is 127.0.1.1, not 127.0.0.1.

Code: Select all

 # cat /etc/resolv.conf
nameserver 127.0.1.1
# grep listen-address /etc/dnsmasq.conf
listen-address = 127.0.1.1
But in your resolv.conf it's 127.0.0.1? What does dnsmasq.conf show?
User avatar
groot
New here
Posts: 8
Joined: Sun Mar 10, 2019 12:08 pm

Re: Problem with /etc/resolv.conf and DNS

Post by groot »

Code: Select all

[~] # /bin/netstat -ulnp | grep ':53\b'
udp        0      0 127.0.1.1:53            0.0.0.0:*                           9261/dnsmasq
udp        0      0 10.0.5.1:53             0.0.0.0:*                           9261/dnsmasq
udp        0      0 10.0.3.1:53             0.0.0.0:*                           9261/dnsmasq
[~] # ps | grep 9261
 2839 admin       988 S   grep 9261
 9261 admin      1916 S   /sbin/dnsmasq
[~] # grep resolv-file /etc/dnsmasq.conf
resolv-file=/etc/resolv.dnsmasq
[~] # cat /etc/resolv.dnsmasq
nameserver 192.168.1.5@qvs1
nameserver 1.1.1.1@qvs1
and

Code: Select all

[~] # dig www.thetvdb.com

; <<>> DiG 9.10.1-P2 <<>> www.thetvdb.com
;; global options: +cmd
;; connection timed out; no servers could be reached
[~] # dig www.thetvdb.com @192.168.1.5

; <<>> DiG 9.10.1-P2 <<>> www.thetvdb.com @192.168.1.5
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55510
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;www.thetvdb.com.		IN	A

;; ANSWER SECTION:
www.thetvdb.com.	60	IN	A	13.224.153.106

;; Query time: 102 msec
;; SERVER: 192.168.1.5#53(192.168.1.5)
;; WHEN: Wed Jan 13 12:54:55 HKT 2021
;; MSG SIZE  rcvd: 60
192.168.1.5 is my local dns server
TS-551 with Intel Celeron J3355 @ 2.00GHz
Mousetick
Experience counts
Posts: 1081
Joined: Thu Aug 24, 2017 10:28 pm

Re: Problem with /etc/resolv.conf and DNS

Post by Mousetick »

The /etc/resolv.conf file is initialized during boot by this script:

Code: Select all

# grep resolv.conf /etc/init.d/network.sh
    echo "nameserver 127.0.1.1" > /etc/resolv.conf
You see the correct address 127.0.1.1 is set.

Verify on your NAS. If it's correct, something else is changing /etc/resolv.conf. If it's incorrect, your firmware is bugged.
User avatar
groot
New here
Posts: 8
Joined: Sun Mar 10, 2019 12:08 pm

Re: Problem with /etc/resolv.conf and DNS

Post by groot »

Mousetick wrote: Wed Jan 13, 2021 7:04 pm The /etc/resolv.conf file is initialized during boot by this script:

Code: Select all

# grep resolv.conf /etc/init.d/network.sh
    echo "nameserver 127.0.1.1" > /etc/resolv.conf
You see the correct address 127.0.1.1 is set.

Verify on your NAS. If it's correct, something else is changing /etc/resolv.conf. If it's incorrect, your firmware is bugged.

Code: Select all

[~] # grep resolv.conf /etc/init.d/network.sh
    echo "nameserver 127.0.1.1" > /etc/resolv.conf
[~] #
but resolv.conf nameserver 127.0.0.1,I change it to 127.0.1.1 manually and problems gone.
TS-551 with Intel Celeron J3355 @ 2.00GHz
Mousetick
Experience counts
Posts: 1081
Joined: Thu Aug 24, 2017 10:28 pm

Re: Problem with /etc/resolv.conf and DNS

Post by Mousetick »

Yes if you fix it manually and put the correct address obviously it works.

Like I said before, resolv.conf is initialized during boot, after that it should never change and it should stay with the correct address 127.0.1.1.

In your case, the boot configuration is correct, but you find that it contains the wrong address 127.0.0.1 when you view it, so something on your NAS must be changing it. Does that make sense?

Try disabling all 3rd-party apps and packages on your NAS, anything that is not made by QNAP, and then reboot. Then look at /etc/resolv.conf: is it correct or wrong then?
desnap
Starting out
Posts: 34
Joined: Fri Oct 21, 2011 5:42 pm

Re: Problem with /etc/resolv.conf and DNS

Post by desnap »

Does anyone know how the /etc/resolv.dnsmasq file is built? Is it constructed on the fly by QTS config scripts.

My DNS seemed to be screwed (nslookup, dig failed) and resolv.dnamasq contained:

Code: Select all

nameserver 62.24.134.1@eth1
nameserver 62.24.243.2@eth1
nameserver 192.168.1.6@docker0
nameserver 8.8.8.8@docker0
nameserver 192.168.1.6@lxcbr0
nameserver 8.8.8.8@lxcbr0
By chopping it down to this, everything jumped back to life - S3 backups

Code: Select all

nameserver 62.24.134.1@eth1
nameserver 62.24.243.2@eth1
These are my ISP servers
RulerOfHeck
New here
Posts: 2
Joined: Thu May 13, 2021 4:21 am

Re: Problem with /etc/resolv.conf and DNS

Post by RulerOfHeck »

Might be the same issue that I posted about, viewtopic.php?f=50&t=161312

In short: have you tried to reconfigure your network settings? As far as I know, that would recreate your configuration files with the correct settings.

I, too, had the right information shown, but still it didn't work. After changing the settings to the same settings again, something started working again.
Post Reply

Return to “Miscellaneous”