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.

I'm trying to use nc to debug some network issues (but am sort of ending up debugging nc itself).

I have the relevant port open (to the world) in the ec2 security group. When I run either of these commands on my ec2 server:

nc -n -v -v -l <private IP address> -p 4161

or

nc -n -v -v -l <public IP address> -p 4161

And then from any other server (on EC2 or in my local office network):

nc -n -v -v <public IP address> 4161

I get the following on the server (which then exits):

listening on [any] 4161 ...
invalid connection to [<private IP address>] from (UNKNOWN) [<remote IP address>] 54002

And on the client (which also then exits):

(UNKNOWN) [<public IP address>] 4161 (?) open
sent 0, rcvd 0

Any suggestions?

I suspect this has to do with the fact that EC2 instances have public and private IP addresses, but I'm baffled as to how to get this to work ?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

sigh

Never fails. As soon as I post a question to serverfault, a moment later I find the answer myself...

Omitting the IP address for the server netcat takes care of it:

nc -n -v -v -l -p 4161
share|improve this answer
    
thanks for following up. Could you explain why did this work? –  TheIndependentAquarius Feb 26 '13 at 10:36

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.