You are not logged in.

#1 2017-11-11 17:18:16

PhilippD
Member
Registered: 2015-02-06
Posts: 40

[SOLVED] Cannot resove local hostnames with netctl static profile

I would like to resolve the hostnames in my network.
I have 3 devices on Arch Linux, one uses a systemd-networkd and ethernet, another uses NetworkManager.
It has been a while that I set those up but I don't recall any problems at all with avahi.
My newest device uses netctl profile for a static IP, and it works except for the local hostname resolution.
I followed the wiki page on avahi, but to no avail. I cannot resolve the other machines' names and they cannot resolve this one.
https://wiki.archlinux.org/index.php/Av … resolution

I assume it has something to do with the DNS entry in my netctl profile. However I could not find the necessary information in the wiki or the web.
Any help is appreciated.

My netctl profile. I tried some thisg for the DNS but not successfully.

Description='A simple WPA encrypted wireless connection using a static IP'
Interface=wlp0s20u2
Connection=wireless
Security=wpa
ESSID='xxx'
Key='yyy'
IP=static
Address='192.168.0.98/24'
Gateway='192.168.0.1'
DNS='192.168.0.1'
#DNS=('8.8.8.8' '8.8.4.4')
#DNSDOMAIN=('192.168.0.*')
#DNSSEARCH=('localhost')

My /etc/nsswitch.conf:

# Begin /etc/nsswitch.conf

passwd: compat mymachines systemd
group: compat mymachines systemd
shadow: compat

publickey: files

hosts: files mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname
#hosts: files mdns [NOTFOUND=return] dns myhostname
networks: files

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

netgroup: files

# End /etc/nsswitch.conf

My /etc/resolv.conf:

nameserver 192.168.0.1

I assume something is missing here since there are additional cryptic lines on my other two machines.

My /etc/hostname:

pddesktop

My /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.1.1       pddesktop.localdomain   pddesktop

# End of file

output from systemctl status avahi-daemon.service -n 50:

Nov 11 17:49:53 pddesktop systemd[1]: Starting Avahi mDNS/DNS-SD Stack...
Nov 11 17:49:53 pddesktop avahi-daemon[321]: Found user 'avahi' (UID 84) and group 'avahi' (GID 84).
Nov 11 17:49:53 pddesktop avahi-daemon[321]: Successfully dropped root privileges.
Nov 11 17:49:53 pddesktop avahi-daemon[321]: avahi-daemon 0.7 starting up.
Nov 11 17:49:53 pddesktop avahi-daemon[321]: Successfully called chroot().
Nov 11 17:49:53 pddesktop avahi-daemon[321]: Successfully dropped remaining capabilities.
Nov 11 17:49:53 pddesktop avahi-daemon[321]: No service file found in /etc/avahi/services.
Nov 11 17:49:53 pddesktop systemd[1]: Started Avahi mDNS/DNS-SD Stack.
Nov 11 17:49:53 pddesktop avahi-daemon[321]: Network interface enumeration completed.
Nov 11 17:49:53 pddesktop avahi-daemon[321]: Server startup complete. Host name is pddesktop.local. Local service cookie is 3643817906.
Nov 11 17:50:00 pddesktop avahi-daemon[321]: Joining mDNS multicast group on interface wlp0s20u2.IPv4 with address 192.168.0.98.
Nov 11 17:50:00 pddesktop avahi-daemon[321]: New relevant interface wlp0s20u2.IPv4 for mDNS.
Nov 11 17:50:00 pddesktop avahi-daemon[321]: Registering new address record for 192.168.0.98 on wlp0s20u2.IPv4.
Nov 11 17:50:00 pddesktop avahi-daemon[321]: Joining mDNS multicast group on interface wlp0s20u2.IPv6 with address fe80::1ad6:c7ff:fe11:bba7.
Nov 11 17:50:00 pddesktop avahi-daemon[321]: New relevant interface wlp0s20u2.IPv6 for mDNS.
Nov 11 17:50:00 pddesktop avahi-daemon[321]: Registering new address record for fe80::1ad6:c7ff:fe11:bba7 on wlp0s20u2.*.
Nov 11 17:50:02 pddesktop avahi-daemon[321]: Leaving mDNS multicast group on interface wlp0s20u2.IPv6 with address fe80::1ad6:c7ff:fe11:bba7.
Nov 11 17:50:02 pddesktop avahi-daemon[321]: Joining mDNS multicast group on interface wlp0s20u2.IPv6 with address 2a02:aa13:247f:d300:1ad6:c7ff:fe11:bba7.
Nov 11 17:50:02 pddesktop avahi-daemon[321]: Registering new address record for 2a02:aa13:247f:d300:1ad6:c7ff:fe11:bba7 on wlp0s20u2.*.
Nov 11 17:50:02 pddesktop avahi-daemon[321]: Withdrawing address record for fe80::1ad6:c7ff:fe11:bba7 on wlp0s20u2.

Last edited by PhilippD (2017-11-12 12:09:51)

Offline

#2 2017-11-11 17:42:45

lo1
Member
Registered: 2017-09-25
Posts: 584

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

From your /etc/hosts:

127.0.0.1       localhost.localdomain   localhost
127.0.1.1       pddesktop.localdomain   pddesktop

is it normal to have two different loopback addresses in your case?

Offline

#3 2017-11-11 17:45:14

PhilippD
Member
Registered: 2015-02-06
Posts: 40

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

From the Arch Wiki Installation guide:

/etc/hosts

127.0.0.1	localhost.localdomain	localhost
::1		localhost.localdomain	localhost
127.0.1.1	myhostname.localdomain	myhostname

So I believe this is correct.

Offline

#4 2017-11-11 18:11:53

lo1
Member
Registered: 2017-09-25
Posts: 584

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

Ok, that was trivial of me.
Assuming this

Nov 11 17:49:53 pddesktop avahi-daemon[321]: No service file found in /etc/avahi/services.

is out of your free will,
I'm not seeing any ULA ipv6 address. I know, I'm circling around the problem but these are the only thing i can assume according to what you posted (and i don't know what else output may be relevant anyway). What you configured seems legit so far.

Last edited by lo1 (2017-11-11 18:12:50)

Offline

#5 2017-11-11 18:16:31

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

Is 192.168.0.1 (your router I am assuming) your DNS for the LAN?  Are you using pi-hole on your LAN?  Post the output of:

# nmap -sn 192.168.0.0/24 -oG -

Offline

#6 2017-11-11 18:19:15

progandy
Member
Registered: 2012-05-17
Posts: 5,322

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

I don't use avahi here, but did you try to resolve with avahi-resolve? That should cut out a lot of the stack and make troubleshooting easier.

Edit: Did you set up iptables / a firewall? Then there may be ports you have to open for avahi.

Last edited by progandy (2017-11-11 18:23:34)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#7 2017-11-11 19:44:20

PhilippD
Member
Registered: 2015-02-06
Posts: 40

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

Thanks for your replies.

graysky wrote:

Is 192.168.0.1 (your router I am assuming) your DNS for the LAN?  Are you using pi-hole on your LAN?  Post the output of:

# nmap -sn 192.168.0.0/24 -oG -

Yes 192.168.0.1 is my router, but I am not sure if it is the DNS. I didn't configure the router aside from the name and password of the wifi. It has not been necessary for the other devices, either, and I have used those in another network before and they resolved each others host names.
I'm not using pi-hole.

[root@pddesktop philipp]# nmap -sn 192.168.0.0/24 -oG -
# Nmap 7.60 scan initiated Sat Nov 11 20:28:40 2017 as: nmap -sn -oG - 192.168.0.0/24
Host: 192.168.0.1 (compalhub.home)	Status: Up
Host: 192.168.0.99 ()	Status: Up
Host: 192.168.0.98 ()	Status: Up
# Nmap done at Sat Nov 11 20:28:42 2017 -- 256 IP addresses (3 hosts up) scanned in 1.94 seconds

192.168.0.99 is the static ip of my Raspberry Pi.

progandy wrote:

I don't use avahi here, but did you try to resolve with avahi-resolve? That should cut out a lot of the stack and make troubleshooting easier.

Edit: Did you set up iptables / a firewall? Then there may be ports you have to open for avahi.

avahi-resolve works as expected for my two other devices, but not for this one.

In the meantime I found this in the wiki:
https://wiki.archlinux.org/index.php/Resolv.conf

If you are using netctl and static IP address assignment, do not use the DNS* options in your profile, otherwise resolvconf is called and /etc/resolv.conf overwritten.

So I removed the DNS line in my netctl profile and restarted it, but it didn't help. My resolv.conf still has this one line only.
Now I am pretty sure that this file is not correct, it should have more entries.
For the reference, on my Raspberry pi it looks like this:

# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known DNS servers.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 2001:730:3e82::10
nameserver 2001:730:3e82::11

Starting the systemd-resolved service did not help.

Offline

#8 2017-11-11 19:51:31

lo1
Member
Registered: 2017-09-25
Posts: 584

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

That's it: you need to get your dns server ipv6 address and add it to your resolvconf, it seems ula is not necessary.
Edit: perhaps to your netctl profile, not the resolvconf...

Last edited by lo1 (2017-11-11 19:53:39)

Offline

#9 2017-11-11 20:14:13

PhilippD
Member
Registered: 2015-02-06
Posts: 40

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

Well I don't have a dedicated DNS server. If you mean the router, it was originally part of my netctl file (192.168.0.1). Are you sure the IPv6 address is important and IPv4 is not enough?

Offline

#10 2017-11-11 20:22:51

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

If you're not using IPv6, I recommend disabling it.

Offline

#11 2017-11-11 20:40:51

lo1
Member
Registered: 2017-09-25
Posts: 584

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

graysky wrote:

If you're not using IPv6, I recommend disabling it.

His gateway provided a unicast global address (2a02:...) and the interface is using a link local ipv6 (fe80::...) so the gateway is working on both ipv6 and ipv4. The raspberry itself has a DNS server (its gateway unless we're talking badass network) known for his ipv6 address, so this seems relevant to me.

@PhilippD, I'm talking out of basic knowledge, so you'll need to try a little bit since I never used avahi myself.
Take a look at the others nodes in your network, if they point to a DNS server (which is your gateway)  which has an ipv6 address, then most likely you'll need to do as I suggested above.

Offline

#12 2017-11-12 12:09:29

PhilippD
Member
Registered: 2015-02-06
Posts: 40

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

Thanks for your help.
I stopped using netctl and use NetworkManager and dhcpcd now.
My resolve.conf now looks better, and at least my other machines can resolve my new machine now, but not vice-versa neutral.

But it is fine for me now. In the meantime I found out that I can assign static IPs through my router, which means I don't really need hostname resolution as long as I am able to remember the 3 ip addresses.
I will mark this topic as solved.

Offline

#13 2019-07-06 15:45:50

a0_r
Member
Registered: 2019-07-06
Posts: 1

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

Sorry for bumping up this post, but I faced the same problem and easily solved it though installing
ifplugd

Offline

#14 2019-07-06 16:41:49

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,648

Re: [SOLVED] Cannot resove local hostnames with netctl static profile

a0_r wrote:

Sorry for bumping up this post, but I faced the same problem and easily solved it though installing
ifplugd

Please do not necrobump.

Closing.

Offline

Board footer

Powered by FluxBB