Testing for Remote Listener
Anyone know a good method for testing whether a remote UDP service is reachable - preferably without the use of
netcatfor HOST in ${SERVERLIST} do printf "Attempting service-connect to ${HOST}...\n" SOCKTEST=$(timeout 5 bash -c 'cat /dev/null > \ /dev/tcp/${HOST}/53')$? if [[ ${SOCKTEST} -eq 0 ]] then printf "Socket-test passed.\n" else printf "Socket-test failed.\n" fi done
Is a fairly quick way to ensure that (in this case) the guys who provisioned a system pointed it to reachable DNS servers (didn't fat-finger any entries in the DHCP zone).
Using the above method-type for UDP doesn't really work - you get false successes. The specific case I'm trying to verify is NTPD accessibility. Using
ntpdate service ntpd stop ; ; service ntpd start ntpq -c peersAny ideas?
Responses