How to do UDP Ping with Linux

Background

UDP Ping is really useful especially to see if SNMP is running. The syntax for UDP checking commands is a bit obscure so we’ve listed a few variants.

How to do UDP Ping with Linux
How to do UDP Ping with Linux

NMAP

SNMP running on port 161 UDP, but open and filtered:

➜ ~ sudo nmap -sU -p 161 xyz.vander.host
Starting Nmap 7.80 ( https://nmap.org ) at 2022-02-09 11:01 SAST
Nmap scan report for xyz.vander.host (x.y.z.v)
Host is up (0.022s latency).

PORT STATE SERVICE
161/udp open|filtered snmp

SNMP running on port 161 UDP,  but just open:

➜ ~ sudo nmap -sU -p 161 abc.vander.host 
Starting Nmap 7.80 ( https://nmap.org ) at 2022-02-09 11:01 SAST
Nmap scan report for abc.vander.host (a.b.c.d)
Host is up (0.023s latency).

PORT STATE SERVICE
161/udp open snmp

NC

nc is also known as nmap-ncat. Here is the command syntax to test if an UDP port is listening with nc. Be sure to use the v verbose switch to get the full story.

nc -zvu serverxyz.abc.com 161
Connection to serverxyz.abc.host 161 port [udp/snmp] succeeded!

Or try this (not working version – see 0 bytes received):

[root@872397-db1 ~]# nc -zvu 127.0.0.1 161
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 127.0.0.1:161.
Ncat: UDP packet sent successfully
Ncat: 1 bytes sent, 0 bytes received in 2.01 seconds.

And here are some alternate methods:

sudo nmap -sU -p port target
nping –udp -p port target
hping3 -S –udp -p port target

https://www.tecmint.com/check-remote-port-in-linux/

Reference

How to Check Remote Ports are Reachable Using ‘nc’ Command

Ping UDP/TCP Port

Tags

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top