如何从开发框中检查某个端口是打开还是阻塞在任何其他服务器上?

时间:2013-10-13 19:49:35

标签: linux ubuntu port telnet ping

我正在尝试通过开发盒连接到我们公司端口9042和9160上的一个升级Cassandra服务器..通过代码,我无法连接到它...程序被绞死我的SELECT查询..

所以我想知道有没有办法从我的开发盒中弄清楚这两个端口是否在我的Cassandra登台服务器上被阻止了?

下面是Cassandra登台服务器网址,我试图从我的开发框连接 -

sc-host01.vip.slc.qa.host.com

我的开发盒机器网址是 -

username-dyn-vm1-4.phx-os1.tratus.dev.host.com

有谁能告诉我如何找出可能导致我无法连接的原因..

如何从我的开发箱中检查我的Cassandra登台服务器上是否打开了这些端口?

更新: -

ubuntu@username-dyn-vm1-4:~/build$ traceroute sc-host01.vip.slc.qa.host.com
traceroute to sc-host01.vip.slc.qa.host.com (10.109.107.64), 30 hops max, 60 byte packets
 1  10.9.209.1 (10.9.209.1)  4.594 ms  6.628 ms  8.299 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *
 7  stgcass01-1.vip.slc.qa.host.com (10.109.107.64)  7.907 ms  3.312 ms  3.950 ms

这是我运行nmap时所得到的 -

ubuntu@username-dyn-vm1-4:~/build$ nmap -p T:9160 sc-host01.vip.slc.qa.host.com

Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-13 20:01 UTC
Nmap scan report for sc-host01.vip.slc.qa.host.com (10.109.107.64)
Host is up (0.0037s latency).
rDNS record for 10.109.107.64: stgcass01-1.vip.slc.qa.host.com
PORT     STATE SERVICE
9160/tcp open  apani1

Nmap done: 1 IP address (1 host up) scanned in 0.19 seconds
ubuntu@username-dyn-vm1-48493:~/build$ nmap -p T:9042 sc-host01.vip.slc.qa.host.com

Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-13 20:02 UTC
Nmap scan report for sc-host01.vip.slc.qa.host.com (10.109.107.64)
Host is up (0.0049s latency).
rDNS record for 10.109.107.64: stgcass01-1.vip.slc.qa.host.com
PORT     STATE SERVICE
9042/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 0.11 seconds

这是否意味着端口正确打开并且没有问题?

使用telnet,我得到了这个 -

ubuntu@username-dyn-vm1-4:~/build$ telnet sc-host01.vip.slc.qa.host.com 9042
Trying 10.109.107.64...
Connected to stgcass01-1.vip.slc.qa.host.com.
Escape character is '^]'.
^CConnection closed by foreign host.

ubuntu@username-dyn-vm1-4:~/build$ telnet sc-host01.vip.slc.qa.host.com 9160
Trying 10.109.107.64...
Connected to stgcass01-1.vip.slc.qa.host.com.

1 个答案:

答案 0 :(得分:6)

您是否尝试过开发框中的telnet?

telnet sc-host01.vip.slc.qa.host.com 9042
telnet sc-host01.vip.slc.qa.host.com 9160

如果你收到一个telnet提示符,你就有连接,如果它挂起,那么连接可能会超时,如果命令完全失败,你可能会有阻止访问的防火墙规则。您可以尝试'traceroute sc-host01.vip.slc.qa.host.com'来查看连接尝试的路径。