Skip to content

Instantly share code, notes, and snippets.

@Macmee
Created March 8, 2024 20:10
Show Gist options
  • Save Macmee/a13dee5f8698c9aae7b8ac8c34422e26 to your computer and use it in GitHub Desktop.
Save Macmee/a13dee5f8698c9aae7b8ac8c34422e26 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Perform a ping test
echo "Starting ping test to $SERVER_IP..."
ping -c 4 $SERVER_IP
if [ $? -eq 0 ]; then
echo "Ping test to $SERVER_IP: Success"
else
echo "Ping test to $SERVER_IP: Failed"
fi
echo "---------------------------------------------"
# Check UDP port 500
echo "Checking UDP port 500 connectivity..."
echo "This is a UDP test packet" | nc -u -w3 $SERVER_IP 500
echo "UDP port 500 check sent. (Note: 'nc' does not confirm UDP open ports reliably)"
echo "---------------------------------------------"
# Check UDP port 4500
echo "Checking UDP port 4500 connectivity..."
echo "This is a UDP test packet" | nc -u -w3 $SERVER_IP 4500
echo "UDP port 4500 check sent. (Note: 'nc' does not confirm UDP open ports reliably)"
echo "---------------------------------------------"
# Check UDP port 1701
echo "Checking UDP port 1701 connectivity..."
echo "This is a UDP test packet" | nc -u -w3 $SERVER_IP 1701
echo "UDP port 1701 check sent. (Note: 'nc' does not confirm UDP open ports reliably)"
echo "---------------------------------------------"
echo "Tests completed."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment