DNS resolving once, then answer from external DNS

Could you enter via SSH into NethServer and ping the address and see if answer by the server is always correct?

I suppose that NS is DNS of your Lan and you are in Lan with the PC. Please explain more of your network.

I’ve some problems to understand. Your Nethserver is an internal DNS, or is it a public one? If it is internal, you can’t take it’s IP as DNS in an other network, only in the same one.
And I don’t get your internal IP if I ping.

ping brf.kullgarden.se

Ping wird ausgeführt für masendata.com [85.8.12.127] mit 32 Bytes Daten:
Antwort von (MyGateway): Zielhost nicht erreichbar.
Antwort von (MyGateway): Zielhost nicht erreichbar.
Antwort von (MyGateway): Zielhost nicht erreichbar.
Antwort von (MyGateway): Zielhost nicht erreichbar.

Ping-Statistik für 85.8.12.127:
    Pakete: Gesendet = 4, Empfangen = 4, Verloren = 0
    (0% Verlust),

Here are my network explained (some faked name to make it more easy to understand):

.Internet
. . . 85.8.12.127 WAN
. . . . . Firewall (act as DHCP server and sends out Nethserver AD01 as DNS)
. . . . … . . . .LAN
. . . . … . . . … . . . .Webserver1, My web server with the site brf.kullgarden.se
. . . . … . . . … . . . .AD01, My Nethserver with DNS
. . . . … . . . … . . . … . . . .DNS with brf.kullgarden.se pointing to the internal address, Webserver1
. . . . … . . . … . . . .PC01, My PC with Ubuntu

When I, from PC01, ping brf.kullgarden.se I get one answer with the correct internal address and next time I ping, and all after that, I get the external address to brf.kullgarden.se. If I flush DNS on PC01 the first ping are correct and after that I get the external address again.

Could you try to ping it direclty from NethServer CLI and see if behavior it’s the same?

ping from Nethserver to brf.kullgarden.se gives med the internal address all times.

Try nslookup command from your PC and post the two complete different results.

First time after DNS flush, from PC01:
$ nslookup brf.kullgarden.se
Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
Name: brf.kullgarden.se
Address: 192.xxx.xxx.xxx (the correct internal address)
brf.kullgarden.se canonical name = www.masendata.com.
www.masendata.com canonical name = masendata.com.

Second time, from PC01:
Server: 127.0.0.53
Address: 127.0.0.53#53

Non-authoritative answer:
brf.kullgarden.se canonical name = www.masendata.com.
www.masendata.com canonical name = masendata.com.
Name: masendata.com
Address: 85.8.12.127

I think that the address of your DNS server it’s not this. It should be 192.xxx.xxx.xxx or I’m wrong?

I get the same result from other Ubuntu installations to, on other networks, all results in
Server: 127.0.0.53
Address: 127.0.0.53#53

Could you try from Windows CMD?

The address is from systemd DNS resolver (systemd-resolved)

2 Likes

Yes @dnutan thank you, I think the problem is instead of systemd resolver. I think that in windows there isn’t the problem.
I wait for a check by @PelleH

You are right, @dnutan and @federico.ballarini. In Windows there are no problem. The problem appears in both Ubuntu 18.04 server and client.
Do you have any idea on how to disable this annoying problem?

Could you post your configuration into /etc/resolv.conf ?

/etc/resolv.conf

#Generated by NetworkManager
search lan
nameserver 192.xxx.xxx.61
nameserver 192.xxx.xxx.62

I tested to disable systemd-resolved on my Ubuntu desktop and now it is working as I guessed it would work.

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved
vi /etc/NetworkManager/NetworkManager.conf <

Add
[main]
dns=default
[…]

sudo rm /etc/resolv.conf
sudo reboot

Don’t need to remove /etc/resolv.conf…

You have to launch these commands and all should works.

systemctl stop systemd-resolved
systemctl disable systemd-resolved
ifconfig /flushdns

Then check DNS configuration in NetworkManager. Can be helpful also ifconfig command.

3 Likes

Thanks, that works :grinning:!
I wonder why systemd-resolved are implemented in Ubuntu.
One reason I switched over from Zentyal server to Nethserver was theirs DNS not working - when it was Ubuntu’s… But many other things fits my needs better with Nethserver.

2 Likes

Probably systemd-resolved creates an uncorrect dns cache. Please mark the answer as solution: it can be helpful for other Linux users :wink:

Have a nice evening :slight_smile:

1 Like

Some extra info if you have to fix this on Ubuntu 18.04 server. Do like this (rm /etc/resolv.conf because it is a link to a file under /run and cannot be edited):

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved
rm /etc/resolv.conf
vi /etc/resolv.conf

Add following in /etc/resolv.conf (replace 192.xxx.xxx.xxx with the ip address of your DNS servers)

#Generated by NetworkManager
search lan
nameserver 192.xxx.xxx.xxx
nameserver 192.xxx.xxx.xxx

reboot

Now you have control over the DNS settings again.

1 Like

Consider using NetPlan for configure network interfaces on Ubuntu Server.
https://netplan.io/examples

2 Likes