Occasionally I want to know if UDP packets are being dropped between 2 machines. When they are, lots of audio/video services (such as Asterisk) can be interrupted. How do I find out if UDP is enabled between 2 servers? Simple…I connect to one of them and run a command against the other.
Using nmap (network map) is one way. I specify the port(s) I want to scan with -p, the scan type you want (UDP is -sU), and the hostname or IP of the machine I want to scan. Specifying “don't ping in advance of connect” (-P0) is optional.
[me@myhost]# nmap -p 123 -sU -P0 myotherhost Starting nmap 3.70 ( http://www.insecure.org/nmap/ ) at 2010-02-02 10:31 EST Interesting ports on myotherhost (192.168.1.14): PORT STATE SERVICE 123/udp open|filtered ntp Nmap run completed -- 1 IP address (1 host up) scanned in 2.019 seconds
The result shows port 123 is open and be filtered, and that NTP is running there.
Using nc (netcat) is another possibility. I specified verbose with -v, UDP with -u, and scan-only with -z.
[me@myhost]# nc -v -u -z myotherhost 123 myotherhost [192.168.1.14] 123 (ntp) open
The result shows port 123 is open and the ntp daemon is listening.