Blog

How to check whether UDP connection is open or not?

Tags: Server Managementserver monitoring

Published on: February 12, 2019 by Anitta Jose

How to check whether UDP connection is open or not?

Scenario:

UDP is being a connectionless protocol, you can t reliably say that the port is open or not. Below two commands are the only way of checking the same. When you send a packet to the open port, there need not be any acknowledgment saying that the port is open.

Theoretically, UDP should give a ICMP REJECT message saying “port unreachable”, but it can also drop the message as if its a black hole.

# nmap -sU -p UN4500 xx.xx.xx.xx

# nc -vz -u xx.xx.xx.xx 53

Using nmap and netcat tool would be of help, but let me repeat that this is not reliable. However, if you want to check whether the port is blocked at a hardware level either at client end or the server end, what you can probably do is to open a UDP port at the server end like below:

server.example.com # nc -u -l 4500

And then at the client side, open the communication using nc as below and write some message and check whether it is reaching at the server end.

client.example.com # nc -u server.example.com 4500

On a quick note, to check whether a port is open, programmatically/script, use the below command:

nc 127.0.0.1 22 &> /dev/null; echo $?

If $? is 0, the port is open and if 1, the port is closed.

Uninterrupted service delivery can only be assured through constant monitoring of services and servers. Let us take care of your servers 24/7/365.

Get 24/7 expert server management

Category : Linux

Anitta Jose

Anitta Jose

Anitta is systems engineer since 2015 and holds broad experience in Linux, WordPress, and cPanel systems administration. Her interest lies more in Cloud technologies (AWS). From 2016, she writes blogs to share her experiences with wider audience.

You may also read:

Comments

Add new commentSIGN IN

Let's Connect

Categories

Your Cart

Cart is empty.

Subtotal
₹0.00
APPLY
0
Send this to a friend