Thursday, February 28, 2013

How to test UDP Connectivity ?


Sometimes we need to check the UDP Connectivity? A There are few free tools available in the net to test the UDP Connectivity but here we are going to describe about a utility called nmap, by which we will test the UDP Connectivity.
How would you be able to test and probe a port that listens for UDP connections? Or  how would you test a listening UDP port?

How to test a listening UDP port through nmap

If you have managed to create a daemonized service that opens port for UDP connections, here’s how to test that listening UDP port for UDP connections. Read on.
To test a listening UDP port, simply use nmap.
# nmap -p [port] -sU -P0 [host name | ip address]
# nmap -p 123 -sU -P0 example.com
# nmap -p 123 -sU -P0 123.123.123.123
From the command shown above, I am assuming that the host example.com is currently serving NTP service on UDP port 123.
Sample opened UDP port output:
~~~~~~~~~~~~~~~~~~~
Starting Nmap 4.52 ( http://insecure.org ) at 2008-04-29 10:56 WAT
Interesting ports on host.example.com (123.123.123.123):
PORT STATE SERVICE
123/udp open|filtered ntp
MAC Address: 00:02:A5:EC:00:8C (Compaq Computer)
Nmap done: 1 IP address (1 host up) scanned in 1.043 seconds
~~~~~~~~~~~~~~~~~~~
Not only you get to test and scan the UDP port, you also get the host’s current MAC address.
If you have a closed UDP port, you should be seeing similar lines as shown
~~~~~~~~~~~~~~~~~~~
Interesting ports on localhost (127.0.0.1):
PORT STATE SERVICE
123/udp closed ntp
~~~~~~~~~~~~~~~~~~~

How to test a listening TCP/UDP port through nc


Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open


Netcat (nc) can also be used for a lot of other purposes.  It can also be used as a very fast basic port scanner:

To scan a range of UDP ports 1-1000


nc -zu destination_ip 1-1000




To scan a range of TCP ports 1-1000
 nc -z destination_ip 1-1000 






In order to get more information, you can add v, for more verbose


nc -vz destination_ip 1-1000








No comments:

Post a Comment