You are not logged in.

#1 2022-02-23 20:41:15

pradtf
Member
Registered: 2009-06-10
Posts: 149

SOLVED ping/ssh not working via hostname

i've setup archlinux on a laptop behind a asus wifi router just like my desktop machines.

the laptop shows up on the router:
lappi 192.168.50.222 DHCP
and everything works perfectly as far as accessing the internet or pinging other machines on the internal network.

for instance, there is a desktop
divisi 192.168.50.110 DHCP
that i can ping from lappi (ping divisi)

however, if i try to ping lappi from divisi it times out:

[root@divisi ~]# ping lappi
ping: lappi: Name or service not known

(btw, that is lappi with an 'L' not a '1', so there is no accidental typo.)

both lappi and divisi have
systemctl enable dhcpcd
systemctl enable iwd
systemctl enable sshd

i can ssh into lappi using the ip address 192.168.50.222,
but not using ssh lappi because for some reason it can't find it.

/etc/hostname is lappi

/etc/hosts has

127.0.0.1 localhost
:: localhost
127.0.0.1 lappi

/etc/resolv.conf shows

# Generated by dhcpcd from wlan0.dhcp
# /etc/resolv.conf.head can replace this line
nameserver 192.168.50.1
# /etc/resolv.conf.tail can replace this line

192.168.50.1 is the router ip

not sure how to troubleshoot this since there seems to be nothing to go on and lappi shows up on the router.

Last edited by pradtf (2022-02-23 21:56:55)


in friendship,
prad

Offline

#2 2022-02-23 21:04:39

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: SOLVED ping/ssh not working via hostname

Why do you expect it to work without any further configuration?

You need to either have a correctly configured DNS server on your network handling name resolution or something zero-conf like Avahi installed and running.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2022-02-23 21:16:34

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

Re: SOLVED ping/ssh not working via hostname

Why do you expect it to work without any further configuration?

He has set the values into the hostsfile and that should take that role and should work.

At the moment my firewall/DNS server is kaput, but I can just ping my host the same way you try to do.
Beside resolv.conf and a set IP everything is setup similar!
What if you set '127.0.0.53' into resolv.conf?

edit: Slithery is right here concerning Avahi:-)

Last edited by qinohe (2022-02-23 23:04:43)

Offline

#4 2022-02-23 21:18:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,453
Website

Re: SOLVED ping/ssh not working via hostname

Or even simpler, configure the router's dhcp server to assign static IPs to each machine (based on their MAC address) and then just add a listing of the relevant machines in each machine's /etc/hosts.

qinohe wrote:

He has set the values into the hostsfile and that should take that role and should work.

No, this should not be expected to work on most systems.  If by "hostsfile" you mean /etc/hosts then this is my suggestion, but the listing of *other* machines on the network needs to be manually added to each system's /etc/hosts (as the example in the post below does, but that will fail if/when lappi gets assigned a new IP address by the router).

Last edited by Trilby (2022-02-23 21:21:28)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-02-23 21:18:38

vorvac
Member
Registered: 2021-05-14
Posts: 44

Re: SOLVED ping/ssh not working via hostname

On divisi, you could try modifying the /etc/hosts file with something like this:

# divisi's /etc/hosts
192.168.50.222    lappi

Edit: See post # 4 for a better explanation of what I was trying to say.

Last edited by vorvac (2022-02-23 21:23:50)

Offline

#6 2022-02-23 21:22:11

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

Re: SOLVED ping/ssh not working via hostname

Trilby wrote:

Or even simpler, configure the router's dhcp server to assign static IPs to each machine (based on their MAC address) and then just add a listing of the relevant machines in each machine's /etc/hosts.

Yep, poor-mans DNS - works very well.

f by "hostsfile" you mean /etc/hosts then this is my suggestion

Exactly what I meant...

Last edited by qinohe (2022-02-23 21:23:49)

Offline

#7 2022-02-23 21:38:16

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,453
Website

Re: SOLVED ping/ssh not working via hostname

But that requires adding to /etc/hosts the local IP addresses and hostname of *other* systems in the network, not just the loopback IP and local machine's hostname which is all that is normally required and all that was shown by the OP.  So in contrast to your previous statement, the OP has not set the (relevant) values in /etc/hosts (yet).


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2022-02-23 21:46:59

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

Re: SOLVED ping/ssh not working via hostname

Ah, darn I didn't notice he was pinging from 'divisi' and not 'lappi'
Correct, that has to be set on every '/etc/hosts' in the machine park!

Offline

#9 2022-02-23 21:56:19

pradtf
Member
Registered: 2009-06-10
Posts: 149

Re: SOLVED ping/ssh not working via hostname

thx for the help, everyone.

it was through more poking around based on trying out ideas in your replies (other than the poorman's DNS) that i discovered

divisi has
systemctl enable systemd-resolved
but lappi doesn't!
just something i forgot to put into my custom install script and didn't look back at my past efforts!

my apologies for this oversight and thx again.

(ps @qinohe is it possible that might resolve your difficulty as well?)


in friendship,
prad

Offline

#10 2022-02-23 22:10:40

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

Re: SOLVED ping/ssh not working via hostname

pradtf wrote:

(ps @qinohe is it possible that might resolve your difficulty as well?)

Oh well, the server is a Proxmox server that also served a firewall/DNS (OPNSense) but the machine is broken:..(
Now I have only one machine and it runs fine on ISP router, no problems on a very basic network, thanks for suggesting anyway;-)

Offline

#11 2022-02-23 22:33:38

pradtf
Member
Registered: 2009-06-10
Posts: 149

Re: SOLVED ping/ssh not working via hostname

qinohe wrote:

Now I have only one machine and it runs fine on ISP router, no problems on a very basic network, thanks for suggesting anyway;-)

sorry to hear that, qinohe about your broken machine.

it was your suggestion of 127.0.0.53 that i searched to understand the intent, which led me to finding the
systemd-resolved
oversight.
(possibly that's the sort of thing Slithery was referring to with the avahi idea.)

so much appreciated!

Last edited by pradtf (2022-02-23 22:42:30)


in friendship,
prad

Offline

#12 2022-02-23 22:48:07

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: SOLVED ping/ssh not working via hostname

pradtf wrote:

(possibly that's the sort of thing Slithery was referring to with the avahi idea.)

Nope. Not at all.

It only worked because your router happens to link it's DNS/DHCP entries.
This is by no means a common thing and in most cases your 'solution'  wouldn't have made a difference and Avahi would still be needed.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#13 2022-02-23 23:03:14

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

Re: SOLVED ping/ssh not working via hostname

Sorry for interpreting your answer wrong @Slithery
Your right  that in most cases Avahi would be needed...

Offline

#14 2022-02-23 23:53:30

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,551

Re: SOLVED ping/ssh not working via hostname

pradtf wrote:

it was your suggestion of 127.0.0.53 that i searched to understand the intent, which led me to finding the
systemd-resolved
oversight.
(possibly that's the sort of thing Slithery was referring to with the avahi idea.)

Actually it is. systemd-resolved does mDNS, same as avahi does.

Offline

#15 2022-02-24 00:13:35

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: SOLVED ping/ssh not working via hostname

Scimmia wrote:
pradtf wrote:

it was your suggestion of 127.0.0.53 that i searched to understand the intent, which led me to finding the
systemd-resolved
oversight.
(possibly that's the sort of thing Slithery was referring to with the avahi idea.)

Actually it is. systemd-resolved does mDNS, same as avahi does.

Thanks for the correction, I never knew that it handled mDNS.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#16 2022-02-24 03:46:01

pradtf
Member
Registered: 2009-06-10
Posts: 149

Re: SOLVED ping/ssh not working via hostname

Scimmia wrote:
pradtf wrote:

(possibly that's the sort of thing Slithery was referring to with the avahi idea.)

Actually it is. systemd-resolved does mDNS, same as avahi does.

from what i understand now and from this post:
https://bbs.archlinux.org/viewtopic.php … 7#p1893937

a combo of systemd-networkd and systemd-resolved is require to replace avahi.

however, checking the status on lappi i don't have systemd-networkd active:

[root@lappi ~]# systemctl status systemd-networkd
○ systemd-networkd.service - Network Configuration
     Loaded: loaded (/usr/lib/systemd/system/systemd-networkd.service; disabled>
     Active: inactive (dead)
TriggeredBy: ○ systemd-networkd.socket

and things work fine as far as i can tell.

systemd-networkd is active on divisi though and from this:

systemd-networkd is a system daemon that manages network configurations. It detects and configures network devices as they appear; it can also create virtual network devices ... The systemd package is part of the default Arch installation and contains all needed files to operate a wired network. Wireless adapters, covered later in this article, can be set up by services, such as wpa_supplicant or iwd.
https://wiki.archlinux.org/index.php/Systemd-networkd

i'm inclined to think that it should be made active.

to do so, so the router picks them up we should also have in:
/etc/systemd/network/25-wlan0.network

[Match]
Name=wlan0

[Network]
DHCP=yes

(even though the router seemed to pick things up without this ... though hostname changes didn't get altered without all this.)

in any case, my setup is the above 25-wlan0.network file, followed by
systemctl start systemd-networkd
systemctl start systemd-resolved
(after connection is setup by iwd.)

that's what i have on the other machines (i'd forgotten that's how i set it up from nearly a year ago) and all has been well, so i assume it is solid. hope this is helpful to someone else.

Last edited by pradtf (2022-02-24 03:48:35)


in friendship,
prad

Offline

Board footer

Powered by FluxBB