I'm making a system that scans my servers and reports all sorts of lovely details about their health.

I've got a simple function that can test if a TCP port is open or not to help me determine if my web server or SSH server is running. I'd like something similar for my UDP based services (NTP, DHCP, DNS resolver etc...).

I looked in the Perl Cookbook, and they have a recipe for a simple UDP client. Apparently, you need to send a datagram to the server and hope it sends you one back.

Is there a generic initial UDP datagram that will illicit a response that I can test for? I'm worried that differences in DNS,DHCP,NTP and whatever else will make it so there is no generic initial connection and no reliably uniform response.

A better question might be, what's the best way to test if a server is listening for UDP packets on a given port?

-Thanks!
-pileofrogs


In reply to UDP port scan? by pileofrogs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.