ping works but not ssh?

7,860

Ping uses the icmp protocol, which doesn't require a port.

ssh needs port 22 (by default) to be open on the machine to which you're attempting to connect, and an ssh daemon running.

To check the port is open on 'the first' machine, 192.168.0.1 :

 $ sudo firewall-cmd --list-services
   dhcpv6-client ssh samba-client

ssh should be listed as above. To check if the ssh daemon is running (on 'the first'):

 $ sudo systemctl status sshd
   sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2017-04-26 22:22:04 BST; 1s ago
   ...

It should be 'Active' as above.

Then, if needed, to open the port:

 $ sudo firewall-cmd --permanent --add-service=http
success
 $ sudo firewall-cmd --reload
success

And to start the service:

$ sudo systemctl start sshd
Share:
7,860

Related videos on Youtube

yO_
Author by

yO_

Updated on September 18, 2022

Comments

  • yO_
    yO_ over 1 year
    • I connected two linuxes (CentOS7) with an ethernet cable, and
    • I did ifconfig <eth> 192.168.0.1 on the first and .. 0.2 on the second.
    • From the second, ping 192.168.0.1 works, but
    • ssh <mylogin_on_first>@192.168.0.1 does nothing (ends by an timeout)

    Any ideas?