1

Good evening,

I am trying to run the following command on Ubuntu 22:

nc -vv 127.0.1.1 1234

But console returns this error:

nc: connection to port 127.0.1.1 failed 1234 (tcp): connection refused

Do I have to enable or configure something before I can test this?

1 Answer 1

1

Netcat is blind and it can listen exactly to what you indicating. In your case, I think you will have to enable the service on the indicating host and port. Or just change the host or port of your already running service.

If you want to start a service on your localhost to listen for incoming connections you can use the -l flag.

nc -l 1234

Once the service is running at localhost and on port 1234, you can use the nc command again to start listening.

nc -vv 127.0.0.1 1234

If you want to connect to a different machine, you will have to know the IP address and the port where the service is running and listening. And then you can use something like this.

nc -vv <IP address> <port number>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .