Limiting NetCat listening to specific network

netcat

I would like to get your help to figure out how to use NetCat to listen to a specific port accepting connection only from the hosts in a specific network.
I have a server that I would like to share a file with a group of clients only using NetCat (or any other tool).

Thanks.

Best Answer

I figured out how to do using the netcat version from RedHat using the command line below:

nc -l --allow "IPs" -p "port number"

Example:

nc -l --allow 192.168.0.10,192.168.0.15 -p 8080

Any other different IP that tries to connect will be refused.

Related Topic