Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

When i use;

nc -v 151.XXX.240.227 9001

on my Centos server, i get

nc: connect to 151.XXX.240.227 port 9001 (tcp) failed: Connection timed out

In my Windows 7 computer, Tcpview shows that port 9001 is listening, i also forwarded port 9001 from my router.

How can i debug this connection problem?

Thanks

EDIT

The problem was with the router port forwarding, in port forwarding i was using my own ip as client, changing it to ipv4 that i found with ipconfig command in cmd solved the problem.

share|improve this question
    
Is your port opened 9001? –  Abhishek Anand Amralkar May 3 '13 at 10:58
    
I think so, how can i be sure? I also tried with canyouseeme.org and it also cant connect to my ip on port 9001. It says Error: I could not see your service on 151.2XX.240.227 on port (9001) Reason: Connection timed out –  user2314575 May 3 '13 at 11:07
    
On your windows box check firewall and make sure you have opened port 9001 in outbound and inbound. –  Abhishek Anand Amralkar May 3 '13 at 11:34
    
Thats what i am asking here hoping to get help how to do it. –  user2314575 May 3 '13 at 11:40
    
CentOS has quite restrictive default iptables ruleset. Try turn off iptables and check whether it helps. –  user172266 May 3 '13 at 11:54

1 Answer 1

up vote 0 down vote accepted

Here is how to open both Windows Firewall incoming 9001, and iptables outbound 9001.

Linux

iptables -A OUTPUT -p tcp -d 151.XXX.240.227 --dport 9001 -j ACCEPT

Windows

netsh advfirewall firewall add rule name="Open Port 9001" dir=in action=allow protocol=TCP localport=9001
share|improve this answer
    
I runned first command in server and I runned 2. command in windows cmd and it answered : Ok but still i get Connection timed out error –  user2314575 May 3 '13 at 12:16
    
still i get Connection timed out error from nc command but in canyouseeme.org the error changed from connection timed out to Error: I could not see your service on 151.250.235.47 on port (9001) Reason: Connection refused , in tcpview it shows phpstorm is listening on port 9001 which is correct –  user2314575 May 3 '13 at 12:22
    
Do you have the ports opened on your router also? –  David Houde May 5 '13 at 11:28

Your Answer

 
discard

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.