ping linux失败,linux – ping工作但ssh失败

> machine1 IP:172.30.11.119

> machine2 IP:172.30.11.120

> machine3 IP:172.30.11.121

> machine4 IP:172.30.11.122

Note:

These machines are connected to LAN.

我已经在/ etc / network / interfaces文件中为每台机器的以太网接口配置了静态IP,以便在系统重启后保持IP.

我在机器4中将默认网关设置为172.30.11.97(以便通过putty连接管理器从用户桌面访问它)

allow-hotplug eth0

iface eth0 inet static

address 172.30.11.122

netmask 255.255.255.0

gateway 172.30.11.97

但是在其他3台机器中,我没有像122那样设置默认网关.相反,我在“接口”和“rt_table”文件中尝试了下面这3台机器中的策略路由:

echo "1 policy_gw" >> /etc/iproute/rt_table

In /etc/iproute/rt_table:

1 policy_gw

在/ etc / network / interfaces中:

allow-hotplug eth0

iface eth0 inet static

address 172.30.11.121

netmask 255.255.255.0

post-up ip rule add dev eth0 table policy_gw

post-up ip route add default via 172.30.11.97 dev etho src 172.30.11.121/24 table policy_gw

就像120/119机器一样.现在我可以直接通过putty到达这些机器.

面临的问题:我能够从同一局域网中的其他机器ping这个局域网中的每台机器.但是ssh因错误端口22而失败:没有到主机的路由

假设我在机器121中:ssh 172.30.11.120抛出上述错误.

default gateway is a cisco system router/switch.They are blocking

ports for SSH,telnet protocols but not ICMP.

机器122的路由表:

root@debian:~# route -n

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Use Iface

0.0.0.0 172.30.11.97 0.0.0.0 UG 0 0 0 eth1

172.30.11.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1

ssh_config文件的内容:

Host *

SendEnv LANG LC_*

HashKnownHosts yes

GSSAPIAuthentication yes

GSSAPIDelegateCredentials no

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值