View previous topic :: View next topic |
Author |
Message |
jankom Guru
Joined: 30 Aug 2021 Posts: 364 Location: USA
|
Posted: Thu Feb 08, 2024 3:54 am Post subject: avahi local network foo.local [SOLVED] |
|
|
This is a continuation of topic https://forums.gentoo.org/viewtopic-t-1164785-highlight-hostname.html I'm trying to access machines on my home network by foo,kocal instead of 192.168.aaa.bbb. This is because the private IP addresses can change but machine name remains. In the topic referenced it eventually worked but then stopped working.
I removed dhcp package and now only have dhcpcd. Accessing other machines sometimes work, sometimes it does not. I could think of cache, TTL or lease. Yes, I changed some configurations, removed dhcp package, reset everything to default configurations, yet it works sometime and it does not after reboots. Specifically, the two machines are: andraslinux and acerlinux: Code: | janos@andraslinux ~ $ ping -c 2 andraslinux
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.064 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.080 ms
--- localhost ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1060ms
rtt min/avg/max/mdev = 0.064/0.072/0.080/0.008 ms
janos@andraslinux ~ $ ping -c 2 andraslinux.local
PING andraslinux.local (192.168.77.11) 56(84) bytes of data.
64 bytes from andraslinux.local (192.168.77.11): icmp_seq=1 ttl=64 time=0.352 ms
64 bytes from andraslinux.local (192.168.77.11): icmp_seq=2 ttl=64 time=0.082 ms
--- andraslinux.local ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.082/0.217/0.352/0.135 ms
janos@andraslinux ~ $ ping -c 2 acerlinux
ping: acerlinux: Name or service not known
janos@andraslinux ~ $ ping -c 2 acerlinux.local
ping: acerlinux.local: Name or service not known
janos@andraslinux ~ $
|
"acerlinux" machine is a laptop with linux Mint. doing similar commands gives similar results.
But sometimes I can ping each other with foo.local
Additional info: andraslinux is a fitlet2 desktop with Gentoo, not systemd.
Last edited by jankom on Mon Feb 12, 2024 5:27 pm; edited 1 time in total |
|
Back to top |
|
|
sublogic Apprentice
Joined: 21 Mar 2022 Posts: 270 Location: Pennsylvania, USA
|
Posted: Fri Feb 09, 2024 1:03 am Post subject: |
|
|
I used to have problems with avahi spontaneously appending -1 or -2 or the like to my local names. It may have been due to flaky wireless connections (causing avahi to restart ?) and hasn't happened lately. Anyway, to check, Code: | $ ps p $(pgrep avahi)
PID TTY STAT TIME COMMAND
3722 ? S 0:32 avahi-daemon: running [dell.local]
3723 ? S 0:00 avahi-daemon: chroot helper | dell.local is what I want to see. dell-1.local is bad. In that case, Code: | # rc-service avahi-daemon restart | and the name returns to normal.
If your names are good, I'm afraid I can't help you |
|
Back to top |
|
|
jankom Guru
Joined: 30 Aug 2021 Posts: 364 Location: USA
|
Posted: Fri Feb 09, 2024 4:08 am Post subject: |
|
|
Thanks sublogic.
Good command with ps. I always learn something. In my case it looks like avai cannot see to the outside: it sees the machine itself as .local but not those on the home network. Code: | janos@andraslinux ~ $ ps p $(pgrep avahi)
PID TTY STAT TIME COMMAND
1637 ? S 0:00 avahi-daemon: running [andraslinux.local]
1638 ? S 0:00 avahi-daemon: chroot helper
janos@andraslinux ~ $ | One more info, I left out in my previous post that I do not have network manager installed on the Gentoo machine (andraslinux).
Also, yoday I tried adding a line to my /etc/conf.d/net file based on Gentoo Metwork web info: Code: | # 02/08/2024 next added to make access to machines on local network by foo.local not just by ip
config_wlan0="dhcp"
| but no luck. |
|
Back to top |
|
|
flexibeast Guru
Joined: 04 Apr 2022 Posts: 452 Location: Naarm/Melbourne, Australia
|
Posted: Fri Feb 09, 2024 4:54 am Post subject: |
|
|
Could you please post the current contents of your /etc/avahi/avahi-daemon.conf file? |
|
Back to top |
|
|
jankom Guru
Joined: 30 Aug 2021 Posts: 364 Location: USA
|
Posted: Fri Feb 09, 2024 2:27 pm Post subject: |
|
|
I think it is the default; I have not made any changes. As a side question: what is the convention for these distro provided configurations if a line starts with a comment character (#) immediately followed (without a qpace character after it) by the statement? Does that mean that those statements are actually active, not disabled by a comment+space sharacter?
Anyway, here it is, and the file is date stamped as May 15, 2023. Quote: | # This file is part of avahi.
#
# avahi is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# avahi is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with avahi; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
# See avahi-daemon.conf(5) for more information on this configuration
# file!
[server]
#host-name=foo
#domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=yes
#allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000
[wide-area]
enable-wide-area=yes
[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no
[reflector]
#enable-reflector=no
#reflect-ipv=no
#reflect-filters=_airplay._tcp.local,_raop._tcp.local
[rlimits]
#rlimit-as=
#rlimit-core=0
#rlimit-data=8388608
#rlimit-fsize=0
#rlimit-nofile=768
#rlimit-stack=8388608
#rlimit-nproc=3
| jankom |
|
Back to top |
|
|
jankom Guru
Joined: 30 Aug 2021 Posts: 364 Location: USA
|
Posted: Fri Feb 09, 2024 7:38 pm Post subject: update |
|
|
Played with /etc/nsswitch.conf file and studied https://wiki.gentoo.org/wiki/Avahi then modified the file Code: | hosts: files dns mdns4 [NOTFOUND=return] | Did not make much of a difference.
(1) andraslinux can ping itself as andraslinux showing IP 127.0.0.1 - OK, as expected, as in /etc/hosts file alias.
(2) andraslinux can ping itself as andraslinux.local showing IP 192.168.77.11 - OK, its local IP assgined by WiFi router.
(3) interestingly, andraslinux can ping NPI97D945.local which is an HP WiFi printer on local network. Apparently avahi can reach properly configured devices on local network.
(4) All above is true if I do the same in Linux Mint laptop acerlinux pinging itself but not pinging other devices by <name>.local except the HP printer.
Not giving up - jankom |
|
Back to top |
|
|
jankom Guru
Joined: 30 Aug 2021 Posts: 364 Location: USA
|
Posted: Sat Feb 10, 2024 11:33 pm Post subject: Progress report |
|
|
Found interesting topic https://forums.gentoo.org/viewtopic-t-1061710-start-0.html and continued my research. It looks like my linux Mint laptop is running avahi, just as my Gentoo desktop. The output below leads me to suspect ipv4 vs ipv6 situation. Apparently these machines do not announce themseves on the local network. Only the HP printer is visible to both Gentoo and Mint. Code: | janos@acerlinux:~/Desktop$ ps p $(pgrep avahi)
PID TTY STAT TIME COMMAND
704 ? Ss 0:00 avahi-daemon: running [acerlinux.local]
774 ? S 0:00 avahi-daemon: chroot helper
janos@acerlinux:~/Desktop$ ss -ltump | grep 53
udp UNCONN 0 0 127.0.0.53%lo:domain 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.53%lo:domain 0.0.0.0:*
janos@acerlinux:~/Desktop$ getent hosts acerlinux.local
2607:fb90:adb5:8c09:18c8:e931:b08d:5698 acerlinux.local
2607:fb90:adb5:8c09:fb40:5113:909e:d575 acerlinux.local
fe80::4945:2d7:a522:98f acerlinux.local
janos@acerlinux:~/Desktop$ getent hosts andraslinux.local
janos@acerlinux:~/Desktop$
janos@andraslinux ~ $ ss -nlp 'sport = 53'
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
janos@andraslinux ~ $ ss -nlp 'sport = 5353'
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:*
udp UNCONN 0 0 *:5353 *:*
janos@andraslinux ~ $ ssh janos@192.168.77.97
janos@192.168.77.97's password:
Last login: Sat Nov 18 18:35:33 2023 from 10.100.0.6
janos@acerlinux:~$ ss -nlp 'sport = 53'
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:*
tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*
janos@acerlinux:~$ ss -nlp 'sport = 5353'
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:*
udp UNCONN 0 0 [::]:5353 [::]:*
janos@acerlinux:~$
|
The most recent, current nsswitch,conf file has "hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4"
jankom |
|
Back to top |
|
|
sublogic Apprentice
Joined: 21 Mar 2022 Posts: 270 Location: Pennsylvania, USA
|
Posted: Sun Feb 11, 2024 1:58 am Post subject: Re: Progress report |
|
|
jankom wrote: | Code: | janos@acerlinux:~/Desktop$ getent hosts andraslinux.local
janos@acerlinux:~/Desktop$ |
|
How about these variants ? Code: | $ getent ahosts andraslinux.local
$ getnet ahostsv4 andraslinux.local | (note, ahosts and ahostsv4.)
Quote: | The most recent, current nsswitch,conf file has "hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4" | For what it's worth, mine has Code: | hosts: files mdns_minimal [NOTFOUND=return] dns mdns |
|
|
Back to top |
|
|
jankom Guru
Joined: 30 Aug 2021 Posts: 364 Location: USA
|
Posted: Sun Feb 11, 2024 3:59 am Post subject: Solved |
|
|
Bingo!
Yes, it was the ipv4/ipv6. I did not know that one character "4" made such a difference in nsswitch.conf. Code: | janos@andraslinux ~ $ getent ahosts andraslinux.local
2607:fb90:adb5:8c09:acf6:539:cf43:768b%6 STREAM andraslinux.local
2607:fb90:adb5:8c09:acf6:539:cf43:768b%6 DGRAM
2607:fb90:adb5:8c09:acf6:539:cf43:768b%6 RAW
192.168.77.11 STREAM
192.168.77.11 DGRAM
192.168.77.11 RAW
janos@andraslinux ~ $ getent ahostsv4 andraslinux.local
192.168.77.11 STREAM andraslinux.local
192.168.77.11 DGRAM
192.168.77.11 RAW
janos@andraslinux ~ $ getent ahosts acerlinux.local
2607:fb90:adb5:8c09:fb40:5113:909e:d575%6 STREAM acerlinux.local
2607:fb90:adb5:8c09:fb40:5113:909e:d575%6 DGRAM
2607:fb90:adb5:8c09:fb40:5113:909e:d575%6 RAW
192.168.77.97 STREAM
192.168.77.97 DGRAM
192.168.77.97 RAW
janos@andraslinux ~ $ getent ahostsv4 acerlinux.local
janos@andraslinux ~ $ ping -c 2 acerlinux.local
PING acerlinux.local(acerlinux.local (2607:fb90:adb5:8c09:18c8:e931:b08d:5698%6)) 56 data bytes
64 bytes from acerlinux.local (2607:fb90:adb5:8c09:18c8:e931:b08d:5698): icmp_seq=1 ttl=64 time=10.5 ms
64 bytes from acerlinux.local (2607:fb90:adb5:8c09:18c8:e931:b08d:5698): icmp_seq=2 ttl=64 time=21.2 ms
--- acerlinux.local ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 10.501/15.850/21.199/5.349 ms
janos@andraslinux ~ $ cat /etc/nsswitch.conf | grep mdns
# mdns*, mdns*_minimal Use Avahi mDNS/DNS-SD
hosts: files mdns_minimal [NOTFOUND=return] dns mdns
janos@andraslinux ~ $ |
Thank you very much.
jankom |
|
Back to top |
|
|
jankom Guru
Joined: 30 Aug 2021 Posts: 364 Location: USA
|
Posted: Thu Jun 06, 2024 9:11 pm Post subject: Summary solution, lessons learned |
|
|
After eix-syn, profile adjustment due to updates and further review of this subject here is the summary of settings that works for me:
/etc/conf.d/hostname - has fqdn of the hostname. It is fqdn because my fitlet machine runs an apache2 web server and a postfix mail server. The fqdn is an A record for my domain dns
/etc/hotname - no such file, no need for it because /etc/conf.d/hostname already defines it.
/etc/hosts - has simple alias for the hostname,ipv4 and ipv6. It is necessary for avahi to map local network IP to machine name, to find machines on local network by foo.local, and also for printer connection by avahi.
/etc/dhcpcd.conf - customized: Code: | # Inform the DHCP server of our hostname for DDNS.
hostname
# Request a hostname from the network
#option host_name
## 08/25/2023 - next section uncommented
# Most distributions have NTP support.
option ntp_servers
| The "hostname" part is necessary so that my router (the smart phone Hotspot) would list connected device by name, and the "ntp-servers" is probably not relevant for this topic.
/etc/avahi/avahi-daemon.conf unchanged from distro default.
/etc/nsswitch.conf This is important for avahi to work. Code: | hosts: files mdns_minimal dns | # files - finds andrasllinux
# mdns_minimal - finds andraslinux.local
# dns - finds andraslinux.jgklinux.jankom.net
My other machine on the home network (HP laptop, linux Mint) has
files mdns4_minimal [NOTFOUND=return] dns myhostname
and both andraslinux and acerlinux can ping each other as .local
I just wanted to share my experience.
jankom |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|