The following works on MacOS, details may vary on Linux distros or other Unix (for example SUSE SLES has netcat not nc)

Create a UDP listener on a specific port:

  $ nc -ul 2122

Check if the port is open:

  $ netstat -an| grep 2122
  udp4       0      0

Check if the UDP port is reachable from another machine:

  $ nc -vnzu 212
  found 0 associations
  found 1 connections:
       1: flags=82<CONNECTED,PREFERRED>
    outif (null)
    src port 53601
    dst port 212
    rank info not available

  Connection to port 212 [udp/*] succeeded!
      Connection to IP port 2122 [udp/*] succeeded!

Spray that port with packets:

  $ nc -u IP 2122 < /dev/random

Click here for a serverfault post on the subject