本地 LAN 上的跟踪路径较慢

本地 LAN 上的跟踪路径较慢

我在 EXSi 上,有 2 个实例:Ubuntu 和 CentOS。这些是网络配置

Ubuntu

eth0      Link encap:Ethernet  HWaddr 00:50:56:00:1f:68  
          inet addr:212.83.153.71  Bcast:212.83.153.71  Mask:255.255.255.255              
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:76059 errors:0 dropped:26 overruns:0 frame:0
          TX packets:7224 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6482760 (6.4 MB)  TX bytes:2080684 (2.0 MB)

eth1      Link encap:Ethernet  HWaddr 00:0c:29:46:5a:f2  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:252 errors:0 dropped:0 overruns:0 frame:0
          TX packets:608 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:42460 (42.4 KB)  TX bytes:82474 (82.4 KB)

/etc/iptables.conf

*nat
:PREROUTING ACCEPT [142:12571]
:INPUT ACCEPT [5:1076]
:OUTPUT ACCEPT [8:496]
:POSTROUTING ACCEPT [8:496]
-A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE
COMMIT

*filter
:INPUT ACCEPT [2:72]
:FORWARD ACCEPT [4:336]
:OUTPUT ACCEPT [6:328]
-A INPUT -i eth1 -p tcp -j ACCEPT
-A INPUT -i eth1 -p udp -j ACCEPT
-A INPUT -i eth0 -p tcp --dport ssh -j ACCEPT
COMMIT

CentOS

eth0      Link encap:Ethernet  HWaddr 00:0C:29:74:1C:55  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe74:1c55/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:499 errors:0 dropped:0 overruns:0 frame:0
          TX packets:475 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:68326 (66.7 KiB)  TX bytes:82641 (80.7 KiB)

主要问题是,如果我从 CentOS 实例执行此命令

ssh 192.168.1.2

连接需要 20 多秒。似乎它正在将连接路由到错误的网络。

会是什么呢?谢谢!

答案1

大多数情况下,SSH 连接延迟是由反向 DNS 查找失败引起的。请尝试以下操作之一来解决问题...

1:将以下行添加到您的/etc/ssh/sshd_config

UseDNS no

2:将主机名和 IP 添加到/etc/hosts

centos 192.168.1.1
ubuntu 192.168.1.2

相关内容