Unable to SSH to CentOS using Hostname

Issues related to configuring your network
Post Reply
user_2020
Posts: 1
Joined: 2020/02/02 03:55:18

Unable to SSH to CentOS using Hostname

Post by user_2020 » 2020/02/02 04:23:10

Hi! I cannot SSH into a CentOS VM from an Ubuntu 18.04 machine using the hostname, but I can using the IP address. For example: ssh user@centos8vm.local does not work but ssh user@10.10.10.1 works. The strange thing is when I reboot the vm I'm able to ssh using the hostname a couple of times before I get the error unable to resolve hostname. Also, I can ssh into another Ubuntu 18.04 VM using the hostname and ip. It's only the CentOS vm that's has the issues. This is a soho network with no local dns server. We're using avahi for the multicast DNS to resolve hostnames without a central DNS server.

I'm new to linux so maybe I missed somethings. Here are some sample configs:

/etc/hosts file:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.1.1 centos8vm.local centos8vm
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

10.10.10.1 centos8vm.local centos8vm


/etc/hostname file:
centos8vm


/etc/nsswitch.conf file:
passwd: sss files systemd
group: sss files systemd
netgroup: sss files
automount: sss files
services: sss files

shadow: files
hosts: files dns
bootparams: files
ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
publickey: files
aliases: files


● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
Active: active (running) since

summitflier
Posts: 13
Joined: 2020/01/22 22:16:05

Re: Unable to SSH to CentOS using Hostname

Post by summitflier » 2020/02/02 14:16:05

For one thing ...
127.0.1.1 centos8vm.local centos8vm

127.0.1.1 is an invalid address. The entire 127.x.x.x subnet is not routeable.
Almost any other subnet will work.

Post Reply

Return to “CentOS 8 - Networking Support”