Page 1 of 1

DNS cache - Server/client connection problem

Posted: 05 Dec 2016 21:33
by ilu
I'm trying to troubleshoot a connection and support desk - thinking I'm on MSWin (they refuse to even try to deal with Linux) - tells me to:

Code: Select all

ipconfig /release
ipconfig /renew
ipconfig /flushdns
I'm behind a DSL router and don't understand why this should help because it only affects local DNS entries, right?
I'm also fairly sure the first 2 commands would stop my network from working.

Anyway, what would be the correspondent commands under Linux? Is there a way to view the DNS cache first?
Internet search turned up either commands that are not installed on SolydX (rndc, nscd) or the information that Linux doesn't cache DNS.

Re: DNS cache

Posted: 05 Dec 2016 23:31
by Zill
I would ignore any info from an ISP or MS support desk as I doubt they will be of much use with a Linux system.

Firstly, I would ask if your DSL router has actually been configured with your preferred DNS server addresses? If this is the case, then it is only necessary for connected computers to point to the router LAN address (such as 192.168.0.1) and they should all then automatically send all DNS requests to your selected servers via the router gateway. No local caching should be needed.

However, if the DNS addresses are not stored in the router, each machine will then use its local networking settings to define your DNS server addresses. This varies according to how they connect so it may be useful to see the output from the following commands:

Code: Select all

cat /etc/resolv.conf
cat /etc/network/interfaces
If you use NetworkManager then DNS addresses (or a pointer to the router gateway) will be saved in the following directory in files for the appropriate Wired and Wireless connections. Note that these files are owned by root so you will need to use "sudo -i" to view them with "cat":

Code: Select all

/etc/NetworkManager/system-connections/

Re: DNS cache

Posted: 06 Dec 2016 00:11
by ilu
The problem has nothing to do with my network config. Everything is configured correctly. The router provides DNS and DHCP services as it should. Internet works fine.
Just one application can't login to its servers. It's additionally complicated because it has to do so through wine. I know you can't help me with the troubleshooting, I just need the info about those commands - what are the Linux equivalents, if any?

The first 2 commands reset the IP, but the local IP, which would have no effect on the connection to their servers. I'm trying to figure out what they think they are achieving with those commands. Anything at all?

The 3rd one seems to be the only relevant one because they have changed the config and IP of their login server. The old one might still be cached somewhere. Is there such a thing as a DNS cache on my system? cat /etc/resolv.conf shows just the router. cat /etc/hosts also shows nothing special. /etc/NetworkManager/system-connections/ is empty.
So nothing to flush?

Re: DNS cache

Posted: 06 Dec 2016 11:27
by Zill
AIUI, on Linux systems, DNS caching is only done by DNS servers and so, unless you are running your own DNS server, there should not be any local caching.

However, as you are also using Wine, the DNS resolution may be getting confused by some Windows-related garbage. I'm sorry, but I have no info about the Windows ipconfig command. :-(

I suggest you could take a look at "How To: Flush Your Local DNS Cache" as this details both Windows and Linux systems. It also shows the following commands:

Code: Select all

nscd -i hosts
nscd -I hosts
sudo service dns-clean restart
However, on my SolydX system, nscd is not installed.

How do you actually manage your network connection(s)? If you are using NetworkManager then you should see some output from the following command:

Code: Select all

ls -l /etc/NetworkManager/system-connections
Or are you using /etc/network/interfaces instead of NetworkManager?
Or some other GUI or CLI network management tool?

What particular application and website is showing this problem? Can you ping the server directly by IP address?

Re: DNS cache

Posted: 06 Dec 2016 12:46
by kurotsugi
AFAIK wine is using linux stack so he's using whatever linux provide. though, there might problem with wine itself. do you have other app to test?

Re: DNS cache

Posted: 06 Dec 2016 13:02
by ilu
My network installation is standard SolydX from 2013 and it seems to be using /etc/network/interfaces.

Code: Select all

sudo ls -l /etc/NetworkManager/system-connections
total 0
cat /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
I have read the liquidweb page (I try to "startpage" before asking here :-) ) and checked that nscd is not installed. "sudo service dns-clean restart" looked strange to me - Shouldn't it use systemctl? Anyway: this
Zill wrote:AIUI, on Linux systems, DNS caching is only done by DNS servers and so, unless you are running your own DNS server, there should not be any local caching.
is the confirmation I was looking for. Thank you.
Zill wrote:However, as you are also using Wine, the DNS resolution may be getting confused by some Windows-related garbage.
The server is actually answering but with various error codes. As I said, support tells me to flush an obviously non existent Windows DNS cache. :-( Finding the right dll and overrides to use is what I'm actually struggling with. There are so many possibilities to mess things up. I'm guessing the problem is with wininet.dll and winhttp.dll. Downloading those through POL fails. I might try winetricks instead but people report download problems there too. Other forum threads say I don't need any overrides at all anymore but a new install without failed too. They change server configs about every 3 month and keep technical details secret, so the wine community has to guess around ever so often. :-( It's a game of course - to what length you go for your vices ... :roll:
But I know nobody here is really much into wine so never mind.

Edit: @kurotsugi: Wine works, even the game works - just the updater doesn't. Which is annoying because I have to provide a MSWin install just for that purpose.

Re: DNS cache

Posted: 06 Dec 2016 15:17
by Zill
ilu: I am still puzzled by your network configuration. Are you using a wired (ethernet) or wireless connection?

Do you actually have the NetworkManager GUI installed and is it enabled?

Code: Select all

apt policy networkmanager
cat /etc/NetworkManager/NetworkManager.conf
We have had some debate previously on these forums about whether the "managed=false" or "managed=true" flag was respected. I use the NM for both wired and wireless but my setting is still "managed=false". :?

It might be worth experimenting with the NM configuration to see if this makes a difference to your problem. FYI, my NM Wired Connection screen is as follows:
DNS.png
DNS.png (47.85 KiB) Viewed 3337 times
You will see that this points to my router address for DNS. However, you could also substitute this address for your specific DNS IP addresses and see if this helps resolve the problem.

Alternatively, if you are not using the NM, you could add the specific DNS IP addresses to /etc/network/interfaces as described in "Defining the (DNS) Nameservers".

Re: DNS cache

Posted: 06 Dec 2016 17:21
by ilu
I have the NM installed (and I use it on my laptop) but I never even looked at it on my desktop. Ethernet just works and always did, so I never cared. But actually, clicking on the tray icon I see "Network enabled" checked but choosing "connection information" says: No connection found. This has probably nothing to do with the actual problem but is still weird. Maybe SolydX changed the way to connect since 2013?

As I said, everything works, the update server even answers my request, just doesn't let me login. This can't be a DNS problem. I should try to monitor the exchange between my client and the server to see what goes wrong in the communikation ... maybe a use case for wireshark? I've no idea how to use it but it might turn out educative. What do you think, is wireshark the right app to use?

Re: DNS cache - Server/client connection problem

Posted: 06 Dec 2016 20:30
by Zill
ilu: You could get some funnies with DNS etc if there is some misconfiguration with network management. The NM can override existing CLI and router settings and so, if the NM is only partially configured, it could be that blank settings may cause network confusion.

I suggest it could be beneficial to take a look and edit the NM settings slightly so that you see a file listed in /etc/NetworkManager/system-connections.

Then you can reset the DNS field to either your router IP address or your preferred DNS server addresses. This way, the NM should be configured correctly and remove any potential DNS conflicts.

Also, I recommend that the following two options are enabled (checked) in the "General" tab of the NM connection editing screen:
  • "Automatically connect to this network when it is available"
    "All users may connect to this network"
This ensures that the NM operates at system level (saving its settings in /etc/) rather than at user level (saving its settings in the user's home)

Note that, at system level, a reboot should set networking parameters correctly, whereas at user level, logout/login should be adequate.

p.s. I have never had a need to use wireshark (and wouldn't understand the output!) so I cannot comment on this.

Re: DNS cache - Server/client connection problem

Posted: 07 Dec 2016 02:55
by kurotsugi
NM is installed by default since it works better with systemd and modern systems. I think the funny stuff you mentioned was because NM now handle all DNS setting (the setting is renewed every time you connect to internet). that's why sometimes people confused with the DNS setting. if you want to set your own DNS you can edit /etc/dhcp/dhclient.conf and put your dns in this line

Code: Select all

prepend domain-name-servers 8.8.8.8, 8.8.4.4;

Re: DNS cache - Server/client connection problem

Posted: 07 Dec 2016 09:39
by ilu
The NM config mjght be screwed, but everything works, so I don't need to change my DNS. This is handled by the router anyway! I need to debug a connection to a server who expects Windows and answers with undocumented error codes which I need to somehow figur out.
I just tried to understand why those support guys got the idea that this could have anything to do with DNS ...

Re: DNS cache - Server/client connection problem

Posted: 07 Dec 2016 09:58
by kurotsugi
well...recently I got a case when a friend asked their help, instead of helping him, they gave him a link to a japanese site.

I think it's their "polite" way to say "sorry mate, I have no idea how to help you" :lol: