In Linux distributions that use yum, you can use this command to find the package name.
yum search netcat
nc.x86_64 : Reads and writes data across network connections using TCP or UDP.
You can then install it with this command.
yum install nc.x86_64
Here are some examples
Testing TCP connectivity to NetVault SmartDisk port 37453
nc -z -w5 <hostname> 37453
Testing UDP connectivity to NetVault Backup port 20031
nc -z -u -w5 <hostname> 20031
Sometimes connectivity problems are intermittent. To test connectivity over time you may want to create a script that will run on a schedule. Netcat works well for this. Here is an example of some commands you can place in a script.
date >> /root/tclog.txt
nc -z -w5 sylvester 37453 >> /root/tclog.txt
nc -z -u -w5 speedy-gonzales 20031 >> /root/tclog.txt
The output is redirected to a file named tclog.txt and each time it runs it will append output similar to this, if it was successful.
Wed Nov 13 20:39:15 EST 2013
Connection to sylvester 37453 port [tcp/*] succeeded!
Connection to speedy-gonzales 20031 port [udp/*] succeeded!
If it is not successful it will not produce output for the command. If you see a section of the output which only shows dates, you know that it failed at those times.
To schedule the script to run, you can use cron. If you run crontab -e as root, it will open a vi editor of the cron configuration. If you create a script called tc.sh in /root you can add this line to have it run the script every 5 minutes.
*/5 * * * * /root/tc.sh
© 2025 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center