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
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
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 ?