---
title: "双线云主机不能访问远程服务的问题解决记录"
author: "codingstandards"
date: "2012-06-13T13:59:08Z"
tags: []
categories: ["操作系统"]
slug: "untitled"
draft: false
lastmod: "2012-06-13T14:02:19Z"
id: 1559906
url: "https://codingstandards.iteye.com/blog/1559906"
---

#### 双线云主机不能访问远程服务的问题解决记录

新购置的双线云主机，一切都比较正常，访问速度也比较快。不过有个问题，我们系统的程序需要访问部署在移动机房的服务，端口20009，无法访问。

 

\[root@www ~]$ telnet 211.103.28.xxx 20009  
Trying 211.103.28.xxx...

等待较长时间也没有反应，只好 Ctrl+C 掉。

\[root@www ~]$

 

检查了一下是否开启了防火墙，发现并没有启动防火墙。

 

\[root@www ~]$ iptables-save  
\[root@www ~]$

 

难道是云主机所在的网络把 20009 端口毙掉了？试试别的端口，发现也不行

 

\[root@www ~]$ telnet 211.103.28.xxx 80  
Trying 211.103.28.xxx...

等待较长时间也没有反应，只好 Ctrl+C 掉。

\[root@www ~]$

 

试试别的网站是否能访问：发现 Google 的能正常访问。

 

\[root@www ~]$ telnet www.google.com 80  
Trying 74.125.71.103...  
Connected to www.google.com.  
Escape character is '^]'.  
^]  
telnet&gt; q  
Connection closed.  
\[root@www ~]$ 

于是，我们公司的技术支持人员 darry lee 联系了云主机提供方解决，折腾了好几天，终于得到了解决。

\[root@www test]$ telnet 211.103.28.xxx 20009  
Trying 211.103.28.xxx...  
Connected to 211.103.28.xxx.  
Escape character is '^]'.

0^]  
telnet&gt; q  
Connection closed.  
\[root@www test]$

原来系统中设置的默认路由是电信的，改成网通的(联通)之后就能访问了：

Bash历史记录文件中，找到了两条命令，如下：

第一条，增加网通的默认路由。

route add default gw 203.166.xxx.1 dev eth1

第二条，删除电信的默认路由。

route del default gw 211.152.xxx.1 dev eth2

**一句话：不同运营商之间的网络互通问题真是很多，这就是中国互联网的现状！**

另外，在该服务器的 /etc/rc.local 中还发现了如下命令行（在开机时自动启动）

/etc/init.d/startMonitor

 

该脚本的内容如下：

\[root@www ~]$ cat /etc/init.d/startMonitor  
**java -classpath /usr/local/javawrapper/lib/SystemMonitor.jar:/usr/local/javawrapper/lib/sigar.jar cn.redDragon.Systemmonitor.MonitorLinux &**

\[root@www ~]$

经询问，此命令是为了支持双线路由而设置。（**是否真如此，还得确认！** ）

本文链接：[http://codingstandards.iteye.com/blog/1559906](/blog/1559906)   （转载请注明出处）

关于双线路由的一些详细设置，下次有空再做研究。