【解决】SSH 远程失败之路由配置问题
开发平台:RedHat 8
一、问题描述
使用 WindTerm SSH 远程连接 192.168.88.211 虚拟主机,无法连接。
二、问题追溯
VMWare 虚拟机配置
虚拟网卡 | IP | VMNet 模式 | 应用 |
---|---|---|---|
网卡1(eth0) | 192.168.88.11/24 | VMNet 8 | 服务 |
网卡2(eth1) | 192.168.88.211/24 | VMNet 1(仅主机模式) | SSH 远程 |
VMNet1 网卡 使用 192.168.88.254/24
校验 SSH 默认端口是否改变
[root@web1 ~]# ss -antlp | grep sshd
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=987,fd=4))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=987,fd=6))
SSH 默认端口 22。经确认此处无问题!且同时确认 SSHD 正在运行中。
检查 SELinux 防火墙
[root@web1 ~]# getenforce
Disabled
防火墙可能会阻碍 windows 与 虚拟主机 的通讯。因此确认,因为关闭状态,认为不是问题源。
本虚拟主机未安装 firewall,因此不继续确认。
检查 路由
[root@web1 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.88.200 0.0.0.0 UG 100 0 0 eth0
192.168.88.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0
192.168.88.0 0.0.0.0 255.255.255.0 U 101 0 0 eth1
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
注意此处出现 192.168.88.0 指向 eth0 eth1 两个连接口。推测通讯被 eth0 优先处理。
[root@web1 ~]# route del -net 192.168.88.0 netmask 255.255.255.0 eth0 # 删除 eth0 192.168.88.0 的配置
因此确认问题原因。解决 ping 问题。