一、网络是否通畅

方法:

  1. ping ip或域名
  2. telnet ip或域名
[root@Docker_Ser ~]# ping 192.168.10.237
PING 192.168.10.237 (192.168.10.237) 56(84) bytes of data.
64 bytes from 192.168.10.237: icmp_seq=1 ttl=64 time=0.057 ms
64 bytes from 192.168.10.237: icmp_seq=2 ttl=64 time=0.038 ms
^C
--- 192.168.10.237 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1039ms
rtt min/avg/max/mdev = 0.038/0.047/0.057/0.011 ms
[root@Docker_Ser ~]# telnet 192.168.10.237 22
Trying 192.168.10.237...
Connected to 192.168.10.237.
Escape character is '^]'.
SSH-2.0-OpenSSH_6.6.1
^[
Protocol mismatch.
Connection closed by foreign host.
[root@Docker_Ser ~]#

二、防火墙限制

方法:

  1. 本地ping 或 telnet 是正常的,但其他机器无法 ping 或 telent 通
  2. 检查 firewall(ubuntu是ufw) 是否关闭
  3. 检查 selinux 是否关闭
[root@Docker_Ser ~]# systemctl status firewalld.service 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@Docker_Ser ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 


[root@Docker_Ser ~]# 

三、检查本地服务是否启动

方法:

  1. 端口是否监听:netstat -nltup | grep "22"
  2. 进程是否启动:ps -ef | grep "ssh"
[root@Docker_Ser ~]# netstat -nltup | grep "22"
tcp        0      0 192.168.10.237:22       0.0.0.0:*               LISTEN      1072/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2122/master         
tcp6       0      0 ::1:25                  :::*                    LISTEN      2122/master         
[root@Docker_Ser ~]# ps -ef | grep "ssh"
root      1072     1  0  2024 ?        00:00:00 /usr/sbin/sshd -D
root     12821  1072  0 21:08 ?        00:00:00 sshd: root@pts/0
root     13084 12823  0 21:12 pts/0    00:00:00 grep --color=auto ssh
[root@Docker_Ser ~]# 

四、检查时间是否正确

方法:

  1. 检查时区和时间
[root@Docker_Ser ~]# timedatectl 
      Local time: Wed 2025-02-05 21:16:09 CST
  Universal time: Wed 2025-02-05 13:16:09 UTC
        RTC time: Wed 2025-02-05 13:16:02
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@Docker_Ser ~]# date
Wed Feb  5 21:16:28 CST 2025
[root@Docker_Ser ~]#