Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am trying to connect to one of our staging Cassandra servers on port 9042 and 9160 here in our company from a dev box.. Through the code, I am not able to connect to it... The program gets hanged at my SELECT query..

So I am wondering is there any way to figure out from my dev box whether these two ports are either blocked on my Cassandra staging servers or not?

Below is the Cassandra staging server url which I am trying to connect from my dev box -

And my dev box machine url is -

Can anyone tell me how to figure out what can be the possible reason to which I am not able to connect to it..

How to check from my dev box whether these ports are opened or not on my Cassandra staging servers?


This is what I got when I ran nmap -

ubuntu@username-dyn-vm1-4:~/build$ nmap -p T:9160

Starting Nmap 6.00 ( ) at 2013-10-13 20:01 UTC
Nmap scan report for (
Host is up (0.0037s latency).
rDNS record for
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

Starting Nmap 6.00 ( ) at 2013-10-13 20:02 UTC
Nmap scan report for (
Host is up (0.0049s latency).
rDNS record for
9042/tcp open  unknown

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

Does that mean port is opened correctly and there is no problem?

And with telnet I get this -

ubuntu@username-dyn-vm1-4:~/build$ telnet 9042
Connected to
Escape character is '^]'.
^CConnection closed by foreign host.

ubuntu@username-dyn-vm1-4:~/build$ telnet 9160
Connected to
share|improve this question

2 Answers 2

up vote 1 down vote accepted

From your dev box you could likely just use telnet if it's a TCP port:

telnet 9042
telnet 9160

If you get a timeout error, then the port is blocked.

share|improve this answer
After trying this, I got connected to some server name.. Updated my question as well for this test.. – SSH Oct 13 '13 at 20:10
So the question then becomes, is the server you connected to, the one you wanted to connect to ? (ie. eliminate the possibility of a DNS problem...) – Niall Byrne Oct 13 '13 at 20:15
Yeah kind of I guess... – SSH Oct 13 '13 at 20:17

You can use NMAP to test them (available in most distributions)

nmap -p T:9042
nmap -p T:9160

Edit: If the staging server has filtered ports and no response, it's likely that Cassandra server is dead or those ports filtered by IPTables/Firewall

share|improve this answer
I should use the above command to run from my dev box? Right? And what is This should be replaced with my staging servers hostname? – SSH Oct 13 '13 at 19:55
btw, I cannot run nmap in my dev box ubuntu machine.. It says command not found? – SSH Oct 13 '13 at 19:59
Run sudo apt-get install nmap first – Srdjan Grubor Oct 13 '13 at 20:00
I just installed and now nmap is working fine.. I updated my question with the details of nmap.. Can you take a look and let me know if those results means port is opened? If it is opened then what can be the other problem? – SSH Oct 13 '13 at 20:05
That means that the server is accepting connections on that port, given the port numbers uniqueness it's most likely your Cassandra server, and that you have (from the nmap testing box) an open communication channel to it. – Srdjan Grubor Oct 13 '13 at 20:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.