You are not logged in.

#1 2019-05-05 13:14:22

dmidge
Member
Registered: 2015-04-04
Posts: 68

Can't seem to refresh my DNS cache

Hi,

I am trying to SSH to another computer on my network, which I just rebooted, but I can't connect, even though it was working just before.
So, the first thing I think is that I have a problem of DNS caching. And indeed, if I connect using the new IP address, 192.168.1.5, it works. But if I ping the hostname, it redirects to 192.168.1.8.
I try everything on this webpage: https://www.cyberciti.biz/faq/rhel-debi … dns-cache/. But the only related service that I have is nscd, and restarting it doesn't help.

The weirdest part is, if I search the local IPs:

nmap -sL 192.168.1.0/24

I get an answer for both 192.168.1.5 and 192.168.1.8, associated to the hostname.
However, I only have one computer with this hostname. And this computer has only a wired connection (no wifi enabled now).

So, what do I miss?
Thanks!

Last edited by dmidge (2019-05-05 13:15:23)

Offline

#2 2019-05-05 14:04:09

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: Can't seem to refresh my DNS cache

Hi there, first thing that springs to mind is the hosts file, check /etc/hosts for the old entry and change it.

Offline

#3 2019-05-05 14:50:15

Maniaxx
Member
Registered: 2014-05-14
Posts: 738

Re: Can't seem to refresh my DNS cache

If you're using 'NetworkManager' restart the service. Also check the arp cache.

Last edited by Maniaxx (2019-05-05 14:51:35)


sys2064

Offline

#4 2019-05-28 20:57:06

dmidge
Member
Registered: 2015-04-04
Posts: 68

Re: Can't seem to refresh my DNS cache

Hi,

Sorry for the delay.
For the host file, it looks like that:

% cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost
::1             localhost.localdomain   localhost
127.0.0.1       bob-aspire-e15.localdomain      bob-aspire-e15

# End of file

This one seems good.

Sadly, rebooting the network manager didn't work so far. Or am I rebooting the right service? I rebooted netctl.

Thanks!
Cheers.

Offline

#5 2019-05-28 21:29:40

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: Can't seem to refresh my DNS cache

Well, no, it doesn't seem good. Didn't you notice the double loopback entry?
You should probably be using '192.168.1.5' - your new IP for your hostname entry, like:

192.168.1.5       bob-aspire-e15.localdomain      bob-aspire-e15

Offline

#6 2019-05-30 00:44:50

dmidge
Member
Registered: 2015-04-04
Posts: 68

Re: Can't seem to refresh my DNS cache

Hm, so I gather that having 2 references to localhost is not good then.
But bob-aspire-e15 correspond to the my local computer. So, if this line should not be present, it should not be 192.168.1.5, which is the target where I want to ssh.
My local IP address, associated to bob-aspire-e15, is 192.168.1.10.

Offline

#7 2019-05-30 07:15:19

seth
Member
Registered: 2012-09-03
Posts: 51,056

Re: Can't seem to refresh my DNS cache

Let's please first clarify how you're actually resolving local domains.

systemctl --user list-unit-files --state=enabled
cat /etc/nsswitch.conf
cat /etc/resolv.conf

nscd is ldap is configured statically on the ldap sever, see https://wiki.archlinux.org/index.php/LDAP_Hosts
So *iffffff* you're running an ldap server and that resolves local domains you'll have to update its list before everything else.

Offline

#8 2019-06-02 20:20:08

dmidge
Member
Registered: 2015-04-04
Posts: 68

Re: Can't seem to refresh my DNS cache

Hi Seth,

Thank you for your time also!
I don't think I have a ldap server. However, I did have a DHCP update script (to update an outside-of-my-LAN DNS) on one of my computer on the network. I don't think it is functioning now (sadly, I lack of time for that).

% systemctl --user list-unit-files --state=enabled                                                                                      :(
UNIT FILE                    STATE  
xdg-user-dirs-update.service enabled
dirmngr.socket               enabled
gpg-agent-browser.socket     enabled
gpg-agent-extra.socket       enabled
gpg-agent-ssh.socket         enabled
gpg-agent.socket             enabled
p11-kit-server.socket        enabled
pipewire.socket              enabled
pulseaudio.socket            enabled

9 unit files listed.
% cat /etc/nsswitch.conf
# Name Service Switch configuration file.
# See nsswitch.conf(5) for details.

passwd: files mymachines systemd
group: files mymachines systemd
shadow: files

publickey: files

hosts: files mymachines myhostname resolve [!UNAVAIL=return] dns
networks: files

protocols: files
services: files
ethers: files
rpc: files

netgroup: files
% cat /etc/resolv.conf
# Generated by NetworkManager
search Home 
nameserver 192.168.1.1

Last edited by dmidge (2019-06-02 21:39:53)

Offline

#9 2019-06-03 06:39:17

seth
Member
Registered: 2012-09-03
Posts: 51,056

Re: Can't seem to refresh my DNS cache

Your resolve.conf seems written by NetworkManager and seems to be your router (192.168.1.1) which would usually get hostnames via the dhcp request (if it provides sth. like dnsmasq and is not just forwarding eg. your ISPs DNS)
There's also no mdns or wins involved.
More interestingly, NM isn't even enabled, so what configures your network itfp?

Also check whether the router keeps a list of the local hostnames, try eg.

dig @192.168.1.1 <hostname>

Also ensure your hostnames are not just resolved through /etc/hosts (on every used machine)

Offline

Board footer

Powered by FluxBB