Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
avahi local network foo.local [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 322
Location: USA

PostPosted: Thu Feb 08, 2024 3:54 am    Post subject: avahi local network foo.local [SOLVED] Reply with quote

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
View user's profile Send private message
sublogic
Apprentice
Apprentice


Joined: 21 Mar 2022
Posts: 222
Location: Pennsylvania, USA

PostPosted: Fri Feb 09, 2024 1:03 am    Post subject: Reply with quote

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
View user's profile Send private message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 322
Location: USA

PostPosted: Fri Feb 09, 2024 4:08 am    Post subject: Reply with quote

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
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 324
Location: Naarm/Melbourne, Australia

PostPosted: Fri Feb 09, 2024 4:54 am    Post subject: Reply with quote

Could you please post the current contents of your /etc/avahi/avahi-daemon.conf file?
Back to top
View user's profile Send private message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 322
Location: USA

PostPosted: Fri Feb 09, 2024 2:27 pm    Post subject: Reply with quote

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
View user's profile Send private message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 322
Location: USA

PostPosted: Fri Feb 09, 2024 7:38 pm    Post subject: update Reply with quote

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
View user's profile Send private message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 322
Location: USA

PostPosted: Sat Feb 10, 2024 11:33 pm    Post subject: Progress report Reply with quote

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
View user's profile Send private message
sublogic
Apprentice
Apprentice


Joined: 21 Mar 2022
Posts: 222
Location: Pennsylvania, USA

PostPosted: Sun Feb 11, 2024 1:58 am    Post subject: Re: Progress report Reply with quote

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
View user's profile Send private message
jankom
Guru
Guru


Joined: 30 Aug 2021
Posts: 322
Location: USA

PostPosted: Sun Feb 11, 2024 3:59 am    Post subject: Solved Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
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